Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [RFC v4 1/6] drm/i915/dp: Add a config function for YCBCR420 outputs
Date: Wed, 6 Mar 2019 22:52:37 +0200	[thread overview]
Message-ID: <20190306205237.GQ3888@intel.com> (raw)
In-Reply-To: <20190306193102.306-2-gwan-gyeong.mun@intel.com>

On Wed, Mar 06, 2019 at 09:30:57PM +0200, Gwan-gyeong Mun wrote:
> This patch checks a support of YCBCR420 outputs on an encoder level.
> If the input mode is YCBCR420-only mode then it prepares DP as an YCBCR420
> output, else it continues with RGB output mode.
> It set output_format to INTEL_OUTPUT_FORMAT_YCBCR420 in order to using
> a pipe scaler as RGB to YCbCr 4:4:4.
> 
> v2:
>   Addressed review comments from Ville.
>   Style fixed with few naming.
>   %s/config/crtc_state/
>   %s/intel_crtc/crtc/
>   If lscon is active, it makes not to call intel_dp_ycbcr420_config()
>   to avoid to clobber of lspcon_ycbcr420_config() routine.
>   And it move the 420_only check into the intel_dp_ycbcr420_config().
> 
> v3: Fix uninitialized return value and it is reported by Dan Carpenter.
> 
> Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 39 ++++++++++++++++++++++++++++++++-
>  1 file changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index e1a051c0fbfe..882afba6e0f1 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2104,6 +2104,38 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  	return 0;
>  }
>  
> +static int
> +intel_dp_ycbcr420_config(struct drm_connector *connector,
> +			 struct intel_crtc_state *crtc_state)
> +{
> +	const struct drm_display_info *info = &connector->display_info;
> +	const struct drm_display_mode *adjusted_mode =
> +		&crtc_state->base.adjusted_mode;
> +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> +	int ret;
> +
> +	if (drm_mode_is_420_only(info, adjusted_mode) &&
> +	    connector->ycbcr_420_allowed) {

I would invert this into an early return. That way we avoid the
extra indentation for the rest of the function.

> +		crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
> +
> +		/* YCBCR 420 output conversion needs a scaler */
> +		ret = skl_update_scaler_crtc(crtc_state);
> +		if (ret) {
> +			DRM_DEBUG_KMS("Scaler allocation for output failed\n");
> +			goto err;
> +		}
> +
> +		intel_pch_panel_fitting(crtc, crtc_state,
> +					DRM_MODE_SCALE_FULLSCREEN);
> +	}
> +
> +	return 0;
> +
> +err:
> +	DRM_ERROR("Can't support YCBCR420 output\n");

Remove the error print. That is user triggerable which means
no errors prints allowed. And we already have the debug print.

> +	return ret;
> +}
> +
>  int
>  intel_dp_compute_config(struct intel_encoder *encoder,
>  			struct intel_crtc_state *pipe_config,
> @@ -2120,7 +2152,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  		to_intel_digital_connector_state(conn_state);
>  	bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
>  					   DP_DPCD_QUIRK_CONSTANT_N);
> -	int ret;
> +	int ret = 0;
>  
>  	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
>  		pipe_config->has_pch_encoder = true;
> @@ -2128,6 +2160,11 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
>  	if (lspcon->active)
>  		lspcon_ycbcr420_config(&intel_connector->base, pipe_config);
> +	else
> +		ret = intel_dp_ycbcr420_config(&intel_connector->base, pipe_config);
> +
> +	if (ret)
> +		return ret;
>  
>  	pipe_config->has_drrs = false;
>  	if (IS_G4X(dev_priv) || port == PORT_A)
> -- 
> 2.21.0

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

  reply	other threads:[~2019-03-06 20:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 19:30 [RFC v4 0/6] drm/i915/dp: Preliminary support for DP YCbCr4:2:0 outputs Gwan-gyeong Mun
2019-03-06 19:30 ` [RFC v4 1/6] drm/i915/dp: Add a config function for YCBCR420 outputs Gwan-gyeong Mun
2019-03-06 20:52   ` Ville Syrjälä [this message]
2019-03-07 20:29     ` Mun, Gwan-gyeong
2019-03-06 19:30 ` [RFC v4 2/6] drm: Add a VSC structure for handling Pixel Encoding/Colorimetry Formats Gwan-gyeong Mun
2019-03-06 19:30 ` [RFC v4 3/6] drm/i915/dp: Program VSC Header and DB for Pixel Encoding/Colorimetry Format Gwan-gyeong Mun
2019-03-06 19:31 ` [RFC v4 4/6] drm/i915/dp: Add a support of YCBCR 4:2:0 to DP MSA Gwan-gyeong Mun
2019-03-06 19:31 ` [RFC v4 5/6] drm/i915/dp: Change a link bandwidth computation for DP YCbCr 4:2:0 output Gwan-gyeong Mun
2019-03-06 21:04   ` Ville Syrjälä
2019-03-07 20:31     ` Mun, Gwan-gyeong
2019-03-06 19:31 ` [RFC v4 6/6] drm/i915/dp: Support DP ports YUV 4:2:0 output to GEN11 Gwan-gyeong Mun
2019-03-06 20:12 ` ✓ Fi.CI.BAT: success for drm/i915/dp: Preliminary support for DP YCbCr4:2:0 outputs (rev4) Patchwork
2019-03-06 22:03 ` ✓ Fi.CI.IGT: " 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=20190306205237.GQ3888@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox