summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/nouveau/nouveau_context.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-02-08 19:27:57 +0100
committerKristian Høgsberg <krh@bitplanet.net>2010-02-16 10:38:50 -0500
commit88a560691b904cc8eacda62d9bf80987d3c430c1 (patch)
treecc37a38491d41a41dbc7738d29f858f68029fb54 /src/mesa/drivers/dri/nouveau/nouveau_context.c
parent61d26bc82e7c4100acfb551cbb0ba9d84bbc4ba5 (diff)
dri/nouveau: Use event driven buffer validation.
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nouveau_context.c')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index b87b8dbdd0..6117f68bcf 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -140,6 +140,8 @@ nouveau_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
__DRIbuffer *buffers = NULL;
int i = 0, count, ret;
+ *stamp = *drawable->pStamp;
+
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
if (fb->Visual.doubleBufferMode)
attachments[i++] = __DRI_BUFFER_BACK_LEFT;
@@ -218,10 +220,11 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw,
struct nouveau_context *nctx = dri_ctx->driverPrivate;
GLcontext *ctx = &nctx->base;
- if (nctx->screen->context != nctx) {
- nctx->screen->context = nctx;
- BITSET_ONES(nctx->dirty);
- }
+ if (nctx->screen->context == nctx)
+ return GL_TRUE;
+
+ nctx->screen->context = nctx;
+ BITSET_ONES(nctx->dirty);
/* Ask the X server for new renderbuffers. */
nouveau_update_renderbuffers(dri_ctx, dri_draw,
@@ -267,6 +270,28 @@ void
nouveau_validate_framebuffer(GLcontext *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
+ __DRIcontext *dri_ctx = to_nouveau_context(ctx)->dri_context;
+ __DRIdrawable *dri_draw = dri_ctx->driDrawablePriv;
+ __DRIdrawable *dri_read = dri_ctx->driReadablePriv;
+
+ if ((ctx->DrawBuffer->Name == 0 &&
+ nctx->drawable.d_stamp != *dri_draw->pStamp) ||
+ (dri_draw != dri_read &&
+ ctx->ReadBuffer->Name == 0 &&
+ nctx->drawable.r_stamp != *dri_read->pStamp)) {
+ if (nctx->drawable.dirty)
+ ctx->Driver.Flush(ctx);
+
+ /* Ask the X server for new renderbuffers. */
+ nouveau_update_renderbuffers(dri_ctx, dri_draw,
+ &nctx->drawable.d_stamp);
+ if (dri_draw != dri_read)
+ nouveau_update_renderbuffers(dri_ctx, dri_read,
+ &nctx->drawable.r_stamp);
+
+ if (nouveau_next_dirty_state(ctx) >= 0)
+ FIRE_RING(context_chan(ctx));
+ }
/* Someone's planning to draw something really soon. */
nctx->drawable.dirty = GL_TRUE;