From b930bb9d6da8c24dbe0949afb7bb2aa4bcb24687 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 3 May 2007 13:44:12 -0700 Subject: [PATCH] Disable vblank interrupts when no DRI clients are running. (cherry picked from commit 6621dd71ada839f4c1742e9e5b272e924cee21d9) --- src/i830.h | 1 + src/i830_dri.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/i830.h b/src/i830.h index 8034302b..7b0ab158 100644 --- a/src/i830.h +++ b/src/i830.h @@ -326,6 +326,7 @@ typedef struct _I830Rec { unsigned int third_tiled; unsigned int depth_tiled; + Bool want_vblank_interrupts; #ifdef DAMAGE DamagePtr pDamage; RegionRec driRegion; diff --git a/src/i830_dri.c b/src/i830_dri.c index 2203c9e5..9498661f 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -590,13 +590,13 @@ I830DRIScreenInit(ScreenPtr pScreen) } pDRIInfo->TransitionTo2d = I830DRITransitionTo2d; + pDRIInfo->TransitionTo3d = I830DRITransitionTo3d; #if DRIINFO_MAJOR_VERSION > 5 || \ (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1) if (!pDRIInfo->ClipNotify) #endif { - pDRIInfo->TransitionTo3d = I830DRITransitionTo3d; pDRIInfo->TransitionSingleToMulti3D = I830DRITransitionSingleToMulti3d; pDRIInfo->TransitionMultiToSingle3D = I830DRITransitionMultiToSingle3d; } @@ -1543,16 +1543,24 @@ I830DRITransitionTo3d(ScreenPtr pScreen) I830Ptr pI830 = I830PTR(pScrn); I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0); + + pI830->want_vblank_interrupts = TRUE; + I830DRISetVBlankInterrupt(pScrn, TRUE); } static void I830DRITransitionTo2d(ScreenPtr pScreen) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen); I830DRISetPfMask(pScreen, 0); sPriv->pf_enabled = 0; + + pI830->want_vblank_interrupts = FALSE; + I830DRISetVBlankInterrupt(pScrn, FALSE); } #if DRI_SUPPORTS_CLIP_NOTIFY @@ -1684,6 +1692,12 @@ I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); drmI830VBlankPipe pipe; + /* If we have no 3d running, then don't bother enabling the vblank + * interrupt. + */ + if (!pI830->want_vblank_interrupts) + on = FALSE; + if (pI830->directRenderingEnabled && pI830->drmMinor >= 5) { if (on) { if (xf86_config->num_crtc > 1 && xf86_config->crtc[1]->enabled)