freedreno: add gmem_lock
[mesa.git] / src / gallium / drivers / freedreno / freedreno_context.h
index d10de1a850462190a7be26cff3574e615459a7a4..80f2462fdd97952baf1cc53e4356b153fc3b297e 100644 (file)
@@ -159,6 +159,16 @@ enum fd_dirty_shader_state {
 struct fd_context {
        struct pipe_context base;
 
+       /* We currently need to serialize emitting GMEM batches, because of
+        * VSC state access in the context.
+        *
+        * In practice this lock should not be contended, since pipe_context
+        * use should be single threaded.  But it is needed to protect the
+        * case, with batch reordering where a ctxB batch triggers flushing
+        * a ctxA batch
+        */
+       mtx_t gmem_lock;
+
        struct fd_device *dev;
        struct fd_screen *screen;
        struct fd_pipe *pipe;