From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 71BB081EDF for ; Mon, 23 Jan 2017 00:36:40 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP; 23 Jan 2017 00:36:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,273,1477983600"; d="scan'208";a="56121051" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 23 Jan 2017 00:36:39 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 23 Jan 2017 00:36:39 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 23 Jan 2017 00:36:38 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.177]) by SHSMSX103.ccr.corp.intel.com ([10.239.4.69]) with mapi id 14.03.0248.002; Mon, 23 Jan 2017 16:36:36 +0800 From: "Tian, Feng" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [PATCH 2/3] MdeModulePkg/FrameBufferBltLib: Use dynamic allocated line buffer Thread-Index: AQHSdT+rt8MgPoLuHE22Ns2iNJBEIqFFvO4A Date: Mon, 23 Jan 2017 08:36:36 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE5699AB7C7@SHSMSX101.ccr.corp.intel.com> References: <20170123061149.279944-1-ruiyu.ni@intel.com> <20170123061149.279944-3-ruiyu.ni@intel.com> In-Reply-To: <20170123061149.279944-3-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 2/3] MdeModulePkg/FrameBufferBltLib: Use dynamic allocated line buffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 08:36:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Feng Tian Thanks Feng -----Original Message----- From: Ni, Ruiyu=20 Sent: Monday, January 23, 2017 2:12 PM To: edk2-devel@lists.01.org Cc: Tian, Feng Subject: [PATCH 2/3] MdeModulePkg/FrameBufferBltLib: Use dynamic allocated = line buffer https://bugzilla.tianocore.org/show_bug.cgi?id=3D339 The patch uses dynamic allocated line buffer to reduce memory usage of fram= e buffer configure. (Original implementation uses 0x4000 bytes for line buf= fer.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Feng Tian --- .../Library/FrameBufferBltLib/FrameBufferBltLib.c | 24 +++++++++++-------= ---- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c b/M= deModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c index 5f6eddc..011d9c5 100644 --- a/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c +++ b/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c @@ -26,12 +26,12 @@ struct FRAME_BUFFER_CONFIGURE { UINTN BytesPerPixel; UINTN WidthInPixels; UINTN Height; - UINT8 LineBuffer[SIZE_4KB * sizeof (EFI_GRAPHI= CS_OUTPUT_BLT_PIXEL)]; UINT8 *FrameBuffer; EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; EFI_PIXEL_BITMASK PixelMasks; INT8 PixelShl[4]; // R-G-B-Rsvd INT8 PixelShr[4]; // R-G-B-Rsvd + UINT8 LineBuffer[0]; }; =20 CONST EFI_PIXEL_BITMASK mRgbPixelMasks =3D { @@ -123,15 +123,6 @@ FrameBuf= ferBltConfigure ( return RETURN_INVALID_PARAMETER; } =20 - if (*ConfigureSize < sizeof (FRAME_BUFFER_CONFIGURE)) { - *ConfigureSize =3D sizeof (FRAME_BUFFER_CONFIGURE); - return RETURN_BUFFER_TOO_SMALL; - } - - if (Configure =3D=3D NULL) { - return RETURN_INVALID_PARAMETER; - } - switch (FrameBufferInfo->PixelFormat) { case PixelRedGreenBlueReserved8BitPerColor: BitMask =3D &mRgbPixelMasks; @@ -156,6 +147,17 @@ FrameBufferBltConfigure ( =20 FrameBufferBltLibConfigurePixelFormat (BitMask, &BytesPerPixel, PixelShl= , PixelShr); =20 + if (*ConfigureSize < sizeof (FRAME_BUFFER_CONFIGURE) + + FrameBufferInfo->HorizontalResolution * BytesPerPix= el) { + *ConfigureSize =3D sizeof (FRAME_BUFFER_CONFIGURE) + + FrameBufferInfo->HorizontalResolution * BytesPerPixel= ; + return RETURN_BUFFER_TOO_SMALL; + } + + if (Configure =3D=3D NULL) { + return RETURN_INVALID_PARAMETER; + } + CopyMem (&Configure->PixelMasks, BitMask, sizeof (*BitMask)); CopyMem (Configure->PixelShl, PixelShl, sizeof (PixelShl)); CopyMem (Configure->PixelShr, PixelShr, sizeof (PixelShr)); @@ -166,8 +168,6 @@ FrameBufferBltConfigure ( Configure->Height =3D (UINTN) FrameBufferInfo->VerticalResolution= ; Configure->WidthInBytes =3D Configure->WidthInPixels * Configure->Bytes= PerPixel; =20 - ASSERT (Configure->WidthInBytes < sizeof (Configure->LineBuffer)); - return RETURN_SUCCESS; } =20 -- 2.9.0.windows.1