vrend: specify if a transfer occurs in context zero or not

A transfer won't occur in context zero if the transfer command
comes from submit_cmd. We need to restore prior state.

With the recent framebuffer binding cleanups, we really only need
to worry about the framebuffer.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Gurchetan Singh 6 years ago committed by Gert Wollny
parent cc4f8c933c
commit 0475d679aa
  1. 2
      src/virglrenderer.c
  2. 8
      src/vrend_renderer.c
  3. 1
      src/vrend_renderer.h

@ -131,6 +131,7 @@ int virgl_renderer_transfer_write_iov(uint32_t handle,
transfer_info.offset = offset;
transfer_info.iovec = iovec;
transfer_info.iovec_cnt = iovec_cnt;
transfer_info.context0 = true;
return vrend_renderer_transfer_iov(&transfer_info, VREND_TRANSFER_WRITE);
}
@ -153,6 +154,7 @@ int virgl_renderer_transfer_read_iov(uint32_t handle, uint32_t ctx_id,
transfer_info.offset = offset;
transfer_info.iovec = iovec;
transfer_info.iovec_cnt = iovec_cnt;
transfer_info.context0 = true;
return vrend_renderer_transfer_iov(&transfer_info, VREND_TRANSFER_READ);
}

@ -6654,6 +6654,10 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
separate_invert);
free(data);
}
if (!info->context0 && ctx->sub)
glBindFramebuffer(GL_FRAMEBUFFER, ctx->sub->fb_id);
return 0;
}
@ -6780,7 +6784,8 @@ int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info,
if (!check_iov_bounds(res, info, iov, num_iovs))
return EINVAL;
vrend_hw_switch_context(vrend_lookup_renderer_ctx(0), true);
if (info->context0)
vrend_hw_switch_context(vrend_lookup_renderer_ctx(0), true);
if (transfer_mode == VREND_TRANSFER_WRITE)
return vrend_renderer_transfer_write_iov(ctx, res, iov, num_iovs,
@ -8720,6 +8725,7 @@ void vrend_renderer_get_rect(int res_handle, struct iovec *iov, unsigned int num
transfer_info.handle = res->handle;
transfer_info.iovec = iov;
transfer_info.iovec_cnt = num_iovs;
transfer_info.context0 = true;
vrend_renderer_transfer_iov(&transfer_info, VREND_TRANSFER_READ);
}

@ -95,6 +95,7 @@ struct vrend_transfer_info {
unsigned int iovec_cnt;
struct iovec *iovec;
uint64_t offset;
bool context0;
struct pipe_box *box;
};

Loading…
Cancel
Save