All of 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 v2 1/2] drm/i915/fbc: fbc_dirty_rect restrictions and logging
Date: Tue, 25 Aug 2026 17:16:11 +0000	[thread overview]
Message-ID: <20260825171611.9E4E61F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260825165629.1799744-2-austin.hu@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Incorrect 180-degree rotation math negates `y_offset` instead of maintaining it, resulting in a 0-height dirty rectangle that breaks FBC updates.
- [Medium] Spurious 'FBC dirty rect out of range' debug logging on every frame update during 180-degree rotation.
--

commit 4adeca8228048877f976377febbd0e77586bd42c
Author: Charlton Lin <charlton.lin@intel.com>

drm/i915/fbc: fbc_dirty_rect restrictions and logging

This commit clamps the fbc dirty rectangle coordinates to the valid frame
buffer range to prevent out-of-bounds access. It also adds a debug message
to log when clamping occurs.

> diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
[ ... ]
> @@ -1535,11 +1538,41 @@ __intel_fbc_prepare_dirty_rect(const struct intel_plane_state *plane_state,
>  		return;
>  	}
>  
> -	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 this calculation erroneously mix relative sizes with absolute
coordinates?

The math `height - damage->y2` seems to assume `damage` is viewport-relative,
but it is actually in absolute framebuffer coordinates (which contains
`y_offset`). When `y_offset` is added back here, it effectively cancels out.

If `y_offset >= height`, this strictly clamps to `y_offset`, resulting in
a 0-height dirty rectangle (`y1 = y2 = y_offset`), which can cause a
regression for fbc screen updates when 180-degree rotation is active.

This issue does not appear to be fixed in the subsequent patch in the series.

> +		} else {
> +			y1 = clamp(damage->y1, y_offset, y_end);
> +			y2 = clamp(damage->y2, y_offset, y_end);
> +		}
> +
> +		/*
> +		 * 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)

[Severity: Medium]
Will this condition trigger a false positive on every frame update during
180-degree rotation?

The check `y1 != damage->y1` directly compares the newly inverted coordinate
(`y1`) against the original non-inverted coordinate (`damage->y1`). This
will almost always evaluate to true regardless of whether any actual
clamping occurred.

This can potentially spam the kernel log with false positive 'fbc dirty
rect out of range' messages whenever kms debugging is enabled.

This issue also does not appear to be fixed in the subsequent patch in the
series.

> +			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);

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

  reply	other threads:[~2026-08-25 17:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 21:53 [PATCH 0/2] drm/i915/fbc: Dirty rectangle bounds enforcement and CFB nuke handling Austin Hu
2026-08-12 21:53 ` [PATCH 1/2] drm/i915/fbc: fbc_dirty_rect restrictions and logging Austin Hu
2026-08-12 22:08   ` sashiko-bot
2026-08-12 21:53 ` [PATCH 2/2] drm/i915/fbc: nuke CFB if Plane setting (except for surf addr) changes Austin Hu
2026-08-12 22:10   ` sashiko-bot
2026-08-12 22:03 ` ✓ CI.KUnit: success for drm/i915/fbc: Dirty rectangle bounds enforcement and CFB nuke handling Patchwork
2026-08-12 22:44 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-12 22:57 ` ✗ i915.CI.BAT: failure " Patchwork
2026-08-13  5:40 ` ✗ Xe.CI.FULL: " Patchwork
2026-08-25 16:56 ` [PATCH v2 0/2] drm/i915/fbc: Dirty rectangle bounding " Austin Hu
2026-08-25 16:56 ` [PATCH v2 1/2] drm/i915/fbc: fbc_dirty_rect restrictions and logging Austin Hu
2026-08-25 17:16   ` sashiko-bot [this message]
2026-08-25 16:56 ` [PATCH v2 2/2] drm/i915/fbc: nuke CFB if Plane setting (except for surf addr) changes Austin Hu
2026-08-25 17:13   ` sashiko-bot
2026-09-07 11:28   ` Jani Nikula
2026-09-23 17:28 ` [PATCH v3 0/3] drm/i915/fbc: Dirty rectangle bounding and CFB Austin Hu
2026-09-24 11:25   ` Jani Nikula
2026-09-25 21:59     ` Hu, Austin
2026-09-23 17:28 ` [PATCH v3 1/3] drm/i915/display/fbc: Move intel_fbc_can_flip_nuke() higher up Austin Hu
2026-09-23 17:28 ` [PATCH v3 2/3] drm/i915/fbc: fbc_dirty_rect restrictions and logging Austin Hu
2026-09-23 17:44   ` sashiko-bot
2026-09-23 17:28 ` [PATCH v3 3/3] drm/i915/fbc: nuke CFB if Plane setting (except for surf addr) changes Austin Hu
2026-09-23 17:45   ` sashiko-bot
2026-09-24  0:56 ` ✗ Fi.CI.BUILD: failure for drm/i915/fbc: Dirty rectangle bounds enforcement and CFB nuke handling 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=20260825171611.9E4E61F00A3A@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 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.