drm: call connector->dpms(OFF) when disabling
Subsystems (2)
PATCH 1/1 drm: call connector->dpms(OFF) when disabling
From: Rob Clark <[email protected]>
When disabling unused connectors, be sure to call connector->dpms(OFF), so if there is actually some IP to turn off (such as external bridge chips, etc), these actually do get turned off.
--- drivers/gpu/drm/drm_crtc_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_crtc_helper.c +3 -3
@@ -244,16 +244,16 @@ void drm_helper_disable_unused_functions(struct drm_device *dev)struct drm_crtc *crtc;list_for_each_entry (connector, &dev->mode_config.connector_list, head) { -if (!connector->encoder) -continue ;if (connector->status == connector_status_disconnected) connector->encoder =NULL ; +if (!connector->encoder) + connector->funcs->dpms (connector,DRM_MODE_DPMS_OFF ); }list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) {if (!drm_helper_encoder_in_use (encoder)) {drm_encoder_disable (encoder); -/* disconnector encoder from any connector */ +/* disconnect encoder from any connector */ encoder->crtc =NULL ; } }
Signature · 1 line
1.7.9.5
Quoted 8 lines · Rob Clark
From: Rob Clark <[email protected]>
When disabling unused connectors, be sure to call
connector->dpms(OFF), so if there is actually some IP to turn off (such as external bridge chips, etc), these actually do get turned off.Signed-off-by Rob Clark <[email protected]>Tested-by Roger Quadros <[email protected]>
I think this runs counter to the crtc helper design: connectors are pretty much just dummy entities, and any dpms handling is done in the encoders/crtcs. If you call connector->funcs->dpms you don't call a crtc helper function, but actually the official dpms interface (which then again calls down into the encoder/crtc dpms callbacks (which are again crtc helper private). This functions are called again a few lines down in disable_unused_functions anyway, so the only way this changes behaviour is if you already overwrite the dpms interface and don't directly use drm_helper_connector_dpms.
Which is imo a clear sign that the crtc helper is a misfit for your hw and you should stop using it ;-) And adding special-case handling like this into common code, especially if it weakens the semantic concepts in the helper layer is a recipe for a maintainance disaster a few years down the road. Hence
Cheers, Daniel
Quoted 36 lines
--- drivers/gpu/drm/drm_crtc_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_crtc_helper.c +3
-3@@ -244,16 +244,16 @@ void drm_helper_disable_unused_functions(struct drm_device *dev)struct drm_crtc *crtc;list_for_each_entry (connector, &dev->mode_config.connector_list, head) { -if (!connector->encoder) -continue ;if (connector->status == connector_status_disconnected) connector->encoder =NULL ; +if (!connector->encoder) + connector->funcs->dpms (connector,DRM_MODE_DPMS_OFF ); }list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) {if (!drm_helper_encoder_in_use (encoder)) {drm_encoder_disable (encoder); -/* disconnector encoder from any connector */ +/* disconnect encoder from any connector */ encoder->crtc =NULL ; } }Signature · 6 lines
1.7.9.5 _______________________________________________ dri-devel mailing list http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 10 lines · Daniel Vetter
Quoted 8 lines · Rob Clark
From: Rob Clark <[email protected]>
When disabling unused connectors, be sure to call
connector->dpms(OFF), so if there is actually some IP to turn off (such as external bridge chips, etc), these actually do get turned off.Signed-off-by Rob Clark <[email protected]>Tested-by Roger Quadros <[email protected]>
Quoted 9 lines
I think this runs counter to the crtc helper design: connectors are pretty much just dummy entities, and any dpms handling is done in the encoders/crtcs. If you call
connector->funcs->dpmsyou don't call a crtc helper function, but actually the official dpms interface (which then again calls down into the encoder/crtc dpms callbacks (which are again crtc helper private). This functions are called again a few lines down indisable_unused_functionsanyway, so the only way this changes behaviour is if you already overwrite the dpms interface and don't directly usedrm_helper_connector_dpms.
yeah, I do this.. I have my own fxn in the connector which does some stuff, and then calls drm_helper_connector_dpms().
Maybe it just makes sense to always do connector->dpms(OFF) before unhooking the chain, rather than directly calling dpms on the encoder/crtc?
Quoted 5 lines
Which is imo a clear sign that the crtc helper is a misfit for your hw and you should stop using it ;-) And adding special-case handling like this into common code, especially if it weakens the semantic concepts in the helper layer is a recipe for a maintainance disaster a few years down the road. Hence
well, I think by the time we start adding atomic-modeset and common/dsi panel framework, there might be need for a new set of helpers.. but I'm not sure that the hw is quite strange enough to need an omap specific set of helpers. Maybe I start w/ something in omapdrm but then refactor into common functions once a few drivers are converted to atomic modeset and panel framework.
BR,
-R
Quoted 49 lines
NACKed-by Daniel Vetter <[email protected]>Cheers, Daniel
Quoted 32 lines
--- drivers/gpu/drm/drm_crtc_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_crtc_helper.c +3
-4@@ -244,16 +244,16 @@ void drm_helper_disable_unused_functions(struct drm_device *dev)struct drm_crtc *crtc;list_for_each_entry (connector, &dev->mode_config.connector_list, head) { -if (!connector->encoder) -continue ;if (connector->status == connector_status_disconnected) connector->encoder =NULL ; +if (!connector->encoder) + connector->funcs->dpms (connector,DRM_MODE_DPMS_OFF ); }list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) {if (!drm_helper_encoder_in_use (encoder)) {drm_encoder_disable (encoder); -/* disconnector encoder from any connector */ +/* disconnect encoder from any connector */ encoder->crtc =NULL ; } } --1.7.9.5
Quoted 4 lines
_______________________________________________
dri-devel mailing list--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines · Rob Clark
Maybe it just makes sense to always do
connector->dpms(OFF)before unhooking the chain, rather than directly calling dpms on the encoder/crtc?
Well, that makes the entire (optional) ->disable stuff a bit more awkward. The thing imo really is that the crtc helper assume that the connectors do not hold any hw state, whereas you're omap driver violates that assumption.
For the intel driver we've fixed this by doing any sink handling (e.g. for dp) in the encoder->dpms functions. So I think the right way for omap is to do the same (or conclude that the crtc helpers are a bad fit and ditch them). Having connectors that are special, but only in some of the cases imo makes squat sense for a generic helper library.
Quoted 6 lines
Quoted 5 lines
Which is imo a clear sign that the crtc helper is a misfit for your hw and you should stop using it ;-) And adding special-case handling like this into common code, especially if it weakens the semantic concepts in the helper layer is a recipe for a maintainance disaster a few years down the road. Hence
Quoted 6 lines
well, I think by the time we start adding atomic-modeset and common/dsi panel framework, there might be need for a new set of helpers.. but I'm not sure that the hw is quite strange enough to need an omap specific set of helpers. Maybe I start w/ something in omapdrm but then refactor into common functions once a few drivers are converted to atomic modeset and panel framework.
I see a few ways forward with the crtc helpers and atomic modeset:
- bake the assumption into the code that drivers using the crtc helpers don't have any shared global resources and drop all these checks. This would boil down to writing a new set_config to handle global modeset changes (instead of changes to just one crtc). Obviously the current possible_encoders/possible_crtcs would still be checked.
- like above, but add a driver-global ->check callback before starting the modeset sequence, but with the new configuration already applied to the kms structures.
- an alternative would be a new ->global_adjust_modes after the ->adjust_mode stage that gets all the new adjusted_modes and could check global resource constrains.
Imo anything more complicated than that has dubious value in a common framework. I also dunno yet how (or if at all) we should bake in handling of planes restrictions ...
For panel framework integration I don't think we need much, this is likely just a driver internal thing.
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 29 lines · Daniel Vetter
Quoted 3 lines · Rob Clark
Maybe it just makes sense to always do
connector->dpms(OFF)before unhooking the chain, rather than directly calling dpms on the encoder/crtc?Well, that makes the entire (optional) ->disable stuff a bit more awkward. The thing imo really is that the crtc helper assume that the connectors do not hold any hw state, whereas you're omap driver violates that assumption.
For the intel driver we've fixed this by doing any sink handling (e.g. for dp) in the
encoder->dpmsfunctions. So I think the right way for omap is to do the same (or conclude that the crtc helpers are a bad fit and ditch them). Having connectors that are special, but only in some of the cases imo makes squat sense for a generic helper library.Quoted 6 lines
Quoted 5 lines
Which is imo a clear sign that the crtc helper is a misfit for your hw and you should stop using it ;-) And adding special-case handling like this into common code, especially if it weakens the semantic concepts in the helper layer is a recipe for a maintainance disaster a few years down the road. Hence
Quoted 6 lines
well, I think by the time we start adding atomic-modeset and common/dsi panel framework, there might be need for a new set of helpers.. but I'm not sure that the hw is quite strange enough to need an omap specific set of helpers. Maybe I start w/ something in omapdrm but then refactor into common functions once a few drivers are converted to atomic modeset and panel framework.
Quoted 10 lines
I see a few ways forward with the crtc helpers and atomic modeset:
- bake the assumption into the code that drivers using the crtc helpers don't have any shared global resources and drop all these checks. This would boil down to writing a newset_configto handle global modeset changes (instead of changes to just one crtc). Obviously the current possible_encoders/possible_crtcs would still be checked.
- like above, but add a driver-global ->check callback before starting the modeset sequence, but with the new configuration already applied to the kms structures.
That's essentially what my intel_atomic.c code does. Somewhat ironically, since your modeset rework, that code is now more suited for other drivers and I need to go and rewrite it for i915.
Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 10 lines · Daniel Vetter
Quoted 3 lines · Rob Clark
Maybe it just makes sense to always do
connector->dpms(OFF)before unhooking the chain, rather than directly calling dpms on the encoder/crtc?Well, that makes the entire (optional) ->disable stuff a bit more awkward. The thing imo really is that the crtc helper assume that the connectors do not hold any hw state, whereas you're omap driver violates that assumption.
Quoted 5 lines
For the intel driver we've fixed this by doing any sink handling (e.g. for dp) in the
encoder->dpmsfunctions. So I think the right way for omap is to do the same (or conclude that the crtc helpers are a bad fit and ditch them). Having connectors that are special, but only in some of the cases imo makes squat sense for a generic helper library.
hmm.. well I have been thinking that some of what is currently in the connectors needs to move into the encoders.. this would help, although will take some time.
Quoted 27 lines
Quoted 6 lines
Quoted 5 lines
Which is imo a clear sign that the crtc helper is a misfit for your hw and you should stop using it ;-) And adding special-case handling like this into common code, especially if it weakens the semantic concepts in the helper layer is a recipe for a maintainance disaster a few years down the road. Hence
Quoted 6 lines
well, I think by the time we start adding atomic-modeset and common/dsi panel framework, there might be need for a new set of helpers.. but I'm not sure that the hw is quite strange enough to need an omap specific set of helpers. Maybe I start w/ something in omapdrm but then refactor into common functions once a few drivers are converted to atomic modeset and panel framework.
I see a few ways forward with the crtc helpers and atomic modeset:
- bake the assumption into the code that drivers using the crtc helpers don't have any shared global resources and drop all these checks. This would boil down to writing a newset_configto handle global modeset changes (instead of changes to just one crtc). Obviously the current possible_encoders/possible_crtcs would still be checked.
- like above, but add a driver-global ->check callback before starting the modeset sequence, but with the new configuration already applied to the kms structures.
- an alternative would be a new ->global_adjust_modes after the ->adjust_mode stage that gets all the newadjusted_modesand could check global resource constrains.
Quoted 6 lines
Imo anything more complicated than that has dubious value in a common framework. I also dunno yet how (or if at all) we should bake in handling of planes restrictions ...
For panel framework integration I don't think we need much, this is likely just a driver internal thing.
well.. I guess it where the panel driver fits in KMS. I think it would be common that we need to send a command to the panel to turn off / disable backlight / etc. Versus an hdmi/dp/etc monitor which would just do this automatically when it stops receiving a signal. So it doesn't seem like a bad idea to not assume that your connector is completely passive. But I could buy the argument that this should be part of crtc helpers v2.
BR,
-R
Quoted 9 lines
Cheers, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 55 lines · Rob Clark
Quoted 10 lines · Daniel Vetter
Quoted 3 lines · Rob Clark
Maybe it just makes sense to always do
connector->dpms(OFF)before unhooking the chain, rather than directly calling dpms on the encoder/crtc?Well, that makes the entire (optional) ->disable stuff a bit more awkward. The thing imo really is that the crtc helper assume that the connectors do not hold any hw state, whereas you're omap driver violates that assumption.
Quoted 5 lines
For the intel driver we've fixed this by doing any sink handling (e.g. for dp) in the
encoder->dpmsfunctions. So I think the right way for omap is to do the same (or conclude that the crtc helpers are a bad fit and ditch them). Having connectors that are special, but only in some of the cases imo makes squat sense for a generic helper library.hmm.. well I have been thinking that some of what is currently in the connectors needs to move into the encoders.. this would help, although will take some time.
Quoted 27 lines
Quoted 6 lines
Quoted 5 lines
Which is imo a clear sign that the crtc helper is a misfit for your hw and you should stop using it ;-) And adding special-case handling like this into common code, especially if it weakens the semantic concepts in the helper layer is a recipe for a maintainance disaster a few years down the road. Hence
Quoted 6 lines
well, I think by the time we start adding atomic-modeset and common/dsi panel framework, there might be need for a new set of helpers.. but I'm not sure that the hw is quite strange enough to need an omap specific set of helpers. Maybe I start w/ something in omapdrm but then refactor into common functions once a few drivers are converted to atomic modeset and panel framework.
I see a few ways forward with the crtc helpers and atomic modeset:
- bake the assumption into the code that drivers using the crtc helpers don't have any shared global resources and drop all these checks. This would boil down to writing a newset_configto handle global modeset changes (instead of changes to just one crtc). Obviously the current possible_encoders/possible_crtcs would still be checked.
- like above, but add a driver-global ->check callback before starting the modeset sequence, but with the new configuration already applied to the kms structures.
- an alternative would be a new ->global_adjust_modes after the ->adjust_mode stage that gets all the newadjusted_modesand could check global resource constrains.Quoted 6 lines
Imo anything more complicated than that has dubious value in a common framework. I also dunno yet how (or if at all) we should bake in handling of planes restrictions ...
For panel framework integration I don't think we need much, this is likely just a driver internal thing.
Quoted 7 lines
well.. I guess it where the panel driver fits in KMS. I think it would be common that we need to send a command to the panel to turn off / disable backlight / etc. Versus an hdmi/dp/etc monitor which would just do this automatically when it stops receiving a signal. So it doesn't seem like a bad idea to not assume that your connector is completely passive. But I could buy the argument that this should be part of crtc helpers v2.
Thinking about modern hw, I'd probably only expose connectors and monitors (or maybe call them displays). You could hang backlight controls and brightness, etc on the monitor objects. Also you could have a multiple monitors connected to a single connector (DP 1.2 or virtual adapters (wireless or remote display for example)). Everything else (crtcs, plls, encoders, etc.) would be driver controlled and validated.
Alex
Quoted 7 lines · Alex Deucher
Thinking about modern hw, I'd probably only expose connectors and monitors (or maybe call them displays). You could hang backlight controls and brightness, etc on the monitor objects. Also you could have a multiple monitors connected to a single connector (DP 1.2 or virtual adapters (wireless or remote display for example)). Everything else (crtcs, plls, encoders, etc.) would be driver controlled and validated.
Yeah, that's pretty much my idea, too. For backwards-compat we could expose a fake encoder for each connector, but essentially ignore it in the generic modeset code.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 5 lines · On Fri, 28 Sep 2012 09:27:18 +0200 Rob Clark <[email protected]> wrote:
From: Rob Clark <[email protected]>
When disabling unused connectors, be sure to call
connector->dpms(OFF), so if there is actually some IP to turn off (such as external bridge chips, etc), these actually do get turned off.
That's a fairly drastic and non-obvious API change for all the other drivers. Have you tested this widely on other hardware ?
Alan
Quoted 11 lines · Alan Cox
Quoted 5 lines · On Fri, 28 Sep 2012 09:27:18 +0200 Rob Clark <[email protected]> wrote:
From: Rob Clark <[email protected]>
When disabling unused connectors, be sure to call
connector->dpms(OFF), so if there is actually some IP to turn off (such as external bridge chips, etc), these actually do get turned off.That's a fairly drastic and non-obvious API change for all the other drivers. Have you tested this widely on other hardware ?
no, not yet.. just testing the waters to see how much others freak out first ;-)
But since we disconnect the encoder first, drm_helper_connector_dpms() should end up being a no-op so I don't think it works out to be quite as drastic as it sounds.
BR,
-R
Quoted 5 lines
Alan
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel