aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2019-02-11 12:53:38 +1000
committerDave Airlie <[email protected]>2019-04-09 14:15:12 +1000
commit316b785c59446c9206343d5349091d797f677f2b (patch)
treef2bb5fb3e462d100998b0db478ed48a7e095dbbb /src
parent899fd66b446356544afadff27b9365f5f5a26276 (diff)
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/virgl/virgl_hw.h2
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.c2
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.h8
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;
}