[PATCH 3.16 016/132] drm/fb-helper: dpms_legacy(): Only set on connectors in use

From: Ben Hutchings
Date: Fri Sep 20 2019 - 10:38:17 EST


3.16.74-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Noralf TrÃnnes <noralf@xxxxxxxxxxx>

commit 65a102f68005891d7f39354cfd79099908df6d51 upstream.

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@xxxxxxxxxxx>
Fixes: 023eb571a1d0 ("drm: correctly update connector DPMS status in drm_fb_helper")
Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
Link: https://patchwork.freedesktop.org/patch/msgid/20190326175546.18126-3-noralf@xxxxxxxxxxx
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
drivers/gpu/drm/drm_fb_helper.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -453,8 +453,8 @@ static void drm_fb_helper_dpms(struct fb
{
struct drm_fb_helper *fb_helper = info->par;
struct drm_device *dev = fb_helper->dev;
- struct drm_crtc *crtc;
struct drm_connector *connector;
+ struct drm_mode_set *modeset;
int i, j;

/*
@@ -475,14 +475,13 @@ static void drm_fb_helper_dpms(struct fb
}

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 */
- for (j = 0; j < fb_helper->connector_count; 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);