diff options
author | Simon Ser <contact@emersion.fr> | 2021-08-01 19:28:36 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-08-03 02:53:03 -0400 |
commit | 8a3cd28973210b1c91d822c0f371b888641d05d8 (patch) | |
tree | e78255b14d22ebc9197e97c652d56e6fb94d526f /render | |
parent | b913e64f953a8eb5fb1d3eeffc53572ee44ae91d (diff) |
render/pixman/pixel_format: add more formats
Add a bunch of new formats for Pixman: a few missing 32-bit ones,
some 16-bit and 32-bit formats as well.
Mostly based on a Weston patch [1].
[1]: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/664
Diffstat (limited to 'render')
-rw-r--r-- | render/pixman/pixel_format.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/render/pixman/pixel_format.c b/render/pixman/pixel_format.c index 166f8580..5a460a0a 100644 --- a/render/pixman/pixel_format.c +++ b/render/pixman/pixel_format.c @@ -35,7 +35,68 @@ static const struct wlr_pixman_pixel_format formats[] = { #else .pixman_format = PIXMAN_a8b8g8r8, #endif - } + }, + { + .drm_format = DRM_FORMAT_RGBA8888, +#if WLR_BIG_ENDIAN + .pixman_format = PIXMAN_a8b8g8r8, +#else + .pixman_format = PIXMAN_r8g8b8a8, +#endif + }, + { + .drm_format = DRM_FORMAT_RGBX8888, +#if WLR_BIG_ENDIAN + .pixman_format = PIXMAN_x8b8g8r8, +#else + .pixman_format = PIXMAN_r8g8b8x8, +#endif + }, + { + .drm_format = DRM_FORMAT_BGRA8888, +#if WLR_BIG_ENDIAN + .pixman_format = PIXMAN_a8r8g8b8, +#else + .pixman_format = PIXMAN_b8g8r8a8, +#endif + }, + { + .drm_format = DRM_FORMAT_BGRX8888, +#if WLR_BIG_ENDIAN + .pixman_format = PIXMAN_x8r8g8b8, +#else + .pixman_format = PIXMAN_b8g8r8x8, +#endif + }, +#if WLR_LITTLE_ENDIAN + // Since DRM formats are always little-endian, they don't have an + // equivalent on big-endian if their components are spanning across + // multiple bytes. + { + .drm_format = DRM_FORMAT_RGB565, + .pixman_format = PIXMAN_r5g6b5, + }, + { + .drm_format = DRM_FORMAT_BGR565, + .pixman_format = PIXMAN_b5g6r5, + }, + { + .drm_format = DRM_FORMAT_ARGB2101010, + .pixman_format = PIXMAN_a2r10g10b10, + }, + { + .drm_format = DRM_FORMAT_XRGB2101010, + .pixman_format = PIXMAN_x2r10g10b10, + }, + { + .drm_format = DRM_FORMAT_ABGR2101010, + .pixman_format = PIXMAN_a2b10g10r10, + }, + { + .drm_format = DRM_FORMAT_XBGR2101010, + .pixman_format = PIXMAN_x2b10g10r10, + }, +#endif }; pixman_format_code_t get_pixman_format_from_drm(uint32_t fmt) { |