vc4: Fix query_dmabuf_modifiers mis-reporting external_only property
authorChris Lord <clord@igalia.com>
Thu, 5 Mar 2020 16:37:53 +0000 (16:37 +0000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 11 Mar 2020 09:10:13 +0000 (09:10 +0000)
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>

src/gallium/drivers/vc4/vc4_screen.c

index 21db4c944ff12d0d17755909611a96ac18233ee8..faa36c722ae4bba31a7469ab7a534960f459b745 100644 (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;
        }
 }