drm/fb-helper: Export helpers for marking damage areas
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 30 May 2023 15:12:25 +0000 (17:12 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Thu, 1 Jun 2023 10:41:40 +0000 (12:41 +0200)
Export drm_fb_helper_damage() and drm_fb_helper_damage_range(), which
handle damage areas for fbdev emulation. This is a temporary export
that allows to move the DRM I/O helpers for fbdev into drivers. Only
fbdev-generic and i915 need them. Both will be updated to implement
damage handling by themselves and the exported functions will be removed.

v4:
* update interfaces

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230530151228.22979-11-tzimmermann@suse.de
drivers/gpu/drm/drm_fb_helper.c
include/drm/drm_fb_helper.h

index f0e9549..cb03099 100644 (file)
@@ -670,6 +670,28 @@ static void drm_fb_helper_memory_range_to_clip(struct fb_info *info, off_t off,
        drm_rect_init(clip, x1, y1, x2 - x1, y2 - y1);
 }
 
+/* Don't use in new code. */
+void drm_fb_helper_damage_range(struct fb_info *info, off_t off, size_t len)
+{
+       struct drm_fb_helper *fb_helper = info->par;
+       struct drm_rect damage_area;
+
+       drm_fb_helper_memory_range_to_clip(info, off, len, &damage_area);
+       drm_fb_helper_damage(fb_helper, damage_area.x1, damage_area.y1,
+                            drm_rect_width(&damage_area),
+                            drm_rect_height(&damage_area));
+}
+EXPORT_SYMBOL(drm_fb_helper_damage_range);
+
+/* Don't use in new code. */
+void drm_fb_helper_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
+{
+       struct drm_fb_helper *fb_helper = info->par;
+
+       drm_fb_helper_damage(fb_helper, x, y, width, height);
+}
+EXPORT_SYMBOL(drm_fb_helper_damage_area);
+
 /**
  * drm_fb_helper_deferred_io() - fbdev deferred_io callback function
  * @info: fb_info struct pointer
index 72032c3..7d58048 100644 (file)
@@ -253,6 +253,9 @@ void drm_fb_helper_fill_info(struct fb_info *info,
                             struct drm_fb_helper *fb_helper,
                             struct drm_fb_helper_surface_size *sizes);
 
+void drm_fb_helper_damage_range(struct fb_info *info, off_t off, size_t len);
+void drm_fb_helper_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height);
+
 void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);
 
 ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,