Instead of having a special case for YUV formats in
si_query_dmabuf_modifiers, let ac_get_supported_modifiers handle
them. Keep setting external_only = 1 for YUV formats, since we
can only sample from such formats (we can't use them as render
targets).
This shouldn't change si_query_dmabuf_modifiers's behavior, because
for YUV formats ac_get_supported_modifiers will return a single
LINEAR modifier.
Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10134>
{
struct si_screen *sscreen = (struct si_screen *)screen;
- if (util_format_is_yuv(format)) {
- if (max) {
- *modifiers = DRM_FORMAT_MOD_LINEAR;
- if (external_only)
- *external_only = 1;
- }
- *count = 1;
- return;
- }
-
unsigned ac_mod_count = max;
ac_get_supported_modifiers(&sscreen->info, &(struct ac_modifier_options) {
.dcc = !(sscreen->debug_flags & DBG(NO_DCC)),
}, format, &ac_mod_count, max ? modifiers : NULL);
if (max && external_only) {
for (unsigned i = 0; i < ac_mod_count; ++i)
- external_only[i] = 0;
+ external_only[i] = util_format_is_yuv(format);
}
*count = ac_mod_count;
}