Mesa (master): virgl: add support for missing command buffer binding.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 9 04:26:29 UTC 2019


Module: Mesa
Branch: master
Commit: 316b785c59446c9206343d5349091d797f677f2b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=316b785c59446c9206343d5349091d797f677f2b

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Feb 11 12:53:38 2019 +1000

virgl: add support for missing command buffer binding.

When I added indirect support I forgot this, however to use it
now we need to check for a new enough capability on the host side.

Reviewed-By: Gert Wollny <gert.wollny at collabora.com>

---

 src/gallium/drivers/virgl/virgl_hw.h       | 2 ++
 src/gallium/drivers/virgl/virgl_resource.c | 2 +-
 src/gallium/drivers/virgl/virgl_resource.h | 8 ++++++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/virgl/virgl_hw.h b/src/gallium/drivers/virgl/virgl_hw.h
index 7038f3973d9..e193752c498 100644
--- a/src/gallium/drivers/virgl/virgl_hw.h
+++ b/src/gallium/drivers/virgl/virgl_hw.h
@@ -237,6 +237,7 @@ enum virgl_formats {
 #define VIRGL_CAP_TRANSFER             (1 << 17)
 #define VIRGL_CAP_FBO_MIXED_COLOR_FORMATS (1 << 18)
 #define VIRGL_CAP_FAKE_FP64            (1 << 19)
+#define VIRGL_CAP_BIND_COMMAND_ARGS    (1 << 20)
 #define VIRGL_CAP_TRANSFORM_FEEDBACK3  (1 << 23)
 
 /* virgl bind flags - these are compatible with mesa 10.5 gallium.
@@ -249,6 +250,7 @@ enum virgl_formats {
 #define VIRGL_BIND_INDEX_BUFFER  (1 << 5)
 #define VIRGL_BIND_CONSTANT_BUFFER (1 << 6)
 #define VIRGL_BIND_DISPLAY_TARGET (1 << 7)
+#define VIRGL_BIND_COMMAND_ARGS  (1 << 8)
 #define VIRGL_BIND_STREAM_OUTPUT (1 << 11)
 #define VIRGL_BIND_SHADER_BUFFER (1 << 14)
 #define VIRGL_BIND_QUERY_BUFFER  (1 << 15)
diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c
index 7aef1dfdd23..5f0040c1db1 100644
--- a/src/gallium/drivers/virgl/virgl_resource.c
+++ b/src/gallium/drivers/virgl/virgl_resource.c
@@ -72,7 +72,7 @@ static struct pipe_resource *virgl_resource_create(struct pipe_screen *screen,
    res->u.b = *templ;
    res->u.b.screen = &vs->base;
    pipe_reference_init(&res->u.b.reference, 1);
-   vbind = pipe_to_virgl_bind(templ->bind);
+   vbind = pipe_to_virgl_bind(vs, templ->bind);
    virgl_resource_layout(&res->u.b, &res->metadata);
    res->hw_res = vs->vws->resource_create(vs->vws, templ->target,
                                           templ->format, vbind,
diff --git a/src/gallium/drivers/virgl/virgl_resource.h b/src/gallium/drivers/virgl/virgl_resource.h
index a60987c5b86..f127d45cff1 100644
--- a/src/gallium/drivers/virgl/virgl_resource.h
+++ b/src/gallium/drivers/virgl/virgl_resource.h
@@ -30,6 +30,7 @@
 #include "util/u_transfer.h"
 
 #include "virgl_hw.h"
+#include "virgl_screen.h"
 #define VR_MAX_TEXTURE_2D_LEVELS 15
 
 struct winsys_handle;
@@ -80,7 +81,7 @@ static inline struct virgl_transfer *virgl_transfer(struct pipe_transfer *trans)
 
 void virgl_buffer_init(struct virgl_resource *res);
 
-static inline unsigned pipe_to_virgl_bind(unsigned pbind)
+static inline unsigned pipe_to_virgl_bind(const struct virgl_screen *vs, unsigned pbind)
 {
    unsigned outbind = 0;
    if (pbind & PIPE_BIND_DEPTH_STENCIL)
@@ -108,7 +109,10 @@ static inline unsigned pipe_to_virgl_bind(unsigned pbind)
    if (pbind & PIPE_BIND_SHADER_BUFFER)
       outbind |= VIRGL_BIND_SHADER_BUFFER;
    if (pbind & PIPE_BIND_QUERY_BUFFER)
-     outbind |= VIRGL_BIND_QUERY_BUFFER;
+      outbind |= VIRGL_BIND_QUERY_BUFFER;
+   if (pbind & PIPE_BIND_COMMAND_ARGS_BUFFER)
+      if (vs->caps.caps.v2.capability_bits & VIRGL_CAP_BIND_COMMAND_ARGS)
+         outbind |= VIRGL_BIND_COMMAND_ARGS;
    return outbind;
 }
 




More information about the mesa-commit mailing list