#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;
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,
#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;
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)
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)