wlroots/render/meson.build
Simon Ser e69e1b5f7a 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
2026-03-27 18:58:14 +01:00

80 lines
2 KiB
Meson

renderers = get_option('renderers')
if 'auto' in renderers and get_option('auto_features').enabled()
renderers = ['gles2', 'vulkan']
elif 'auto' in renderers and get_option('auto_features').disabled()
renderers = []
endif
wlr_files += files(
'color.c',
'dmabuf.c',
'drm_format_set.c',
'drm_syncobj_merger.c',
'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>',
)
if has_dma_buf_import_sync_file and target_machine.system() == 'linux'
wlr_files += files('dmabuf_linux.c')
else
wlr_files += files('dmabuf_fallback.c')
endif
internal_config.set10('HAVE_EVENTFD', cc.has_header('sys/eventfd.h'))
internal_config.set10('HAVE_LINUX_SYNC_FILE', cc.has_header('linux/sync_file.h'))
if 'gles2' in renderers or 'auto' in renderers
egl = dependency('egl', required: 'gles2' in renderers)
if egl.found()
eglext_version = cc.get_define(
'EGL_EGLEXT_VERSION',
dependencies: egl,
prefix: '#include <EGL/eglext.h>',
).to_int()
if eglext_version < 20210604
egl = dependency(
'',
required: 'gles2' in renderers,
not_found_message: 'EGL headers too old',
)
endif
endif
gbm = dependency('gbm', required: 'gles2' in renderers)
if egl.found() and gbm.found()
wlr_deps += [egl, gbm]
wlr_files += files('egl.c')
internal_features += { 'egl': true }
endif
subdir('gles2')
endif
if 'vulkan' in renderers or 'auto' in renderers
subdir('vulkan')
endif
subdir('pixman')
subdir('allocator')
lcms2 = dependency('lcms2', required: get_option('color-management'))
if lcms2.found()
wlr_deps += lcms2
wlr_files += files('color_lcms2.c')
features += { 'color-management': true }
else
wlr_files += files('color_fallback.c')
endif