Don't bail from drmmode_set_desired_modes immediately
PATCH 1/1 Don't bail from drmmode_set_desired_modes immediately
From: Michel Dänzer <[email protected]>
If we fail to find or set the mode for a CRTC, keep trying for the remaining CRTCs, and only return FALSE if we failed for all CRTCs that should be on.
--- src/drmmode_display.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-)
src/drmmode_display.c +21 -10
@@ -2523,6 +2523,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, {xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn);AMDGPUEntPtr pAMDGPUEnt =AMDGPUEntPriv (pScrn); +unsigned num_desired =0 , num_on =0 ;int c;for (c =0 ; c < config->num_crtc; c++) {
@@ -2557,6 +2558,8 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,if (!output)continue ; + num_desired++; +/* Mark that we'll need to re-set the mode for sure */ memset (&crtc->mode,0 ,sizeof (crtc->mode));if (!crtc->desiredMode.CrtcHDisplay) {
@@ -2564,8 +2567,11 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, pScrn-> currentMode); -if (!mode) -return FALSE; +if (!mode) { +xf86DrvMsg (pScrn->scrnIndex,X_ERROR , +"Failed to find mode for CRTC %d\n" , c); +continue ; + } crtc->desiredMode = *mode; crtc->desiredRotation = RR_Rotate_0; crtc->desiredX =0 ;
@@ -2573,21 +2579,26 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, }if (set_hw) { -if (!crtc->funcs->set_mode_major (crtc, &crtc->desiredMode, - crtc->desiredRotation, - crtc->desiredX, - crtc->desiredY)) -return FALSE; +if (crtc->funcs->set_mode_major (crtc, &crtc->desiredMode, + crtc->desiredRotation, + crtc->desiredX, + crtc->desiredY)) { + num_on++; + }else { +xf86DrvMsg (pScrn->scrnIndex,X_ERROR , +"Failed to set mode on CRTC %d\n" , c); + } }else { crtc->mode = crtc->desiredMode; crtc->rotation = crtc->desiredRotation; crtc->x = crtc->desiredX; crtc->y = crtc->desiredY; -if (!drmmode_handle_transform (crtc)) -return FALSE; +if (drmmode_handle_transform (crtc)) + num_on++; } } -return TRUE; + +return num_on >0 || num_desired ==0 ; }Bool drmmode_setup_colormap (ScreenPtr pScreen,ScrnInfoPtr pScrn)
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): 20180215173931.11298-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH v2 1/1 Don't bail from drmmode_set_desired_modes immediately
From: Michel Dänzer <[email protected]>
If we fail to find or set the mode for a CRTC, keep trying for the remaining CRTCs, and only return FALSE if we failed for all CRTCs that should be on.
---
v2:
Print warning messages for trouble with a particular CRTC, and an error message only when returning FALSE.
src/drmmode_display.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
src/drmmode_display.c +25 -9
@@ -2523,6 +2523,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, {xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn);AMDGPUEntPtr pAMDGPUEnt =AMDGPUEntPriv (pScrn); +unsigned num_desired =0 , num_on =0 ;int c;for (c =0 ; c < config->num_crtc; c++) {
@@ -2557,6 +2558,8 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,if (!output)continue ; + num_desired++; +/* Mark that we'll need to re-set the mode for sure */ memset (&crtc->mode,0 ,sizeof (crtc->mode));if (!crtc->desiredMode.CrtcHDisplay) {
@@ -2564,8 +2567,11 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, pScrn-> currentMode); -if (!mode) -return FALSE; +if (!mode) { +xf86DrvMsg (pScrn->scrnIndex,X_WARNING , +"Failed to find mode for CRTC %d\n" , c); +continue ; + } crtc->desiredMode = *mode; crtc->desiredRotation = RR_Rotate_0; crtc->desiredX =0 ;
@@ -2573,20 +2579,30 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, }if (set_hw) { -if (!crtc->funcs->set_mode_major (crtc, &crtc->desiredMode, - crtc->desiredRotation, - crtc->desiredX, - crtc->desiredY)) -return FALSE; +if (crtc->funcs->set_mode_major (crtc, &crtc->desiredMode, + crtc->desiredRotation, + crtc->desiredX, + crtc->desiredY)) { + num_on++; + }else { +xf86DrvMsg (pScrn->scrnIndex,X_WARNING , +"Failed to set mode on CRTC %d\n" , c); + } }else { crtc->mode = crtc->desiredMode; crtc->rotation = crtc->desiredRotation; crtc->x = crtc->desiredX; crtc->y = crtc->desiredY; -if (!drmmode_handle_transform (crtc)) -return FALSE; +if (drmmode_handle_transform (crtc)) + num_on++; } } + +if (num_on ==0 && num_desired >0 ) { +xf86DrvMsg (pScrn->scrnIndex,X_ERROR ,"Failed to enable any CRTC\n" ); +return FALSE; + } +return TRUE; }
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): 20180215174900.11747-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Alex Deucher
Reviewed-byQuoted 7 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
If we fail to find or set the mode for a CRTC, keep trying for the remaining CRTCs, and only return FALSE if we failed for all CRTCs that should be on.
Signed-off-by Michel Dänzer <[email protected]>
Quoted 85 lines
---
v2:
Print warning messages for trouble with a particular CRTC, and an error message only when returning FALSE.src/drmmode_display.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)src/drmmode_display.c +25
-10@@ -2523,6 +2523,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, {xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn);AMDGPUEntPtr pAMDGPUEnt =AMDGPUEntPriv (pScrn); +unsigned num_desired =0 , num_on =0 ;int c;for (c =0 ; c < config->num_crtc; c++) {@@ -2557,6 +2558,8 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,if (!output)continue ; + num_desired++; +/* Mark that we'll need to re-set the mode for sure */ memset (&crtc->mode,0 ,sizeof (crtc->mode));if (!crtc->desiredMode.CrtcHDisplay) {@@ -2564,8 +2567,11 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, pScrn-> currentMode); -if (!mode) -return FALSE; +if (!mode) { +xf86DrvMsg (pScrn->scrnIndex,X_WARNING , +"Failed to find mode for CRTC %d\n" , c); +continue ; + } crtc->desiredMode = *mode; crtc->desiredRotation = RR_Rotate_0; crtc->desiredX =0 ;@@ -2573,20 +2579,30 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, }if (set_hw) { -if (!crtc->funcs->set_mode_major (crtc, &crtc->desiredMode, - crtc->desiredRotation, - crtc->desiredX, - crtc->desiredY)) -return FALSE; +if (crtc->funcs->set_mode_major (crtc, &crtc->desiredMode, + crtc->desiredRotation, + crtc->desiredX, + crtc->desiredY)) { + num_on++; + }else { +xf86DrvMsg (pScrn->scrnIndex,X_WARNING , +"Failed to set mode on CRTC %d\n" , c); + } }else { crtc->mode = crtc->desiredMode; crtc->rotation = crtc->desiredRotation; crtc->x = crtc->desiredX; crtc->y = crtc->desiredY; -if (!drmmode_handle_transform (crtc)) -return FALSE; +if (drmmode_handle_transform (crtc)) + num_on++; } } + +if (num_on ==0 && num_desired >0 ) { +xf86DrvMsg (pScrn->scrnIndex,X_ERROR ,"Failed to enable any CRTC\n" ); +return FALSE; + } +return TRUE; } --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
Harry Wentland
Acked-byQuoted 7 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
If we fail to find or set the mode for a CRTC, keep trying for the remaining CRTCs, and only return FALSE if we failed for all CRTCs that should be on.
Signed-off-by Michel Dänzer <[email protected]>
Thanks. This should help when bandwidth checks in DC fail.
Harry
Quoted 73 lines
---
v2:
Print warning messages for trouble with a particular CRTC, and an error message only when returning FALSE.src/drmmode_display.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)src/drmmode_display.c +19
-9@@ -2523,6 +2523,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, {xf86CrtcConfigPtr config =XF86_CRTC_CONFIG_PTR (pScrn);AMDGPUEntPtr pAMDGPUEnt =AMDGPUEntPriv (pScrn); +unsigned num_desired =0 , num_on =0 ;int c;for (c =0 ; c < config->num_crtc; c++) {@@ -2557,6 +2558,8 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,if (!output)continue ; + num_desired++; +/* Mark that we'll need to re-set the mode for sure */ memset (&crtc->mode,0 ,sizeof (crtc->mode));if (!crtc->desiredMode.CrtcHDisplay) {@@ -2564,8 +2567,11 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, pScrn-> currentMode); -if (!mode) -return FALSE; +if (!mode) { +xf86DrvMsg (pScrn->scrnIndex,X_WARNING , +"Failed to find mode for CRTC %d\n" , c); +continue ; + } crtc->desiredMode = *mode; crtc->desiredRotation = RR_Rotate_0; crtc->desiredX =0 ;@@ -2573,20 +2579,30 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, }if (set_hw) { -if (!crtc->funcs->set_mode_major (crtc, &crtc->desiredMode, - crtc->desiredRotation, - crtc->desiredX, - crtc->desiredY)) -return FALSE; +if (crtc->funcs->set_mode_major (crtc, &crtc->desiredMode, + crtc->desiredRotation, + crtc->desiredX, + crtc->desiredY)) { + num_on++; + }else { +xf86DrvMsg (pScrn->scrnIndex,X_WARNING , +"Failed to set mode on CRTC %d\n" , c); + } }else { crtc->mode = crtc->desiredMode; crtc->rotation = crtc->desiredRotation; crtc->x = crtc->desiredX; crtc->y = crtc->desiredY; -if (!drmmode_handle_transform (crtc)) -return FALSE; +if (drmmode_handle_transform (crtc)) + num_on++; }
src/drmmode_display.c Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, · line 2608
Quoted 10 lines
src/drmmode_display.c +6
-0} + +if (num_on ==0 && num_desired >0 ) { +xf86DrvMsg (pScrn->scrnIndex,X_ERROR ,"Failed to enable any CRTC\n" ); +return FALSE; + } +return TRUE; }
_______________________________________________
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): 8c0dbe40-dfd0-9801-1077-2a76c3124dfd-5C7GfCeVMHo@public.gmane.org
Quoted 10 lines · Harry Wentland
Quoted 7 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
If we fail to find or set the mode for a CRTC, keep trying for the remaining CRTCs, and only return FALSE if we failed for all CRTCs that should be on.
Signed-off-by Michel Dänzer <[email protected]>Thanks. This should help when bandwidth checks in DC fail.
It might in some cases, though I'm afraid it won't make any difference in the case you're probably thinking of (not enough bandwidth for 3 4K monitors connected to an APU), in that case two monitors should light up either way. But if there was e.g. a fourth 1080 monitor connected, that might light up now, whereas it might not have before.
Quoted 1 line
Acked-by Harry Wentland <[email protected]>
Thanks!
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ 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): 117021cd-1a9d-d9e2-a9ad-8e685ca272c8-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 10 lines · Michel Dänzer
Quoted 9 lines · Harry Wentland
Quoted 7 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
If we fail to find or set the mode for a CRTC, keep trying for the remaining CRTCs, and only return FALSE if we failed for all CRTCs that should be on.
Signed-off-by Michel Dänzer <[email protected]>
Quoted 8 lines
Quoted 1 line
Thanks. This should help when bandwidth checks in DC fail.
It might in some cases, though I'm afraid it won't make any difference in the case you're probably thinking of (not enough bandwidth for 3 4K monitors connected to an APU), in that case two monitors should light up either way. But if there was e.g. a fourth 1080 monitor connected, that might light up now, whereas it might not have before.
Are you saying that if 3 @ 4k60 fail DDX or X will retry at lower refresh rate for one (or all CRTCs)?
Harry
Quoted 6 lines
Quoted 2 lines
Acked-by Harry Wentland <[email protected]>Thanks!
_______________________________________________
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): 94783b02-adff-eece-18bd-1f3e82af8959-5C7GfCeVMHo@public.gmane.org
Quoted 13 lines · Harry Wentland
Quoted 12 lines · Michel Dänzer
Quoted 10 lines · Harry Wentland
Quoted 7 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
If we fail to find or set the mode for a CRTC, keep trying for the remaining CRTCs, and only return FALSE if we failed for all CRTCs that should be on.
Signed-off-by Michel Dänzer <[email protected]>Thanks. This should help when bandwidth checks in DC fail.
Quoted 8 lines
Quoted 6 lines
It might in some cases, though I'm afraid it won't make any difference in the case you're probably thinking of (not enough bandwidth for 3 4K monitors connected to an APU), in that case two monitors should light up either way. But if there was e.g. a fourth 1080 monitor connected, that might light up now, whereas it might not have before.
Are you saying that if 3 @ 4k60 fail DDX or X will retry at lower refresh rate for one (or all CRTCs)?
That's not what I'm saying. Such a fallback would be more complicated, and might require changing Xorg code. I'm currently not planning to work on that.
drmmode_set_desired_modes simply tries setting the mode chosen by Xorg for each CRTC in turn. Before this change, if setting the mode failed for any CRTC, it would bail and wouldn't even try setting the mode for the remaining CRTCs. With this change, it will continue trying to set the modes for the remaining CRTCs.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ 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): ff8f1afd-639a-e8c6-7e54-4e0fd80085a0-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 27 lines · Michel Dänzer
Quoted 13 lines · Harry Wentland
Quoted 12 lines · Michel Dänzer
Quoted 10 lines · Harry Wentland
Quoted 7 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
If we fail to find or set the mode for a CRTC, keep trying for the remaining CRTCs, and only return FALSE if we failed for all CRTCs that should be on.
Signed-off-by Michel Dänzer <[email protected]>Thanks. This should help when bandwidth checks in DC fail.
Quoted 8 lines
Quoted 6 lines
It might in some cases, though I'm afraid it won't make any difference in the case you're probably thinking of (not enough bandwidth for 3 4K monitors connected to an APU), in that case two monitors should light up either way. But if there was e.g. a fourth 1080 monitor connected, that might light up now, whereas it might not have before.
Are you saying that if 3 @ 4k60 fail DDX or X will retry at lower refresh rate for one (or all CRTCs)?
That's not what I'm saying. Such a fallback would be more complicated, and might require changing Xorg code. I'm currently not planning to work on that.
Quoted 6 lines
drmmode_set_desired_modessimply tries setting the mode chosen by Xorg for each CRTC in turn. Before this change, if setting the mode failed for any CRTC, it would bail and wouldn't even try setting the mode for the remaining CRTCs. With this change, it will continue trying to set the modes for the remaining CRTCs.
Thanks, that makes sense.
Harry
Quoted 1 line
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx