diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2018-02-21 17:53:59 +0100 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2018-03-02 12:06:11 +0100 |
commit | ace1e3871c39a86becdf473a47fdc096e8ef39f5 (patch) | |
tree | f41ff7973b1b57c01183a93a83e535cca7cd3cd2 | |
parent | f2915eb7a4beb6140ebec183aeac02111fc6ba77 (diff) |
Disable all unused CRTCs before setting desired modes
This might avoid modeset failures in some cases where a CRTC which isn't
used by Xorg was enabled before.
(Ported from amdgpu commit e3aae7a24296f640c0153d1459f3e0820485468a)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 517ec8fb..d8bb9cc9 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -2720,24 +2720,33 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, unsigned num_desired = 0, num_on = 0; int c; + /* First, disable all unused CRTCs */ + if (set_hw) { + for (c = 0; c < config->num_crtc; c++) { + xf86CrtcPtr crtc = config->crtc[c]; + drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + + /* Skip disabled CRTCs */ + if (crtc->enabled) + continue; + + drmmode_do_crtc_dpms(crtc, DPMSModeOff); + drmModeSetCrtc(pRADEONEnt->fd, + drmmode_crtc->mode_crtc->crtc_id, + 0, 0, 0, NULL, 0, NULL); + drmmode_fb_reference(pRADEONEnt->fd, + &drmmode_crtc->fb, NULL); + } + } + + /* Then, try setting the chosen mode on each CRTC */ for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; - drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; xf86OutputPtr output = NULL; int o; - /* Skip disabled CRTCs */ - if (!crtc->enabled) { - if (set_hw) { - drmmode_do_crtc_dpms(crtc, DPMSModeOff); - drmModeSetCrtc(pRADEONEnt->fd, - drmmode_crtc->mode_crtc->crtc_id, - 0, 0, 0, NULL, 0, NULL); - drmmode_fb_reference(pRADEONEnt->fd, - &drmmode_crtc->fb, NULL); - } + if (!crtc->enabled) continue; - } if (config->output[config->compat_output]->crtc == crtc) output = config->output[config->compat_output]; |