summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_format_internal.h
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2025-06-25 13:48:22 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2025-06-27 15:59:23 +0200
commit8ad00a81d769ad81aac0ef65a4adbc2f53169b3c (patch)
tree5d3a66b6b3c28252f51248bfaaa421d1a5f5a764 /drivers/gpu/drm/drm_format_internal.h
parentb462b0ef4d788d56f0e575406e58450358dcbd96 (diff)
drm/format-helper: Split off byte swapping from drm_fb_xrgb8888_to_rgb565()
Move big-endian support from drm_fb_xrgb8888_to_rgb565() into the new helper drm_xrgb8888_to_rgb565be(). The functionality is required for displays with big-endian byte order. Update all callers. With the change applied, drm_fb_xrgb8888_to_rgb565() has the same signature as the other conversion functions, which is required for further updates to drm_fb_blit(). Also makes the format-conversion helper available to panic handlers, if necessary. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://lore.kernel.org/r/20250625114911.1121301-1-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/drm_format_internal.h')
-rw-r--r--drivers/gpu/drm/drm_format_internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_format_internal.h b/drivers/gpu/drm/drm_format_internal.h
index 9428d5cfebc5..ce29dd05bcc5 100644
--- a/drivers/gpu/drm/drm_format_internal.h
+++ b/drivers/gpu/drm/drm_format_internal.h
@@ -5,6 +5,7 @@
#include <linux/bits.h>
#include <linux/types.h>
+#include <linux/swab.h>
/*
* Each pixel-format conversion helper takes a raw pixel in a
@@ -59,6 +60,11 @@ static inline u32 drm_pixel_xrgb8888_to_rgb565(u32 pix)
((pix & 0x000000f8) >> 3);
}
+static inline u32 drm_pixel_xrgb8888_to_rgb565be(u32 pix)
+{
+ return swab16(drm_pixel_xrgb8888_to_rgb565(pix));
+}
+
static inline u32 drm_pixel_xrgb8888_to_rgbx5551(u32 pix)
{
return ((pix & 0x00f80000) >> 8) |