virgl: check scanout mask
authorGurchetan Singh <gurchetansingh@chromium.org>
Wed, 7 Aug 2019 02:15:58 +0000 (19:15 -0700)
committerGurchetan Singh <gurchetansingh@chromium.org>
Thu, 8 Aug 2019 23:21:57 +0000 (16:21 -0700)
Otherwise, virgl will report renderable or texturable formats as
also scan-out formats.

v2: drop host feature check (@kusma)

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
src/gallium/drivers/virgl/virgl_hw.h
src/gallium/drivers/virgl/virgl_screen.c

index 94f5987fe32d218825d9fe3f20016c062d8183be..e23a6194a9dccea07ff66797a842db5ff0f10001 100644 (file)
@@ -399,6 +399,7 @@ struct virgl_caps_v2 {
         uint32_t max_combined_atomic_counter_buffers;
         uint32_t host_feature_check_version;
         struct virgl_supported_format_mask supported_readback_formats;
+        struct virgl_supported_format_mask scanout;
 };
 
 union virgl_caps {
index 3bd6d48091ca2da597ef20ec04b61f46f9533862..f4b7a66003bdb33ce52276614fe17225495a7557 100644 (file)
@@ -738,6 +738,11 @@ virgl_is_format_supported( struct pipe_screen *screen,
          return false;
    }
 
+   if (bind & PIPE_BIND_SCANOUT) {
+      if (!virgl_format_check_bitmask(format, caps->v2.scanout.bitmask, false))
+         return false;
+   }
+
    /*
     * All other operations (sampling, transfer, etc).
     */
@@ -905,6 +910,7 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
    vws->get_caps(vws, &screen->caps);
    fixup_formats(&screen->caps.caps,
                  &screen->caps.caps.v2.supported_readback_formats);
+   fixup_formats(&screen->caps.caps, &screen->caps.caps.v2.scanout);
 
    screen->refcnt = 1;