From ec30913cfd1bd7a3d6bcf6008a2536eaa258876e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 31 Aug 2009 15:16:30 +1000 Subject: [PATCH] --- yaml --- r: 163947 b: refs/heads/master c: a3a0544b2c84e1d7a2022b558ecf66d8c6a8dd93 h: refs/heads/master i: 163945: 037645174d924c44de2a48cb6c5eb605da1feda2 163943: b48c3f75c97cd578db58ea39ac920d82d854fe9e v: v3 --- [refs] | 2 +- trunk/drivers/gpu/drm/drm_crtc_helper.c | 24 ++++++++++++++++++++---- trunk/include/drm/drm_crtc_helper.h | 2 ++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index f892d4b642db..7835bf00e69c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ed017d9fb17af3162f5acf922eb5731c541e1f3a +refs/heads/master: a3a0544b2c84e1d7a2022b558ecf66d8c6a8dd93 diff --git a/trunk/drivers/gpu/drm/drm_crtc_helper.c b/trunk/drivers/gpu/drm/drm_crtc_helper.c index 205349ea1075..eea5e6c4099c 100644 --- a/trunk/drivers/gpu/drm/drm_crtc_helper.c +++ b/trunk/drivers/gpu/drm/drm_crtc_helper.c @@ -260,13 +260,27 @@ EXPORT_SYMBOL(drm_helper_crtc_in_use); void drm_helper_disable_unused_functions(struct drm_device *dev) { struct drm_encoder *encoder; + struct drm_connector *connector; struct drm_encoder_helper_funcs *encoder_funcs; 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; + } + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { encoder_funcs = encoder->helper_private; - if (!drm_helper_encoder_in_use(encoder)) - (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); + if (!drm_helper_encoder_in_use(encoder)) { + if (encoder_funcs->disable) + (*encoder_funcs->disable)(encoder); + else + (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); + } + /* disconnector encoder from any connector */ + encoder->crtc = NULL; } list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { @@ -411,7 +425,7 @@ static int drm_pick_crtcs(struct drm_device *dev, c = 0; list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - if ((connector->encoder->possible_crtcs & (1 << c)) == 0) { + if ((encoder->possible_crtcs & (1 << c)) == 0) { c++; continue; } @@ -496,8 +510,10 @@ static void drm_setup_crtcs(struct drm_device *dev) mode->name, crtc->base.id); crtc->desired_mode = mode; connector->encoder->crtc = crtc; - } else + } else { connector->encoder->crtc = NULL; + connector->encoder = NULL; + } i++; } diff --git a/trunk/include/drm/drm_crtc_helper.h b/trunk/include/drm/drm_crtc_helper.h index e44a4f87303c..4c8dacaf4f58 100644 --- a/trunk/include/drm/drm_crtc_helper.h +++ b/trunk/include/drm/drm_crtc_helper.h @@ -79,6 +79,8 @@ struct drm_encoder_helper_funcs { /* detect for DAC style encoders */ enum drm_connector_status (*detect)(struct drm_encoder *encoder, struct drm_connector *connector); + /* disable encoder when not in use - more explicit than dpms off */ + void (*disable)(struct drm_encoder *encoder); }; struct drm_connector_helper_funcs {