[Mesa-stable] [PATCH 3/3 v2] st/nine: Fix second Multithreading issue with MANAGED buffers

Axel Davy axel.davy at ens.fr
Sat Feb 27 10:55:19 UTC 2016


Here is another threading issue with MANAGED buffers:

Thread 1: buffer creation
Thread 1: buffer lock
Thread 2: Draw call
Thread 1: writes data
Thread 1: Unlock

Without this patch, the buffer is initially dirty
and in the list of things to upload after its creation.
The draw call will then upload the data and unset the dirty flag,
and the Unlock won't trigger a second upload.

Fixes regression introduced by cc0114f30b587a10766ec212afb3ad356099ef23:
"st/nine: Implement Managed vertex/index buffers"

v2: fixed small compilation issue.

Cc: "11.2" <mesa-stable at lists.freedesktop.org>

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/buffer9.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c
index 6d5d9d6..1103741 100644
--- a/src/gallium/state_trackers/nine/buffer9.c
+++ b/src/gallium/state_trackers/nine/buffer9.c
@@ -182,6 +182,9 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
                 This->managed.dirty_box = box;
             } else {
                 u_box_union_2d(&This->managed.dirty_box, &This->managed.dirty_box, &box);
+                /* Do not upload while we are locking, we'll add it back later */
+                if (!LIST_IS_EMPTY(&This->managed.list))
+                    list_delinit(&This->managed.list);
             }
         }
         *ppbData = (char *)This->managed.data + OffsetToLock;
-- 
2.7.1



More information about the mesa-stable mailing list