Incorrect implementation has been found during code surfing.
v3d implementation used for reference.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Icenowy Zheng <icenowy@aosc.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6076>
DRM_FORMAT_MOD_LINEAR,
};
+ int num_modifiers = ARRAY_SIZE(available_modifiers);
+
if (!modifiers) {
- *count = ARRAY_SIZE(available_modifiers);
+ *count = num_modifiers;
return;
}
+ *count = MIN2(max, num_modifiers);
for (int i = 0; i < *count; i++) {
modifiers[i] = available_modifiers[i];
if (external_only)
- external_only = false;
+ external_only[i] = false;
}
}