summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Barnish <dave.barnish@arm.com>2013-10-03 09:54:57 +0100
committerDave Barnish <dave.barnish@arm.com>2014-06-26 17:08:43 +0100
commitf99604d33f315c0d192616f7c225778f01af7a1d (patch)
treee749a6d39cac08affcec4a8b8d5fd24e470665c6
parentc0b91e2d9579d97ec10eeb8e35bcfa8d0d6be2d5 (diff)
Implemented crtc dpms handling via drmmode_crtc_dpms()
Change-Id: I8fd0ab095aec0599368ecb3a26832fdc3b2568f9
-rw-r--r--src/drmmode_display.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index f725fd5..ca7a42e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -107,6 +107,7 @@ struct drmmode_output_priv {
static void drmmode_output_dpms(xf86OutputPtr output, int mode);
static Bool resize_scanout_bo(ScrnInfoPtr pScrn, int width, int height);
+static Bool drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int x, int y);
static struct drmmode_rec *
drmmode_from_scrn(ScrnInfoPtr pScrn)
@@ -179,9 +180,42 @@ drmmode_ConvertToKMode(ScrnInfoPtr pScrn, drmModeModeInfo *kmode,
}
static void
-drmmode_crtc_dpms(xf86CrtcPtr drmmode_crtc, int mode)
+drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
{
- /* TODO: MIDEGL-1431: Implement this function */
+ struct drmmode_crtc_private_rec *drmmode_crtc = crtc->driver_private;
+ struct drmmode_rec *drmmode = drmmode_crtc->drmmode;
+ ScrnInfoPtr pScrn = crtc->scrn;
+
+ DEBUG_MSG("Setting dpms mode %d on crtc %d", mode, drmmode_crtc->crtc_id);
+
+ switch (mode) {
+ case DPMSModeOn:
+ drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y);
+ break;
+
+ /* unimplemented modes fall through to the next lowest mode */
+ case DPMSModeStandby:
+ case DPMSModeSuspend:
+ case DPMSModeOff:
+ if (drmModeSetCrtc(drmmode->fd, drmmode_crtc->crtc_id, 0, 0, 0, 0, 0, NULL)) {
+ ERROR_MSG("drm failed to disable crtc %d", drmmode_crtc->crtc_id);
+ } else {
+ int i;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+ /* set dpms off for all outputs for this crtc */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc != crtc)
+ continue;
+ drmmode_output_dpms(output, mode);
+ }
+ }
+ break;
+ default:
+ ERROR_MSG("bad dpms mode %d for crtc %d", mode, drmmode_crtc->crtc_id);
+ return;
+ }
}
static int