Skip to content

Commit

Permalink
drm/i915: Remove usage of encoder->new_crtc from clock computations
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ander Conselvan de Oliveira authored and Daniel Vetter committed Mar 27, 2015
1 parent 723f9aa commit 55bb999
Showing 1 changed file with 38 additions and 13 deletions.
51 changes: 38 additions & 13 deletions drivers/gpu/drm/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 55bb999

Please sign in to comment.