render/pixel_format: add pixel_format_get_opaque_substitute()

We'll soon move opaque substitutes outside of the format table.
Prepare the work by introducing a separate function to get this
piece of information.
This commit is contained in:
Simon Ser 2026-02-19 15:43:51 +01:00
parent f295d0322a
commit 2d95d8d292
4 changed files with 20 additions and 10 deletions

View file

@ -372,3 +372,11 @@ bool pixel_format_is_ycbcr(uint32_t format) {
}
return false;
}
uint32_t pixel_format_get_opaque_substitute(uint32_t fmt) {
const struct wlr_pixel_format_info *info = drm_get_pixel_format_info(fmt);
if (info == NULL) {
return DRM_FORMAT_INVALID;
}
return info->opaque_substitute;
}