From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH master 3/3] efi: gop: report and use framebuffer stride
Date: Sat, 27 Jun 2026 11:55:41 +0200 [thread overview]
Message-ID: <20260627095543.2462939-3-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260627095543.2462939-1-a.fatoum@barebox.org>
Both barebox and EFI GOP differentiate between the width of a line on
screen and in memory.
The EFI GOP driver we had imported from U-Boot loses that distinction
and reports PixelsPerScanLine to be identical to the visible horizontal
resolution. Pass the framebuffer line length instead to fix potential
issues when they differ.
Assisted-by: Codex:gpt-5.5
Fixes: d040f49ad0b3 ("efi: loader: protocol: add graphical output protocol support")
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
efi/loader/protocols/gop.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/efi/loader/protocols/gop.c b/efi/loader/protocols/gop.c
index 03995d9eee29..fbbcace83eef 100644
--- a/efi/loader/protocols/gop.c
+++ b/efi/loader/protocols/gop.c
@@ -174,7 +174,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_graphics_output_proto
break;
case EFI_BLT_VIDEO_TO_BLT_BUFFER:
case EFI_BLT_VIDEO_TO_VIDEO:
- swidth = gopobj->info.horizontal_resolution;
+ swidth = gopobj->info.pixels_per_scan_line;
if (!vid_bpp)
return EFI_UNSUPPORTED;
break;
@@ -187,7 +187,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_graphics_output_proto
case EFI_BLT_BUFFER_TO_VIDEO:
case EFI_BLT_VIDEO_FILL:
case EFI_BLT_VIDEO_TO_VIDEO:
- dwidth = gopobj->info.horizontal_resolution;
+ dwidth = gopobj->info.pixels_per_scan_line;
if (!vid_bpp)
return EFI_UNSUPPORTED;
break;
@@ -489,6 +489,7 @@ static efi_status_t efi_gop_register(void *data)
struct fb_info *fbi;
struct screen *sc;
struct efi_pixel_bitmask *pixel_information;
+ u32 bytes_per_pixel, pixels_per_scan_line;
sc = fb_open(fbdev);
if (IS_ERR(sc)) {
@@ -510,6 +511,14 @@ static efi_status_t efi_gop_register(void *data)
return EFI_UNSUPPORTED;
}
+ bytes_per_pixel = fbi->bits_per_pixel / BITS_PER_BYTE;
+ if (fbi->line_length % bytes_per_pixel)
+ return EFI_UNSUPPORTED;
+
+ pixels_per_scan_line = fbi->line_length / bytes_per_pixel;
+ if (pixels_per_scan_line < col)
+ return EFI_UNSUPPORTED;
+
gopobj = calloc(1, sizeof(*gopobj));
if (!gopobj) {
pr_err("Out of memory\n");
@@ -566,7 +575,7 @@ static efi_status_t efi_gop_register(void *data)
pixel_information->green_mask = 0x07e0;
pixel_information->blue_mask = 0x001f;
}
- gopobj->info.pixels_per_scan_line = col;
+ gopobj->info.pixels_per_scan_line = pixels_per_scan_line;
gopobj->fb = fbi->screen_base;
gopobj->fbi = fbi;
--
2.47.3
prev parent reply other threads:[~2026-06-27 9:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-27 9:55 [PATCH master 1/3] efi: gop: fix rectangle extents passed to fb_damage Ahmad Fatoum
2026-06-27 9:55 ` [PATCH master 2/3] efi: gop: use correct BLT pixel type Ahmad Fatoum
2026-06-27 9:55 ` Ahmad Fatoum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260627095543.2462939-3-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox