summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c33
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c12
2 files changed, 41 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index b87b8dbdd02..6117f68bcf7 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;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 6abab8c9656..3f9f3a3567a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -247,7 +247,19 @@ nouveau_destroy_buffer(__DRIdrawable *drawable)
(struct gl_framebuffer **)&drawable->driverPrivate, NULL);
}
+static void
+nouveau_drawable_flush(__DRIdrawable *draw)
+{
+}
+
+static const struct __DRI2flushExtensionRec nouveau_flush_extension = {
+ { __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
+ nouveau_drawable_flush,
+ dri2InvalidateDrawable,
+};
+
static const __DRIextension *nouveau_screen_extensions[] = {
+ &nouveau_flush_extension.base,
NULL
};