vrend: Introduce and support VIRGL_BIND_STAGING

VIRGL_BIND_STAGING is used for buffers that are backed only by guest iov
storage and are guaranteed to not be written to by the host, thus not
requiring additional synchronization. They will be used in upcoming
commits as staging buffers for copy transfers.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Alexandros Frantzis 6 years ago committed by Gert Wollny
parent faa38808c9
commit 0c09d8441b
  1. 4
      src/virgl_hw.h
  2. 4
      src/vrend_renderer.c

@ -265,6 +265,10 @@ enum virgl_formats {
#define VIRGL_BIND_CURSOR (1 << 16)
#define VIRGL_BIND_CUSTOM (1 << 17)
#define VIRGL_BIND_SCANOUT (1 << 18)
/* Used for buffers that are backed by guest storage and
* are only read by the host.
*/
#define VIRGL_BIND_STAGING (1 << 19)
struct virgl_caps_bool_set1 {
unsigned indep_blend_enable:1;

@ -5908,6 +5908,7 @@ static int check_resource_valid(struct vrend_renderer_resource_create_args *args
if (args->bind == 0 ||
args->bind == VIRGL_BIND_CUSTOM ||
args->bind == VIRGL_BIND_STAGING ||
args->bind == VIRGL_BIND_INDEX_BUFFER ||
args->bind == VIRGL_BIND_STREAM_OUTPUT ||
args->bind == VIRGL_BIND_VERTEX_BUFFER ||
@ -6160,6 +6161,9 @@ int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *a
FREE(gr);
return ENOMEM;
}
} else if (args->bind == VIRGL_BIND_STAGING) {
/* Staging buffers use only guest memory. */
gr->storage = VREND_RESOURCE_STORAGE_GUEST;
} else if (args->bind == VIRGL_BIND_INDEX_BUFFER) {
gr->target = GL_ELEMENT_ARRAY_BUFFER_ARB;
vrend_create_buffer(gr, args->width);

Loading…
Cancel
Save