From fd12b8b5da827dfe36a50ee2f6cf674f238cc684 Mon Sep 17 00:00:00 2001 From: Owain Ainsworth Date: Wed, 4 Feb 2009 19:48:27 +0000 Subject: Merge in two commits of mine from upstream mesa which mean that on startup with and when we have only one pipe running we will always pick the correct vblank pipe to sync to. ok matthieu@. --- .../src/mesa/drivers/dri/intel/intel_buffers.c | 42 +++++++++++++++++----- .../src/mesa/drivers/dri/intel/intel_buffers.h | 3 ++ .../src/mesa/drivers/dri/intel/intel_context.c | 5 +++ 3 files changed, 42 insertions(+), 8 deletions(-) (limited to 'dist/Mesa/src/mesa') diff --git a/dist/Mesa/src/mesa/drivers/dri/intel/intel_buffers.c b/dist/Mesa/src/mesa/drivers/dri/intel/intel_buffers.c index 4ffd2ff6d..c8198667c 100644 --- a/dist/Mesa/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/dist/Mesa/src/mesa/drivers/dri/intel/intel_buffers.c @@ -216,16 +216,13 @@ intelUpdatePageFlipping(struct intel_context *intel, intel_draw_buffer(&intel->ctx, intel->ctx.DrawBuffer); } -/** - * This will be called whenever the currently bound window is moved/resized. - * XXX: actually, it seems to NOT be called when the window is only moved (BP). +/* + * Correct a drawablePrivate's set of vblank flags WRT the current context. + * When considering multiple crtcs. */ -void -intelWindowMoved(struct intel_context *intel) +GLuint +intelFixupVblank(struct intel_context *intel, __DRIdrawablePrivate *dPriv) { - GLcontext *ctx = &intel->ctx; - __DRIdrawablePrivate *dPriv = intel->driDrawable; - struct intel_framebuffer *intel_fb = dPriv->driverPrivate; if (!intel->ctx.DrawBuffer) { /* when would this happen? -BP */ @@ -275,6 +272,35 @@ intelWindowMoved(struct intel_context *intel) flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY; } + /* Do the stupid test: Is one of them actually disabled? + */ + if (sarea->planeA_w == 0 || sarea->planeA_h == 0) { + flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY; + } else if (sarea->planeB_w == 0 || sarea->planeB_h == 0) { + flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY; + } + + return flags; + } else { + return dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY; + } +} + +/** + * This will be called whenever the currently bound window is moved/resized. + * XXX: actually, it seems to NOT be called when the window is only moved (BP). + */ +void +intelWindowMoved(struct intel_context *intel) +{ + GLcontext *ctx = &intel->ctx; + __DRIdrawablePrivate *dPriv = intel->driDrawable; + struct intel_framebuffer *intel_fb = dPriv->driverPrivate; + + if (!intel->intelScreen->driScrnPriv->dri2.enabled && + intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) { + GLuint flags = intelFixupVblank(intel, dPriv); + /* Check to see if we changed pipes */ if (flags != dPriv->vblFlags && dPriv->vblFlags && !(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ)) { diff --git a/dist/Mesa/src/mesa/drivers/dri/intel/intel_buffers.h b/dist/Mesa/src/mesa/drivers/dri/intel/intel_buffers.h index a669a8543..6789a3c2f 100644 --- a/dist/Mesa/src/mesa/drivers/dri/intel/intel_buffers.h +++ b/dist/Mesa/src/mesa/drivers/dri/intel/intel_buffers.h @@ -47,6 +47,9 @@ extern void intel_wait_flips(struct intel_context *intel); extern void intelSwapBuffers(__DRIdrawablePrivate * dPriv); +extern GLuint intelFixupVblank(struct intel_context *intel, + __DRIdrawablePrivate *dPriv); + extern void intelWindowMoved(struct intel_context *intel); extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb); diff --git a/dist/Mesa/src/mesa/drivers/dri/intel/intel_context.c b/dist/Mesa/src/mesa/drivers/dri/intel/intel_context.c index 7c352c0da..e1ee7e7d3 100644 --- a/dist/Mesa/src/mesa/drivers/dri/intel/intel_context.c +++ b/dist/Mesa/src/mesa/drivers/dri/intel/intel_context.c @@ -732,6 +732,11 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, ? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ; + /* Prevent error printf if one crtc is disabled, this will + * be properly calculated in intelWindowMoved() next. + */ + driDrawPriv->vblFlags = intelFixupVblank(intel, driDrawPriv); + (*psp->systemTime->getUST) (&intel_fb->swap_ust); driDrawableInitVBlank(driDrawPriv); intel_fb->vbl_waited = driDrawPriv->vblSeq; -- cgit v1.2.3