mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 03:24:19 +02:00
drm/format-helper: Flip src/dst-format branches in blit helper
Upcoming changes to the format conversion will mostly blit from XRGB8888 to some other format. So put the source format in blit's outer branches to make the code more readable. For cases where a format only changes its endianness, such as XRGB565, introduce dedicated branches that handle this for all formats. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230102112927.26565-7-tzimmermann@suse.de
This commit is contained in:
parent
4db88a9026
commit
f238ac30af
|
|
@ -653,43 +653,39 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d
|
|||
if (dst_format == DRM_FORMAT_ARGB2101010)
|
||||
dst_format = DRM_FORMAT_XRGB2101010;
|
||||
|
||||
if (dst_format == fb_format) {
|
||||
if (fb_format == dst_format) {
|
||||
drm_fb_memcpy(dst, dst_pitch, src, fb, clip);
|
||||
return 0;
|
||||
|
||||
} else if (dst_format == DRM_FORMAT_RGB565) {
|
||||
if (fb_format == DRM_FORMAT_XRGB8888) {
|
||||
} else if (fb_format == (dst_format | DRM_FORMAT_BIG_ENDIAN)) {
|
||||
drm_fb_swab(dst, dst_pitch, src, fb, clip, false);
|
||||
return 0;
|
||||
} else if (fb_format == (dst_format & ~DRM_FORMAT_BIG_ENDIAN)) {
|
||||
drm_fb_swab(dst, dst_pitch, src, fb, clip, false);
|
||||
return 0;
|
||||
} else if (fb_format == DRM_FORMAT_XRGB8888) {
|
||||
if (dst_format == DRM_FORMAT_RGB565) {
|
||||
drm_fb_xrgb8888_to_rgb565(dst, dst_pitch, src, fb, clip, false);
|
||||
return 0;
|
||||
}
|
||||
} else if (dst_format == (DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN)) {
|
||||
if (fb_format == DRM_FORMAT_RGB565) {
|
||||
drm_fb_swab(dst, dst_pitch, src, fb, clip, false);
|
||||
return 0;
|
||||
}
|
||||
} else if (dst_format == DRM_FORMAT_RGB888) {
|
||||
if (fb_format == DRM_FORMAT_XRGB8888) {
|
||||
} else if (dst_format == DRM_FORMAT_RGB888) {
|
||||
drm_fb_xrgb8888_to_rgb888(dst, dst_pitch, src, fb, clip);
|
||||
return 0;
|
||||
}
|
||||
} else if (dst_format == DRM_FORMAT_XRGB8888) {
|
||||
if (fb_format == DRM_FORMAT_RGB888) {
|
||||
drm_fb_rgb888_to_xrgb8888(dst, dst_pitch, src, fb, clip);
|
||||
return 0;
|
||||
} else if (fb_format == DRM_FORMAT_RGB565) {
|
||||
drm_fb_rgb565_to_xrgb8888(dst, dst_pitch, src, fb, clip);
|
||||
return 0;
|
||||
}
|
||||
} else if (dst_format == DRM_FORMAT_XRGB2101010) {
|
||||
if (fb_format == DRM_FORMAT_XRGB8888) {
|
||||
} else if (dst_format == DRM_FORMAT_XRGB2101010) {
|
||||
drm_fb_xrgb8888_to_xrgb2101010(dst, dst_pitch, src, fb, clip);
|
||||
return 0;
|
||||
}
|
||||
} else if (dst_format == DRM_FORMAT_BGRX8888) {
|
||||
if (fb_format == DRM_FORMAT_XRGB8888) {
|
||||
} else if (dst_format == DRM_FORMAT_BGRX8888) {
|
||||
drm_fb_swab(dst, dst_pitch, src, fb, clip, false);
|
||||
return 0;
|
||||
}
|
||||
} else if (fb_format == DRM_FORMAT_RGB888) {
|
||||
if (dst_format == DRM_FORMAT_XRGB8888) {
|
||||
drm_fb_rgb888_to_xrgb8888(dst, dst_pitch, src, fb, clip);
|
||||
return 0;
|
||||
}
|
||||
} else if (fb_format == DRM_FORMAT_RGB565) {
|
||||
if (dst_format == DRM_FORMAT_XRGB8888) {
|
||||
drm_fb_rgb565_to_xrgb8888(dst, dst_pitch, src, fb, clip);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
drm_warn_once(fb->dev, "No conversion helper from %p4cc to %p4cc found.\n",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user