[Intel-gfx] [PATCH] create known state at startup time
Zhenyu Wang
zhenyu.z.wang at intel.com
Mon Feb 16 04:22:09 CET 2009
On 2009.02.14 06:32:40 +0800, Jesse Barnes wrote:
> Per bug 19603 (and possibly others), we may need to shut everything down at
> server startup time in order to re-route planes & pipes when we set modes.
> However, since the pipe A force quirk went in, we haven't been properly
> disabling pipe A at startup. This patch pulls the CRTC enable/disable code
> out of the DPMS function, and calls it instead at startup time to really
> disable things.
>
> According to some tests, this patch may actually remove the need for the force
> quirk as well; but we'll need additional testing to confirm that.
>
...
> +/**
> + * Sets the power management mode of the pipe and plane.
> + *
> + * This code should probably grow support for turning the cursor off and back
> + * on appropriately at the same time as we're turning the pipe off/on.
> + */
> +static void
> +i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
> +{
> + ScrnInfoPtr pScrn = crtc->scrn;
> + I830Ptr pI830 = I830PTR(pScrn);
> + I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
> + int pipe = intel_crtc->pipe;
> + Bool disable_pipe = TRUE;
> +
> + /* XXX: When our outputs are all unaware of DPMS modes other than off and
> + * on, we should map those modes to DPMSModeOff in the CRTC.
> + */
> + switch (mode) {
> + case DPMSModeOn:
> + case DPMSModeStandby:
> + case DPMSModeSuspend:
> + i830_crtc_enable(crtc);
> + break;
> + case DPMSModeOff:
> + if ((pipe != 0) || !(pI830->quirk_flag & QUIRK_PIPEA_FORCE))
> + disable_pipe = FALSE;
Shouldn't this be, if (pipe == 0 && (pI830->quirk_flag & QUIRK_PIPEA_FORCE))?
> + i830_crtc_disable(crtc, disable_pipe);
> break;
> }
>
> diff --git a/src/i830_display.h b/src/i830_display.h
> index 8d767b1..0ba196d 100644
> --- a/src/i830_display.h
> +++ b/src/i830_display.h
> @@ -32,6 +32,8 @@ void i830PipeSetBase(xf86CrtcPtr crtc, int x, int y);
> void i830WaitForVblank(ScrnInfoPtr pScrn);
> void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn);
> void i830_set_new_crtc_bo(ScrnInfoPtr pScrn);
> +void i830_crtc_disable(xf86CrtcPtr crtc, Bool disable_pipe);
> +void i830_crtc_enable(xf86CrtcPtr crtc);
>
> xf86CrtcPtr i830GetLoadDetectPipe(xf86OutputPtr output, DisplayModePtr mode,
> int *dpms_mode);
> void i830ReleaseLoadDetectPipe(xf86OutputPtr output, int dpms_mode);
> diff --git a/src/i830_driver.c b/src/i830_driver.c
> index b8d8d37..aa5973b 100644
> --- a/src/i830_driver.c
> +++ b/src/i830_driver.c
> @@ -2375,7 +2375,7 @@ RestoreHWState(ScrnInfoPtr pScrn)
> /* Disable pipes */
> for (i = 0; i < xf86_config->num_crtc; i++) {
> xf86CrtcPtr crtc = xf86_config->crtc[i];
> - crtc->funcs->dpms(crtc, DPMSModeOff);
> + i830_crtc_disable(crtc, TRUE);
> }
> i830WaitForVblank(pScrn);
>
> @@ -3636,7 +3636,9 @@ static Bool
> I830EnterVT(int scrnIndex, int flags)
> {
> ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
> + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
> I830Ptr pI830 = I830PTR(pScrn);
> + int i;
>
> DPRINTF(PFX, "Enter VT\n");
>
> @@ -3650,6 +3652,23 @@ I830EnterVT(int scrnIndex, int flags)
> SaveHWState(pScrn);
> }
>
> + /* Get the hardware into a known state if needed */
> + if (!pI830->use_drm_mode) {
> + /* Disable outputs */
> + for (i = 0; i < xf86_config->num_output; i++) {
> + xf86OutputPtr output = xf86_config->output[i];
> + output->funcs->dpms(output, DPMSModeOff);
> + }
> + i830WaitForVblank(pScrn);
> +
> + /* Disable pipes */
> + for (i = 0; i < xf86_config->num_crtc; i++) {
> + xf86CrtcPtr crtc = xf86_config->crtc[i];
> + i830_crtc_disable(crtc, TRUE);
> + }
> + i830WaitForVblank(pScrn);
> + }
> +
> pI830->leaving = FALSE;
>
> #ifdef XF86DRI
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090216/5c969a21/attachment.sig>
More information about the Intel-gfx
mailing list