Re: [PATCH 08/20] drm/i915: Don't use encoder->new_crtc in intel_modeset_pipe_config()

Daniel Vetter
2015-03-26T16:42:45Z

On Fri, Mar 20, 2015 at 04:18:08PM +0200, Ander Conselvan de Oliveira wrote:
> Move towards atomic by using the legacy modeset's drm_atomic_state
> instead.
>
> v2: Move call to drm_atomic_add_affected_connectors() to
> intel_modeset_compute_config(). (Daniel)
>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b76726f..7851d6c 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10434,8 +10434,11 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
> {
> struct drm_device *dev = crtc->dev;
> struct intel_encoder *encoder;
> + struct intel_connector *connector;
> + struct drm_connector_state *connector_state;
> struct intel_crtc_state *pipe_config;
> int plane_bpp, ret = -EINVAL;
> + int i;
> bool retry = true;
>
> if (!check_encoder_cloning(to_intel_crtc(crtc))) {
> @@ -10509,11 +10512,17 @@ encoder_retry:
> * adjust it according to limitations or connector properties, and also
> * a chance to reject the mode entirely.
> */
> - for_each_intel_encoder(dev, encoder) {
> + for (i = 0; i < state->num_connector; i++) {
> + connector = to_intel_connector(state->connectors[i]);
> + if (!connector)
> + continue;
>
> - if (&encoder->new_crtc->base != crtc)
> + connector_state = state->connector_states[i];
> + if (connector_state->crtc != crtc)
> continue;
>
> + encoder = to_intel_encoder(connector_state->best_encoder);
> +
> if (!(encoder->compute_config(encoder, pipe_config))) {
> DRM_DEBUG_KMS("Encoder config failure\n");
> goto fail;
> @@ -11237,6 +11246,10 @@ intel_modeset_compute_config(struct drm_crtc *crtc,
> struct intel_crtc *intel_crtc;
> int ret = 0;
>
> + ret = drm_atomic_add_affected_connectors(state, crtc);

Ah, here's the usage of ret that I've missed in the first patch.
-Daniel

> + if (ret)
> + return ERR_PTR(ret);
> +
> intel_modeset_affected_pipes(crtc, modeset_pipes,
> prepare_pipes, disable_pipes);
>
> --
> 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