drm/ast: Don't check new mode if CRTC is being disabled
Subsystems (3)
Thomas Zimmermann
maintainerPATCH 1/1 drm/ast: Don't check new mode if CRTC is being disabled
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_mode.c +3 -0
@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ; } +if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ + ast_state =to_ast_crtc_state (state); format = ast_state->format;
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Thomas.
Quoted 4 lines · Thomas Zimmermann
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
Signed-off-by Thomas Zimmermann <[email protected]>
Don't you miss:
Reported-by:
Tested-by:
Fixes:
???
Sam
Quoted 20 lines
--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/ast/ast_mode.c +3
-0@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ; } +if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ + ast_state =to_ast_crtc_state (state); format = ast_state->format;Signature · 1 line
2.26.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi
Am 30.04.20 um 11:22 schrieb Sam Ravnborg:
Quoted 6 lines
Hi Thomas.
Quoted 3 lines · Thomas Zimmermann
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
Quoted 6 lines
Quoted 1 line
Signed-off-by Thomas Zimmermann <[email protected]>Don't you miss:
Reported-by:
Tested-by:
Waiting for the reporter's ok.
Quoted 1 line
Fixes:
Indeed. :(
Best regards
Thomas
Quoted 29 lines
???
Sam
Quoted 20 lines
--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/ast/ast_mode.c +3
-0@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ; } +if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ + ast_state =to_ast_crtc_state (state); format = ast_state->format;Signature · 1 line
2.26.0_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Thomas,
Couple of fly-by ideas/suggestions.
Quoted 14 lines · Thomas Zimmermann
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/ast/ast_mode.c +0
-0
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 801
Quoted 1 line
drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ;
Unrelated:
This feels quite dirty. If AST1180 does not support atomic modeset simply remove the DRIVER_ATOMIC bit.
You can do that at runtime, via drm_device::driver_features in say, ast_detect_chip()?
The drm_driver::driver_features is immutable, or it ought to be.
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 806
Quoted 5 lines
drivers/gpu/drm/ast/ast_mode.c +3
-0} +if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ +
I cannot think of a reason why a driver would need to perform crtc_atomic_check, if the crtc is being disabled.
Can you spot any? If not, this should be better served in core, which calls this callback.
Correct?
HTH
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi Emil
Am 01.05.20 um 15:20 schrieb Emil Velikov:
Quoted 14 lines
Hi Thomas,
Couple of fly-by ideas/suggestions.
Quoted 9 lines · Thomas Zimmermann
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 11 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 801
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ;Unrelated:
This feels quite dirty. If AST1180 does not support atomic modeset simply remove theDRIVER_ATOMICbit.
You can do that at runtime, viadrm_device::driver_featuresin say,ast_detect_chip()?
The line you commented on dates back to non-atomic modesetting, but I don't know what the story behind AST1180 is. It is explicitly disabled in the list of PCI IDs, but the driver has plenty of code for it. It looks as if the chip can only do pageflipping with a pre-set video mode.
As it is right now, the AST1180 code could probably be deleted entirely.
Quoted 5 lines
The
drm_driver::driver_featuresis immutable, or it ought to be.Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0}
Quoted 8 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 806
Quoted 3 lines
drivers/gpu/drm/ast/ast_mode.c +3
-0+if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ +I cannot think of a reason why a driver would need to perform
crtc_atomic_check, if the crtc is being disabled.
Can you spot any? If not, this should be better served in core, which calls this callback.
Correct?
Ast is a bit of a special case, because it tests the incoming mode against a list of re-defined modes. With the crtc being disabled, the incoming mode is 0 in all fields. Obviously that's not a valid mode, and we need that additional test here.
In the general case, I'd see 'crtc check' as part of the larger atomic infrastructure. I can imagine that configurations require the CRTC to be enabled before other HW blocks work. So a driver might have a reason to run crtc's check even for disabled crtcs (at least to verify that the crtc is not disabled). I don't think this can be handled in the core easily.
Best regards
Thomas
Quoted 8 lines
HTH
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 54 lines · Thomas Zimmermann
Hi Emil
Am 01.05.20 um 15:20 schrieb Emil Velikov:
Quoted 14 lines
Hi Thomas,
Couple of fly-by ideas/suggestions.
Quoted 9 lines · Thomas Zimmermann
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 11 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 801
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ;Unrelated:
This feels quite dirty. If AST1180 does not support atomic modeset simply remove theDRIVER_ATOMICbit.
You can do that at runtime, viadrm_device::driver_featuresin say,ast_detect_chip()?The line you commented on dates back to non-atomic modesetting, but I don't know what the story behind AST1180 is. It is explicitly disabled in the list of PCI IDs, but the driver has plenty of code for it. It looks as if the chip can only do pageflipping with a pre-set video mode.
As it is right now, the AST1180 code could probably be deleted entirely.
Quoted 5 lines
The
drm_driver::driver_featuresis immutable, or it ought to be.Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0}Quoted 8 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 806
Quoted 3 lines
drivers/gpu/drm/ast/ast_mode.c +3
-0+if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ +I cannot think of a reason why a driver would need to perform
crtc_atomic_check, if the crtc is being disabled.
Can you spot any? If not, this should be better served in core, which calls this callback.
Correct?Ast is a bit of a special case, because it tests the incoming mode against a list of re-defined modes. With the crtc being disabled, the incoming mode is 0 in all fields. Obviously that's not a valid mode, and we need that additional test here.
Quoted 5 lines
In the general case, I'd see 'crtc check' as part of the larger atomic infrastructure. I can imagine that configurations require the CRTC to be enabled before other HW blocks work. So a driver might have a reason to run crtc's check even for disabled crtcs (at least to verify that the crtc is not disabled). I don't think this can be handled in the core easily.
Jumping out of ->atomic_check callbacks when stuff is all off is fairly standard pattern. So much standard that I'm kinda wondering whether we shouldn't just make it the default in atomic helpers - so many drivers forget to do it and break in funny ways.
-Daniel
Quoted 29 lines
Best regards
ThomasQuoted 8 lines
HTH
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 15 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi
Am 04.05.20 um 17:31 schrieb Daniel Vetter:
Quoted 61 lines · Thomas Zimmermann
Quoted 54 lines
Hi Emil
Am 01.05.20 um 15:20 schrieb Emil Velikov:
Quoted 14 lines
Hi Thomas,
Couple of fly-by ideas/suggestions.
Quoted 9 lines · Thomas Zimmermann
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 11 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 801
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ;Unrelated:
This feels quite dirty. If AST1180 does not support atomic modeset simply remove theDRIVER_ATOMICbit.
You can do that at runtime, viadrm_device::driver_featuresin say,ast_detect_chip()?The line you commented on dates back to non-atomic modesetting, but I don't know what the story behind AST1180 is. It is explicitly disabled in the list of PCI IDs, but the driver has plenty of code for it. It looks as if the chip can only do pageflipping with a pre-set video mode.
As it is right now, the AST1180 code could probably be deleted entirely.
Quoted 5 lines
The
drm_driver::driver_featuresis immutable, or it ought to be.Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0}Quoted 8 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 806
Quoted 3 lines
drivers/gpu/drm/ast/ast_mode.c +3
-0+if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ +I cannot think of a reason why a driver would need to perform
crtc_atomic_check, if the crtc is being disabled.
Can you spot any? If not, this should be better served in core, which calls this callback.
Correct?Ast is a bit of a special case, because it tests the incoming mode against a list of re-defined modes. With the crtc being disabled, the incoming mode is 0 in all fields. Obviously that's not a valid mode, and we need that additional test here.
Quoted 5 lines
In the general case, I'd see 'crtc check' as part of the larger atomic infrastructure. I can imagine that configurations require the CRTC to be enabled before other HW blocks work. So a driver might have a reason to run crtc's check even for disabled crtcs (at least to verify that the crtc is not disabled). I don't think this can be handled in the core easily.
Quoted 4 lines
Jumping out of ->atomic_check callbacks when stuff is all off is fairly standard pattern. So much standard that I'm kinda wondering whether we shouldn't just make it the default in atomic helpers - so many drivers forget to do it and break in funny ways.
If there comes a driver that really must handle the 'disable case' in its check handler, such a change would be hard to revert. Removing the check from the DRM core could regress drivers that depend on the new semantics.
Best regards
Thomas
Quoted 33 lines
-Daniel
Quoted 29 lines
Best regards
ThomasQuoted 8 lines
HTH
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 15 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 69 lines · Thomas Zimmermann
Hi
Am 04.05.20 um 17:31 schrieb Daniel Vetter:
Quoted 61 lines · Thomas Zimmermann
Quoted 54 lines
Hi Emil
Am 01.05.20 um 15:20 schrieb Emil Velikov:
Quoted 14 lines
Hi Thomas,
Couple of fly-by ideas/suggestions.
Quoted 9 lines · Thomas Zimmermann
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 11 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 801
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ;Unrelated:
This feels quite dirty. If AST1180 does not support atomic modeset simply remove theDRIVER_ATOMICbit.
You can do that at runtime, viadrm_device::driver_featuresin say,ast_detect_chip()?The line you commented on dates back to non-atomic modesetting, but I don't know what the story behind AST1180 is. It is explicitly disabled in the list of PCI IDs, but the driver has plenty of code for it. It looks as if the chip can only do pageflipping with a pre-set video mode.
As it is right now, the AST1180 code could probably be deleted entirely.
Quoted 5 lines
The
drm_driver::driver_featuresis immutable, or it ought to be.Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0}Quoted 8 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 806
Quoted 3 lines
drivers/gpu/drm/ast/ast_mode.c +3
-0+if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ +I cannot think of a reason why a driver would need to perform
crtc_atomic_check, if the crtc is being disabled.
Can you spot any? If not, this should be better served in core, which calls this callback.
Correct?Ast is a bit of a special case, because it tests the incoming mode against a list of re-defined modes. With the crtc being disabled, the incoming mode is 0 in all fields. Obviously that's not a valid mode, and we need that additional test here.
Quoted 5 lines
In the general case, I'd see 'crtc check' as part of the larger atomic infrastructure. I can imagine that configurations require the CRTC to be enabled before other HW blocks work. So a driver might have a reason to run crtc's check even for disabled crtcs (at least to verify that the crtc is not disabled). I don't think this can be handled in the core easily.
Quoted 4 lines
Jumping out of ->atomic_check callbacks when stuff is all off is fairly standard pattern. So much standard that I'm kinda wondering whether we shouldn't just make it the default in atomic helpers - so many drivers forget to do it and break in funny ways.
Quoted 4 lines
If there comes a driver that really must handle the 'disable case' in its check handler, such a change would be hard to revert. Removing the check from the DRM core could regress drivers that depend on the new semantics.
Yeah I know, that's why I don't want to push this into helpers (it wouldn't ever be in core code). But it surely is tempting, because we have tons of bugs in this area. I've made a patch series a while ago that only cleaned up some of the minor confusion between plane_state->crtc and plane_state->fb (they're only set together or neither). Losing choice either way :-/
-Daniel
Quoted 46 lines
Best regards
ThomasQuoted 33 lines
-Daniel
Quoted 29 lines
Best regards
ThomasQuoted 8 lines
HTH
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 15 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 30 lines · Thomas Zimmermann
Hi Emil
Am 01.05.20 um 15:20 schrieb Emil Velikov:
Quoted 14 lines
Hi Thomas,
Couple of fly-by ideas/suggestions.
Quoted 9 lines · Thomas Zimmermann
Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/ast/ast_mode.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 11 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 801
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,return -EINVAL ;Unrelated:
This feels quite dirty. If AST1180 does not support atomic modeset simply remove theDRIVER_ATOMICbit.
You can do that at runtime, viadrm_device::driver_featuresin say,ast_detect_chip()?
Quoted 7 lines
The line you commented on dates back to non-atomic modesetting, but I don't know what the story behind AST1180 is. It is explicitly disabled in the list of PCI IDs, but the driver has plenty of code for it. It looks as if the chip can only do pageflipping with a pre-set video mode.
As it is right now, the AST1180 code could probably be deleted entirely.
No modeset support at all? Ouch.
Removing is one option a shorter/simpler one will be to expose zero connectors. So any crazy^W brave soul can reinstate AST1180 support.
In either way - it's something for another day/series.
Quoted 18 lines
Quoted 5 lines
The
drm_driver::driver_featuresis immutable, or it ought to be.Quoted 2 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0}Quoted 8 lines
drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 806
Quoted 3 lines
drivers/gpu/drm/ast/ast_mode.c +3
-0+if (!state->enable) +return 0 ;/* no checks required if CRTC is being disabled */ +I cannot think of a reason why a driver would need to perform
crtc_atomic_check, if the crtc is being disabled.
Can you spot any? If not, this should be better served in core, which calls this callback.
Correct?Ast is a bit of a special case, because it tests the incoming mode against a list of re-defined modes. With the crtc being disabled, the incoming mode is 0 in all fields. Obviously that's not a valid mode, and we need that additional test here.
Quoted 6 lines
In the general case, I'd see 'crtc check' as part of the larger atomic infrastructure. I can imagine that configurations require the CRTC to be enabled before other HW blocks work. So a driver might have a reason to run crtc's check even for disabled crtcs (at least to verify that the crtc is not disabled). I don't think this can be handled in the core easily.
Ack, makes sense.
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel