Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Austin Hu" <austin.hu@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v4 2/3] drm/i915/fbc: fbc_dirty_rect restrictions and logging
Date: Fri, 25 Sep 2026 17:52:55 +0000	[thread overview]
Message-ID: <20260925175256.370F51F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260925173658.1042048-3-austin.hu@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/i915/fbc: collapsed FBC dirty rect for panned or rotated planes
--

commit 688db83891029bf71adf9b522ab593681a2edb50
Author: Charlton Lin <charlton.lin@intel.com>

    drm/i915/fbc: fbc_dirty_rect restrictions and logging
    
    Clamp the FBC dirty rectangle coordinates to the valid frame buffer
    range [y_offset, y_end] to prevent out-of-bounds coordinates, and
    log a debug message when clamping occurs.

> diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> index c6f9e6506f630..3915dea9edb1e 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> @@ -1556,11 +1556,14 @@ __intel_fbc_prepare_dirty_rect(const struct intel_plane_state *plane_state,
>  			       const struct intel_crtc_state *crtc_state)
>  {

[ ... ]

> -	if (drm_rect_visible(damage))
> -		*fbc_dirty_rect = *damage;
> -	else
> +	if (drm_rect_visible(damage)) {
> +		int y1, y2;
> +
> +		if (plane_state->hw.rotation & DRM_MODE_ROTATE_180) {
> +			/* Under 180 degree rotation, coordinate system is inverted */
> +			int inv_y1 = height - damage->y2;
> +			int inv_y2 = height - damage->y1;
> +
> +			y1 = clamp(y_offset + inv_y1, y_offset, y_end);
> +			y2 = clamp(y_offset + inv_y2, y_offset, y_end);

[Severity: High]
Does subtracting an absolute coordinate from a relative size here break the
dirty rect for rotated planes?

The damage rectangle coordinates are in absolute framebuffer space, while
height and y_offset are relative. If an absolute coordinate like damage->y2
exceeds the relative height, inv_y1 becomes negative.

Could this cause y_offset + inv_y1 to fall below y_offset, forcing clamp()
to always return y_offset and collapse the FBC dirty rect to zero height?

> +		} else {
> +			y1 = clamp(damage->y1, y_offset, y_end);
> +			y2 = clamp(damage->y2, y_offset, y_end);

[Severity: High]
Are absolute coordinates being incorrectly clamped against tile-relative bounds
here in __intel_fbc_prepare_dirty_rect()?

For panned planes where the source Y offset is non-zero, damage->y1 might be
much larger than the relative y_end. For example, if damage->y1 is 500 and
y_end is 120, wouldn't clamping an absolute damage coordinate against y_end
force both y1 and y2 to y_end?

Could this result in the dirty rect collapsing to zero height and halting
compressed framebuffer updates?

> +		}
> +
> +		/*
> +		 * Clamp dirty rect to the valid FB range [y_offset, y_end].
> +		 * Per Bspec:
> +		 *   start_line >= y_offset
> +		 *   end_line <= y_offset + plane_height
> +		 */
> +		if (y1 != damage->y1 || y2 != damage->y2)
> +			drm_dbg_kms(display->drm,
> +				    "[PLANE:%d:%s] FBC dirty rect out of range: y1=%d y2=%d clamped to y1=%d y2=%d (y_offset=%d y_end=%d)\n",
> +				    plane->base.base.id, plane->base.name,
> +				    damage->y1, damage->y2, y1, y2, y_offset, y_end);

[Severity: High]
Since absolute damage coordinates will naturally differ from tile-relative
clamped coordinates, will this condition evaluate to true incorrectly?

If so, does this falsely trigger the debug message and spam the kernel logs
whenever panned or rotated planes are configured by a compositor?

> +
> +		fbc_dirty_rect->x1 = damage->x1;
> +		fbc_dirty_rect->x2 = damage->x2;
> +		fbc_dirty_rect->y1 = y1;
> +		fbc_dirty_rect->y2 = y2;
> +	} else {
>  		/* dirty rect must cover at least one line */
>  		*fbc_dirty_rect = DRM_RECT_INIT(0, y_offset, width, 1);
> +	}
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925173658.1042048-1-austin.hu@intel.com?part=2

  reply	other threads:[~2026-09-25 17:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 17:36 [PATCH v4 0/3] drm/i915/fbc: Dirty rectangle bounding and CFB Austin Hu
2026-09-25 17:36 ` [PATCH v4 1/3] drm/i915/display/fbc: Move intel_fbc_can_flip_nuke() higher up Austin Hu
2026-09-25 17:36 ` [PATCH v4 2/3] drm/i915/fbc: fbc_dirty_rect restrictions and logging Austin Hu
2026-09-25 17:52   ` sashiko-bot [this message]
2026-09-25 17:36 ` [PATCH v4 3/3] drm/i915/fbc: nuke CFB if Plane setting (except for surf addr) changes Austin Hu
2026-09-25 17:55   ` sashiko-bot
2026-09-25 19:00 ` ✓ CI.KUnit: success for drm/i915/fbc: Dirty rectangle bounding and CFB Patchwork
2026-09-25 19:41 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-26  4:54 ` ✗ Xe.CI.FULL: failure " 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=20260925175256.370F51F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=austin.hu@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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