vrend: fix copy transfers with gbm bo

We don't know what internal format the GL driver uses and we have to
glFinish and do a gbm transfer unless VREND_STORAGE_GL_IMMUTABLE is set.

This is motivated by Mesa's internal format change from GL_RGB to
GL_RGB8 for VIRGL_FORMAT_B8G8R8X8_UNORM in
5e4d69ec78.
That change caused glTexSubImage2D(..., GL_BGRA_EXT, GL_UNSIGNED_BYTE)
to be rejected by _mesa_gles_error_check_format_and_type.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 4 years ago
parent ad2e9c49da
commit 9040965354
  1. 18
      src/vrend_renderer.c

@ -8029,18 +8029,18 @@ int vrend_renderer_copy_transfer3d(struct vrend_context *ctx,
bool use_gbm = true;
/* The guest uses copy transfers against busy resources to avoid
* waiting. The host driver is usually smart enough to avoid blocking
* by putting the data in a staging buffer and doing a pipelined copy.
*
* However, we cannot do that with GBM. Use GBM only when we have to
* (until vrend_renderer_transfer_write_iov swizzles).
* waiting. The host GL driver is usually smart enough to avoid
* blocking by putting the data in a staging buffer and doing a
* pipelined copy. But when there is a GBM bo, we can only do that when
* VREND_STORAGE_GL_IMMUTABLE is set because it implies that the
* internal format is known and is known to be compatible with the
* subsequence glTexSubImage2D. Otherwise, we glFinish and use GBM.
*/
if (info->synchronized) {
if (tex_conv_table[dst_res->base.format].internalformat == 0 ||
tex_conv_table[dst_res->base.format].flags & VIRGL_TEXTURE_NEED_SWIZZLE)
glFinish();
else
if (has_bit(dst_res->storage_bits, VREND_STORAGE_GL_IMMUTABLE))
use_gbm = false;
else
glFinish();
}
if (use_gbm) {

Loading…
Cancel
Save