Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Souza, Jose" <jose.souza@intel.com>
To: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"De Marchi, Lucas" <lucas.demarchi@intel.com>
Subject: Re: [PATCH 4/5] drm/i915: avoid reading DP_TP_CTL twice
Date: Fri, 1 Nov 2019 00:39:36 +0000	[thread overview]
Message-ID: <a9300b4d8c98d8f35c60008799b1444eb736d814.camel@intel.com> (raw)
In-Reply-To: <20191030012448.14937-5-lucas.demarchi@intel.com>

On Tue, 2019-10-29 at 18:24 -0700, Lucas De Marchi wrote:
> Just avoid the additional read in case DP_TP_CTL is enabled:
> read it once and save the value.

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

> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c | 33 ++++++++++++--------
> ----
>  1 file changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 2ce998529d08..41b9b9a6772a 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4148,37 +4148,38 @@ static void
> intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp)
>  	struct drm_i915_private *dev_priv =
>  		to_i915(intel_dig_port->base.base.dev);
>  	enum port port = intel_dig_port->base.port;
> -	u32 val;
> +	u32 dp_tp_ctl, ddi_buf_ctl;
>  	bool wait = false;
>  
> -	if (I915_READ(intel_dp->regs.dp_tp_ctl) & DP_TP_CTL_ENABLE) {
> -		val = I915_READ(DDI_BUF_CTL(port));
> -		if (val & DDI_BUF_CTL_ENABLE) {
> -			val &= ~DDI_BUF_CTL_ENABLE;
> -			I915_WRITE(DDI_BUF_CTL(port), val);
> +	dp_tp_ctl = I915_READ(intel_dp->regs.dp_tp_ctl);
> +
> +	if (dp_tp_ctl & DP_TP_CTL_ENABLE) {
> +		ddi_buf_ctl = I915_READ(DDI_BUF_CTL(port));
> +		if (ddi_buf_ctl & DDI_BUF_CTL_ENABLE) {
> +			I915_WRITE(DDI_BUF_CTL(port),
> +				   ddi_buf_ctl & ~DDI_BUF_CTL_ENABLE);
>  			wait = true;
>  		}
>  
> -		val = I915_READ(intel_dp->regs.dp_tp_ctl);
> -		val &= ~(DP_TP_CTL_ENABLE | DP_TP_CTL_LINK_TRAIN_MASK);
> -		val |= DP_TP_CTL_LINK_TRAIN_PAT1;
> -		I915_WRITE(intel_dp->regs.dp_tp_ctl, val);
> +		dp_tp_ctl &= ~(DP_TP_CTL_ENABLE |
> DP_TP_CTL_LINK_TRAIN_MASK);
> +		dp_tp_ctl |= DP_TP_CTL_LINK_TRAIN_PAT1;
> +		I915_WRITE(intel_dp->regs.dp_tp_ctl, dp_tp_ctl);
>  		POSTING_READ(intel_dp->regs.dp_tp_ctl);
>  
>  		if (wait)
>  			intel_wait_ddi_buf_idle(dev_priv, port);
>  	}
>  
> -	val = DP_TP_CTL_ENABLE |
> -	      DP_TP_CTL_LINK_TRAIN_PAT1 | DP_TP_CTL_SCRAMBLE_DISABLE;
> +	dp_tp_ctl = DP_TP_CTL_ENABLE |
> +		    DP_TP_CTL_LINK_TRAIN_PAT1 |
> DP_TP_CTL_SCRAMBLE_DISABLE;
>  	if (intel_dp->link_mst)
> -		val |= DP_TP_CTL_MODE_MST;
> +		dp_tp_ctl |= DP_TP_CTL_MODE_MST;
>  	else {
> -		val |= DP_TP_CTL_MODE_SST;
> +		dp_tp_ctl |= DP_TP_CTL_MODE_SST;
>  		if (drm_dp_enhanced_frame_cap(intel_dp->dpcd))
> -			val |= DP_TP_CTL_ENHANCED_FRAME_ENABLE;
> +			dp_tp_ctl |= DP_TP_CTL_ENHANCED_FRAME_ENABLE;
>  	}
> -	I915_WRITE(intel_dp->regs.dp_tp_ctl, val);
> +	I915_WRITE(intel_dp->regs.dp_tp_ctl, dp_tp_ctl);
>  	POSTING_READ(intel_dp->regs.dp_tp_ctl);
>  
>  	intel_dp->DP |= DDI_BUF_CTL_ENABLE;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: "Souza, Jose" <jose.souza@intel.com>
To: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"De Marchi, Lucas" <lucas.demarchi@intel.com>
Subject: Re: [Intel-gfx] [PATCH 4/5] drm/i915: avoid reading DP_TP_CTL twice
Date: Fri, 1 Nov 2019 00:39:36 +0000	[thread overview]
Message-ID: <a9300b4d8c98d8f35c60008799b1444eb736d814.camel@intel.com> (raw)
Message-ID: <20191101003936.Ex-GnMKUUYSsaCnV5IMVcThG-dNOSkA9_89im0Irz3I@z> (raw)
In-Reply-To: <20191030012448.14937-5-lucas.demarchi@intel.com>

On Tue, 2019-10-29 at 18:24 -0700, Lucas De Marchi wrote:
> Just avoid the additional read in case DP_TP_CTL is enabled:
> read it once and save the value.

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

> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c | 33 ++++++++++++--------
> ----
>  1 file changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 2ce998529d08..41b9b9a6772a 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4148,37 +4148,38 @@ static void
> intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp)
>  	struct drm_i915_private *dev_priv =
>  		to_i915(intel_dig_port->base.base.dev);
>  	enum port port = intel_dig_port->base.port;
> -	u32 val;
> +	u32 dp_tp_ctl, ddi_buf_ctl;
>  	bool wait = false;
>  
> -	if (I915_READ(intel_dp->regs.dp_tp_ctl) & DP_TP_CTL_ENABLE) {
> -		val = I915_READ(DDI_BUF_CTL(port));
> -		if (val & DDI_BUF_CTL_ENABLE) {
> -			val &= ~DDI_BUF_CTL_ENABLE;
> -			I915_WRITE(DDI_BUF_CTL(port), val);
> +	dp_tp_ctl = I915_READ(intel_dp->regs.dp_tp_ctl);
> +
> +	if (dp_tp_ctl & DP_TP_CTL_ENABLE) {
> +		ddi_buf_ctl = I915_READ(DDI_BUF_CTL(port));
> +		if (ddi_buf_ctl & DDI_BUF_CTL_ENABLE) {
> +			I915_WRITE(DDI_BUF_CTL(port),
> +				   ddi_buf_ctl & ~DDI_BUF_CTL_ENABLE);
>  			wait = true;
>  		}
>  
> -		val = I915_READ(intel_dp->regs.dp_tp_ctl);
> -		val &= ~(DP_TP_CTL_ENABLE | DP_TP_CTL_LINK_TRAIN_MASK);
> -		val |= DP_TP_CTL_LINK_TRAIN_PAT1;
> -		I915_WRITE(intel_dp->regs.dp_tp_ctl, val);
> +		dp_tp_ctl &= ~(DP_TP_CTL_ENABLE |
> DP_TP_CTL_LINK_TRAIN_MASK);
> +		dp_tp_ctl |= DP_TP_CTL_LINK_TRAIN_PAT1;
> +		I915_WRITE(intel_dp->regs.dp_tp_ctl, dp_tp_ctl);
>  		POSTING_READ(intel_dp->regs.dp_tp_ctl);
>  
>  		if (wait)
>  			intel_wait_ddi_buf_idle(dev_priv, port);
>  	}
>  
> -	val = DP_TP_CTL_ENABLE |
> -	      DP_TP_CTL_LINK_TRAIN_PAT1 | DP_TP_CTL_SCRAMBLE_DISABLE;
> +	dp_tp_ctl = DP_TP_CTL_ENABLE |
> +		    DP_TP_CTL_LINK_TRAIN_PAT1 |
> DP_TP_CTL_SCRAMBLE_DISABLE;
>  	if (intel_dp->link_mst)
> -		val |= DP_TP_CTL_MODE_MST;
> +		dp_tp_ctl |= DP_TP_CTL_MODE_MST;
>  	else {
> -		val |= DP_TP_CTL_MODE_SST;
> +		dp_tp_ctl |= DP_TP_CTL_MODE_SST;
>  		if (drm_dp_enhanced_frame_cap(intel_dp->dpcd))
> -			val |= DP_TP_CTL_ENHANCED_FRAME_ENABLE;
> +			dp_tp_ctl |= DP_TP_CTL_ENHANCED_FRAME_ENABLE;
>  	}
> -	I915_WRITE(intel_dp->regs.dp_tp_ctl, val);
> +	I915_WRITE(intel_dp->regs.dp_tp_ctl, dp_tp_ctl);
>  	POSTING_READ(intel_dp->regs.dp_tp_ctl);
>  
>  	intel_dp->DP |= DDI_BUF_CTL_ENABLE;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-11-01  0:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30  1:24 [PATCH 0/5] tgl: MST support Lucas De Marchi
2019-10-30  1:24 ` [Intel-gfx] " Lucas De Marchi
2019-10-30  1:24 ` [PATCH 1/5] drm/i915: Add for_each_new_intel_connector_in_state() Lucas De Marchi
2019-10-30  1:24   ` [Intel-gfx] " Lucas De Marchi
2019-10-30  1:24 ` [PATCH 2/5] drm/i915: add wrappers to get intel connector state Lucas De Marchi
2019-10-30  1:24   ` [Intel-gfx] " Lucas De Marchi
2019-11-01  0:26   ` Souza, Jose
2019-11-01  0:26     ` [Intel-gfx] " Souza, Jose
2019-10-30  1:24 ` [PATCH 3/5] drm/i915/tgl: do not enable transcoder clock twice on MST Lucas De Marchi
2019-10-30  1:24   ` [Intel-gfx] " Lucas De Marchi
2019-11-01  0:37   ` Souza, Jose
2019-11-01  0:37     ` [Intel-gfx] " Souza, Jose
2019-10-30  1:24 ` [PATCH 4/5] drm/i915: avoid reading DP_TP_CTL twice Lucas De Marchi
2019-10-30  1:24   ` [Intel-gfx] " Lucas De Marchi
2019-11-01  0:39   ` Souza, Jose [this message]
2019-11-01  0:39     ` Souza, Jose
2019-10-30  1:24 ` [PATCH 5/5] drm/i915/tgl: Select master transcoder in DP MST Lucas De Marchi
2019-10-30  1:24   ` [Intel-gfx] " Lucas De Marchi
2019-10-30  3:24 ` ✗ Fi.CI.CHECKPATCH: warning for tgl: MST support Patchwork
2019-10-30  3:24   ` [Intel-gfx] " Patchwork
2019-10-30  3:27 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-10-30  3:27   ` [Intel-gfx] " Patchwork
2019-10-30  3:51 ` ✓ Fi.CI.BAT: success " Patchwork
2019-10-30  3:51   ` [Intel-gfx] " Patchwork
2019-10-31  8:00 ` ✓ Fi.CI.IGT: " Patchwork
2019-10-31  8:00   ` [Intel-gfx] " Patchwork
2019-11-01  0:43 ` [PATCH 0/5] " Souza, Jose
2019-11-01  0:43   ` [Intel-gfx] " Souza, Jose

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=a9300b4d8c98d8f35c60008799b1444eb736d814.camel@intel.com \
    --to=jose.souza@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@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