nouveau/vieux: finish != flush, how about we do that..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs
2012-05-11 03:02:13 +10:00
parent 9d6b46b1cd
commit 6660041483
3 changed files with 23 additions and 0 deletions
@@ -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);
}
@@ -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;
@@ -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