sna: Attempt to restore the current mode if pipe is disabled on DPMS on

If we attempt to power up the pipe through a DPMS request, but it was
previously disabled due to an error, first try re-enabling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-09-27 17:17:30 +01:00
parent 88cfd23379
commit dddb6e4e63
1 changed files with 25 additions and 9 deletions

View File

@ -787,6 +787,8 @@ sna_crtc_disable(xf86CrtcPtr crtc)
kgem_bo_destroy(&sna->kgem, sna_crtc->bo);
sna_crtc->bo = NULL;
}
sna_crtc->dpms_mode = DPMSModeOff;
}
static void update_flush_interval(struct sna *sna)
@ -824,15 +826,6 @@ static void update_flush_interval(struct sna *sna)
max_vrefresh, sna->vblank_interval));
}
static void
sna_crtc_dpms(xf86CrtcPtr crtc, int mode)
{
DBG(("%s(pipe %d, dpms mode -> %d):= active=%d\n",
__FUNCTION__, to_sna_crtc(crtc)->pipe, mode, mode == DPMSModeOn));
to_sna_crtc(crtc)->dpms_mode = mode;
update_flush_interval(to_sna(crtc->scrn));
}
void sna_mode_disable_unused(struct sna *sna)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(sna->scrn);
@ -1289,6 +1282,28 @@ retry: /* Attach per-crtc pixmap or direct */
return TRUE;
}
static void
sna_crtc_dpms(xf86CrtcPtr crtc, int mode)
{
struct sna_crtc *priv = to_sna_crtc(crtc);
DBG(("%s(pipe %d, dpms mode -> %d):= active=%d\n",
__FUNCTION__, priv->pipe, mode, mode == DPMSModeOn));
if (mode == DPMSModeOn) {
if (priv->bo == NULL &&
!sna_crtc_set_mode_major(crtc,
&crtc->mode, crtc->rotation,
crtc->x, crtc->y))
sna_crtc_disable(crtc);
} else
sna_crtc_disable(crtc);
if (priv->bo != NULL) {
priv->dpms_mode = mode;
update_flush_interval(to_sna(crtc->scrn));
}
}
void sna_mode_adjust_frame(struct sna *sna, int x, int y)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
@ -1497,6 +1512,7 @@ sna_crtc_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
return;
sna_crtc->id = mode->kmode->crtcs[num];
sna_crtc->dpms_mode = DPMSModeOff;
VG_CLEAR(get_pipe);
get_pipe.pipe = 0;