[1/2] gallium/u_threaded: fix EXPLICIT_FLUSH for flush offsets > 0

Submitted by Marek Olšák on Feb. 6, 2019, 9:12 p.m.

Details

Message ID 20190206211251.4111-1-maraeo@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Marek Olšák Feb. 6, 2019, 9:12 p.m.
From: Marek Olšák <marek.olsak@amd.com>

Cc: 18.3 19.0 <mesa-stable@lists.freedesktop.org>
---
 src/gallium/auxiliary/util/u_threaded_context.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 8e3bceae18d..b596c322918 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -1517,21 +1517,22 @@  tc_resource_copy_region(struct pipe_context *_pipe,
 static void
 tc_buffer_do_flush_region(struct threaded_context *tc,
                           struct threaded_transfer *ttrans,
                           const struct pipe_box *box)
 {
    struct threaded_resource *tres = threaded_resource(ttrans->b.resource);
 
    if (ttrans->staging) {
       struct pipe_box src_box;
 
-      u_box_1d(ttrans->offset + box->x % tc->map_buffer_alignment,
+      u_box_1d(ttrans->offset + ttrans->b.box.x % tc->map_buffer_alignment +
+               (box->x - ttrans->b.box.x),
                box->width, &src_box);
 
       /* Copy the staging buffer into the original one. */
       tc_resource_copy_region(&tc->base, ttrans->b.resource, 0, box->x, 0, 0,
                               ttrans->staging, 0, &src_box);
    }
 
    util_range_add(tres->base_valid_buffer_range, box->x, box->x + box->width);
 }