virgl: Avoid unfinished transfer_get with PIPE_TRANSFER_DONTBLOCK
authorAlexandros Frantzis <alexandros.frantzis@collabora.com>
Thu, 23 May 2019 18:16:48 +0000 (21:16 +0300)
committerChia-I Wu <olvaffe@gmail.com>
Sat, 8 Jun 2019 04:45:22 +0000 (21:45 -0700)
commitf38cdaebac79788e353b1589f0c0b722f5bc5191
tree17ae8fd7d9e6127a6c486fba6037ec9ef5a4c365
parent8eb8222c102ee6cd38a01e7df952ea87e1ca4f42
virgl: Avoid unfinished transfer_get with PIPE_TRANSFER_DONTBLOCK

If we are not allowed to block, and we know that we will have to wait,
either because the resource is busy, or because it will become busy due
to a readback, return early to avoid performing an incomplete
transfer_get. Such an incomplete transfer_get may finish at any time,
during which another unsynchronized map could write to the resource
contents, leaving the contents in an undefined state.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Suggested-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/virgl/virgl_resource.c