From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Nemesa Garg <nemesa.garg@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/pfit: Prevent negative coordinates in center mode
Date: Wed, 1 Apr 2026 23:40:41 +0300 [thread overview]
Message-ID: <ac2CyZQA9ku8jk78@intel.com> (raw)
In-Reply-To: <20260331181656.77300-1-nemesa.garg@intel.com>
On Tue, Mar 31, 2026 at 11:46:56PM +0530, Nemesa Garg wrote:
> When the pipe_src width or height are greater than adjusted_mode hdisplay
> and vdisplay, computed x and y offsets for center mode can be negative.
> Writing negative values into the pch_fit registers result in a state error.
> Add a check to clamp these values so that they are never negative.
>
> v2: Compare in terms of pipe_src width and height.[Ville]
>
> Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_pfit.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_pfit.c b/drivers/gpu/drm/i915/display/intel_pfit.c
> index 6dda496190e0..0edd29eef6ad 100644
> --- a/drivers/gpu/drm/i915/display/intel_pfit.c
> +++ b/drivers/gpu/drm/i915/display/intel_pfit.c
> @@ -186,6 +186,7 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
> const struct drm_connector_state *conn_state)
> {
> struct intel_display *display = to_intel_display(crtc_state);
> + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> const struct drm_display_mode *adjusted_mode =
> &crtc_state->hw.adjusted_mode;
> int pipe_src_w = drm_rect_width(&crtc_state->pipe_src);
> @@ -200,6 +201,16 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
>
> switch (conn_state->scaling_mode) {
> case DRM_MODE_SCALE_CENTER:
> + if (adjusted_mode->crtc_hdisplay < pipe_src_w ||
> + adjusted_mode->crtc_vdisplay < pipe_src_h) {
> + drm_dbg_kms(display->drm,
> + "[CRTC:%d:%s] pfit center mode source (%dx%d) exceeds display (%dx%d)\n",
> + crtc->base.base.id, crtc->base.name,
> + width, height,
These should should be pipe_src_* as well.
> + adjusted_mode->crtc_hdisplay,
> + adjusted_mode->crtc_vdisplay);
> + return -EINVAL;
> + }
> width = pipe_src_w;
> height = pipe_src_h;
> x = (adjusted_mode->crtc_hdisplay - width + 1)/2;
> --
> 2.25.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-04-01 20:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 18:16 [PATCH] drm/i915/pfit: Prevent negative coordinates in center mode Nemesa Garg
2026-03-31 19:16 ` ✓ i915.CI.BAT: success for drm/i915/pfit: Prevent negative coordinates in center mode (rev2) Patchwork
2026-03-31 20:07 ` ✓ CI.KUnit: " Patchwork
2026-03-31 20:51 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-01 2:59 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-01 10:11 ` ✗ i915.CI.Full: " Patchwork
2026-04-01 20:40 ` Ville Syrjälä [this message]
2026-04-07 3:49 ` [PATCH] drm/i915/pfit: Prevent negative coordinates in center mode kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2026-04-02 6:13 Nemesa Garg
2026-04-07 15:39 ` Ville Syrjälä
2026-03-31 17:40 Nemesa Garg
2026-03-31 18:01 ` Ville Syrjälä
2026-03-31 18:24 ` Garg, Nemesa
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=ac2CyZQA9ku8jk78@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@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 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.