From 71fb55f3bf4341d250b580cb2d6a7acf21cfce39 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 31 Jan 2024 12:30:16 -0500 Subject: render/pixel-format: Move has_alpha into it's own array Some opaque pixel formats (nv12, p010) require per-plane bytes_per_block info. However, it doesn't make sense to store them in wlr_pixel_format_info, as they will never be useful (currently, this info is used for shm, which doesn't have a concept of multi-planar buffers.) Let's define a separate array and function for determining whether a pixel format has alpha. --- include/render/pixel_format.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/render/pixel_format.h b/include/render/pixel_format.h index a024ff9d..e0b500c7 100644 --- a/include/render/pixel_format.h +++ b/include/render/pixel_format.h @@ -27,9 +27,6 @@ struct wlr_pixel_format_info { uint32_t bytes_per_block; /* Size of a block in pixels (zero for 1×1) */ uint32_t block_width, block_height; - - /* True if the format has an alpha channel */ - bool has_alpha; }; /** @@ -61,4 +58,9 @@ 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); +/** + * Return true if the DRM FourCC fmt has an alpha channel, false otherwise. + */ +bool pixel_format_has_alpha(uint32_t fmt); + #endif -- cgit v1.2.3