Merge branch 'kdfs' into 'master'

render/pixel_format: generate tables via kdfs

See merge request wlroots/wlroots!5271
This commit is contained in:
Simon Ser 2026-04-12 11:38:37 +00:00
commit 5d859d09be
7 changed files with 716 additions and 310 deletions

View file

@ -18,17 +18,15 @@
struct wlr_pixel_format_info {
uint32_t drm_format;
/* Equivalent of the format if it has an alpha channel,
* DRM_FORMAT_INVALID (0) if NA
*/
uint32_t opaque_substitute;
/* Bytes per block (including padding) */
uint32_t bytes_per_block;
/* Size of a block in pixels (zero for 1×1) */
/* Size of a block in pixels */
uint32_t block_width, block_height;
};
extern const struct wlr_pixel_format_info pixel_format_info[];
extern const size_t pixel_format_info_len;
/**
* Get pixel format information from a DRM FourCC.
*
@ -58,6 +56,8 @@ uint32_t convert_wl_shm_format_to_drm(enum wl_shm_format fmt);
*/
enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt);
bool pixel_format_is_opaque(uint32_t fmt);
/**
* Return true if the DRM FourCC fmt has an alpha channel, false otherwise.
*/
@ -68,4 +68,10 @@ bool pixel_format_has_alpha(uint32_t fmt);
*/
bool pixel_format_is_ycbcr(uint32_t fmt);
/**
* Get the equivalent opaque variant of a format if it has an alpha channel,
* DRM_FORMAT_INVALID otherwise.
*/
uint32_t pixel_format_get_opaque_substitute(uint32_t fmt);
#endif