summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/virgl/virgl_hw.h1
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.c2
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.h17
3 files changed, 16 insertions, 4 deletions
diff --git a/src/gallium/drivers/virgl/virgl_hw.h b/src/gallium/drivers/virgl/virgl_hw.h
index a01c48dd41f..50ccafcb0d6 100644
--- a/src/gallium/drivers/virgl/virgl_hw.h
+++ b/src/gallium/drivers/virgl/virgl_hw.h
@@ -262,6 +262,7 @@ enum virgl_formats {
#define VIRGL_BIND_CURSOR (1 << 16)
#define VIRGL_BIND_CUSTOM (1 << 17)
#define VIRGL_BIND_SCANOUT (1 << 18)
+#define VIRGL_BIND_STAGING (1 << 19)
struct virgl_caps_bool_set1 {
unsigned indep_blend_enable:1;
diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c
index 1cb9feb3658..e334d55fa79 100644
--- a/src/gallium/drivers/virgl/virgl_resource.c
+++ b/src/gallium/drivers/virgl/virgl_resource.c
@@ -179,7 +179,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(vs, templ->bind);
+ vbind = pipe_to_virgl_bind(vs, templ->bind, templ->flags);
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 f9a652367c2..87b3ea71673 100644
--- a/src/gallium/drivers/virgl/virgl_resource.h
+++ b/src/gallium/drivers/virgl/virgl_resource.h
@@ -33,6 +33,12 @@
#include "virgl_screen.h"
#define VR_MAX_TEXTURE_2D_LEVELS 15
+/* Indicates that the resource will be used as a staging buffer, not requiring
+ * dedicated host-side storage. Can only be used with PIPE_BUFFER resources
+ * that have a PIPE_BIND_CUSTOM bind type.
+ */
+#define VIRGL_RESOURCE_FLAG_STAGING (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
+
struct winsys_handle;
struct virgl_screen;
struct virgl_context;
@@ -90,7 +96,8 @@ 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(const struct virgl_screen *vs, unsigned pbind)
+static inline unsigned pipe_to_virgl_bind(const struct virgl_screen *vs,
+ unsigned pbind, unsigned flags)
{
unsigned outbind = 0;
if (pbind & PIPE_BIND_DEPTH_STENCIL)
@@ -111,8 +118,12 @@ static inline unsigned pipe_to_virgl_bind(const struct virgl_screen *vs, unsigne
outbind |= VIRGL_BIND_STREAM_OUTPUT;
if (pbind & PIPE_BIND_CURSOR)
outbind |= VIRGL_BIND_CURSOR;
- if (pbind & PIPE_BIND_CUSTOM)
- outbind |= VIRGL_BIND_CUSTOM;
+ if (pbind & PIPE_BIND_CUSTOM) {
+ if (flags & VIRGL_RESOURCE_FLAG_STAGING)
+ outbind |= VIRGL_BIND_STAGING;
+ else
+ outbind |= VIRGL_BIND_CUSTOM;
+ }
if (pbind & PIPE_BIND_SCANOUT)
outbind |= VIRGL_BIND_SCANOUT;
if (pbind & PIPE_BIND_SHADER_BUFFER)