drm/i915: Remove usage of encoder->new_crtc from clock computations
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Fri, 20 Mar 2015 14:18:19 +0000 (16:18 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 27 Mar 2015 09:42:35 +0000 (10:42 +0100)
Some of the crtc_compute_clock() still depended on encoder->new_crtc
since they didn't use intel_pipe_will_have_type() and used an open
coded version of that function instead. This patch replaces those with
the appropriate code that checks the atomic state intead.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
[danvet: Separate the if (!connector) continue to facility easier
extraction of a loop iterator for all of these (there's lots more in
i915 and atomic helpers).]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c

index 1c4efeee13c8122a62d5f00780907d4163b6bcd8..dc9a5c1d596c2edcc0d8eb579ca883b50f9e2809 100644 (file)
@@ -6765,11 +6765,20 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc,
        bool is_lvds = false, is_dsi = false;
        struct intel_encoder *encoder;
        const intel_limit_t *limit;
+       struct drm_atomic_state *state = crtc_state->base.state;
+       struct drm_connector_state *connector_state;
+       int i;
 
-       for_each_intel_encoder(dev, encoder) {
-               if (encoder->new_crtc != crtc)
+       for (i = 0; i < state->num_connector; i++) {
+               if (!state->connectors[i])
+                       continue;
+
+               connector_state = state->connector_states[i];
+               if (connector_state->crtc != &crtc->base)
                        continue;
 
+               encoder = to_intel_encoder(connector_state->best_encoder);
+
                switch (encoder->type) {
                case INTEL_OUTPUT_LVDS:
                        is_lvds = true;
@@ -7443,18 +7452,26 @@ void intel_init_pch_refclk(struct drm_device *dev)
                lpt_init_pch_refclk(dev);
 }
 
-static int ironlake_get_refclk(struct drm_crtc *crtc)
+static int ironlake_get_refclk(struct intel_crtc_state *crtc_state)
 {
-       struct drm_device *dev = crtc->dev;
+       struct drm_device *dev = crtc_state->base.crtc->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
+       struct drm_atomic_state *state = crtc_state->base.state;
+       struct drm_connector_state *connector_state;
        struct intel_encoder *encoder;
-       int num_connectors = 0;
+       int num_connectors = 0, i;
        bool is_lvds = false;
 
-       for_each_intel_encoder(dev, encoder) {
-               if (encoder->new_crtc != to_intel_crtc(crtc))
+       for (i = 0; i < state->num_connector; i++) {
+               if (!state->connectors[i])
                        continue;
 
+               connector_state = state->connector_states[i];
+               if (connector_state->crtc != crtc_state->base.crtc)
+                       continue;
+
+               encoder = to_intel_encoder(connector_state->best_encoder);
+
                switch (encoder->type) {
                case INTEL_OUTPUT_LVDS:
                        is_lvds = true;
@@ -7647,7 +7664,7 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc,
 
        is_lvds = intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS);
 
-       refclk = ironlake_get_refclk(crtc);
+       refclk = ironlake_get_refclk(crtc_state);
 
        /*
         * Returns a set of divisors for the desired target clock with the given
@@ -7702,16 +7719,24 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,
        struct drm_crtc *crtc = &intel_crtc->base;
        struct drm_device *dev = crtc->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct intel_encoder *intel_encoder;
+       struct drm_atomic_state *state = crtc_state->base.state;
+       struct drm_connector_state *connector_state;
+       struct intel_encoder *encoder;
        uint32_t dpll;
-       int factor, num_connectors = 0;
+       int factor, num_connectors = 0, i;
        bool is_lvds = false, is_sdvo = false;
 
-       for_each_intel_encoder(dev, intel_encoder) {
-               if (intel_encoder->new_crtc != to_intel_crtc(crtc))
+       for (i = 0; i < state->num_connector; i++) {
+               if (!state->connectors[i])
                        continue;
 
-               switch (intel_encoder->type) {
+               connector_state = state->connector_states[i];
+               if (connector_state->crtc != crtc_state->base.crtc)
+                       continue;
+
+               encoder = to_intel_encoder(connector_state->best_encoder);
+
+               switch (encoder->type) {
                case INTEL_OUTPUT_LVDS:
                        is_lvds = true;
                        break;
This page took 0.034116 seconds and 5 git commands to generate.