@ -475,16 +475,12 @@ static ssize_t get_drm_format_set_index(const struct wlr_drm_format_set *set,
format_found = true ;
format_found = true ;
break ;
break ;
}
}
idx + = 1 + fmt - > len ;
idx + = fmt - > len ;
}
}
if ( ! format_found ) {
if ( ! format_found ) {
return - 1 ;
return - 1 ;
}
}
if ( modifier = = DRM_FORMAT_MOD_INVALID ) {
return idx ;
}
for ( size_t i = 0 ; i < fmt - > len ; i + + ) {
for ( size_t i = 0 ; i < fmt - > len ; i + + ) {
if ( fmt - > modifiers [ i ] = = modifier ) {
if ( fmt - > modifiers [ i ] = = modifier ) {
return idx ;
return idx ;
@ -506,7 +502,7 @@ static struct wlr_linux_dmabuf_feedback_v1_compiled *feedback_compile(
size_t table_len = 0 ;
size_t table_len = 0 ;
for ( size_t i = 0 ; i < fallback_tranche - > formats - > len ; i + + ) {
for ( size_t i = 0 ; i < fallback_tranche - > formats - > len ; i + + ) {
const struct wlr_drm_format * fmt = fallback_tranche - > formats - > formats [ i ] ;
const struct wlr_drm_format * fmt = fallback_tranche - > formats - > formats [ i ] ;
table_len + = 1 + fmt - > len ;
table_len + = fmt - > len ;
}
}
assert ( table_len > 0 ) ;
assert ( table_len > 0 ) ;
@ -533,12 +529,6 @@ static struct wlr_linux_dmabuf_feedback_v1_compiled *feedback_compile(
for ( size_t i = 0 ; i < fallback_tranche - > formats - > len ; i + + ) {
for ( size_t i = 0 ; i < fallback_tranche - > formats - > len ; i + + ) {
const struct wlr_drm_format * fmt = fallback_tranche - > formats - > formats [ i ] ;
const struct wlr_drm_format * fmt = fallback_tranche - > formats - > formats [ i ] ;
table [ n ] = ( struct wlr_linux_dmabuf_feedback_v1_table_entry ) {
. format = fmt - > format ,
. modifier = DRM_FORMAT_MOD_INVALID ,
} ;
n + + ;
for ( size_t k = 0 ; k < fmt - > len ; k + + ) {
for ( size_t k = 0 ; k < fmt - > len ; k + + ) {
table [ n ] = ( struct wlr_linux_dmabuf_feedback_v1_table_entry ) {
table [ n ] = ( struct wlr_linux_dmabuf_feedback_v1_table_entry ) {
. format = fmt - > format ,
. format = fmt - > format ,
@ -584,20 +574,6 @@ static struct wlr_linux_dmabuf_feedback_v1_compiled *feedback_compile(
uint16_t * indices = compiled_tranche - > indices . data ;
uint16_t * indices = compiled_tranche - > indices . data ;
for ( size_t j = 0 ; j < tranche - > formats - > len ; j + + ) {
for ( size_t j = 0 ; j < tranche - > formats - > len ; j + + ) {
const struct wlr_drm_format * fmt = tranche - > formats - > formats [ j ] ;
const struct wlr_drm_format * fmt = tranche - > formats - > formats [ j ] ;
ssize_t index = get_drm_format_set_index (
fallback_tranche - > formats , fmt - > format ,
DRM_FORMAT_MOD_INVALID ) ;
if ( index < 0 ) {
wlr_log ( WLR_ERROR , " Format 0x% " PRIX32 " and modifier "
" INVALID are in tranche #%zu but are missing "
" from the fallback tranche " ,
fmt - > format , i ) ;
goto error_compiled ;
}
indices [ n ] = index ;
n + + ;
for ( size_t k = 0 ; k < fmt - > len ; k + + ) {
for ( size_t k = 0 ; k < fmt - > len ; k + + ) {
ssize_t index = get_drm_format_set_index (
ssize_t index = get_drm_format_set_index (
fallback_tranche - > formats , fmt - > format , fmt - > modifiers [ k ] ) ;
fallback_tranche - > formats , fmt - > format , fmt - > modifiers [ k ] ) ;