From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False 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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,347,1511856000"; d="scan'208";a="9149356" 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 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Star Zeng , Christian Ehrhardt 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: [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: , X-List-Received-Date: Fri, 12 Jan 2018 04:03:17 -0000 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/MdeModulePkg/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. - 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 BSD License which accompanies this distribution. The full text of the license may be found at @@ -148,9 +148,9 @@ FrameBufferBltConfigure ( FrameBufferBltLibConfigurePixelFormat (BitMask, &BytesPerPixel, PixelShl, PixelShr); if (*ConfigureSize < sizeof (FRAME_BUFFER_CONFIGURE) - + FrameBufferInfo->HorizontalResolution * BytesPerPixel) { + + FrameBufferInfo->PixelsPerScanLine * BytesPerPixel) { *ConfigureSize = sizeof (FRAME_BUFFER_CONFIGURE) - + FrameBufferInfo->HorizontalResolution * BytesPerPixel; + + FrameBufferInfo->PixelsPerScanLine * BytesPerPixel; return RETURN_BUFFER_TOO_SMALL; } @@ -164,7 +164,7 @@ FrameBufferBltConfigure ( Configure->BytesPerPixel = BytesPerPixel; Configure->PixelFormat = FrameBufferInfo->PixelFormat; Configure->FrameBuffer = (UINT8*) FrameBuffer; - Configure->WidthInPixels = (UINTN) FrameBufferInfo->HorizontalResolution; + Configure->WidthInPixels = (UINTN) FrameBufferInfo->PixelsPerScanLine; Configure->Height = (UINTN) FrameBufferInfo->VerticalResolution; Configure->WidthInBytes = Configure->WidthInPixels * Configure->BytesPerPixel; -- 2.15.1.windows.2