drm/cirrus: Inline cirrus_fb_blit_rect()
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 15 Feb 2023 16:15:10 +0000 (17:15 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 13 Mar 2023 09:36:28 +0000 (10:36 +0100)
Inline cirrus_fb_blit_rect into its only caller. While at it, update
the code to use IOSYS_MAP_INIT_OFFSET(), which is the ideomatic way
of initializing struct iosys_map with an offset.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230215161517.5113-11-tzimmermann@suse.de
drivers/gpu/drm/tiny/cirrus.c

index 46c6aa34ba79d864db60599794750b0f004b0552..a483abc2e6baaf301e6086a2462bdfd08fbc8f87 100644 (file)
@@ -317,21 +317,6 @@ static void cirrus_pitch_set(struct cirrus_device *cirrus,
        cirrus_set_start_address(cirrus, 0);
 }
 
-static int cirrus_fb_blit_rect(struct drm_framebuffer *fb,
-                              const struct iosys_map *vmap,
-                              struct drm_rect *rect)
-{
-       struct cirrus_device *cirrus = to_cirrus(fb->dev);
-       struct iosys_map dst;
-
-       iosys_map_set_vaddr_iomem(&dst, cirrus->vram);
-       iosys_map_incr(&dst, drm_fb_clip_offset(cirrus->pitch, fb->format, rect));
-
-       drm_fb_blit(&dst, &cirrus->pitch, cirrus->format->format, vmap, fb, rect);
-
-       return 0;
-}
-
 static int cirrus_check_size(int width, int height,
                             struct drm_framebuffer *fb)
 {
@@ -393,6 +378,7 @@ static void cirrus_primary_plane_helper_atomic_update(struct drm_plane *plane,
        struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(plane_state);
        struct drm_framebuffer *fb = plane_state->fb;
        struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
+       struct iosys_map vaddr = IOSYS_MAP_INIT_VADDR_IOMEM(cirrus->vram);
        struct drm_atomic_helper_damage_iter iter;
        struct drm_rect damage;
        int idx;
@@ -410,7 +396,11 @@ static void cirrus_primary_plane_helper_atomic_update(struct drm_plane *plane,
 
        drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
        drm_atomic_for_each_plane_damage(&iter, &damage) {
-               cirrus_fb_blit_rect(fb, &shadow_plane_state->data[0], &damage);
+               unsigned int offset = drm_fb_clip_offset(cirrus->pitch, fb->format, &damage);
+               struct iosys_map dst = IOSYS_MAP_INIT_OFFSET(&vaddr, offset);
+
+               drm_fb_blit(&dst, &cirrus->pitch, cirrus->format->format,
+                           &shadow_plane_state->data[0], fb, &damage);
        }
 
        drm_dev_exit(idx);