render/pixel_format: drop wlr_pixel_format_info.opaque_substitute

Move this away from struct wlr_pixel_format_info. The next commit
will generate the pixel_format_info table from kdfs, computing a
compatible opaque format needs to be done separately from
retrieving pixel format metadata (and is not yet supported).
This commit is contained in:
Simon Ser 2026-02-19 15:49:41 +01:00
parent 2d95d8d292
commit 34ffeaa4ef
2 changed files with 28 additions and 22 deletions

View file

@ -18,11 +18,6 @@
struct wlr_pixel_format_info { struct wlr_pixel_format_info {
uint32_t drm_format; 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) */ /* Bytes per block (including padding) */
uint32_t bytes_per_block; uint32_t bytes_per_block;
/* Size of a block in pixels (zero for 1×1) */ /* Size of a block in pixels (zero for 1×1) */

View file

@ -10,7 +10,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_ARGB8888, .drm_format = DRM_FORMAT_ARGB8888,
.opaque_substitute = DRM_FORMAT_XRGB8888,
.bytes_per_block = 4, .bytes_per_block = 4,
}, },
{ {
@ -19,7 +18,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_ABGR8888, .drm_format = DRM_FORMAT_ABGR8888,
.opaque_substitute = DRM_FORMAT_XBGR8888,
.bytes_per_block = 4, .bytes_per_block = 4,
}, },
{ {
@ -28,7 +26,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_RGBA8888, .drm_format = DRM_FORMAT_RGBA8888,
.opaque_substitute = DRM_FORMAT_RGBX8888,
.bytes_per_block = 4, .bytes_per_block = 4,
}, },
{ {
@ -37,7 +34,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_BGRA8888, .drm_format = DRM_FORMAT_BGRA8888,
.opaque_substitute = DRM_FORMAT_BGRX8888,
.bytes_per_block = 4, .bytes_per_block = 4,
}, },
{ {
@ -90,7 +86,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_RGBA4444, .drm_format = DRM_FORMAT_RGBA4444,
.opaque_substitute = DRM_FORMAT_RGBX4444,
.bytes_per_block = 2, .bytes_per_block = 2,
}, },
{ {
@ -99,7 +94,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_BGRA4444, .drm_format = DRM_FORMAT_BGRA4444,
.opaque_substitute = DRM_FORMAT_BGRX4444,
.bytes_per_block = 2, .bytes_per_block = 2,
}, },
{ {
@ -108,7 +102,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_RGBA5551, .drm_format = DRM_FORMAT_RGBA5551,
.opaque_substitute = DRM_FORMAT_RGBX5551,
.bytes_per_block = 2, .bytes_per_block = 2,
}, },
{ {
@ -117,7 +110,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_BGRA5551, .drm_format = DRM_FORMAT_BGRA5551,
.opaque_substitute = DRM_FORMAT_BGRX5551,
.bytes_per_block = 2, .bytes_per_block = 2,
}, },
{ {
@ -126,7 +118,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_ARGB1555, .drm_format = DRM_FORMAT_ARGB1555,
.opaque_substitute = DRM_FORMAT_XRGB1555,
.bytes_per_block = 2, .bytes_per_block = 2,
}, },
{ {
@ -143,7 +134,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_ARGB2101010, .drm_format = DRM_FORMAT_ARGB2101010,
.opaque_substitute = DRM_FORMAT_XRGB2101010,
.bytes_per_block = 4, .bytes_per_block = 4,
}, },
{ {
@ -152,7 +142,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_ABGR2101010, .drm_format = DRM_FORMAT_ABGR2101010,
.opaque_substitute = DRM_FORMAT_XBGR2101010,
.bytes_per_block = 4, .bytes_per_block = 4,
}, },
{ {
@ -161,7 +150,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_ABGR16161616F, .drm_format = DRM_FORMAT_ABGR16161616F,
.opaque_substitute = DRM_FORMAT_XBGR16161616F,
.bytes_per_block = 8, .bytes_per_block = 8,
}, },
{ {
@ -174,7 +162,6 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
{ {
.drm_format = DRM_FORMAT_ABGR16161616, .drm_format = DRM_FORMAT_ABGR16161616,
.opaque_substitute = DRM_FORMAT_XBGR16161616,
.bytes_per_block = 8, .bytes_per_block = 8,
}, },
{ {
@ -374,9 +361,33 @@ bool pixel_format_is_ycbcr(uint32_t format) {
} }
uint32_t pixel_format_get_opaque_substitute(uint32_t fmt) { uint32_t pixel_format_get_opaque_substitute(uint32_t fmt) {
const struct wlr_pixel_format_info *info = drm_get_pixel_format_info(fmt); switch (fmt) {
if (info == NULL) { case DRM_FORMAT_ARGB8888:
return DRM_FORMAT_XRGB8888;
case DRM_FORMAT_ABGR8888:
return DRM_FORMAT_XBGR8888;
case DRM_FORMAT_RGBA8888:
return DRM_FORMAT_RGBX8888;
case DRM_FORMAT_BGRA8888:
return DRM_FORMAT_BGRX8888;
case DRM_FORMAT_RGBA4444:
return DRM_FORMAT_RGBX4444;
case DRM_FORMAT_BGRA4444:
return DRM_FORMAT_BGRX4444;
case DRM_FORMAT_RGBA5551:
return DRM_FORMAT_RGBX5551;
case DRM_FORMAT_BGRA5551:
return DRM_FORMAT_BGRX5551;
case DRM_FORMAT_ARGB1555:
return DRM_FORMAT_XRGB1555;
case DRM_FORMAT_ARGB2101010:
return DRM_FORMAT_XRGB2101010;
case DRM_FORMAT_ABGR2101010:
return DRM_FORMAT_XBGR2101010;
case DRM_FORMAT_ABGR16161616F:
return DRM_FORMAT_XBGR16161616F;
case DRM_FORMAT_ABGR16161616:
return DRM_FORMAT_XBGR16161616;
}
return DRM_FORMAT_INVALID; return DRM_FORMAT_INVALID;
} }
return info->opaque_substitute;
}