From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=benjamin.you@intel.com; receiver=edk2-devel@lists.01.org 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 D668C21E25686 for ; Wed, 24 Jan 2018 21:29:21 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2018 21:34:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,409,1511856000"; d="scan'208";a="22159225" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 24 Jan 2018 21:34:50 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Jan 2018 21:34:49 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Jan 2018 21:34:49 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Thu, 25 Jan 2018 13:34:47 +0800 From: "You, Benjamin" To: "arthur@aheymans.xyz" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] CorebootPayloadPkg: Use correct BytesPerScanLine Thread-Index: AQHTlTAYbO9yM5GE4kKb+ZrPyeBPYKOECl/g Date: Thu, 25 Jan 2018 05:34:47 +0000 Message-ID: References: <20180124105736.14877-1-arthur@aheymans.xyz> In-Reply-To: <20180124105736.14877-1-arthur@aheymans.xyz> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDcyNGU3M2MtZTJkYi00ODZhLWIxNWMtMWMyYmQ0NGEzYTNjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJudTZJQ1RTNlZYYWp5NTZPQVJzTUlSQ2s3cVR3WWJLbUh0VTg1NzB5Q3llM2NnM3Vtc3ZKZGlLaEVHSTZ3NnJpIn0= dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] CorebootPayloadPkg: Use correct BytesPerScanLine 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: Thu, 25 Jan 2018 05:29:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Arthur, Could you please give more details about your case that=20 HorizontalResolution * (BitsPerPixel / 8) and pFbInfo->BytesPerScanLine=20 don't match? I did a brief search in Coreboot source and found following comments in=20 coreboot-4.6\src\lib\edid.c: /* In the case of (e.g.) 24 framebuffer bits per pixel, the convention * nowadays seems to be to round it up to the nearest reasonable * boundary, because otherwise the byte-packing is hideous. =20 So it appears framebuffer BitsPerPixel will likely be 16 or 32, and the=20 following statement in the same file calculates: edid->x_resolution =3D edid->bytes_per_line / (fb_bpp / 8); which results in bytes_per_line (already rounded up to be 32 or 64 byte=20 aligned) matching x_resolution * (fb_bpp / 8). There are cases that even if panel bits_per_pixel is 24, the framebuffer=20 bits_per_pixel is still 32, as shown in=20 coreboot-4.6\src\drivers\emulation\qemu\bochs.c: edid.panel_bits_per_pixel =3D 24; edid_set_framebuffer_bits_per_pixel(&edid, 32, 0); It would be good if you could help with more details on how the mismatch=20 happened in your case as I may have missed something. Thanks, - ben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > arthur@aheymans.xyz > Sent: Wednesday, January 24, 2018 6:58 PM > To: edk2-devel@lists.01.org > Cc: Arthur Heymans > Subject: [edk2] [PATCH] CorebootPayloadPkg: Use correct BytesPerScanLine >=20 > From: Arthur Heymans >=20 > Fetch BytesPerScanLine from coreboot table to reflect how the actual > framebuffer is set up instead of guessing it from the horizontal > resolution. >=20 > This fixes a garbled display when HorizontalResolution * (BitsPerPixel > / 8) and pFbInfo->BytesPerScanLine don't match. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Arthur Heymans >=20 > diff --git a/CorebootPayloadPkg/FbGop/FbGop.c > b/CorebootPayloadPkg/FbGop/FbGop.c > index 37d6def7f7..6790617033 100644 > --- a/CorebootPayloadPkg/FbGop/FbGop.c > +++ b/CorebootPayloadPkg/FbGop/FbGop.c > @@ -822,7 +822,7 @@ FbGopCheckForVbe ( > BitsPerPixel =3D pFbInfo->BitsPerPixel; > HorizontalResolution =3D pFbInfo->HorizontalResolution; > VerticalResolution =3D pFbInfo->VerticalResolution; > - BytesPerScanLine =3D HorizontalResolution * (BitsPerPixel / 8); > + BytesPerScanLine =3D pFbInfo->BytesPerScanLine; >=20 > ModeBuffer =3D (FB_VIDEO_MODE_DATA *) AllocatePool ( >=20 >=20 > ModeNumber * sizeof > (FB_VIDEO_MODE_DATA) > -- > 2.16.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel