[PATCH v2] Disable CRTCs when disabling the outputs
Piotr Redlewski
predlewski at gmail.com
Tue Jun 23 12:38:29 PDT 2015
When turning the outputs off (DPMSModeOff), CRTCs stayed enabled. This led
to higher gpu temperatures than with fglrx driver.
v2: when entering DPMS also disable active CRTCs
Signed-off-by: Piotr Redlewski <predlewski at gmail.com>
---
src/drmmode_display.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 3564853..1ef7c50 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -342,7 +342,45 @@ drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)
static void
drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
{
- /* Nothing to do. drmmode_do_crtc_dpms() is called as appropriate */
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ uint32_t *output_ids;
+ int output_count = 0;
+ drmModeModeInfo kmode;
+ int i;
+
+ /* Disable unused CRTCs */
+ if (!crtc->enabled || mode != DPMSModeOn) {
+ drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+ 0, 0, 0, NULL, 0, NULL);
+ return;
+ }
+
+ output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
+ if (!output_ids)
+ return;
+
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+ drmmode_output_private_ptr drmmode_output;
+
+ if (output->crtc != crtc)
+ continue;
+
+ drmmode_output = output->driver_private;
+ output_ids[output_count]
+ = drmmode_output->mode_output->connector_id;
+ output_count++;
+ }
+
+ drmmode_ConvertToKMode(crtc->scrn, &kmode, &crtc->mode);
+
+ drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+ drmmode->fb_id, crtc->x, crtc->y, output_ids,
+ output_count, &kmode);
+
+ free(output_ids);
}
static PixmapPtr
--
2.4.4
More information about the xorg-driver-ati
mailing list