Module: Mesa Branch: staging/19.3 Commit: 632f18ea171c466745b49c34351a6b5bea9e569b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=632f18ea171c466745b49c34351a6b5bea9e569b
Author: Thomas Hellstrom <[email protected]> Date: Wed Feb 5 07:54:19 2020 +0100 svga: Fix banded DMA upload A previous commit ("winsys/svga: Limit the maximum DMA hardware buffer size") made banded DMA transfer kick in when transfering gnome-shell window contents under gnome-shell / wayland. This uncovered a bug where we assumed that banded DMA transfers always occur to the top (y=0) of the surface. Fix this by taking the destination y offset into account. Cc: 19.2 19.3 20.0 <[email protected]> Fixes: 287c94ea498 ("Squashed commit of the following:") Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3733> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3733> (cherry picked from commit 451cf228d53ba8f51beb3dcf04370e126fb7ccb6) --- .pick_status.json | 2 +- src/gallium/drivers/svga/svga_resource_texture.c | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 19484bb9de3..8a5c6a2c99c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -256,7 +256,7 @@ "description": "svga: Fix banded DMA upload", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "287c94ea4987033f9c99a2f91c5750c9083504ca" }, diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index f1d16563efb..2ca13b7a73e 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -133,25 +133,26 @@ svga_transfer_dma(struct svga_context *svga, } } else { - int y, h, srcy; + int y, h, y_max; unsigned blockheight = util_format_get_blockheight(st->base.resource->format); h = st->hw_nblocksy * blockheight; - srcy = 0; + y_max = st->box.y + st->box.h; - for (y = 0; y < st->box.h; y += h) { + for (y = st->box.y; y < y_max; y += h) { unsigned offset, length; void *hw, *sw; - if (y + h > st->box.h) - h = st->box.h - y; + if (y + h > y_max) + h = y_max - y; /* Transfer band must be aligned to pixel block boundaries */ assert(y % blockheight == 0); assert(h % blockheight == 0); - offset = y * st->base.stride / blockheight; + /* First band starts at the top of the SW buffer. */ + offset = (y - st->box.y) * st->base.stride / blockheight; length = h * st->base.stride / blockheight; sw = (uint8_t *) st->swbuf + offset; @@ -159,9 +160,9 @@ svga_transfer_dma(struct svga_context *svga, if (transfer == SVGA3D_WRITE_HOST_VRAM) { unsigned usage = PIPE_TRANSFER_WRITE; - /* Wait for the previous DMAs to complete */ - /* TODO: keep one DMA (at half the size) in the background */ - if (y) { + /* Don't write to an in-flight DMA buffer. Synchronize or + * discard in-flight storage. */ + if (y != st->box.y) { svga_context_flush(svga, NULL); usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE; } @@ -177,7 +178,7 @@ svga_transfer_dma(struct svga_context *svga, svga_transfer_dma_band(svga, st, transfer, st->box.x, y, st->box.z, st->box.w, h, st->box.d, - 0, srcy, 0, flags); + 0, 0, 0, flags); /* * Prevent the texture contents to be discarded on the next band _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
