aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-04-19 18:18:09 -0400
committerKeith Packard <keithp@keithp.com>2011-05-10 16:19:15 -0400
commit8261b19173b89d86cc3088483595e2879e4976d6 (patch)
tree8ae61604d984a43f73950c443992b1a636790e61 /drivers
parentbe925587570a745944d99042368f72496bc28a70 (diff)
drm/i915: Don't store temporary load-detect variables in the generic encoder
Keep all the state required for undoing and restoring the previous pipe configuration together in a single struct passed from intel_get_load_detect_pipe() to intel_release_load_detect_pipe() rather than stuffing them inside the common encoder structure. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c11
-rw-r--r--drivers/gpu/drm/i915/intel_display.c26
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h10
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c9
4 files changed, 33 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 2eb60cd47b33..e93f93cc7e78 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -430,7 +430,6 @@ intel_crt_detect(struct drm_connector *connector, bool force)
430 struct drm_device *dev = connector->dev; 430 struct drm_device *dev = connector->dev;
431 struct intel_crt *crt = intel_attached_crt(connector); 431 struct intel_crt *crt = intel_attached_crt(connector);
432 struct drm_crtc *crtc; 432 struct drm_crtc *crtc;
433 int dpms_mode;
434 enum drm_connector_status status; 433 enum drm_connector_status status;
435 434
436 if (I915_HAS_HOTPLUG(dev)) { 435 if (I915_HAS_HOTPLUG(dev)) {
@@ -454,14 +453,16 @@ intel_crt_detect(struct drm_connector *connector, bool force)
454 if (crtc && crtc->enabled) { 453 if (crtc && crtc->enabled) {
455 status = intel_crt_load_detect(crt); 454 status = intel_crt_load_detect(crt);
456 } else { 455 } else {
457 if (intel_get_load_detect_pipe(&crt->base, connector, 456 struct intel_load_detect_pipe tmp;
458 NULL, &dpms_mode)) { 457
458 if (intel_get_load_detect_pipe(&crt->base, connector, NULL,
459 &tmp)) {
459 if (intel_crt_detect_ddc(connector)) 460 if (intel_crt_detect_ddc(connector))
460 status = connector_status_connected; 461 status = connector_status_connected;
461 else 462 else
462 status = intel_crt_load_detect(crt); 463 status = intel_crt_load_detect(crt);
463 intel_release_load_detect_pipe(&crt->base, 464 intel_release_load_detect_pipe(&crt->base, connector,
464 connector, dpms_mode); 465 &tmp);
465 } else 466 } else
466 status = connector_status_unknown; 467 status = connector_status_unknown;
467 } 468 }
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 943bcbcb4670..81c4f597cac0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5484,7 +5484,7 @@ static struct drm_display_mode load_detect_mode = {
5484bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, 5484bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
5485 struct drm_connector *connector, 5485 struct drm_connector *connector,
5486 struct drm_display_mode *mode, 5486 struct drm_display_mode *mode,
5487 int *dpms_mode) 5487 struct intel_load_detect_pipe *old)
5488{ 5488{
5489 struct intel_crtc *intel_crtc; 5489 struct intel_crtc *intel_crtc;
5490 struct drm_crtc *possible_crtc; 5490 struct drm_crtc *possible_crtc;
@@ -5509,14 +5509,18 @@ bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
5509 /* See if we already have a CRTC for this connector */ 5509 /* See if we already have a CRTC for this connector */
5510 if (encoder->crtc) { 5510 if (encoder->crtc) {
5511 crtc = encoder->crtc; 5511 crtc = encoder->crtc;
5512 /* Make sure the crtc and connector are running */ 5512
5513 intel_crtc = to_intel_crtc(crtc); 5513 intel_crtc = to_intel_crtc(crtc);
5514 *dpms_mode = intel_crtc->dpms_mode; 5514 old->dpms_mode = intel_crtc->dpms_mode;
5515 old->load_detect_temp = false;
5516
5517 /* Make sure the crtc and connector are running */
5515 if (intel_crtc->dpms_mode != DRM_MODE_DPMS_ON) { 5518 if (intel_crtc->dpms_mode != DRM_MODE_DPMS_ON) {
5516 crtc_funcs = crtc->helper_private; 5519 crtc_funcs = crtc->helper_private;
5517 crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON); 5520 crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON);
5518 encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON); 5521 encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON);
5519 } 5522 }
5523
5520 return true; 5524 return true;
5521 } 5525 }
5522 5526
@@ -5543,10 +5547,10 @@ bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
5543 5547
5544 encoder->crtc = crtc; 5548 encoder->crtc = crtc;
5545 connector->encoder = encoder; 5549 connector->encoder = encoder;
5546 intel_encoder->load_detect_temp = true;
5547 5550
5548 intel_crtc = to_intel_crtc(crtc); 5551 intel_crtc = to_intel_crtc(crtc);
5549 *dpms_mode = intel_crtc->dpms_mode; 5552 old->dpms_mode = intel_crtc->dpms_mode;
5553 old->load_detect_temp = true;
5550 5554
5551 if (!crtc->enabled) { 5555 if (!crtc->enabled) {
5552 if (!mode) 5556 if (!mode)
@@ -5574,7 +5578,8 @@ bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
5574} 5578}
5575 5579
5576void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder, 5580void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder,
5577 struct drm_connector *connector, int dpms_mode) 5581 struct drm_connector *connector,
5582 struct intel_load_detect_pipe *old)
5578{ 5583{
5579 struct drm_encoder *encoder = &intel_encoder->base; 5584 struct drm_encoder *encoder = &intel_encoder->base;
5580 struct drm_device *dev = encoder->dev; 5585 struct drm_device *dev = encoder->dev;
@@ -5582,19 +5587,18 @@ void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder,
5582 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; 5587 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
5583 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; 5588 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
5584 5589
5585 if (intel_encoder->load_detect_temp) { 5590 if (old->load_detect_temp) {
5586 encoder->crtc = NULL; 5591 encoder->crtc = NULL;
5587 connector->encoder = NULL; 5592 connector->encoder = NULL;
5588 intel_encoder->load_detect_temp = false;
5589 crtc->enabled = drm_helper_crtc_in_use(crtc); 5593 crtc->enabled = drm_helper_crtc_in_use(crtc);
5590 drm_helper_disable_unused_functions(dev); 5594 drm_helper_disable_unused_functions(dev);
5591 } 5595 }
5592 5596
5593 /* Switch crtc and encoder back off if necessary */ 5597 /* Switch crtc and encoder back off if necessary */
5594 if (crtc->enabled && dpms_mode != DRM_MODE_DPMS_ON) { 5598 if (crtc->enabled && old->dpms_mode != DRM_MODE_DPMS_ON) {
5595 if (encoder->crtc == crtc) 5599 if (encoder->crtc == crtc)
5596 encoder_funcs->dpms(encoder, dpms_mode); 5600 encoder_funcs->dpms(encoder, old->dpms_mode);
5597 crtc_funcs->dpms(crtc, dpms_mode); 5601 crtc_funcs->dpms(crtc, old->dpms_mode);
5598 } 5602 }
5599} 5603}
5600 5604
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index fa46d329a8ea..3ceb3daeb61f 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -140,7 +140,6 @@ struct intel_fbdev {
140struct intel_encoder { 140struct intel_encoder {
141 struct drm_encoder base; 141 struct drm_encoder base;
142 int type; 142 int type;
143 bool load_detect_temp;
144 bool needs_tv_clock; 143 bool needs_tv_clock;
145 void (*hot_plug)(struct intel_encoder *); 144 void (*hot_plug)(struct intel_encoder *);
146 int crtc_mask; 145 int crtc_mask;
@@ -291,13 +290,18 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
291 struct drm_file *file_priv); 290 struct drm_file *file_priv);
292extern void intel_wait_for_vblank(struct drm_device *dev, int pipe); 291extern void intel_wait_for_vblank(struct drm_device *dev, int pipe);
293extern void intel_wait_for_pipe_off(struct drm_device *dev, int pipe); 292extern void intel_wait_for_pipe_off(struct drm_device *dev, int pipe);
293
294struct intel_load_detect_pipe {
295 bool load_detect_temp;
296 int dpms_mode;
297};
294extern bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, 298extern bool intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
295 struct drm_connector *connector, 299 struct drm_connector *connector,
296 struct drm_display_mode *mode, 300 struct drm_display_mode *mode,
297 int *dpms_mode); 301 struct intel_load_detect_pipe *old);
298extern void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder, 302extern void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder,
299 struct drm_connector *connector, 303 struct drm_connector *connector,
300 int dpms_mode); 304 struct intel_load_detect_pipe *old);
301 305
302extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB); 306extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB);
303extern int intel_sdvo_supports_hotplug(struct drm_connector *connector); 307extern int intel_sdvo_supports_hotplug(struct drm_connector *connector);
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 3322582ba3ec..113e4e7264cd 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1361,13 +1361,14 @@ intel_tv_detect(struct drm_connector *connector, bool force)
1361 if (intel_tv->base.base.crtc && intel_tv->base.base.crtc->enabled) { 1361 if (intel_tv->base.base.crtc && intel_tv->base.base.crtc->enabled) {
1362 type = intel_tv_detect_type(intel_tv, connector); 1362 type = intel_tv_detect_type(intel_tv, connector);
1363 } else if (force) { 1363 } else if (force) {
1364 int dpms_mode; 1364 struct intel_load_detect_pipe tmp;
1365 1365
1366 if (intel_get_load_detect_pipe(&intel_tv->base, connector, 1366 if (intel_get_load_detect_pipe(&intel_tv->base, connector,
1367 &mode, &dpms_mode)) { 1367 &mode, &tmp)) {
1368 type = intel_tv_detect_type(intel_tv, connector); 1368 type = intel_tv_detect_type(intel_tv, connector);
1369 intel_release_load_detect_pipe(&intel_tv->base, connector, 1369 intel_release_load_detect_pipe(&intel_tv->base,
1370 dpms_mode); 1370 connector,
1371 &tmp);
1371 } else 1372 } else
1372 return connector_status_unknown; 1373 return connector_status_unknown;
1373 } else 1374 } else