summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/core/sysimgblt.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-11-27 16:16:00 +0300
committerThomas Zimmermann <tzimmermann@suse.de>2023-11-29 14:20:50 +0300
commitb3e8813773c568fd2d65e9752abfda27442e502e (patch)
tree4bfd1fbb2a8f32f89fabb3a375293edaecfa5652 /drivers/video/fbdev/core/sysimgblt.c
parent33253d9e01d40542f07aaf718a655893cd2949e5 (diff)
downloadlinux-b3e8813773c568fd2d65e9752abfda27442e502e.tar.xz
fbdev: Warn on incorrect framebuffer access
Test in framebuffer read, write and drawing helpers if FBINFO_VIRTFB has been set correctly. Framebuffers in I/O memory should only be accessed with the architecture's respective helpers. Framebuffers in system memory should be accessed with the regular load and store operations. Presumably not all drivers get this right, so we now warn about it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231127131655.4020-32-tzimmermann@suse.de
Diffstat (limited to 'drivers/video/fbdev/core/sysimgblt.c')
-rw-r--r--drivers/video/fbdev/core/sysimgblt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/video/fbdev/core/sysimgblt.c b/drivers/video/fbdev/core/sysimgblt.c
index 665ef7a0a249..6949bbd51d92 100644
--- a/drivers/video/fbdev/core/sysimgblt.c
+++ b/drivers/video/fbdev/core/sysimgblt.c
@@ -296,6 +296,9 @@ void sys_imageblit(struct fb_info *p, const struct fb_image *image)
if (p->state != FBINFO_STATE_RUNNING)
return;
+ if (!(p->flags & FBINFO_VIRTFB))
+ fb_warn_once(p, "Framebuffer is not in virtual address space.");
+
bitstart = (dy * p->fix.line_length * 8) + (dx * bpp);
start_index = bitstart & (32 - 1);
pitch_index = (p->fix.line_length & (bpl - 1)) * 8;