diff --git a/src/i830.h b/src/i830.h index ca48b52..1cfcb9a 100644 --- a/src/i830.h +++ b/src/i830.h @@ -225,6 +225,7 @@ extern const char *i830_output_type_names[]; typedef struct _I830CrtcPrivateRec { int pipe; + int plane; Bool enabled; diff --git a/src/i830_display.c b/src/i830_display.c index 706b9ba..b98135d 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -372,10 +372,11 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y) I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; int pipe = intel_crtc->pipe; + int plane = intel_crtc->plane; unsigned long Start, Offset; - int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE); - int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF); - int dsptileoff = (pipe == 0 ? DSPATILEOFF : DSPBTILEOFF); + int dspbase = (plane == 0 ? DSPABASE : DSPBBASE); + int dspsurf = (plane == 0 ? DSPASURF : DSPBSURF); + int dsptileoff = (plane == 0 ? DSPATILEOFF : DSPBTILEOFF); Offset = ((y * pScrn->displayWidth + x) * pI830->cpp); if (pI830->front_buffer == NULL) { @@ -413,6 +414,7 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y) if (!sPriv) return; + /* XXX: Should this be "plane" instead? */ switch (pipe) { case 0: sPriv->pipeA_x = x; @@ -523,8 +525,7 @@ i830_use_fb_compression(xf86CrtcPtr crtc) ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - int pipe = intel_crtc->pipe; - int plane = (pipe == 0 ? FBC_CTL_PLANEA : FBC_CTL_PLANEB); + int plane = (intel_crtc->plane == 0 ? FBC_CTL_PLANEA : FBC_CTL_PLANEB); if (!pI830->fb_compression) return FALSE; @@ -569,17 +570,15 @@ i830_enable_fb_compression(xf86CrtcPtr crtc) I830CrtcPrivatePtr intel_crtc = crtc->driver_private; uint32_t fbc_ctl = 0; unsigned long compressed_stride; - int pipe = intel_crtc->pipe; - /* FIXME: plane & pipe might not always be equal */ - int plane = (pipe == 0 ? FBC_CTL_PLANEA : FBC_CTL_PLANEB); + int plane = (intel_crtc->plane == 0 ? FBC_CTL_PLANEA : FBC_CTL_PLANEB); unsigned long uncompressed_stride = pScrn->displayWidth * pI830->cpp; unsigned long interval = 1000; if (INREG(FBC_CONTROL) & FBC_CTL_EN) { - char cur_pipe = (INREG(FBC_CONTROL2) & 1) ? 'b' : 'a'; + char cur_plane = (INREG(FBC_CONTROL2) & 1) ? 'b' : 'a'; xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "fbc already enabled on " - "pipe %c, not enabling on pipe %c\n", cur_pipe, pipe ? 'b' : - 'a'); + "plane %c, not enabling on plane %c\n", cur_plane, + plane ? 'b' : 'a'); return; } @@ -615,7 +614,7 @@ i830_enable_fb_compression(xf86CrtcPtr crtc) fbc_ctl |= FBC_CTL_UNCOMPRESSIBLE; OUTREG(FBC_CONTROL, fbc_ctl); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc enabled on plane %c\n", pipe ? + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc enabled on plane %c\n", plane ? 'b' : 'a'); } @@ -625,7 +624,7 @@ i830_disable_fb_compression(xf86CrtcPtr crtc) ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); uint32_t fbc_ctl; - char pipe = (INREG(FBC_CONTROL2) & 1) ? 'b' : 'a'; + char plane = (INREG(FBC_CONTROL2) & 1) ? 'b' : 'a'; /* Disable compression */ fbc_ctl = INREG(FBC_CONTROL); @@ -635,7 +634,7 @@ i830_disable_fb_compression(xf86CrtcPtr crtc) /* Wait for compressing bit to clear */ while (INREG(FBC_STATUS) & FBC_STAT_COMPRESSING) ; /* nothing */ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc disabled on pipe %c\n", pipe); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc disabled on pipe %c\n", plane); } /** @@ -651,10 +650,11 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode) I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; int pipe = intel_crtc->pipe; + int plane = intel_crtc->plane; int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; - int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; - int dspbase_reg = (pipe == 0) ? DSPABASE : DSPBBASE; int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; + int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; + int dspbase_reg = (plane == 0) ? DSPABASE : DSPBBASE; CARD32 temp; /* XXX: When our outputs are all unaware of DPMS modes other than off and @@ -951,10 +951,10 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; int pipe = intel_crtc->pipe; + int plane = intel_crtc->plane; int fp_reg = (pipe == 0) ? FPA0 : FPB0; int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; - int dpll_md_reg = (intel_crtc->pipe == 0) ? DPLL_A_MD : DPLL_B_MD; - int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; + int dpll_md_reg = (pipe == 0) ? DPLL_A_MD : DPLL_B_MD; int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; int htot_reg = (pipe == 0) ? HTOTAL_A : HTOTAL_B; int hblank_reg = (pipe == 0) ? HBLANK_A : HBLANK_B; @@ -962,10 +962,11 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, int vtot_reg = (pipe == 0) ? VTOTAL_A : VTOTAL_B; int vblank_reg = (pipe == 0) ? VBLANK_A : VBLANK_B; int vsync_reg = (pipe == 0) ? VSYNC_A : VSYNC_B; - int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE; - int dspstride_reg = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE; - int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS; int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC; + int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; + int dspstride_reg = (plane == 0) ? DSPASTRIDE : DSPBSTRIDE; + int dsppos_reg = (plane == 0) ? DSPAPOS : DSPBPOS; + int dspsize_reg = (plane == 0) ? DSPASIZE : DSPBSIZE; int i; int refclk; intel_clock_t clock; @@ -973,6 +974,8 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, Bool ok, is_sdvo = FALSE, is_dvo = FALSE; Bool is_crt = FALSE, is_lvds = FALSE, is_tv = FALSE; + if (!crtc->enabled) + return; /* Set up some convenient bools for what outputs are connected to * our pipe, used in DPLL setup. */ @@ -1415,8 +1418,11 @@ i830DescribeOutputConfiguration(ScrnInfoPtr pScrn) for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; - CARD32 dspcntr = INREG(DSPACNTR + (DSPBCNTR - DSPACNTR) * i); - CARD32 pipeconf = INREG(PIPEACONF + (PIPEBCONF - PIPEACONF) * i); + I830CrtcPrivatePtr intel_crtc = crtc ? crtc->driver_private : NULL; + CARD32 dspcntr = intel_crtc->plane == 0 ? INREG(DSPACNTR) : + INREG(DSPBCNTR); + CARD32 pipeconf = i == 0 ? INREG(PIPEACONF) : + INREG(PIPEBCONF); Bool hw_plane_enable = (dspcntr & DISPLAY_PLANE_ENABLE) != 0; Bool hw_pipe_enable = (pipeconf & PIPEACONF_ENABLE) != 0; @@ -1425,8 +1431,8 @@ i830DescribeOutputConfiguration(ScrnInfoPtr pScrn) 'A' + i, crtc->enabled ? "on" : "off"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, " Display plane %c is now %s and connected to pipe %c.\n", - 'A' + i, - crtc->enabled ? "enabled" : "disabled", + 'A' + intel_crtc->plane, + hw_plane_enable ? "enabled" : "disabled", dspcntr & DISPPLANE_SEL_PIPE_MASK ? 'B' : 'A'); if (hw_pipe_enable != crtc->enabled) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -1729,6 +1735,7 @@ i830_crtc_init(ScrnInfoPtr pScrn, int pipe) intel_crtc = xnfcalloc (sizeof (I830CrtcPrivateRec), 1); intel_crtc->pipe = pipe; + intel_crtc->plane = 0; intel_crtc->dpms_mode = DPMSModeOff; /* Initialize the LUTs for when we turn on the CRTC. */ diff --git a/src/i830_tv.c b/src/i830_tv.c index e3aeaf9..a77bf98 100644 --- a/src/i830_tv.c +++ b/src/i830_tv.c @@ -878,11 +878,11 @@ i830_tv_restore(xf86OutputPtr output) OUTREG(TV_CLR_LEVEL, dev_priv->save_TV_CLR_LEVEL); { - int pipeconf_reg = (intel_crtc->pipe == 0)?PIPEACONF:PIPEBCONF; - int dspcntr_reg = (intel_crtc->pipe == 0)?DSPACNTR : DSPBCNTR; + int pipeconf_reg = (intel_crtc->pipe == 0) ? PIPEACONF : PIPEBCONF; + int dspcntr_reg = (intel_crtc->plane == 0) ? DSPACNTR : DSPBCNTR; int pipeconf = INREG(pipeconf_reg); int dspcntr = INREG(dspcntr_reg); - int dspbase_reg = (intel_crtc->pipe == 0) ? DSPABASE : DSPBBASE; + int dspbase_reg = (intel_crtc->plane == 0) ? DSPABASE : DSPBBASE; /* Pipe must be off here */ OUTREG(dspcntr_reg, dspcntr & ~DISPLAY_PLANE_ENABLE); /* Flush the plane changes */ @@ -1182,11 +1182,11 @@ i830_tv_mode_set(xf86OutputPtr output, DisplayModePtr mode, OUTREG(TV_CLR_LEVEL, ((video_levels->black << TV_BLACK_LEVEL_SHIFT) | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); { - int pipeconf_reg = (intel_crtc->pipe == 0)?PIPEACONF:PIPEBCONF; - int dspcntr_reg = (intel_crtc->pipe == 0)?DSPACNTR : DSPBCNTR; + int pipeconf_reg = (intel_crtc->pipe == 0) ? PIPEACONF : PIPEBCONF; + int dspcntr_reg = (intel_crtc->plane == 0) ? DSPACNTR : DSPBCNTR; int pipeconf = INREG(pipeconf_reg); int dspcntr = INREG(dspcntr_reg); - int dspbase_reg = (intel_crtc->pipe == 0) ? DSPABASE : DSPBBASE; + int dspbase_reg = (intel_crtc->plane == 0) ? DSPABASE : DSPBBASE; int xpos = 0x0, ypos = 0x0; unsigned int xsize, ysize; /* Pipe must be off here */