Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: Nemesa Garg <nemesa.garg@intel.com>, <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 1/2] drm/i915/display: Refactor pch_panel_fitting to use local variables for crtc dimensions
Date: Mon, 29 Jul 2024 20:13:04 +0530	[thread overview]
Message-ID: <df9d6b0a-cc31-41df-a3a4-638b5ecd7ee1@intel.com> (raw)
In-Reply-To: <20240726095357.1261804-2-nemesa.garg@intel.com>


On 7/26/2024 3:23 PM, Nemesa Garg wrote:
> Refactor pch_panel_fitting to use local variables for crtc_hdisplay
> and crtc_vdisplay. This will help to adjust the hdisplay at one place
> when big/ultra joiner is involved. Introduce local variables crtc_hdisplay
> and crtc_vdisplay and update all references to adjusted_mode->crtc_hdisplay
> and adjusted_mode->crtc_vdisplay to use the new local variables.
>
> Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>

LGTM.

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>


> ---
>   drivers/gpu/drm/i915/display/intel_panel.c | 34 ++++++++++++----------
>   1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index 71454ddef20f..dd18136d1c61 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -392,10 +392,12 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
>   	int pipe_src_w = drm_rect_width(&crtc_state->pipe_src);
>   	int pipe_src_h = drm_rect_height(&crtc_state->pipe_src);
>   	int x, y, width, height;
> +	u16 crtc_hdisplay = adjusted_mode->crtc_hdisplay;
> +	u16 crtc_vdisplay = adjusted_mode->crtc_vdisplay;
>   
>   	/* Native modes don't need fitting */
> -	if (adjusted_mode->crtc_hdisplay == pipe_src_w &&
> -	    adjusted_mode->crtc_vdisplay == pipe_src_h &&
> +	if (crtc_hdisplay == pipe_src_w &&
> +	    crtc_vdisplay == pipe_src_h &&
>   	    crtc_state->output_format != INTEL_OUTPUT_FORMAT_YCBCR420)
>   		return 0;
>   
> @@ -403,45 +405,45 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
>   	case DRM_MODE_SCALE_CENTER:
>   		width = pipe_src_w;
>   		height = pipe_src_h;
> -		x = (adjusted_mode->crtc_hdisplay - width + 1)/2;
> -		y = (adjusted_mode->crtc_vdisplay - height + 1)/2;
> +		x = (crtc_hdisplay - width + 1) / 2;
> +		y = (crtc_vdisplay - height + 1) / 2;
>   		break;
>   
>   	case DRM_MODE_SCALE_ASPECT:
>   		/* Scale but preserve the aspect ratio */
>   		{
> -			u32 scaled_width = adjusted_mode->crtc_hdisplay * pipe_src_h;
> -			u32 scaled_height = pipe_src_w * adjusted_mode->crtc_vdisplay;
> +			u32 scaled_width = crtc_hdisplay * pipe_src_h;
> +			u32 scaled_height = pipe_src_w * crtc_vdisplay;
>   			if (scaled_width > scaled_height) { /* pillar */
>   				width = scaled_height / pipe_src_h;
>   				if (width & 1)
>   					width++;
> -				x = (adjusted_mode->crtc_hdisplay - width + 1) / 2;
> +				x = (crtc_hdisplay - width + 1) / 2;
>   				y = 0;
> -				height = adjusted_mode->crtc_vdisplay;
> +				height = crtc_vdisplay;
>   			} else if (scaled_width < scaled_height) { /* letter */
>   				height = scaled_width / pipe_src_w;
>   				if (height & 1)
>   				    height++;
> -				y = (adjusted_mode->crtc_vdisplay - height + 1) / 2;
> +				y = (crtc_vdisplay - height + 1) / 2;
>   				x = 0;
> -				width = adjusted_mode->crtc_hdisplay;
> +				width = crtc_hdisplay;
>   			} else {
>   				x = y = 0;
> -				width = adjusted_mode->crtc_hdisplay;
> -				height = adjusted_mode->crtc_vdisplay;
> +				width = crtc_hdisplay;
> +				height = crtc_vdisplay;
>   			}
>   		}
>   		break;
>   
>   	case DRM_MODE_SCALE_NONE:
> -		WARN_ON(adjusted_mode->crtc_hdisplay != pipe_src_w);
> -		WARN_ON(adjusted_mode->crtc_vdisplay != pipe_src_h);
> +		WARN_ON(crtc_hdisplay != pipe_src_w);
> +		WARN_ON(crtc_vdisplay != pipe_src_h);
>   		fallthrough;
>   	case DRM_MODE_SCALE_FULLSCREEN:
>   		x = y = 0;
> -		width = adjusted_mode->crtc_hdisplay;
> -		height = adjusted_mode->crtc_vdisplay;
> +		width = crtc_hdisplay;
> +		height = crtc_vdisplay;
>   		break;
>   
>   	default:

  reply	other threads:[~2024-07-29 14:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26  9:53 [PATCH 0/2] Consider joiner calculation for panel fitting Nemesa Garg
2024-07-26  9:53 ` [PATCH 1/2] drm/i915/display: Refactor pch_panel_fitting to use local variables for crtc dimensions Nemesa Garg
2024-07-29 14:43   ` Nautiyal, Ankit K [this message]
2024-07-26  9:53 ` [PATCH 2/2] drm/i915/display: Call panel_fitting from pipe_config Nemesa Garg
2024-07-29 15:06   ` Nautiyal, Ankit K
2024-07-30  7:56   ` Jani Nikula
2024-07-30 16:20     ` Garg, Nemesa
2024-07-26 10:54 ` ✗ Fi.CI.BAT: failure for Consider joiner calculation for panel fitting Patchwork
2024-07-29  8:27 ` ✓ Fi.CI.BAT: success " Patchwork
2024-07-29 15:28 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-08-05  6:25 [PATCH 0/2] " Nemesa Garg
2024-08-05  6:25 ` [PATCH 1/2] drm/i915/display: Refactor pch_panel_fitting to use local variables for crtc dimensions Nemesa Garg
2024-08-06  3:37   ` Nautiyal, Ankit K

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=df9d6b0a-cc31-41df-a3a4-638b5ecd7ee1@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=nemesa.garg@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