From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web08.8618.1645501255304662045 for ; Mon, 21 Feb 2022 19:40:56 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=b9Menq56; spf=pass (domain: intel.com, ip: 134.134.136.31, 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=1645501256; x=1677037256; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/hBzxJPjeCx73o4fDE2EumOHkfVhv6DnH8JPydABlaI=; b=b9Menq56Bw4luCOnn8t2ocVWb3/0M2nbKvhb8K/wx7jxIvvRQ5dAO0c0 r6yCF/4Mnt/Utq05B3NiLPMWCTDeaRmWfgQmoiQrwOX5y8MjRf9+koSiC AiK+ZCeM2GHLUEoXggo53e2vwmB3/iaXBe19YiuUGag5dyGNAlyPwfGc+ Bzs1+n9mO89Fi2H5Y18lpXpVGqi37H2UUmfeNn550CwipxYACxbO2mKdc fb6TPAZREkZzcg1tPc/0oMF8JcRvt4/g2rYHYiT9RNou9c7/zMfJti/LV maBBJ2PxfuJxPKytRVtnFo1uv7XH2QExdQAlmUxLZj8OUwWpg4U4ghxQG Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="312350670" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="312350670" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 19:40:54 -0800 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="547554722" Received: from guominji-mobl1.ccr.corp.intel.com ([10.238.15.53]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 19:40:53 -0800 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni Subject: [PATCH 2/2] EmulatorPkg/EmuGopDxe: Set ModeInfo after Open successfully Date: Tue, 22 Feb 2022 11:40:38 +0800 Message-Id: <20220222034038.966-3-guomin.jiang@intel.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220222034038.966-1-guomin.jiang@intel.com> References: <20220222034038.966-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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c b/EmulatorPkg/EmuGopDxe/GopScreen.c index 41f748bc6402..ec5ef795d6e5 100644 --- a/EmulatorPkg/EmuGopDxe/GopScreen.c +++ b/EmulatorPkg/EmuGopDxe/GopScreen.c @@ -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