From fb6d09764d8169662a4d24380c51f9edff1a9afd Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 8 May 2019 15:57:09 +0200 Subject: [PATCH] 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 Reviewed-by: Brian Paul Reviewed-by: Charmaine Lee --- src/gallium/winsys/svga/drm/vmw_context.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/svga/drm/vmw_context.c b/src/gallium/winsys/svga/drm/vmw_context.c index 938a3b4a5bc..addb58d165a 100644 --- a/src/gallium/winsys/svga/drm/vmw_context.c +++ b/src/gallium/winsys/svga/drm/vmw_context.c @@ -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); -- 2.30.2