mesa/mesa-8.0-nouveau-vieux-finish.patch

76 lines
2.5 KiB
Diff
Raw Normal View History

From 4b4f636fadd997b82be7b0f4fe9acd1090d3ad20 Mon Sep 17 00:00:00 2001
From: Ben Skeggs <bskeggs@redhat.com>
Date: Fri, 11 May 2012 03:02:13 +1000
Subject: [PATCH] nouveau/vieux: finish != flush, how about we do that..
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
---
src/mesa/drivers/dri/nouveau/nouveau_context.c | 7 +++++++
src/mesa/drivers/dri/nouveau/nouveau_context.h | 2 ++
src/mesa/drivers/dri/nouveau/nouveau_driver.c | 10 ++++++++++
3 files changed, 19 insertions(+)
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 9051e18..db5d9ea 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -91,6 +91,12 @@ nouveau_context_create(gl_api api,
return GL_FALSE;
}
+ if (nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, 4096, &nctx->fence)) {
+ nouveau_context_destroy(dri_ctx);
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
+ return GL_FALSE;
+ }
+
*error = __DRI_CTX_ERROR_SUCCESS;
return GL_TRUE;
}
@@ -189,6 +195,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 7777246..9d06da9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -65,6 +65,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_bo_state bo;
struct nouveau_render_state render;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index 8532032..6031314 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -74,7 +74,17 @@ nouveau_flush(struct gl_context *ctx)
static void
nouveau_finish(struct gl_context *ctx)
{
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_channel *chan = context_chan(ctx);
+
nouveau_flush(ctx);
+
+ MARK_RING(chan, 1, 1);
+ OUT_RELOC(chan, nctx->fence, 0, NOUVEAU_BO_WR | NOUVEAU_BO_DUMMY, 0, 0);
+ FIRE_RING(chan);
+
+ nouveau_bo_map(nctx->fence, NOUVEAU_BO_RDWR);
+ nouveau_bo_unmap(nctx->fence);
}
void
--
1.7.10