[Mesa-dev] [PATCH 1/2] gallium/u_threaded: fix EXPLICIT_FLUSH for flush offsets > 0

Marek Olšák maraeo at gmail.com
Wed Feb 6 21:12:50 UTC 2019


From: Marek Olšák <marek.olsak at amd.com>

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

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);
 }
 
-- 
2.17.1



More information about the mesa-dev mailing list