From: Roland Scheidegger Date: Wed, 18 Jul 2007 13:18:43 +0000 (+0200) Subject: swapbuffers with non-current contexts, cleanups X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ccb713cdb8831617880ac71ac357361b586d05c6;p=mesa.git swapbuffers with non-current contexts, cleanups manywin got broken (when intelPageflip got no longer called). Make sure that intelFlush is getting called when a context gets unbound, to handle later swapbuffer calls on that context's drawable better. Related, fix non-current cliprects getting used on unbound drawables. --- diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c index 3ecd2e8e481..28441f4b835 100644 --- a/src/mesa/drivers/dri/i915tex/intel_blit.c +++ b/src/mesa/drivers/dri/i915tex/intel_blit.c @@ -78,6 +78,12 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv, * should work regardless. */ LOCK_HARDWARE(intel); + /* if this drawable isn't currently bound the LOCK_HARDWARE done on the + current context (which is what intelScreenContext should return) might + not get a contended lock and thus cliprects not updated (tests/manywin) */ + if ((struct intel_context *)dPriv->driContextPriv->driverPrivate != intel) + DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv); + if (dPriv && dPriv->numClipRects) { struct intel_framebuffer *intel_fb = dPriv->driverPrivate; diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c index bcd99106b9e..0ecf3aa1d4d 100644 --- a/src/mesa/drivers/dri/i915tex/intel_buffers.c +++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c @@ -356,7 +356,8 @@ intelClearWithTris(struct intel_context *intel, GLbitfield mask) /* XXX: Using INTEL_BATCH_NO_CLIPRECTS here is dangerous as the * drawing origin may not be correctly emitted. */ - intel_meta_draw_quad(intel, clear.x1, clear.x2, clear.y1, clear.y2, intel->ctx.Depth.Clear, clearColor, 0, 0, 0, 0); /* texcoords */ + intel_meta_draw_quad(intel, clear.x1, clear.x2, clear.y1, clear.y2, + intel->ctx.Depth.Clear, clearColor, 0, 0, 0, 0); /* texcoords */ mask &= ~(BUFFER_BIT_BACK_LEFT | BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH); @@ -991,16 +992,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) /** ** Release old regions, reference new regions **/ -#if 0 /* XXX FBO: this seems to be redundant with i915_state_draw_region() */ - if (intel->draw_region != colorRegion) { - intel_region_release(&intel->draw_region); - intel_region_reference(&intel->draw_region, colorRegion); - } - if (intel->intelScreen->depth_region != depthRegion) { - intel_region_release(&intel->intelScreen->depth_region); - intel_region_reference(&intel->intelScreen->depth_region, depthRegion); - } -#endif intel->vtbl.set_draw_region(intel, colorRegion, depthRegion); diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c index 527b33f4af7..5acfd923b99 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.c +++ b/src/mesa/drivers/dri/i915tex/intel_context.c @@ -569,6 +569,9 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) GLboolean intelUnbindContext(__DRIcontextPrivate * driContextPriv) { + struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate; + FLUSH_VERTICES((&intel->ctx), 0); + intelFlush(&intel->ctx); return GL_TRUE; } @@ -616,14 +619,16 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, (*dri_interface->getUST) (&intel_fb->swap_ust); driDrawableInitVBlank(driDrawPriv, intel_fb->vblank_flags, &intel_fb->vbl_seq); + } + } + + if ((intel->driDrawable != driDrawPriv) || + (intel->lastStamp != driDrawPriv->lastStamp)) { intel->driDrawable = driDrawPriv; intelWindowMoved(intel); intel->lastStamp = driDrawPriv->lastStamp; - } - else if (intel->lastStamp != driDrawPriv->lastStamp) { - intel_draw_buffer(&intel->ctx, &intel_fb->Base); - } } + } else { _mesa_make_current(NULL, NULL, NULL); diff --git a/src/mesa/drivers/dri/i915tex/intel_context.h b/src/mesa/drivers/dri/i915tex/intel_context.h index 5c8e2777996..628a15f8de5 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.h +++ b/src/mesa/drivers/dri/i915tex/intel_context.h @@ -247,8 +247,6 @@ struct intel_context drm_clip_rect_t *pClipRects; drm_clip_rect_t fboRect; /**< cliprect for rendering */ - int perf_boxes; - GLuint do_usleeps; int do_irqs; GLuint irqsEmitted;