Re: [PATCH 13/20] drm/i915: Don't use staged config in intel_dp_mst_compute_config()

Daniel Vetter
2015-03-26T16:58:16Z

On Fri, Mar 20, 2015 at 04:18:13PM +0200, Ander Conselvan de Oliveira wrote:
> Move towards atomic by using the legacy modeset's drm_atomic_state
> instead.
>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> ---
> drivers/gpu/drm/i915/intel_dp_mst.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 5c06a06..b132fe6 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -36,11 +36,11 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
> struct intel_digital_port *intel_dig_port = intel_mst->primary;
> struct intel_dp *intel_dp = &intel_dig_port->dp;
> - struct drm_device *dev = encoder->base.dev;
> - int bpp;
> + struct drm_atomic_state *state;
> + int bpp, i;
> int lane_count, slots;
> struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
> - struct intel_connector *found = NULL, *intel_connector;
> + struct intel_connector *found = NULL;
> int mst_pbn;
>
> pipe_config->dp_encoder_is_mst = true;
> @@ -58,9 +58,14 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> pipe_config->pipe_bpp = 24;
> pipe_config->port_clock = drm_dp_bw_code_to_link_rate(intel_dp->link_bw);
>
> - for_each_intel_connector(dev, intel_connector) {
> - if (intel_connector->new_encoder == encoder) {
> - found = intel_connector;
> + state = pipe_config->base.state;
> +
> + for (i = 0; i < state->num_connector; i++) {
> + if (!state->connectors[i])
> + continue;
> +
> + if (state->connector_states[i]->best_encoder == &encoder->base) {
> + found = to_intel_connector(state->connectors[i]);

A helper to look up the connector/connector_state for a given encoder
might be useful in general. We also need that for the ddi personality fun,
and I guess a bunch of other places where we have loops just because our
logic is based on encoders but atomic states are attached to encoders.

Not sure if it's worth it thought.
-Daniel

> break;
> }
> }
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation