vrend: force temp buffers for BGR* swizzles on small iovec transfers

On GLES hosts, BGR* resources are manually swizzled to RGB* internal
format on creation and swizzled back to BGR* format on readback.

For small transfers, iovec data is directly passed to the host driver
without staging in a temp buffer first. When swizzling for BGR*
resources, this modifies the persistend iovec buffer when it should
remain in the user-provided format. So we force temp buffers for all
iovec transfers on BGR* resources on GLES hosts to fix this.

Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Lepton Wu <lepton@chromium.org>
macos/master
Ryan Neph 3 years ago committed by Lepton Wu
parent 26fe73a275
commit 3b29b0723d
  1. 8
      src/vrend_renderer.c

@ -7560,6 +7560,10 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
need_temp = true;
}
if (vrend_state.use_gles && vrend_format_is_bgra(res->base.format) &&
!vrend_resource_is_emulated_bgra(res))
need_temp = true;
if (vrend_state.use_core_profile == true &&
(res->y_0_top || (res->base.format == VIRGL_FORMAT_Z24X8_UNORM))) {
need_temp = true;
@ -7938,6 +7942,10 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
if (num_iovs > 1 || separate_invert)
need_temp = 1;
if (vrend_state.use_gles && vrend_format_is_bgra(res->base.format) &&
!vrend_resource_is_emulated_bgra(res))
need_temp = true;
if (need_temp) {
send_size = util_format_get_nblocks(res->base.format, info->box->width, info->box->height) * info->box->depth * util_format_get_blocksize(res->base.format);
data = malloc(send_size);

Loading…
Cancel
Save