vrend: Internal support for synchronized transfers

Add an internal mechanism to support synchronized transfers. This will
be used in upcoming commits to perform synchronized resource maps if
the transfer type requires it.

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 7438b455ed
commit 69c52a8fb3
  1. 2
      src/virglrenderer.c
  2. 1
      src/vrend_decode.c
  3. 6
      src/vrend_renderer.c
  4. 1
      src/vrend_renderer.h

@ -132,6 +132,7 @@ int virgl_renderer_transfer_write_iov(uint32_t handle,
transfer_info.iovec = iovec;
transfer_info.iovec_cnt = iovec_cnt;
transfer_info.context0 = true;
transfer_info.synchronized = false;
return vrend_renderer_transfer_iov(&transfer_info, VIRGL_TRANSFER_TO_HOST);
}
@ -155,6 +156,7 @@ int virgl_renderer_transfer_read_iov(uint32_t handle, uint32_t ctx_id,
transfer_info.iovec = iovec;
transfer_info.iovec_cnt = iovec_cnt;
transfer_info.context0 = true;
transfer_info.synchronized = false;
return vrend_renderer_transfer_iov(&transfer_info, VIRGL_TRANSFER_FROM_HOST);
}

@ -374,6 +374,7 @@ static int vrend_decode_resource_inline_write(struct vrend_decode_ctx *ctx, uint
if (length + ctx->ds->buf_offset > ctx->ds->buf_total)
return EINVAL;
memset(&info, 0, sizeof(info));
info.box = &box;
vrend_decode_transfer_common(ctx, &info);
data_len = (length - 11) * 4;

@ -6494,12 +6494,16 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
}
if (res->storage == VREND_RESOURCE_STORAGE_BUFFER) {
GLuint map_flags = GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_WRITE_BIT;
struct virgl_sub_upload_data d;
d.box = info->box;
d.target = res->target;
if (!info->synchronized)
map_flags |= GL_MAP_UNSYNCHRONIZED_BIT;
glBindBufferARB(res->target, res->id);
data = glMapBufferRange(res->target, info->box->x, info->box->width, GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_WRITE_BIT);
data = glMapBufferRange(res->target, info->box->x, info->box->width, map_flags);
if (data == NULL) {
vrend_printf("map failed for element buffer\n");
vrend_read_from_iovec_cb(iov, num_iovs, info->offset, info->box->width, &iov_buffer_upload, &d);

@ -110,6 +110,7 @@ struct vrend_transfer_info {
uint64_t offset;
bool context0;
struct pipe_box *box;
bool synchronized;
};
struct vrend_if_cbs {

Loading…
Cancel
Save