OBS-URL: https://build.opensuse.org/request/show/1146923 OBS-URL: https://build.opensuse.org/package/show/hardware:boot/u-boot?expand=0&rev=206
60 lines
1.8 KiB
Diff
60 lines
1.8 KiB
Diff
From 480a56048a980b297da6b625af6862d2d6805ca6 Mon Sep 17 00:00:00 2001
|
|
From: "Ivan T. Ivanov" <iivanov@suse.de>
|
|
Date: Tue, 23 Jan 2024 10:07:56 +0200
|
|
Subject: [PATCH] bcm2835: Dynamically calculate bytes per pixel parameter
|
|
|
|
brcm,bcm2708-fb device provided by firmware on RPi5 uses
|
|
16 bits per pixel, so lets calculate framebuffer bytes
|
|
per pixel dynamically based on queried information.
|
|
|
|
Tested to work for RPi2b v1.2, RPi3b v1.3, RPi4b v1.1,
|
|
RPi2 Zero W, RPi5b v1.0.
|
|
|
|
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
|
|
Tested-by: Jens Maus <mail@jens-maus.de>
|
|
Tested by: Darko Alavanja <darko.alavanja@konsulko.com>
|
|
Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
|
|
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
|
|
---
|
|
drivers/video/bcm2835.c | 18 ++++++++++++++++--
|
|
1 file changed, 16 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c
|
|
index 14942526f19..63efa762db1 100644
|
|
--- a/drivers/video/bcm2835.c
|
|
+++ b/drivers/video/bcm2835.c
|
|
@@ -16,7 +16,7 @@ static int bcm2835_video_probe(struct udevice *dev)
|
|
struct video_uc_plat *plat = dev_get_uclass_plat(dev);
|
|
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
|
|
int ret;
|
|
- int w, h, pitch;
|
|
+ int w, h, pitch, bpp;
|
|
ulong fb_base, fb_size, fb_start, fb_end;
|
|
|
|
debug("bcm2835: Query resolution...\n");
|
|
@@ -41,9 +41,23 @@ static int bcm2835_video_probe(struct udevice *dev)
|
|
DCACHE_WRITEBACK);
|
|
video_set_flush_dcache(dev, true);
|
|
|
|
+ bpp = pitch / w;
|
|
+ switch (bpp) {
|
|
+ case 2:
|
|
+ uc_priv->bpix = VIDEO_BPP16;
|
|
+ break;
|
|
+ case 4:
|
|
+ uc_priv->bpix = VIDEO_BPP32;
|
|
+ break;
|
|
+ default:
|
|
+ printf("bcm2835: unexpected bpp %d, pitch %d, width %d\n",
|
|
+ bpp, pitch, w);
|
|
+ uc_priv->bpix = VIDEO_BPP32;
|
|
+ break;
|
|
+ }
|
|
+
|
|
uc_priv->xsize = w;
|
|
uc_priv->ysize = h;
|
|
- uc_priv->bpix = VIDEO_BPP32;
|
|
plat->base = fb_base;
|
|
plat->size = fb_size;
|
|
|