diff options
author | Jesse Barnes <jesse.barnes@intel.com> | 2008-01-30 18:59:12 +0800 |
---|---|---|
committer | Zhenyu Wang <zhenyu.z.wang@intel.com> | 2008-01-30 18:59:12 +0800 |
commit | 2e43bec8731ba1b172f7a0bf867bbb5c1adbda2d (patch) | |
tree | 01116531e6eb61bfd2ed3a7453c0613d6d4e47d7 /src/i830_display.c | |
parent | bf629466a46c4037ec7b7cc5ee16be947618bd68 (diff) |
Frame buffer compression support on new chipset
Diffstat (limited to 'src/i830_display.c')
-rw-r--r-- | src/i830_display.c | 89 |
1 files changed, 87 insertions, 2 deletions
diff --git a/src/i830_display.c b/src/i830_display.c index f61d3c40..39f36376 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -571,9 +571,11 @@ i830_use_fb_compression(xf86CrtcPtr crtc) * - SR display watermarks must be equal between 16bpp and 32bpp? * * FIXME: verify above conditions are true + * + * Enable 8xx style FB compression */ static void -i830_enable_fb_compression(xf86CrtcPtr crtc) +i830_enable_fb_compression_8xx(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -629,8 +631,11 @@ i830_enable_fb_compression(xf86CrtcPtr crtc) 'b' : 'a'); } +/* + * Disable 8xx style FB compression + */ static void -i830_disable_fb_compression(xf86CrtcPtr crtc) +i830_disable_fb_compression_8xx(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -648,6 +653,86 @@ i830_disable_fb_compression(xf86CrtcPtr crtc) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc disabled on plane %c\n", plane); } +static void +i830_disable_fb_compression2(xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + I830Ptr pI830 = I830PTR(pScrn); + uint32_t dpfc_ctl; + char plane = (INREG(DPFC_CONTROL) & DPFC_CTL_PLANEB) ? 'b' : 'a'; + + /* Disable compression */ + dpfc_ctl = INREG(DPFC_CONTROL); + dpfc_ctl &= ~DPFC_CTL_EN; + OUTREG(DPFC_CONTROL, dpfc_ctl); + i830WaitForVblank(pScrn); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc2 disabled on plane %c\n", plane); +} + +static void +i830_enable_fb_compression2(xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + I830Ptr pI830 = I830PTR(pScrn); + I830CrtcPrivatePtr intel_crtc = crtc->driver_private; + int plane = (intel_crtc->plane == 0 ? DPFC_CTL_PLANEA : DPFC_CTL_PLANEB); + unsigned long stall_watermark = 200, frames = 50; + + if (INREG(DPFC_CONTROL) & DPFC_CTL_EN) { + char cur_plane = (INREG(DPFC_CONTROL) & DPFC_CTL_PLANEB) ? 'b' : 'a'; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "fbc2 already enabled on " + "plane %c, not enabling on plane %c\n", cur_plane, + plane ? 'b' : 'a'); + return; + } + + /* Set it up... */ + i830_disable_fb_compression2(crtc); + OUTREG(DPFC_CB_BASE, pI830->compressed_front_buffer->offset); + /* Update i830_memory.c too if compression ratio changes */ + OUTREG(DPFC_CONTROL, plane | DPFC_CTL_FENCE_EN | DPFC_CTL_LIMIT_4X | + pI830->front_buffer->fence_nr); + OUTREG(DPFC_RECOMP_CTL, DPFC_RECOMP_STALL_EN | + (stall_watermark << DPFC_RECOMP_STALL_WM_SHIFT) | + (frames << DPFC_RECOMP_TIMER_COUNT_SHIFT)); + OUTREG(DPFC_FENCE_YOFF, crtc->y); + + /* Zero buffers */ + memset(pI830->FbBase + pI830->compressed_front_buffer->offset, 0, + pI830->compressed_front_buffer->size); + + /* enable it... */ + OUTREG(DPFC_CONTROL, INREG(DPFC_CONTROL) | DPFC_CTL_EN); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc2 enabled on plane %c\n", plane ? + 'b' : 'a'); +} + +static void +i830_enable_fb_compression(xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + I830Ptr pI830 = I830PTR(pScrn); + + if (IS_IGD_GM(pI830)) + return i830_enable_fb_compression2(crtc); + + i830_enable_fb_compression_8xx(crtc); +} + +static void +i830_disable_fb_compression(xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + I830Ptr pI830 = I830PTR(pScrn); + + if (IS_IGD_GM(pI830)) + return i830_disable_fb_compression2(crtc); + + i830_disable_fb_compression_8xx(crtc); +} + /** * Sets the power management mode of the pipe and plane. * |