mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-13 08:22:16 -04:00
render/pixel_format: generate opaque substitute table via kdfs
This commit is contained in:
parent
e69e1b5f7a
commit
e00171d871
3 changed files with 70 additions and 32 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue