diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_driver.c | 13 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 2625b76d14f..d7d5a04e692 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -83,6 +83,13 @@ nouveau_context_create(gl_api api, return GL_FALSE; } + if (nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, 4096, + NULL, &nctx->fence)) { + nouveau_context_destroy(dri_ctx); + *error = __DRI_CTX_ERROR_NO_MEMORY; + return GL_FALSE; + } + *error = __DRI_CTX_ERROR_SUCCESS; return GL_TRUE; } @@ -209,6 +216,7 @@ nouveau_context_destroy(__DRIcontext *dri_ctx) struct nouveau_context *nctx = dri_ctx->driverPrivate; struct gl_context *ctx = &nctx->base; + nouveau_bo_ref(NULL, &nctx->fence); context_drv(ctx)->context_destroy(ctx); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 8bba51e8091..2bcc1e12782 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -72,6 +72,8 @@ struct nouveau_context { BITSET_DECLARE(dirty, MAX_NOUVEAU_STATE); enum nouveau_fallback fallback; + struct nouveau_bo *fence; + struct nouveau_hw_state hw; struct nouveau_render_state render; struct nouveau_scratch_state scratch; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 69e5cac426a..e824d1072af 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -76,7 +76,20 @@ nouveau_flush(struct gl_context *ctx) static void nouveau_finish(struct gl_context *ctx) { + struct nouveau_context *nctx = to_nouveau_context(ctx); + struct nouveau_pushbuf *push = context_push(ctx); + struct nouveau_pushbuf_refn refn = + { nctx->fence, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR }; + nouveau_flush(ctx); + + if (!nouveau_pushbuf_space(push, 16, 0, 0) && + !nouveau_pushbuf_refn(push, &refn, 1)) { + PUSH_DATA(push, 0); + PUSH_KICK(push); + } + + nouveau_bo_wait(nctx->fence, NOUVEAU_BO_RDWR, context_client(ctx)); } void |