diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2025-03-28 15:15:00 +0100 |
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2025-04-01 15:35:21 +0200 |
| commit | b39e5ba0ccb4014d94058eda21aec800c647863d (patch) | |
| tree | 10774aca5f5ed38c18fc0bfa0007c64baad1204a /drivers/gpu/drm/drm_format_internal.h | |
| parent | f46bf57299b0a8395263de0bcfcb72a600adaae9 (diff) | |
drm/format-helper: Add generic conversion to 16-bit formats
Add drm_fb_xfrm_line_32to16() to implement conversion from 32-bit
pixels to 16-bit pixels. The pixel-conversion is specified by the
given callback parameter. Mark the helper as always_inline to avoid
overhead from function calls.
Then implement all existing line-conversion functions with the new
generic call and the respective pixel-conversion helper. There's one
pixel-conversion helper that swaps output bytes. It is for gud and
requires refactoring, so don't move it into the header file.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/20250328141709.217283-5-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/drm_format_internal.h')
| -rw-r--r-- | drivers/gpu/drm/drm_format_internal.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_format_internal.h b/drivers/gpu/drm/drm_format_internal.h index e7fcf260a914..4f20b63cb6f6 100644 --- a/drivers/gpu/drm/drm_format_internal.h +++ b/drivers/gpu/drm/drm_format_internal.h @@ -128,4 +128,16 @@ static inline u32 drm_pixel_xrgb8888_to_abgr2101010(u32 pix) drm_pixel_xrgb8888_to_xbgr2101010(pix); } +/* + * Conversion from ARGB8888 + */ + +static inline u32 drm_pixel_argb8888_to_argb4444(u32 pix) +{ + return ((pix & 0xf0000000) >> 16) | + ((pix & 0x00f00000) >> 12) | + ((pix & 0x0000f000) >> 8) | + ((pix & 0x000000f0) >> 4); +} + #endif |
