drm/i915: use staged outuput config in tv->mode_fixup
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 8 Jul 2012 17:41:43 +0000 (19:41 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 6 Sep 2012 06:20:31 +0000 (08:20 +0200)
The "is this encoder cloned" check will be reused by the lvds encoder,
hence exract it.

v2: Be a bit more careful about that we need to check the new, staged
ouput configuration in the check_non_cloned helper ...

v3: Kill the double negation with s/!non_cloned/is_cloned/, suggested
by Jesse Barnes.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_tv.c

index c8fb9268fad7c02c0703f1bf668b89f65bd0e96d..3eec29c75d2e2a4dafafa28439e5d94019715ed8 100644 (file)
@@ -6563,6 +6563,28 @@ static struct drm_crtc_helper_funcs intel_helper_funcs = {
        .disable = intel_crtc_disable,
 };
 
+bool intel_encoder_check_is_cloned(struct intel_encoder *encoder)
+{
+       struct intel_encoder *other_encoder;
+       struct drm_crtc *crtc = &encoder->new_crtc->base;
+
+       if (WARN_ON(!crtc))
+               return false;
+
+       list_for_each_entry(other_encoder,
+                           &crtc->dev->mode_config.encoder_list,
+                           base.head) {
+
+               if (&other_encoder->new_crtc->base != crtc ||
+                   encoder == other_encoder)
+                       continue;
+               else
+                       return true;
+       }
+
+       return false;
+}
+
 static bool intel_encoder_crtc_ok(struct drm_encoder *encoder,
                                  struct drm_crtc *crtc)
 {
index 1aa0b9c0a4d59511d332add2037e57f4f54978c6..8686f47f68296154cda36cb197df4d758f60d502 100644 (file)
@@ -454,6 +454,7 @@ extern void intel_crtc_update_dpms(struct drm_crtc *crtc);
 extern void intel_encoder_disable(struct drm_encoder *encoder);
 extern void intel_encoder_destroy(struct drm_encoder *encoder);
 extern void intel_encoder_dpms(struct intel_encoder *encoder, int mode);
+extern bool intel_encoder_check_is_cloned(struct intel_encoder *encoder);
 extern void intel_connector_dpms(struct drm_connector *, int mode);
 extern bool intel_connector_get_hw_state(struct intel_connector *connector);
 extern void intel_connector_check_state(struct intel_connector *);
index 98ad7fdb36667d4d3f25e20781b6e9e02e9f246b..003ef9e92804f2c7e9c13e7722475802f6f39b28 100644 (file)
@@ -910,17 +910,14 @@ intel_tv_mode_fixup(struct drm_encoder *encoder,
                    const struct drm_display_mode *mode,
                    struct drm_display_mode *adjusted_mode)
 {
-       struct drm_device *dev = encoder->dev;
        struct intel_tv *intel_tv = enc_to_intel_tv(encoder);
        const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv);
-       struct intel_encoder *other_encoder;
 
        if (!tv_mode)
                return false;
 
-       for_each_encoder_on_crtc(dev, encoder->crtc, other_encoder)
-               if (&other_encoder->base != encoder)
-                       return false;
+       if (intel_encoder_check_is_cloned(&intel_tv->base))
+               return false;
 
        adjusted_mode->clock = tv_mode->clock;
        return true;