mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
virgl: Support VIRGL_BIND_STAGING
Support a new virgl bind type for staging buffers which don't require dedicated host-side storage. These will be used to implement copy transfers. Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com> Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
This commit is contained in:
parent
f38cdaebac
commit
636345f496
3 changed files with 16 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue