aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-06-29 16:40:09 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-09-06 01:53:16 -0400
commitef9c3aee60442d1eaf81fbd7b63f256410cc0aa9 (patch)
treeee3c942b4cae46e7e643b7f3490d50f6c34fba4c
parenteae307a5304f8c0956b8eab75596abba7ad58a5c (diff)
drm/i915: add direct encoder disable/enable infrastructure
Just prep work, not yet put to some use. Note that because we're still using the crtc helper to switch modes (and their complicated way to do partial modesets), we need to call the encoder's disable function unconditionally. But once this is cleaned up we shouldn't call the encoder's disable function unconditionally any more, because then we know that we'll only call it if the encoder is actually enabled. Also note that we then need to be careful about which crtc we're filtering the encoder list on: We want to filter on the crtc of the _current_ mode, not the one we're about to set up. For the enabling side we need to do the same trick. And again, we should be able to simplify this quite a bit when things have settled into place. Also note that this simply does not take cloning into account, so dpms needs to be handled specially for the few outputs where we even bother with it. Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_display.c38
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
2 files changed, 38 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 04bec4bd0acb..82aaded6713b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3209,13 +3209,16 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
3209 struct drm_device *dev = crtc->dev; 3209 struct drm_device *dev = crtc->dev;
3210 struct drm_i915_private *dev_priv = dev->dev_private; 3210 struct drm_i915_private *dev_priv = dev->dev_private;
3211 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3211 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3212 struct intel_encoder *encoder;
3212 int pipe = intel_crtc->pipe; 3213 int pipe = intel_crtc->pipe;
3213 int plane = intel_crtc->plane; 3214 int plane = intel_crtc->plane;
3214 u32 temp; 3215 u32 temp;
3215 bool is_pch_port; 3216 bool is_pch_port;
3216 3217
3218 /* XXX: For compatability with the crtc helper code, call the encoder's
3219 * enable function unconditionally for now. */
3217 if (intel_crtc->active) 3220 if (intel_crtc->active)
3218 return; 3221 goto encoders;
3219 3222
3220 intel_crtc->active = true; 3223 intel_crtc->active = true;
3221 intel_update_watermarks(dev); 3224 intel_update_watermarks(dev);
@@ -3262,6 +3265,12 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
3262 mutex_unlock(&dev->struct_mutex); 3265 mutex_unlock(&dev->struct_mutex);
3263 3266
3264 intel_crtc_update_cursor(crtc, true); 3267 intel_crtc_update_cursor(crtc, true);
3268
3269encoders:
3270 for_each_encoder_on_crtc(dev, crtc, encoder) {
3271 if (encoder->enable)
3272 encoder->enable(encoder);
3273 }
3265} 3274}
3266 3275
3267static void ironlake_crtc_disable(struct drm_crtc *crtc) 3276static void ironlake_crtc_disable(struct drm_crtc *crtc)
@@ -3269,10 +3278,18 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
3269 struct drm_device *dev = crtc->dev; 3278 struct drm_device *dev = crtc->dev;
3270 struct drm_i915_private *dev_priv = dev->dev_private; 3279 struct drm_i915_private *dev_priv = dev->dev_private;
3271 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3280 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3281 struct intel_encoder *encoder;
3272 int pipe = intel_crtc->pipe; 3282 int pipe = intel_crtc->pipe;
3273 int plane = intel_crtc->plane; 3283 int plane = intel_crtc->plane;
3274 u32 reg, temp; 3284 u32 reg, temp;
3275 3285
3286 /* XXX: For compatability with the crtc helper code, call the encoder's
3287 * disable function unconditionally for now. */
3288 for_each_encoder_on_crtc(dev, crtc, encoder) {
3289 if (encoder->disable)
3290 encoder->disable(encoder);
3291 }
3292
3276 if (!intel_crtc->active) 3293 if (!intel_crtc->active)
3277 return; 3294 return;
3278 3295
@@ -3371,11 +3388,14 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
3371 struct drm_device *dev = crtc->dev; 3388 struct drm_device *dev = crtc->dev;
3372 struct drm_i915_private *dev_priv = dev->dev_private; 3389 struct drm_i915_private *dev_priv = dev->dev_private;
3373 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3390 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3391 struct intel_encoder *encoder;
3374 int pipe = intel_crtc->pipe; 3392 int pipe = intel_crtc->pipe;
3375 int plane = intel_crtc->plane; 3393 int plane = intel_crtc->plane;
3376 3394
3395 /* XXX: For compatability with the crtc helper code, call the encoder's
3396 * enable function unconditionally for now. */
3377 if (intel_crtc->active) 3397 if (intel_crtc->active)
3378 return; 3398 goto encoders;
3379 3399
3380 intel_crtc->active = true; 3400 intel_crtc->active = true;
3381 intel_update_watermarks(dev); 3401 intel_update_watermarks(dev);
@@ -3390,6 +3410,12 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
3390 /* Give the overlay scaler a chance to enable if it's on this pipe */ 3410 /* Give the overlay scaler a chance to enable if it's on this pipe */
3391 intel_crtc_dpms_overlay(intel_crtc, true); 3411 intel_crtc_dpms_overlay(intel_crtc, true);
3392 intel_crtc_update_cursor(crtc, true); 3412 intel_crtc_update_cursor(crtc, true);
3413
3414encoders:
3415 for_each_encoder_on_crtc(dev, crtc, encoder) {
3416 if (encoder->enable)
3417 encoder->enable(encoder);
3418 }
3393} 3419}
3394 3420
3395static void i9xx_crtc_disable(struct drm_crtc *crtc) 3421static void i9xx_crtc_disable(struct drm_crtc *crtc)
@@ -3397,9 +3423,17 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
3397 struct drm_device *dev = crtc->dev; 3423 struct drm_device *dev = crtc->dev;
3398 struct drm_i915_private *dev_priv = dev->dev_private; 3424 struct drm_i915_private *dev_priv = dev->dev_private;
3399 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 3425 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3426 struct intel_encoder *encoder;
3400 int pipe = intel_crtc->pipe; 3427 int pipe = intel_crtc->pipe;
3401 int plane = intel_crtc->plane; 3428 int plane = intel_crtc->plane;
3402 3429
3430 /* XXX: For compatability with the crtc helper code, call the encoder's
3431 * disable function unconditionally for now. */
3432 for_each_encoder_on_crtc(dev, crtc, encoder) {
3433 if (encoder->disable)
3434 encoder->disable(encoder);
3435 }
3436
3403 if (!intel_crtc->active) 3437 if (!intel_crtc->active)
3404 return; 3438 return;
3405 3439
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 95f635b70b5b..9a5adcc35bde 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -141,6 +141,8 @@ struct intel_encoder {
141 */ 141 */
142 bool cloneable; 142 bool cloneable;
143 void (*hot_plug)(struct intel_encoder *); 143 void (*hot_plug)(struct intel_encoder *);
144 void (*enable)(struct intel_encoder *);
145 void (*disable)(struct intel_encoder *);
144 int crtc_mask; 146 int crtc_mask;
145}; 147};
146 148