Commit da3ced29 authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Daniel Vetter

drm/i915: Use for_each_connector_in_state helper macro

Simplifies looping over connector states a bit.
Signed-off-by: default avatarAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent f0c60574
...@@ -584,17 +584,18 @@ intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state) ...@@ -584,17 +584,18 @@ intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state)
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
struct intel_encoder *ret = NULL; struct intel_encoder *ret = NULL;
struct drm_atomic_state *state; struct drm_atomic_state *state;
struct drm_connector *connector;
struct drm_connector_state *connector_state;
int num_encoders = 0; int num_encoders = 0;
int i; int i;
state = crtc_state->base.state; state = crtc_state->base.state;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i] || if (connector_state->crtc != crtc_state->base.crtc)
state->connector_states[i]->crtc != crtc_state->base.crtc)
continue; continue;
ret = to_intel_encoder(state->connector_states[i]->best_encoder); ret = to_intel_encoder(connector_state->best_encoder);
num_encoders++; num_encoders++;
} }
......
...@@ -453,15 +453,12 @@ static bool intel_pipe_will_have_type(const struct intel_crtc_state *crtc_state, ...@@ -453,15 +453,12 @@ static bool intel_pipe_will_have_type(const struct intel_crtc_state *crtc_state,
int type) int type)
{ {
struct drm_atomic_state *state = crtc_state->base.state; struct drm_atomic_state *state = crtc_state->base.state;
struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
struct intel_encoder *encoder; struct intel_encoder *encoder;
int i, num_connectors = 0; int i, num_connectors = 0;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i])
continue;
connector_state = state->connector_states[i];
if (connector_state->crtc != crtc_state->base.crtc) if (connector_state->crtc != crtc_state->base.crtc)
continue; continue;
...@@ -7461,14 +7458,11 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc, ...@@ -7461,14 +7458,11 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc,
struct intel_encoder *encoder; struct intel_encoder *encoder;
const intel_limit_t *limit; const intel_limit_t *limit;
struct drm_atomic_state *state = crtc_state->base.state; struct drm_atomic_state *state = crtc_state->base.state;
struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
int i; int i;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i])
continue;
connector_state = state->connector_states[i];
if (connector_state->crtc != &crtc->base) if (connector_state->crtc != &crtc->base)
continue; continue;
...@@ -8152,16 +8146,13 @@ static int ironlake_get_refclk(struct intel_crtc_state *crtc_state) ...@@ -8152,16 +8146,13 @@ static int ironlake_get_refclk(struct intel_crtc_state *crtc_state)
struct drm_device *dev = crtc_state->base.crtc->dev; struct drm_device *dev = crtc_state->base.crtc->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_atomic_state *state = crtc_state->base.state; struct drm_atomic_state *state = crtc_state->base.state;
struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
struct intel_encoder *encoder; struct intel_encoder *encoder;
int num_connectors = 0, i; int num_connectors = 0, i;
bool is_lvds = false; bool is_lvds = false;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i])
continue;
connector_state = state->connector_states[i];
if (connector_state->crtc != crtc_state->base.crtc) if (connector_state->crtc != crtc_state->base.crtc)
continue; continue;
...@@ -8415,17 +8406,14 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc, ...@@ -8415,17 +8406,14 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_atomic_state *state = crtc_state->base.state; struct drm_atomic_state *state = crtc_state->base.state;
struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
struct intel_encoder *encoder; struct intel_encoder *encoder;
uint32_t dpll; uint32_t dpll;
int factor, num_connectors = 0, i; int factor, num_connectors = 0, i;
bool is_lvds = false, is_sdvo = false; bool is_lvds = false, is_sdvo = false;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i])
continue;
connector_state = state->connector_states[i];
if (connector_state->crtc != crtc_state->base.crtc) if (connector_state->crtc != crtc_state->base.crtc)
continue; continue;
...@@ -11149,7 +11137,8 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, ...@@ -11149,7 +11137,8 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
{ {
struct drm_device *dev = crtc->base.dev; struct drm_device *dev = crtc->base.dev;
struct drm_atomic_state *state; struct drm_atomic_state *state;
struct intel_connector *connector; struct drm_connector *connector;
struct drm_connector_state *connector_state;
int bpp, i; int bpp, i;
if ((IS_G4X(dev) || IS_VALLEYVIEW(dev))) if ((IS_G4X(dev) || IS_VALLEYVIEW(dev)))
...@@ -11165,15 +11154,12 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc, ...@@ -11165,15 +11154,12 @@ compute_baseline_pipe_bpp(struct intel_crtc *crtc,
state = pipe_config->base.state; state = pipe_config->base.state;
/* Clamp display bpp to EDID value */ /* Clamp display bpp to EDID value */
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i]) if (connector_state->crtc != &crtc->base)
continue;
connector = to_intel_connector(state->connectors[i]);
if (state->connector_states[i]->crtc != &crtc->base)
continue; continue;
connected_sink_compute_bpp(connector, pipe_config); connected_sink_compute_bpp(to_intel_connector(connector),
pipe_config);
} }
return bpp; return bpp;
...@@ -11300,14 +11286,11 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state, ...@@ -11300,14 +11286,11 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state,
struct intel_encoder *encoder) struct intel_encoder *encoder)
{ {
struct intel_encoder *source_encoder; struct intel_encoder *source_encoder;
struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
int i; int i;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i])
continue;
connector_state = state->connector_states[i];
if (connector_state->crtc != &crtc->base) if (connector_state->crtc != &crtc->base)
continue; continue;
...@@ -11324,14 +11307,11 @@ static bool check_encoder_cloning(struct drm_atomic_state *state, ...@@ -11324,14 +11307,11 @@ static bool check_encoder_cloning(struct drm_atomic_state *state,
struct intel_crtc *crtc) struct intel_crtc *crtc)
{ {
struct intel_encoder *encoder; struct intel_encoder *encoder;
struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
int i; int i;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i])
continue;
connector_state = state->connector_states[i];
if (connector_state->crtc != &crtc->base) if (connector_state->crtc != &crtc->base)
continue; continue;
...@@ -11347,6 +11327,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state) ...@@ -11347,6 +11327,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)
{ {
struct drm_device *dev = state->dev; struct drm_device *dev = state->dev;
struct intel_encoder *encoder; struct intel_encoder *encoder;
struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
unsigned int used_ports = 0; unsigned int used_ports = 0;
int i; int i;
...@@ -11356,11 +11337,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state) ...@@ -11356,11 +11337,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)
* list to detect the problem on ddi platforms * list to detect the problem on ddi platforms
* where there's just one encoder per digital port. * where there's just one encoder per digital port.
*/ */
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i])
continue;
connector_state = state->connector_states[i];
if (!connector_state->best_encoder) if (!connector_state->best_encoder)
continue; continue;
...@@ -11411,7 +11388,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc, ...@@ -11411,7 +11388,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
struct drm_atomic_state *state) struct drm_atomic_state *state)
{ {
struct intel_encoder *encoder; struct intel_encoder *encoder;
struct intel_connector *connector; struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
struct intel_crtc_state *pipe_config; struct intel_crtc_state *pipe_config;
int base_bpp, ret = -EINVAL; int base_bpp, ret = -EINVAL;
...@@ -11489,12 +11466,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc, ...@@ -11489,12 +11466,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
* adjust it according to limitations or connector properties, and also * adjust it according to limitations or connector properties, and also
* a chance to reject the mode entirely. * a chance to reject the mode entirely.
*/ */
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
connector = to_intel_connector(state->connectors[i]);
if (!connector)
continue;
connector_state = state->connector_states[i];
if (connector_state->crtc != crtc) if (connector_state->crtc != crtc)
continue; continue;
......
...@@ -40,7 +40,9 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, ...@@ -40,7 +40,9 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
int bpp, i; int bpp, i;
int lane_count, slots, rate; int lane_count, slots, rate;
struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
struct intel_connector *found = NULL; struct drm_connector *drm_connector;
struct intel_connector *connector, *found = NULL;
struct drm_connector_state *connector_state;
int mst_pbn; int mst_pbn;
pipe_config->dp_encoder_is_mst = true; pipe_config->dp_encoder_is_mst = true;
...@@ -70,12 +72,11 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, ...@@ -70,12 +72,11 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
state = pipe_config->base.state; state = pipe_config->base.state;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, drm_connector, connector_state, i) {
if (!state->connectors[i]) connector = to_intel_connector(drm_connector);
continue;
if (state->connector_states[i]->best_encoder == &encoder->base) { if (connector_state->best_encoder == &encoder->base) {
found = to_intel_connector(state->connectors[i]); found = connector;
break; break;
} }
} }
......
...@@ -964,6 +964,7 @@ static bool hdmi_12bpc_possible(struct intel_crtc_state *crtc_state) ...@@ -964,6 +964,7 @@ static bool hdmi_12bpc_possible(struct intel_crtc_state *crtc_state)
struct drm_device *dev = crtc_state->base.crtc->dev; struct drm_device *dev = crtc_state->base.crtc->dev;
struct drm_atomic_state *state; struct drm_atomic_state *state;
struct intel_encoder *encoder; struct intel_encoder *encoder;
struct drm_connector *connector;
struct drm_connector_state *connector_state; struct drm_connector_state *connector_state;
int count = 0, count_hdmi = 0; int count = 0, count_hdmi = 0;
int i; int i;
...@@ -973,11 +974,7 @@ static bool hdmi_12bpc_possible(struct intel_crtc_state *crtc_state) ...@@ -973,11 +974,7 @@ static bool hdmi_12bpc_possible(struct intel_crtc_state *crtc_state)
state = crtc_state->base.state; state = crtc_state->base.state;
for (i = 0; i < state->num_connector; i++) { for_each_connector_in_state(state, connector, connector_state, i) {
if (!state->connectors[i])
continue;
connector_state = state->connector_states[i];
if (connector_state->crtc != crtc_state->base.crtc) if (connector_state->crtc != crtc_state->base.crtc)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment