diff options
author | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-04-26 16:58:01 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-04-27 18:28:41 +0200 |
commit | 30706b71fbdefa9e23c637dd1a5e85306817211c (patch) | |
tree | 8615ab3298d15428ab1d60adb641ebf43f59192f /render/pixman/pixel_format.c | |
parent | 0411dc0663ac59d5cddec71bd830597f3e0a7863 (diff) |
render/pixman: implement preferred_read_format
Diffstat (limited to 'render/pixman/pixel_format.c')
-rw-r--r-- | render/pixman/pixel_format.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/render/pixman/pixel_format.c b/render/pixman/pixel_format.c index a57c6c34..166f8580 100644 --- a/render/pixman/pixel_format.c +++ b/render/pixman/pixel_format.c @@ -49,6 +49,17 @@ pixman_format_code_t get_pixman_format_from_drm(uint32_t fmt) { return 0; } +uint32_t get_drm_format_from_pixman(pixman_format_code_t fmt) { + for (size_t i = 0; i < sizeof(formats) / sizeof(*formats); ++i) { + if (formats[i].pixman_format == fmt) { + return formats[i].drm_format; + } + } + + wlr_log(WLR_ERROR, "pixman format 0x%"PRIX32" has no drm equivalent", fmt); + return DRM_FORMAT_INVALID; +} + const uint32_t *get_pixman_drm_formats(size_t *len) { static uint32_t drm_formats[sizeof(formats) / sizeof(formats[0])]; *len = sizeof(formats) / sizeof(formats[0]); |