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: Tue, 6 Aug 2024 09:07:19 +0530 [thread overview]
Message-ID: <7fc2752e-3662-4355-a585-214320955f4b@intel.com> (raw)
In-Reply-To: <20240805062538.1844291-2-nemesa.garg@intel.com>
On 8/5/2024 11:55 AM, 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>
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:
next prev parent reply other threads:[~2024-08-06 3:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 6:25 [PATCH 0/2] Consider joiner calculation for panel fitting 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 [this message]
2024-08-05 6:25 ` [PATCH 2/2] drm/i915/display: Call panel_fitting from pipe_config Nemesa Garg
2024-08-06 3:35 ` Nautiyal, Ankit K
2024-08-08 4:54 ` Nemesa Garg
2024-08-13 5:18 ` Nautiyal, Ankit K
2024-08-13 7:52 ` Jani Nikula
2024-09-09 6:21 ` Garg, Nemesa
2024-09-09 14:08 ` Ville Syrjälä
2024-08-05 7:04 ` ✓ Fi.CI.BAT: success for Consider joiner calculation for panel fitting (rev2) Patchwork
2024-08-05 17:45 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-08-08 5:58 ` ✓ Fi.CI.BAT: success for Consider joiner calculation for panel fitting (rev3) Patchwork
2024-08-08 8:11 ` ✗ Fi.CI.IGT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
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
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=7fc2752e-3662-4355-a585-214320955f4b@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