diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index 3899064..5df7b66 100644 --- a/src/radeon_crtc.c +++ b/src/radeon_crtc.c @@ -52,6 +52,9 @@ #include "sarea.h" #endif +extern radeon_encoder_ptr +radeon_get_encoder(xf86OutputPtr output); + extern void atombios_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode, @@ -115,6 +118,28 @@ static Bool radeon_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode) { + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (crtc->scrn); + int i, j; + + if (radeon_crtc->crtc_id == 0) + return TRUE; + + for (i = 0; i < config->num_output; i++) { + if (crtc == config->output[i]->crtc) { + radeon_encoder_ptr radeon_encoder = radeon_get_encoder(config->output[i]); + for (j = 0; j < config->num_output; j++) { + if (crtc != config->output[j]->crtc) { + radeon_encoder_ptr other_radeon_encoder = radeon_get_encoder(config->output[j]); + if (radeon_encoder == other_radeon_encoder) { + ErrorF("encoder already driven by other crtc\n"); + return FALSE; + } + } + } + } + } + return TRUE; } diff --git a/src/radeon_output.c b/src/radeon_output.c index 9d9a16c..e5344eb 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -420,6 +420,26 @@ radeon_dpms(xf86OutputPtr output, int mode) if ((mode == DPMSModeOn) && radeon_output->enabled) return; + if (mode != DPMSModeOn) { + radeon_encoder_ptr radeon_encoder = radeon_get_encoder(output); + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (output->scrn); + int i; + + for (i = 0; i < config->num_output; i++) { + if (output != config->output[i]) { + radeon_encoder_ptr other_radeon_encoder = + radeon_get_encoder(config->output[i]); + if (radeon_encoder == other_radeon_encoder) { + xf86CrtcPtr crtc = output->crtc; + if (crtc == NULL) + return; + else if (!crtc->enabled) + return; + } + } + } + } + if (IS_AVIVO_VARIANT || info->r4xx_atom) { atombios_output_dpms(output, mode); } else {