From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=188.166.76.209; helo=mail.aheymans.xyz; envelope-from=arthur@aheymans.xyz; receiver=edk2-devel@lists.01.org Received: from mail.aheymans.xyz (mail.aheymans.xyz [188.166.76.209]) (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 9789A222DE154 for ; Thu, 8 Feb 2018 10:52:43 -0800 (PST) Received: from x220_coreboot.localdomain (unknown [217.79.203.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.aheymans.xyz (Postfix) with ESMTPSA id 1BC34C21BC; Thu, 8 Feb 2018 19:58:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aheymans.xyz; s=mail; t=1518116306; bh=zNxTZV51BIj0LK/y7WN7JxGU+6Hs5+ztrqdEB86Ry+Y=; h=From:To:Cc:Subject:References:Date:In-Reply-To; b=FqlKBIXTiN9wzDIMGAsHrkKDOAoAUPG+ER+taTB4vNKzoyvvdfQDBEVST5xJzG+gn qBsabcLlx4QixsXMsoNhsMPBFQyu7ibHrc6Njy0agre4WVIn9XJgCFhrpJ8+xhW7WR vMSjkFR+j19i02gZCx5LlZqgbbXqcE0f6DQ3ihzM= Received: by x220_coreboot.localdomain (Postfix, from userid 1000) id 9B0C26A579; Sat, 27 Jan 2018 11:17:18 +0100 (CET) From: Arthur Heymans To: "You\, Benjamin" Cc: "edk2-devel\@lists.01.org" References: <20180124105736.14877-1-arthur@aheymans.xyz> <87mv12gvjc.fsf@aheymans.xyz> <87efmdyokj.fsf@aheymans.xyz> Date: Sat, 27 Jan 2018 11:17:18 +0100 In-Reply-To: (Benjamin You's message of "Sat, 27 Jan 2018 04:11:51 +0000") Message-ID: <87607ny5ap.fsf@aheymans.xyz> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) 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, 08 Feb 2018 18:52:45 -0000 Content-Type: text/plain "You, Benjamin" writes: > Hi Arthur, > > I agree with your suggestion that Payload interpret BytesPerScanLine and > Horizontal Resolution properly such that a 1366 display can be handled well. > > The functioning will depend on Coreboot interpreting properly too. However > fixing the Payload will not cause any regression anyway. > This is coreboot's interface of telling payloads how the framebuffer was set up, for the payload to reuse it. The internal implementations in coreboot really shouldn't matter for payloads. The payload should assume it is sane. > I am still not very clear about some cases in Coreboot as below: > >> -----Original Message----- >> From: Arthur Heymans [mailto:arthur@aheymans.xyz] >> Sent: Friday, January 26, 2018 5:09 PM >> To: You, Benjamin >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] [PATCH] CorebootPayloadPkg: Use correct BytesPerScanLine >> >> "You, Benjamin" writes: >> >> > >> > I noticed in coreboot-4.7\src\include\edid.h, there are following comments: >> > >> > /* 3 variables needed for coreboot framebuffer. >> > * In most cases, they are the same as the ha >> > * and va variables, but not always, as in the >> > * case of a 1366 wide display. >> > */ >> > u32 x_resolution; >> > u32 y_resolution; >> > u32 bytes_per_line; >> > >> > And in coreboot-4.7\src\lib\edid.c: >> > >> > edid->bytes_per_line = ALIGN_UP(edid->mode.ha * >> > div_round_up(fb_bpp, 8), row_byte_alignment); >> > edid->x_resolution = edid->bytes_per_line / (fb_bpp / 8); >> > >> >> This is how x_resolution initially gets set after the EDID is read, but >> it is further modified to satisfy the display controllers needs, >> e.g. src/northbridge/intel/gm45/gma.c: >> >> edid->bytes_per_line = (edid->bytes_per_line + 63) & ~63; > > This line does not change the value of edid->bytes_per_line since it is > already rounded up to 64 by previous calculation in edid.c: > > edid->bytes_per_line = ALIGN_UP(edid->mode.ha * > div_round_up(fb_bpp, 8), row_byte_alignment); > Could be, but that doesn't really matter for this patch. What is important is that coreboot has an interface for bytes_per_line for the framebuffer and that it is the payloads job to use that interface. >> >> before it gets send to code that sets up the coreboot tables from which >> payloads extract this information: >> >> set_vbe_mode_info_valid(edid, lfb); >> >> There are also other code paths that don't use src/lib/edid.c to set up >> the framebuffer. >> >> In src/drivers/intel/gma/hires_fb/gma.adb we have: >> x_resolution => word32 (fb.Width), >> y_resolution => word32 (fb.Height), >> bytes_per_line => 4 * word32 (fb.Stride), >> > From the same file, I found: > Stride => ((Width_Type (min_h) + 63) / 64) * 64 > > This line seems to expand Stride to 64 alignment in the unit of Pixel, not > Byte. I thought line padding is on 64 byte alignment, not on 64 pixel > alignment. > "bytes_per_line => 4 * word32 (fb.Stride)", changes it from pixel to bytes (32bits per pixel). That Stride is the maximum stride btw. What it ends up being is something else that depends on the internal of that library. >> >> >> -----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 >> >> >> >> >> >> From: Arthur Heymans >> >> >> >> >> >> Fetch BytesPerScanLine from coreboot table to reflect how the actual >> >> >> framebuffer is set up instead of guessing it from the horizontal >> >> >> resolution. >> >> >> >> >> >> This fixes a garbled display when HorizontalResolution * (BitsPerPixel >> >> >> / 8) and pFbInfo->BytesPerScanLine don't match. >> >> >> >> >> >> Contributed-under: TianoCore Contribution Agreement 1.1 >> >> >> Signed-off-by: Arthur Heymans >> >> >> >> >> >> 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 = pFbInfo->BitsPerPixel; >> >> >> HorizontalResolution = pFbInfo->HorizontalResolution; >> >> >> VerticalResolution = pFbInfo->VerticalResolution; >> >> >> - BytesPerScanLine = HorizontalResolution * (BitsPerPixel / 8); >> >> >> + BytesPerScanLine = pFbInfo->BytesPerScanLine; >> >> >> >> >> >> ModeBuffer = (FB_VIDEO_MODE_DATA *) AllocatePool ( >> >> >> >> >> >> >> >> >> ModeNumber * sizeof >> >> >> (FB_VIDEO_MODE_DATA) >> >> >> -- >> >> >> 2.16.1 >> >> >> >> >> >> _______________________________________________ >> >> >> edk2-devel mailing list >> >> >> edk2-devel@lists.01.org >> >> >> https://lists.01.org/mailman/listinfo/edk2-devel >> >> <#secure method=pgpmime mode=sign> >> >> >> >> -- >> >> Arthur Heymans >> > >> > Thanks, >> > >> > - ben >> >> -- >> Arthur Heymans > > > Thanks, > > - ben ============== Arthur Heymans