render/pixel_format: generate opaque substitute table via kdfs

This commit is contained in:
Simon Ser 2026-03-05 16:49:05 +01:00
parent e69e1b5f7a
commit e00171d871
3 changed files with 70 additions and 32 deletions

View file

@ -28,6 +28,17 @@ gen_opaque() {
'
}
gen_opaque_substitute() {
"$KDFS" compat --json --with 'DRM_FORMAT_*' --filter-channel=a --strip-channel=a 'DRM_FORMAT_*' | jq -r '
to_entries[]
| select((.value | to_entries[] | select(.value.little_endian and .value.big_endian) | length) > 0)
| (.key as $format | .value | to_entries[] | { format: $format, opaque_substitute: .key })
|
" case \(.format):\n" +
" return \(.opaque_substitute);"
'
}
gen_ycbcr() {
"$KDFS" show --json 'DRM_FORMAT_*' | jq -r '
to_entries[]
@ -57,6 +68,14 @@ $(gen_opaque)
}
}
uint32_t pixel_format_get_opaque_substitute(uint32_t format) {
switch (format) {
$(gen_opaque_substitute)
default:
return DRM_FORMAT_INVALID;
}
}
bool pixel_format_is_ycbcr(uint32_t format) {
switch (format) {
$(gen_ycbcr)