From nobody Mon Dec 23 13:43:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1515730115960935.3825275761883; Thu, 11 Jan 2018 20:08:35 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 595C7222CF1DA; Thu, 11 Jan 2018 20:03:19 -0800 (PST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0FD492208589D for ; Thu, 11 Jan 2018 20:03:16 -0800 (PST) Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2018 20:08:30 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.19]) by fmsmga008.fm.intel.com with ESMTP; 11 Jan 2018 20:08:29 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,347,1511856000"; d="scan'208";a="9149356" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Fri, 12 Jan 2018 12:08:28 +0800 Message-Id: <20180112040828.196948-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.1.windows.2 Subject: [edk2] [PATCH] MdeModulePkg/FrameBufferBltLib: Fix a bug causing display corrupted X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Ehrhardt , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The Graphics Output Protocol's mode information specifies the PixelsPerScanLine property. Most of the time this is identical to HorizontalResolution. However, due to alignment requirements etc. it may be slightly larger. I.e. each scan line will have some "pixels" that are not visible on the screen but consume space in the frame buffer. If the graphics output protocol correctly initializes HorizontalResolution to 1366 and PixelsPerScanLine to 1376. As a result the graphics output is broken. If setting HorizontalResolution to 1376 instead, the output is fine (except for 10 invisible pixels on the right of the screen). The patch fixes this bug by using PixelsPerScanLine when calculating the line width. Contributed-under: TianoCore Contribution Agreement 1.1 Reported-by: Christian Ehrhardt Signed-off-by: Ruiyu Ni Cc: Star Zeng Cc: Christian Ehrhardt --- MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c b/M= deModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c index 011d9c52cd..3e323fe3f0 100644 --- a/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c +++ b/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c @@ -1,7 +1,7 @@ /** @file FrameBufferBltLib - Library to perform blt operations on a frame buffer. =20 - Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -148,9 +148,9 @@ FrameBufferBltConfigure ( FrameBufferBltLibConfigurePixelFormat (BitMask, &BytesPerPixel, PixelShl= , PixelShr); =20 if (*ConfigureSize < sizeof (FRAME_BUFFER_CONFIGURE) - + FrameBufferInfo->HorizontalResolution * BytesPerPix= el) { + + FrameBufferInfo->PixelsPerScanLine * BytesPerPixel)= { *ConfigureSize =3D sizeof (FRAME_BUFFER_CONFIGURE) - + FrameBufferInfo->HorizontalResolution * BytesPerPixel; + + FrameBufferInfo->PixelsPerScanLine * BytesPerPixel; return RETURN_BUFFER_TOO_SMALL; } =20 @@ -164,7 +164,7 @@ FrameBufferBltConfigure ( Configure->BytesPerPixel =3D BytesPerPixel; Configure->PixelFormat =3D FrameBufferInfo->PixelFormat; Configure->FrameBuffer =3D (UINT8*) FrameBuffer; - Configure->WidthInPixels =3D (UINTN) FrameBufferInfo->HorizontalResoluti= on; + Configure->WidthInPixels =3D (UINTN) FrameBufferInfo->PixelsPerScanLine; Configure->Height =3D (UINTN) FrameBufferInfo->VerticalResolution; Configure->WidthInBytes =3D Configure->WidthInPixels * Configure->Bytes= PerPixel; =20 --=20 2.15.1.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel