* [PATCH] video: fb: mirror cdev writes to shadow buffer
@ 2026-07-09 7:15 Ahmad Fatoum
2026-07-10 21:52 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-07-09 7:15 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The shadow framebuffer is allocated by the framebuffer core,
but maintained by gui_screen_blit and gu_screen_blit_area.
Direct framebuffer devices currently ignore the shadow framebuffer,
which leads to surprising behavior when doing sequences like:
cp /dev/zero /dev/fb0
splash /env/data/splash.png
as the framebuffer is first cleared and then the old content appear
again as background of the splash screen.
Fix this by having writes go to both.
Reads should arguably be left out as it's useful to be able to see
the actual framebuffer used by the hardware.
Mmap is a bit hairier, but what we do here is already an improvement.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/video/fb.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 10d34a39e2b2..d5ab7f4088da 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -238,9 +238,22 @@ static int fb_set_modename(struct param_d *param, void *priv)
return 0;
}
+static ssize_t fb_cdev_write(struct cdev *cdev, const void *buf, size_t count,
+ loff_t offset, ulong flags)
+{
+ struct fb_info *info = cdev->priv;
+ ssize_t ret;
+
+ ret = mem_write(cdev, buf, count, offset, flags);
+ if (ret > 0 && info->screen_base_shadow)
+ memcpy(info->screen_base_shadow + offset, buf, ret);
+
+ return ret;
+}
+
static struct cdev_operations fb_ops = {
.read = mem_read,
- .write = mem_write,
+ .write = fb_cdev_write,
.memmap = generic_memmap_rw,
.ioctl = fb_ioctl,
.close = fb_close,
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] video: fb: mirror cdev writes to shadow buffer
2026-07-09 7:15 [PATCH] video: fb: mirror cdev writes to shadow buffer Ahmad Fatoum
@ 2026-07-10 21:52 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-07-10 21:52 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Thu, 09 Jul 2026 09:15:25 +0200, Ahmad Fatoum wrote:
> The shadow framebuffer is allocated by the framebuffer core,
> but maintained by gui_screen_blit and gu_screen_blit_area.
>
> Direct framebuffer devices currently ignore the shadow framebuffer,
> which leads to surprising behavior when doing sequences like:
>
> cp /dev/zero /dev/fb0
> splash /env/data/splash.png
>
> [...]
Applied, thanks!
[1/1] video: fb: mirror cdev writes to shadow buffer
https://git.pengutronix.de/cgit/barebox/commit/?id=dc1cb69a07dd (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-10 21:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-09 7:15 [PATCH] video: fb: mirror cdev writes to shadow buffer Ahmad Fatoum
2026-07-10 21:52 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox