All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Lyude Paul <lyude@redhat.com>
Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	stable@vger.kernel.org,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/5] drm/i915: Skip vcpi allocation for MSTB ports that are gone
Date: Fri, 5 Oct 2018 09:26:45 +0200	[thread overview]
Message-ID: <20181005072645.GW31561@phenom.ffwll.local> (raw)
In-Reply-To: <20181005002956.7317-5-lyude@redhat.com>

On Thu, Oct 04, 2018 at 08:29:53PM -0400, Lyude Paul wrote:
> Since we need to be able to allow DPMS on->off prop changes after an MST
> port has disappeared from the system, we need to be able to make sure we
> can compute a config for the resulting atomic commit. Currently this is
> impossible when the port has disappeared, since the VCPI slot searching
> we try to do in intel_dp_mst_compute_config() will fail with -EINVAL.
> 
> Since the only commits we want to allow on no-longer-present MST ports
> are ones that shut off display hardware, we already know that no VCPI
> allocations are needed. So, hardcode the VCPI slot count to 0 when
> intel_dp_mst_compute_config() is called on an MST port that's gone.
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: stable@vger.kernel.org
> ---
>  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 fcb9b87b9339..a366f32b048a 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -42,7 +42,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  		to_intel_connector(conn_state->connector);
>  	struct drm_atomic_state *state = pipe_config->base.state;
>  	int bpp;
> -	int lane_count, slots;
> +	int lane_count, slots = 0;
>  	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
>  	int mst_pbn;
>  	bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc,
> @@ -76,11 +76,16 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  	mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp);
>  	pipe_config->pbn = mst_pbn;
>  
> -	slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr,
> -					      connector->port, mst_pbn);
> -	if (slots < 0) {
> -		DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots);
> -		return false;
> +	if (!connector->mst_port_gone) {

Wondered why you don't need this for nouveau/amdgpu, but a bit of grepping
later says they don't even bother to check that in their atomic_check
functions. So if a multi-stream cable runs out of vcpi slots, they just
toss up their hands, atomic be damned :-(

With the s/mst_port_gone/READ_ONCE(!conn->registered)/ bikeshed:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

I wondered a bit whether ths fuction shouldn't just return 0 if the
connector is gone, but we'd need to audit/fix other drivers first.
-Daniel

> +		slots = drm_dp_atomic_find_vcpi_slots(state,
> +						      &intel_dp->mst_mgr,
> +						      connector->port,
> +						      mst_pbn);
> +		if (slots < 0) {
> +			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
> +				      slots);
> +			return false;
> +		}
>  	}
>  
>  	intel_link_compute_m_n(bpp, lane_count,
> -- 
> 2.17.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
To: Lyude Paul <lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Joonas Lahtinen
	<joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Rodrigo Vivi
	<rodrigo.vivi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Jani Nikula <jani.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: Re: [PATCH v4 4/5] drm/i915: Skip vcpi allocation for MSTB ports that are gone
Date: Fri, 5 Oct 2018 09:26:45 +0200	[thread overview]
Message-ID: <20181005072645.GW31561@phenom.ffwll.local> (raw)
In-Reply-To: <20181005002956.7317-5-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Thu, Oct 04, 2018 at 08:29:53PM -0400, Lyude Paul wrote:
> Since we need to be able to allow DPMS on->off prop changes after an MST
> port has disappeared from the system, we need to be able to make sure we
> can compute a config for the resulting atomic commit. Currently this is
> impossible when the port has disappeared, since the VCPI slot searching
> we try to do in intel_dp_mst_compute_config() will fail with -EINVAL.
> 
> Since the only commits we want to allow on no-longer-present MST ports
> are ones that shut off display hardware, we already know that no VCPI
> allocations are needed. So, hardcode the VCPI slot count to 0 when
> intel_dp_mst_compute_config() is called on an MST port that's gone.
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: stable@vger.kernel.org
> ---
>  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 fcb9b87b9339..a366f32b048a 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -42,7 +42,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  		to_intel_connector(conn_state->connector);
>  	struct drm_atomic_state *state = pipe_config->base.state;
>  	int bpp;
> -	int lane_count, slots;
> +	int lane_count, slots = 0;
>  	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
>  	int mst_pbn;
>  	bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc,
> @@ -76,11 +76,16 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  	mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp);
>  	pipe_config->pbn = mst_pbn;
>  
> -	slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr,
> -					      connector->port, mst_pbn);
> -	if (slots < 0) {
> -		DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots);
> -		return false;
> +	if (!connector->mst_port_gone) {

Wondered why you don't need this for nouveau/amdgpu, but a bit of grepping
later says they don't even bother to check that in their atomic_check
functions. So if a multi-stream cable runs out of vcpi slots, they just
toss up their hands, atomic be damned :-(

With the s/mst_port_gone/READ_ONCE(!conn->registered)/ bikeshed:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

I wondered a bit whether ths fuction shouldn't just return 0 if the
connector is gone, but we'd need to audit/fix other drivers first.
-Daniel

> +		slots = drm_dp_atomic_find_vcpi_slots(state,
> +						      &intel_dp->mst_mgr,
> +						      connector->port,
> +						      mst_pbn);
> +		if (slots < 0) {
> +			DRM_DEBUG_KMS("failed finding vcpi slots:%d\n",
> +				      slots);
> +			return false;
> +		}
>  	}
>  
>  	intel_link_compute_m_n(bpp, lane_count,
> -- 
> 2.17.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

  reply	other threads:[~2018-10-05  7:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05  0:29 [PATCH v4 0/5] Fix legacy DPMS changes with MST Lyude Paul
2018-10-05  0:29 ` Lyude Paul
2018-10-05  0:29 ` [PATCH v4 1/5] drm/atomic_helper: Disallow new modesets on unregistered connectors Lyude Paul
2018-10-05  7:13   ` Daniel Vetter
2018-10-05  0:29 ` [PATCH v4 2/5] drm/nouveau: Fix nv50_mstc->best_encoder() Lyude Paul
2018-10-05  7:14   ` Daniel Vetter
2018-10-05  7:14     ` Daniel Vetter
2018-10-05  0:29 ` [PATCH v4 3/5] drm/i915: Leave intel_conn->mst_port set, use mst_port_gone instead Lyude Paul
2018-10-05  7:20   ` Daniel Vetter
2018-10-05  7:20     ` Daniel Vetter
2018-10-05  0:29 ` [PATCH v4 4/5] drm/i915: Skip vcpi allocation for MSTB ports that are gone Lyude Paul
2018-10-05  7:26   ` Daniel Vetter [this message]
2018-10-05  7:26     ` Daniel Vetter
2018-10-05  0:29 ` [PATCH v4 5/5] drm/i915: Fix intel_dp_mst_best_encoder() Lyude Paul
2018-10-05  7:28   ` Daniel Vetter
2018-10-05  0:36 ` ✗ Fi.CI.BAT: failure for Fix legacy DPMS changes with MST (rev4) Patchwork

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=20181005072645.GW31561@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.