From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.4990.1646204359724057108 for ; Tue, 01 Mar 2022 22:59:21 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=QFHeQ4/k; spf=pass (domain: intel.com, ip: 134.134.136.65, 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=1646204361; x=1677740361; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dYsIxRg8E3i5WWa5qPawfWcP5WjcLw+XzLuBvkbqxdM=; b=QFHeQ4/k68Lbzn4Dz7GSAYIUzzIPnJ/s5AxXtyCmC5F7Zw3We7bNhRUJ 9/U3jVw3J7lY+QU+izdXXL2+vYXT2v1HE+Rx7oNpHul0fHgcDNcfKS41R nthrAMPuCyeJvRI9DWIqIRHKQHteJbGHRkBubPT6S9iq1Gx8uVCYrOt1f zTySUtJsP/9uFJp4r4ZiCv8XB//j+Yu5q6Ab7RHm3dxOBR4q6/Gcqd2VG q5sVHo249bbeQykt2Lfc7rKIBt5esyaZCB05Pbie5z2jPKSNpVQJbauHq goXdfZeU7QOX8v1+0T+7G4dP8XWOtQiG0z32urON2kzKHMVwG6zqn9ZgB Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="253250021" X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="253250021" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 22:59:21 -0800 X-IronPort-AV: E=Sophos;i="5.90,148,1643702400"; d="scan'208";a="510890885" Received: from guominji-mobl1.ccr.corp.intel.com ([10.238.15.53]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 22:59:20 -0800 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni Subject: [PATCH v3 2/2] EmulatorPkg/EmuGopDxe: Set ModeInfo after Open successfully Date: Wed, 2 Mar 2022 14:58:56 +0800 Message-Id: <20220302065856.727-3-guomin.jiang@intel.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220302065856.727-1-guomin.jiang@intel.com> References: <20220302065856.727-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 Reviewed-by: Ray Ni Signed-off-by: Guomin Jiang --- EmulatorPkg/EmuGopDxe/GopScreen.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c b/EmulatorPkg/EmuGopDxe/GopScreen.c index 41f748bc6402..88d95b88e162 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 @@ -107,11 +107,7 @@ EmuGopSetMode ( return EFI_UNSUPPORTED; } - 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; + ModeData = &Private->ModeData[ModeNumber]; 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