vc4: Fix query_dmabuf_modifiers mis-reporting external_only property

vc4_screen_query_dmabuf_modifiers doesn't consider that the given format
may only be supported by lowering, which only happens for external
textures.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4063>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4063>
This commit is contained in:
Chris Lord 2020-03-05 16:37:53 +00:00 committed by Marge Bot
parent 61f2e8d9bb
commit b760ccfedb

View file

@ -412,6 +412,7 @@ vc4_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
int *count)
{
int m, i;
bool tex_will_lower;
uint64_t available_modifiers[] = {
DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED,
DRM_FORMAT_MOD_LINEAR,
@ -426,6 +427,7 @@ vc4_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
*count = MIN2(max, num_modifiers);
m = screen->has_tiling_ioctl ? 0 : 1;
tex_will_lower = !vc4_tex_format_supported(format);
/* We support both modifiers (tiled and linear) for all sampler
* formats, but if we don't have the DRM_VC4_GET_TILING ioctl
* we shouldn't advertise the tiled formats.
@ -433,7 +435,7 @@ vc4_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
for (i = 0; i < *count; i++) {
modifiers[i] = available_modifiers[m++];
if (external_only)
external_only[i] = false;
external_only[i] = tex_will_lower;
}
}