diff options
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0/nvc0_context.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c index c711cb0..6bb94dc 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c @@ -38,7 +38,9 @@ nvc0_flush(struct pipe_context *pipe, if (fence) nouveau_fence_ref(screen->fence.current, (struct nouveau_fence **)fence); + pipe_mutex_lock(screen->push_mutex); PUSH_KICK(nvc0->base.pushbuf); /* fencing handled in kick_notify */ + pipe_mutex_unlock(screen->push_mutex); nouveau_context_update_frame_stats(&nvc0->base); } @@ -48,8 +50,10 @@ nvc0_texture_barrier(struct pipe_context *pipe) { struct nouveau_pushbuf *push = nvc0_context(pipe)->base.pushbuf; + pipe_mutex_lock(nvc0_context(pipe)->screen->base.push_mutex); IMMED_NVC0(push, NVC0_3D(SERIALIZE), 0); IMMED_NVC0(push, NVC0_3D(TEX_CACHE_CTL), 0); + pipe_mutex_unlock(nvc0_context(pipe)->screen->base.push_mutex); } static void @@ -59,6 +63,8 @@ nvc0_memory_barrier(struct pipe_context *pipe, unsigned flags) struct nouveau_pushbuf *push = nvc0->base.pushbuf; int i, s; + pipe_mutex_lock(nvc0_context(pipe)->screen->base.push_mutex); + if (flags & PIPE_BARRIER_MAPPED_BUFFER) { for (i = 0; i < nvc0->num_vtxbufs; ++i) { if (!nvc0->vtxbuf[i].buffer) @@ -108,6 +114,8 @@ nvc0_memory_barrier(struct pipe_context *pipe, unsigned flags) nvc0->cb_dirty = true; if (flags & (PIPE_BARRIER_VERTEX_BUFFER | PIPE_BARRIER_INDEX_BUFFER)) nvc0->base.vbo_dirty = true; + + pipe_mutex_unlock(nvc0_context(pipe)->screen->base.push_mutex); } static void @@ -124,6 +132,7 @@ nvc0_emit_string_marker(struct pipe_context *pipe, const char *str, int len) data_words = string_words; else data_words = string_words + !!(len & 3); + pipe_mutex_lock(nvc0_context(pipe)->screen->base.push_mutex); BEGIN_NIC0(push, SUBC_3D(NV04_GRAPH_NOP), data_words); if (string_words) PUSH_DATAp(push, str, string_words); @@ -132,6 +141,7 @@ nvc0_emit_string_marker(struct pipe_context *pipe, const char *str, int len) memcpy(&data, &str[string_words * 4], len & 3); PUSH_DATA (push, data); } + pipe_mutex_unlock(nvc0_context(pipe)->screen->base.push_mutex); } static void @@ -365,6 +375,8 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) return NULL; pipe = &nvc0->base.pipe; + pipe_mutex_lock(screen->base.push_mutex); + if (!nvc0_blitctx_create(nvc0)) goto out_err; @@ -468,9 +480,12 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) util_dynarray_init(&nvc0->global_residents); + pipe_mutex_unlock(screen->base.push_mutex); + return pipe; out_err: + pipe_mutex_unlock(screen->base.push_mutex); if (nvc0) { if (nvc0->bufctx_3d) nouveau_bufctx_del(&nvc0->bufctx_3d); |