aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-08-31 01:16:30 -0400
committerDave Airlie <airlied@linux.ie>2009-09-01 19:42:59 -0400
commita3a0544b2c84e1d7a2022b558ecf66d8c6a8dd93 (patch)
tree03debf96cac31e7661999d937f5ffaba6ada9e08
parented017d9fb17af3162f5acf922eb5731c541e1f3a (diff)
drm/kms: add explicit encoder disable function and detach harder.
For shared tv-out and VGA encoders, we really need to know if the encoder is just being switched off temporarily in blanking or if we are really disabling it hard. Also we need to try harder to disconnect encoders from unused connectors so we can share more efficently. (shared encoders stuff is coming in radeon tv-out support) Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c24
-rw-r--r--include/drm/drm_crtc_helper.h2
2 files changed, 22 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 205349ea1075..eea5e6c4099c 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -260,13 +260,27 @@ EXPORT_SYMBOL(drm_helper_crtc_in_use);
260void drm_helper_disable_unused_functions(struct drm_device *dev) 260void drm_helper_disable_unused_functions(struct drm_device *dev)
261{ 261{
262 struct drm_encoder *encoder; 262 struct drm_encoder *encoder;
263 struct drm_connector *connector;
263 struct drm_encoder_helper_funcs *encoder_funcs; 264 struct drm_encoder_helper_funcs *encoder_funcs;
264 struct drm_crtc *crtc; 265 struct drm_crtc *crtc;
265 266
267 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
268 if (!connector->encoder)
269 continue;
270 if (connector->status == connector_status_disconnected)
271 connector->encoder = NULL;
272 }
273
266 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 274 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
267 encoder_funcs = encoder->helper_private; 275 encoder_funcs = encoder->helper_private;
268 if (!drm_helper_encoder_in_use(encoder)) 276 if (!drm_helper_encoder_in_use(encoder)) {
269 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); 277 if (encoder_funcs->disable)
278 (*encoder_funcs->disable)(encoder);
279 else
280 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
281 }
282 /* disconnector encoder from any connector */
283 encoder->crtc = NULL;
270 } 284 }
271 285
272 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 286 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -411,7 +425,7 @@ static int drm_pick_crtcs(struct drm_device *dev,
411 c = 0; 425 c = 0;
412 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 426 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
413 427
414 if ((connector->encoder->possible_crtcs & (1 << c)) == 0) { 428 if ((encoder->possible_crtcs & (1 << c)) == 0) {
415 c++; 429 c++;
416 continue; 430 continue;
417 } 431 }
@@ -496,8 +510,10 @@ static void drm_setup_crtcs(struct drm_device *dev)
496 mode->name, crtc->base.id); 510 mode->name, crtc->base.id);
497 crtc->desired_mode = mode; 511 crtc->desired_mode = mode;
498 connector->encoder->crtc = crtc; 512 connector->encoder->crtc = crtc;
499 } else 513 } else {
500 connector->encoder->crtc = NULL; 514 connector->encoder->crtc = NULL;
515 connector->encoder = NULL;
516 }
501 i++; 517 i++;
502 } 518 }
503 519
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index e44a4f87303c..4c8dacaf4f58 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -79,6 +79,8 @@ struct drm_encoder_helper_funcs {
79 /* detect for DAC style encoders */ 79 /* detect for DAC style encoders */
80 enum drm_connector_status (*detect)(struct drm_encoder *encoder, 80 enum drm_connector_status (*detect)(struct drm_encoder *encoder,
81 struct drm_connector *connector); 81 struct drm_connector *connector);
82 /* disable encoder when not in use - more explicit than dpms off */
83 void (*disable)(struct drm_encoder *encoder);
82}; 84};
83 85
84struct drm_connector_helper_funcs { 86struct drm_connector_helper_funcs {