From 6697f9c4d0dbcda6e9dd37c1d232a255b23bcf93 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Thu, 17 Nov 2022 16:54:03 +0100 Subject: [PATCH] drm/fb-helper: Only do damage handling if deferred I/O is active Make damage handling dependent on fbdev deferred I/O, instead of the existence of the fb_dirty callback. The generic fbdev emulation always sets the fb_dirty callback, even if it's unused. For drivers that don't use deferred I/O, this leads to error messages as shown below. WARNING: CPU: 0 PID: 220 at drivers/video/fbdev/core/fb_defio.c:340 A bug report is at [1]. Reported-by: Marek Szyprowski Signed-off-by: Thomas Zimmermann Fixes: 7f5cc4a3e5e4 ("drm/fb-helper: Schedule deferred-I/O worker after writing to framebuffer") Cc: Thomas Zimmermann Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Jaya Kumar Cc: Daniel Vetter Cc: Helge Deller Cc: linux-fbdev@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Link: https://lore.kernel.org/dri-devel/20221115115819.23088-1-tzimmermann@suse.de/T/#m06eedc0a468940e4cbbd14ca026733b639bc445a --- drivers/gpu/drm/drm_fb_helper.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index a1f86e436ae8e..ba5bd85035610 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -816,7 +816,7 @@ ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf, if (ret <= 0) return ret; - if (helper->funcs->fb_dirty) { + if (info->fbdefio) { drm_fb_helper_memory_range_to_clip(info, pos, ret, &damage_area); drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1, drm_rect_width(&damage_area), @@ -841,7 +841,7 @@ void drm_fb_helper_sys_fillrect(struct fb_info *info, sys_fillrect(info, rect); - if (helper->funcs->fb_dirty) + if (info->fbdefio) drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, rect->height); } EXPORT_SYMBOL(drm_fb_helper_sys_fillrect); @@ -860,7 +860,7 @@ void drm_fb_helper_sys_copyarea(struct fb_info *info, sys_copyarea(info, area); - if (helper->funcs->fb_dirty) + if (info->fbdefio) drm_fb_helper_damage(helper, area->dx, area->dy, area->width, area->height); } EXPORT_SYMBOL(drm_fb_helper_sys_copyarea); @@ -879,7 +879,7 @@ void drm_fb_helper_sys_imageblit(struct fb_info *info, sys_imageblit(info, image); - if (helper->funcs->fb_dirty) + if (info->fbdefio) drm_fb_helper_damage(helper, image->dx, image->dy, image->width, image->height); } EXPORT_SYMBOL(drm_fb_helper_sys_imageblit); @@ -989,7 +989,7 @@ ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf, if (ret <= 0) return ret; - if (helper->funcs->fb_dirty) { + if (info->fbdefio) { drm_fb_helper_memory_range_to_clip(info, pos, ret, &damage_area); drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1, drm_rect_width(&damage_area), @@ -1014,7 +1014,7 @@ void drm_fb_helper_cfb_fillrect(struct fb_info *info, cfb_fillrect(info, rect); - if (helper->funcs->fb_dirty) + if (info->fbdefio) drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, rect->height); } EXPORT_SYMBOL(drm_fb_helper_cfb_fillrect); @@ -1033,7 +1033,7 @@ void drm_fb_helper_cfb_copyarea(struct fb_info *info, cfb_copyarea(info, area); - if (helper->funcs->fb_dirty) + if (info->fbdefio) drm_fb_helper_damage(helper, area->dx, area->dy, area->width, area->height); } EXPORT_SYMBOL(drm_fb_helper_cfb_copyarea); @@ -1052,7 +1052,7 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info, cfb_imageblit(info, image); - if (helper->funcs->fb_dirty) + if (info->fbdefio) drm_fb_helper_damage(helper, image->dx, image->dy, image->width, image->height); } EXPORT_SYMBOL(drm_fb_helper_cfb_imageblit); -- 2.38.1