intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Souza, Jose" <jose.souza@intel.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Readout conn_state->max_bpc
Date: Tue, 2 Mar 2021 19:02:31 +0000	[thread overview]
Message-ID: <7d698e8e544db29aac15993d90a7d59a6f2f0fb1.camel@intel.com> (raw)
In-Reply-To: <20210216160035.4780-1-ville.syrjala@linux.intel.com>

On Tue, 2021-02-16 at 18:00 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Populate conn_state->max_bpc with something sensible from the start.
> Otherwise it's possible that we get to compute_sink_pipe_bpp() with
> max_bpc==0.
> 
> The specific scenario goes as follows:
> 1. Initial connector state allocated with max_bpc==0
> 2. Trigger a modeset on the crtc feeding the connector, without
>    actually adding the connector to the commit
> 3. drm_atomic_connector_check() is skipped because the
>    connector has not yet been added, hence conn_state->max_bpc
>    retains its current value
> 4. drm_atomic_helper_check_modeset() ->
>    drm_atomic_add_affected_connectors() -> the connector
>    is now part of the commit
> 5. compute_baseline_pipe_bpp() -> MISSING_CASE(max_bpc==0)
> 
> Note that pipe_bpp itself may not be populated on pre-g4x machines,
> in which case we just fall back to max_bpc==8 and let .compute_config()
> limit the resulting pipe_bpp further if necessary.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> 
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 24 +++++++++++++-------
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 0dc5cb36667a..4d63e68a5ea2 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -7987,19 +7987,27 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
>  
> 
> 
> 
>  	drm_connector_list_iter_begin(dev, &conn_iter);
>  	for_each_intel_connector_iter(connector, &conn_iter) {
> -		if (connector->base.state->crtc)
> +		struct drm_connector_state *conn_state = connector->base.state;
> +		struct intel_encoder *encoder =
> +			to_intel_encoder(connector->base.encoder);
> +
> +		if (conn_state->crtc)
>  			drm_connector_put(&connector->base);
>  
> 
> 
> 
> -		if (connector->base.encoder) {
> -			connector->base.state->best_encoder =
> -				connector->base.encoder;
> -			connector->base.state->crtc =
> -				connector->base.encoder->crtc;
> +		if (encoder) {
> +			struct intel_crtc *crtc =
> +				to_intel_crtc(encoder->base.crtc);
> +			const struct intel_crtc_state *crtc_state =
> +				to_intel_crtc_state(crtc->base.state);
> +
> +			conn_state->best_encoder = &encoder->base;
> +			conn_state->crtc = &crtc->base;
> +			conn_state->max_bpc = (crtc_state->pipe_bpp ?: 24) / 3;
>  
> 
> 
> 
>  			drm_connector_get(&connector->base);
>  		} else {
> -			connector->base.state->best_encoder = NULL;
> -			connector->base.state->crtc = NULL;
> +			conn_state->best_encoder = NULL;
> +			conn_state->crtc = NULL;
>  		}
>  	}
>  	drm_connector_list_iter_end(&conn_iter);

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2021-03-02 19:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 16:00 [Intel-gfx] [PATCH] drm/i915: Readout conn_state->max_bpc Ville Syrjala
2021-02-16 17:25 ` Chris Wilson
2021-02-16 17:41 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-02-16 19:52 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-03-02 19:02 ` Souza, Jose [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7d698e8e544db29aac15993d90a7d59a6f2f0fb1.camel@intel.com \
    --to=jose.souza@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).