Module: Mesa
Branch: main
Commit: 9efe50c83bfa3678fe7ad3cfcd94cf73d900be22
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9efe50c83bfa3678fe7ad3cfcd94cf73d900be22

Author: Gert Wollny <[email protected]>
Date:   Sat Mar  4 18:12:09 2023 +0100

virgl: report MIRROR_CLAMP features better

The new host version checks the support of these features better,
so report here accordingly. This fixes a number of texwrap piglit
tests on Intel.

v2: Stick to old test for PIPE_CAP_TEXTURE_MIRROR_CLAMP because
    host has to be backward compatible.

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25343>

---

 src/gallium/drivers/virgl/virgl_screen.c | 8 +++++---
 src/virtio/virtio-gpu/virgl_hw.h         | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/virgl/virgl_screen.c 
b/src/gallium/drivers/virgl/virgl_screen.c
index ca1913035df..36580e7efe1 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -92,11 +92,13 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
       return vscreen->caps.caps.v1.max_dual_source_render_targets;
    case PIPE_CAP_OCCLUSION_QUERY:
       return vscreen->caps.caps.v1.bset.occlusion_query;
+   case PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE:
+      if (vscreen->caps.caps.v2.host_feature_check_version >= 20)
+         return vscreen->caps.caps.v2.capability_bits_v2 & 
VIRGL_CAP_V2_MIRROR_CLAMP_TO_EDGE;
+      FALLTHROUGH;
    case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
       return vscreen->caps.caps.v1.bset.mirror_clamp &&
-      vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_HOST_IS_GLES ? 0 : 1;
-   case PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE:
-      return vscreen->caps.caps.v1.bset.mirror_clamp;
+             (vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_HOST_IS_GLES);
    case PIPE_CAP_TEXTURE_SWIZZLE:
       return 1;
    case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
diff --git a/src/virtio/virtio-gpu/virgl_hw.h b/src/virtio/virtio-gpu/virgl_hw.h
index b1d9cb2e007..e2340df1e9d 100644
--- a/src/virtio/virtio-gpu/virgl_hw.h
+++ b/src/virtio/virtio-gpu/virgl_hw.h
@@ -585,6 +585,7 @@ enum virgl_formats {
 #define VIRGL_CAP_V2_PIPELINE_STATISTICS_QUERY (1 << 13)
 #define VIRGL_CAP_V2_DRAW_PARAMETERS      (1 << 14)
 #define VIRGL_CAP_V2_GROUP_VOTE           (1 << 15)
+#define VIRGL_CAP_V2_MIRROR_CLAMP_TO_EDGE (1 << 16)
 
 /* virgl bind flags - these are compatible with mesa 10.5 gallium.
  * but are fixed, no other should be passed to virgl either.

Reply via email to