mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
panfrost: fix off-by-one when exporting format modifiers
`count` should not be incremented before the check, because it causes the modifiers array to be filled starting from position 1 instead of 0. This bug causes one less format modifier to be available than would otherwise be expected, which could then lead to a dmabuf query failing in situations where a supported modifier wouldn't be advertised. It also causes garbage data to be advertised as a modifier in position 0 of the array, although this is not very likely to cause issues. Fixes:2a1217513("panfrost: Implement panfrost_query_dmabuf_modifiers") Cc: mesa-stable Signed-off-by: Italo Nicola <italonicola@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20879> (cherry picked from commit6c446377ff)
This commit is contained in:
parent
518487158a
commit
3a65dc4f7f
2 changed files with 2 additions and 3 deletions
|
|
@ -580,7 +580,7 @@
|
|||
"description": "panfrost: fix off-by-one when exporting format modifiers",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "2a1217513e1c5d881718c2a7f2afb951e1fe6305"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -620,14 +620,13 @@ panfrost_walk_dmabuf_modifiers(struct pipe_screen *screen,
|
|||
test_modifier != pan_best_modifiers[i])
|
||||
continue;
|
||||
|
||||
count++;
|
||||
|
||||
if (max > (int) count) {
|
||||
modifiers[count] = pan_best_modifiers[i];
|
||||
|
||||
if (external_only)
|
||||
external_only[count] = false;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
*out_count = count;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue