svga: Fix banded DMA upload unmap
authorThomas Hellstrom <thellstrom@vmware.com>
Thu, 3 Oct 2019 10:26:39 +0000 (12:26 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 24 Oct 2019 13:08:43 +0000 (15:08 +0200)
Even with banded DMA uploads, st->hwbuf is always non-NULL, but when we've
allocated a software buffer to hold the full upload, unmapping of the
hardware buffer has already been done before
svga_texture_transfer_unmap_dma(), and the code was performing an unmap of
an already mapped buffer.

Fix this by testing for software buffer not present.

Fixes: a9c4a861d5d ("svga: refactor svga_texture_transfer_map/unmap functions")
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/drivers/svga/svga_resource_texture.c

index b04542d711a8b59919f42f93d3effc7cd8c8e656..f1d16563efb05612e1d90f757ea9861e9c3ec3ab 100644 (file)
@@ -758,7 +758,7 @@ svga_texture_transfer_unmap_dma(struct svga_context *svga,
 {
    struct svga_winsys_screen *sws = svga_screen(svga->pipe.screen)->sws;
 
-   if (st->hwbuf)
+   if (!st->swbuf)
       sws->buffer_unmap(sws, st->hwbuf);
 
    if (st->base.usage & PIPE_TRANSFER_WRITE) {