diff mbox series

[02/16] drm/fb-helper: dpms_legacy(): Only set on connectors in use

Message ID 20190326175546.18126-3-noralf@tronnes.org (mailing list archive)
State New, archived
Headers show
Series drm/fb-helper: Move modesetting code to drm_client | expand

Commit Message

Noralf Trønnes March 26, 2019, 5:55 p.m. UTC
For each enabled crtc the functions sets dpms on all registered connectors.
Limit this to only doing it once and on the connectors actually in use.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_fb_helper.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Daniel Vetter March 26, 2019, 6:26 p.m. UTC | #1
On Tue, Mar 26, 2019 at 06:55:32PM +0100, Noralf Trønnes wrote:
> For each enabled crtc the functions sets dpms on all registered connectors.
> Limit this to only doing it once and on the connectors actually in use.
> 
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Fixes: 023eb571a1d0 ("drm: correctly update connector DPMS status in drm_fb_helper")
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Just want to trick the AUTOSEL bot into cherrypicking a silly patch onto
-stable :-)

-Daniel

> ---
>  drivers/gpu/drm/drm_fb_helper.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index eea15465da7a..b91df658db59 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -639,20 +639,19 @@ static struct sysrq_key_op sysrq_drm_fb_helper_restore_op = { };
>  static void dpms_legacy(struct drm_fb_helper *fb_helper, int dpms_mode)
>  {
>  	struct drm_device *dev = fb_helper->dev;
> -	struct drm_crtc *crtc;
>  	struct drm_connector *connector;
> +	struct drm_mode_set *modeset;
>  	int i, j;
>  
>  	drm_modeset_lock_all(dev);
>  	for (i = 0; i < fb_helper->crtc_count; i++) {
> -		crtc = fb_helper->crtc_info[i].mode_set.crtc;
> +		modeset = &fb_helper->crtc_info[i].mode_set;
>  
> -		if (!crtc->enabled)
> +		if (!modeset->crtc->enabled)
>  			continue;
>  
> -		/* Walk the connectors & encoders on this fb turning them on/off */
> -		drm_fb_helper_for_each_connector(fb_helper, j) {
> -			connector = fb_helper->connector_info[j]->connector;
> +		for (j = 0; j < modeset->num_connectors; j++) {
> +			connector = modeset->connectors[j];
>  			connector->funcs->dpms(connector, dpms_mode);
>  			drm_object_property_set_value(&connector->base,
>  				dev->mode_config.dpms_property, dpms_mode);
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index eea15465da7a..b91df658db59 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -639,20 +639,19 @@  static struct sysrq_key_op sysrq_drm_fb_helper_restore_op = { };
 static void dpms_legacy(struct drm_fb_helper *fb_helper, int dpms_mode)
 {
 	struct drm_device *dev = fb_helper->dev;
-	struct drm_crtc *crtc;
 	struct drm_connector *connector;
+	struct drm_mode_set *modeset;
 	int i, j;
 
 	drm_modeset_lock_all(dev);
 	for (i = 0; i < fb_helper->crtc_count; i++) {
-		crtc = fb_helper->crtc_info[i].mode_set.crtc;
+		modeset = &fb_helper->crtc_info[i].mode_set;
 
-		if (!crtc->enabled)
+		if (!modeset->crtc->enabled)
 			continue;
 
-		/* Walk the connectors & encoders on this fb turning them on/off */
-		drm_fb_helper_for_each_connector(fb_helper, j) {
-			connector = fb_helper->connector_info[j]->connector;
+		for (j = 0; j < modeset->num_connectors; j++) {
+			connector = modeset->connectors[j];
 			connector->funcs->dpms(connector, dpms_mode);
 			drm_object_property_set_value(&connector->base,
 				dev->mode_config.dpms_property, dpms_mode);