winsys/svga: Fix RELOC_INTERNAL mob GPU access

SVGA_RELOC_INTERNAL indicates a transfer between surface and backing mob.
This means that if the GPU for example reads from the surface it writes
to the backing mob. But since the buffer mapping code allows for
simultaneous gpu- and cpu read access, a read from the surface to the mob
will not synchronize a subsequent map to the readback.

Fix this by inverting the mob access mode in a surface relocation with
SVGA_RELOC_INTERNAL set.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
This commit is contained in:
Thomas Hellstrom 2019-05-08 15:57:09 +02:00
parent eed24156ec
commit fb6d09764d

View file

@ -566,7 +566,15 @@ vmw_swc_surface_relocation(struct svga_winsys_context *swc,
mtx_lock(&vsurf->mutex);
assert(vsurf->buf != NULL);
/*
* An internal reloc means that the surface transfer direction
* is opposite to the MOB transfer direction...
*/
if ((flags & SVGA_RELOC_INTERNAL) &&
(flags & (SVGA_RELOC_READ | SVGA_RELOC_WRITE)) !=
(SVGA_RELOC_READ | SVGA_RELOC_WRITE))
flags ^= (SVGA_RELOC_READ | SVGA_RELOC_WRITE);
vmw_swc_mob_relocation(swc, mobid, NULL, (struct svga_winsys_buffer *)
vsurf->buf, 0, flags);
mtx_unlock(&vsurf->mutex);