Disable all unused CRTCs before setting desired modes
PATCH 1/1 Disable all unused CRTCs before setting desired modes
From: Michel Dänzer <[email protected]>
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)
--- src/drmmode_display.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
src/drmmode_display.c +21 -12
@@ -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];
Signature · 6 lines
2.16.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180222164258.12784-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Alex Deucher
Reviewed-byQuoted 8 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
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)Signed-off-by Michel Dänzer <[email protected]>
Quoted 57 lines
--- src/drmmode_display.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)src/drmmode_display.c +21
-13@@ -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]; --2.16.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx