From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.6266.1646126386729812009 for ; Tue, 01 Mar 2022 01:19:50 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=mcELNinx; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: guomin.jiang@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646126390; x=1677662390; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5EAGC6OTMKy+tFHXCx01lupy+MyzAufZStvXHWRKsX0=; b=mcELNinxwTqWw+HBBAIwIX5l6fyXwkBozhbi96mrhcYL4LjLVLR/bJOF VQI7n2S7W1/DvA0Rcm9xc3+DKyEttZYsUSIZRAESP7QdKYMBc/f8XY9nz Yfx5rZh4/IDj2ltO1wKPgvEAZA/RBz7Bak/PPQuVcxRAetth9CweBKc0k iPK5ZfaI0MqW42zBxviU4CS4k5J+YK9YvfDKbzMICL/HLZR+wVEaXjUFB HLi8rj6B9w7zO3TnfzLaHSswIjDTPta1csrDSAQYdbt4+F1ioPDanKaj9 r9nZr9Ju0ILcNU/tMgDFq8C0vZuBLbbhgdSgMR3ayxrpPTN5HbY92Z7M1 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10272"; a="253286536" X-IronPort-AV: E=Sophos;i="5.90,145,1643702400"; d="scan'208";a="253286536" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 01:19:49 -0800 X-IronPort-AV: E=Sophos;i="5.90,145,1643702400"; d="scan'208";a="708986784" Received: from guominji-mobl1.ccr.corp.intel.com ([10.238.15.53]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 01:19:48 -0800 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni Subject: [PATCH v2 2/2] EmulatorPkg/EmuGopDxe: Set ModeInfo after Open successfully Date: Tue, 1 Mar 2022 17:18:50 +0800 Message-Id: <20220301091850.828-3-guomin.jiang@intel.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220301091850.828-1-guomin.jiang@intel.com> References: <20220301091850.828-1-guomin.jiang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2668 WindowOpen will fail in some case. for example, without XServer. Shouldn't set ModeInfo in this case to avoid the caller use it incorrectly Cc: Andrew Fish Cc: Ray Ni Signed-off-by: Guomin Jiang --- EmulatorPkg/EmuGopDxe/GopScreen.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c b/EmulatorPkg/EmuGopDxe/GopScreen.c index 41f748bc6402..9249eca1dd03 100644 --- a/EmulatorPkg/EmuGopDxe/GopScreen.c +++ b/EmulatorPkg/EmuGopDxe/GopScreen.c @@ -1,6 +1,6 @@ /*++ @file -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -108,10 +108,6 @@ EmuGopSetMode ( } ModeData = &Private->ModeData[ModeNumber]; - This->Mode->Mode = ModeNumber; - Private->GraphicsOutput.Mode->Info->HorizontalResolution = ModeData->HorizontalResolution; - Private->GraphicsOutput.Mode->Info->VerticalResolution = ModeData->VerticalResolution; - Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution; if (Private->HardwareNeedsStarting) { Status = EmuGopStartWindow ( @@ -128,6 +124,11 @@ EmuGopSetMode ( Private->HardwareNeedsStarting = FALSE; } + This->Mode->Mode = ModeNumber; + Private->GraphicsOutput.Mode->Info->HorizontalResolution = ModeData->HorizontalResolution; + Private->GraphicsOutput.Mode->Info->VerticalResolution = ModeData->VerticalResolution; + Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution; + Status = Private->EmuGraphicsWindow->Size ( Private->EmuGraphicsWindow, ModeData->HorizontalResolution, -- 2.35.1.windows.2