render/pixel_format: generate tables via kdfs

Leverage go-kdfs [1] to automatically generate tables (basic info
for single-plane formats, YUV list, opaque list). This allows us
to drop our manually written tables and check format info in a kdfs
viewer (the kdfs CLI or pixfmtdb) to ensure it's correct.

Add a new gen-pixel-format ninja target to regenerate tables. Tables
are checked in Git instead of being generated at build-time, so
that the kdfs CLI isn't a build-time dependency.

block_width/block_height are now never zero.

[1]: https://gitlab.freedesktop.org/emersion/go-kdf
This commit is contained in:
Simon Ser 2026-02-19 15:54:43 +01:00
parent 34ffeaa4ef
commit e69e1b5f7a
5 changed files with 634 additions and 282 deletions

View file

@ -20,10 +20,13 @@ struct wlr_pixel_format_info {
/* 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.
*
@ -53,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.
*/