Commit d1c0cc8d authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/cirrus: Compute blit destination offset in single location

The calculation for the scanout-buffer blit offset is independent
from the color format. In the one case where the current code uses
fb->pitches[0] instead of cirrus->pitch, their values are identical.
Hence merge all into a single line.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230215161517.5113-2-tzimmermann@suse.de
parent a1eccc57
...@@ -327,17 +327,15 @@ static int cirrus_fb_blit_rect(struct drm_framebuffer *fb, ...@@ -327,17 +327,15 @@ static int cirrus_fb_blit_rect(struct drm_framebuffer *fb,
return -ENODEV; return -ENODEV;
iosys_map_set_vaddr_iomem(&dst, cirrus->vram); iosys_map_set_vaddr_iomem(&dst, cirrus->vram);
iosys_map_incr(&dst, drm_fb_clip_offset(cirrus->pitch, fb->format, rect));
if (cirrus->cpp == fb->format->cpp[0]) { if (cirrus->cpp == fb->format->cpp[0]) {
iosys_map_incr(&dst, drm_fb_clip_offset(fb->pitches[0], fb->format, rect));
drm_fb_memcpy(&dst, fb->pitches, vmap, fb, rect); drm_fb_memcpy(&dst, fb->pitches, vmap, fb, rect);
} else if (fb->format->cpp[0] == 4 && cirrus->cpp == 2) { } else if (fb->format->cpp[0] == 4 && cirrus->cpp == 2) {
iosys_map_incr(&dst, drm_fb_clip_offset(cirrus->pitch, fb->format, rect));
drm_fb_xrgb8888_to_rgb565(&dst, &cirrus->pitch, vmap, fb, rect, false); drm_fb_xrgb8888_to_rgb565(&dst, &cirrus->pitch, vmap, fb, rect, false);
} else if (fb->format->cpp[0] == 4 && cirrus->cpp == 3) { } else if (fb->format->cpp[0] == 4 && cirrus->cpp == 3) {
iosys_map_incr(&dst, drm_fb_clip_offset(cirrus->pitch, fb->format, rect));
drm_fb_xrgb8888_to_rgb888(&dst, &cirrus->pitch, vmap, fb, rect); drm_fb_xrgb8888_to_rgb888(&dst, &cirrus->pitch, vmap, fb, rect);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment