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

@ -13,11 +13,17 @@ wlr_files += files(
'drm_syncobj.c',
'pass.c',
'pixel_format.c',
'pixel_format_table.c',
'swapchain.c',
'wlr_renderer.c',
'wlr_texture.c',
)
run_target(
'gen-pixel-format',
command: [files('gen_pixel_format.sh'), files('pixel_format_table.c')],
)
has_dma_buf_import_sync_file = cc.has_header('linux/dma-buf.h') and cc.has_define(
'DMA_BUF_IOCTL_IMPORT_SYNC_FILE',
prefix: '#include <linux/dma-buf.h>',