Commit 253c84c8 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Add output_types bitmask into the crtc state

Rather than looping through encoders to see which encoder types
are being driven by the pipe, add an output_types bitmask into
the crtc state and populate it prior to compute_config and during
state readout.

v2: Determine output_types before .compute_config() hooks are called
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1466621833-5054-4-git-send-email-ville.syrjala@linux.intel.com
parent 5aa56969
...@@ -535,14 +535,7 @@ needs_modeset(struct drm_crtc_state *state) ...@@ -535,14 +535,7 @@ needs_modeset(struct drm_crtc_state *state)
*/ */
bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type) bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type)
{ {
struct drm_device *dev = crtc->base.dev; return crtc->config->output_types & (1 << type);
struct intel_encoder *encoder;
for_each_encoder_on_crtc(dev, &crtc->base, encoder)
if (encoder->type == type)
return true;
return false;
} }
/** /**
...@@ -552,28 +545,9 @@ bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type) ...@@ -552,28 +545,9 @@ bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type)
* encoder->crtc. * encoder->crtc.
*/ */
static bool intel_pipe_will_have_type(const struct intel_crtc_state *crtc_state, static bool intel_pipe_will_have_type(const struct intel_crtc_state *crtc_state,
int type) enum intel_output_type type)
{ {
struct drm_atomic_state *state = crtc_state->base.state; return crtc_state->output_types & (1 << type);
struct drm_connector *connector;
struct drm_connector_state *connector_state;
struct intel_encoder *encoder;
int i, num_connectors = 0;
for_each_connector_in_state(state, connector, connector_state, i) {
if (connector_state->crtc != crtc_state->base.crtc)
continue;
num_connectors++;
encoder = to_intel_encoder(connector_state->best_encoder);
if (encoder->type == type)
return true;
}
WARN_ON(num_connectors == 0);
return false;
} }
/* /*
...@@ -12544,6 +12518,19 @@ intel_modeset_pipe_config(struct drm_crtc *crtc, ...@@ -12544,6 +12518,19 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
&pipe_config->pipe_src_w, &pipe_config->pipe_src_w,
&pipe_config->pipe_src_h); &pipe_config->pipe_src_h);
for_each_connector_in_state(state, connector, connector_state, i) {
if (connector_state->crtc != crtc)
continue;
encoder = to_intel_encoder(connector_state->best_encoder);
/*
* Determine output_types before calling the .compute_config()
* hooks so that the hooks can use this information safely.
*/
pipe_config->output_types |= 1 << encoder->type;
}
encoder_retry: encoder_retry:
/* Ensure the port clock defaults are reset when retrying. */ /* Ensure the port clock defaults are reset when retrying. */
pipe_config->port_clock = 0; pipe_config->port_clock = 0;
...@@ -12842,6 +12829,7 @@ intel_pipe_config_compare(struct drm_device *dev, ...@@ -12842,6 +12829,7 @@ intel_pipe_config_compare(struct drm_device *dev,
PIPE_CONF_CHECK_M_N_ALT(dp_m_n, dp_m2_n2); PIPE_CONF_CHECK_M_N_ALT(dp_m_n, dp_m2_n2);
PIPE_CONF_CHECK_I(has_dsi_encoder); PIPE_CONF_CHECK_I(has_dsi_encoder);
PIPE_CONF_CHECK_X(output_types);
PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hdisplay); PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hdisplay);
PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_htotal); PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_htotal);
...@@ -13109,9 +13097,11 @@ verify_crtc_state(struct drm_crtc *crtc, ...@@ -13109,9 +13097,11 @@ verify_crtc_state(struct drm_crtc *crtc,
"Encoder connected to wrong pipe %c\n", "Encoder connected to wrong pipe %c\n",
pipe_name(pipe)); pipe_name(pipe));
if (active) if (active) {
pipe_config->output_types |= 1 << encoder->type;
encoder->get_config(encoder, pipe_config); encoder->get_config(encoder, pipe_config);
} }
}
if (!new_crtc_state->active) if (!new_crtc_state->active)
return; return;
...@@ -16075,6 +16065,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) ...@@ -16075,6 +16065,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
if (encoder->get_hw_state(encoder, &pipe)) { if (encoder->get_hw_state(encoder, &pipe)) {
crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
encoder->base.crtc = &crtc->base; encoder->base.crtc = &crtc->base;
crtc->config->output_types |= 1 << encoder->type;
encoder->get_config(encoder, crtc->config); encoder->get_config(encoder, crtc->config);
} else { } else {
encoder->base.crtc = NULL; encoder->base.crtc = NULL;
......
...@@ -529,6 +529,11 @@ struct intel_crtc_state { ...@@ -529,6 +529,11 @@ struct intel_crtc_state {
/* DSI has special cases */ /* DSI has special cases */
bool has_dsi_encoder; bool has_dsi_encoder;
/* Bitmask of encoder types (enum intel_output_type)
* driven by the pipe.
*/
unsigned int output_types;
/* Whether we should send NULL infoframes. Required for audio. */ /* Whether we should send NULL infoframes. Required for audio. */
bool has_hdmi_sink; bool has_hdmi_sink;
......
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