From: Austin Hu <austin.hu@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: ville.syrjala@linux.intel.com, maarten.lankhorst@linux.intel.com,
vinod.govindapillai@intel.com, huchao426@gmail.com
Subject: [PATCH v4 3/3] drm/i915/fbc: nuke CFB if Plane setting (except for surf addr) changes
Date: Fri, 25 Sep 2026 10:36:58 -0700 [thread overview]
Message-ID: <20260925173658.1042048-4-austin.hu@intel.com> (raw)
In-Reply-To: <20260925173658.1042048-1-austin.hu@intel.com>
When FBC Dirty Rectangle mode is enabled, any non-PLANE_SURF register
update requires fetching the full plane frame buffer from memory to
re-compress and update the CFB in stolen memory.
Check plane state attributes during atomic commits and force a full
CFB nuke if any setting other than the surface address changes.
v2: Address reviewer feedback to reuse intel_fbc_can_flip_nuke().
v3: Address reviewer feedback not to combine intel_fbc_can_flip_nuke()
movement and changes.
Signed-off-by: Austin Hu <austin.hu@intel.com>
---
drivers/gpu/drm/i915/display/intel_fbc.c | 65 ++++++++++++++++++++++--
1 file changed, 61 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 3915dea9edb1..0d3b25e7a9fc 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -1510,6 +1510,7 @@ static bool intel_fbc_can_flip_nuke(struct intel_atomic_state *state,
struct intel_crtc *crtc,
struct intel_plane *plane)
{
+ struct intel_display *display = to_intel_display(state);
const struct intel_crtc_state *new_crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
const struct intel_plane_state *old_plane_state =
@@ -1548,14 +1549,63 @@ static bool intel_fbc_can_flip_nuke(struct intel_atomic_state *state,
intel_fbc_override_cfb_stride(new_plane_state))
return false;
+ if (!HAS_FBC_DIRTY_RECT(display))
+ return true;
+
+ /*
+ * From BSpec about "FBC Dirty Rectangle", when Dirty Rectangle mode is
+ * active, partial updates only apply to surface address changes. Any other
+ * plane state modification requires Plane to fetch full-plane pixel data
+ * from memory to re-compress and update the entire CFB in stolen memory.
+ * Once fully re-compressed, subsequent atomic commits go ahead with FBC
+ * dirty rectangle updates for smooth visual updates.
+ *
+ * So check other Plane attribute changed except for its surface address by
+ * referring to intel_async_flip_check_hw() which also checks async flip.
+ */
+
+ /* Includes pixel_blend_mode, color_encoding & color_range checking. */
+ if (old_plane_state->color_ctl != new_plane_state->color_ctl)
+ return false;
+
+ if (!drm_rect_equals(&old_plane_state->uapi.src,
+ &new_plane_state->uapi.src) ||
+ !drm_rect_equals(&old_plane_state->uapi.dst,
+ &new_plane_state->uapi.dst))
+ return false;
+
+ if (old_plane_state->view.color_plane[0].x !=
+ new_plane_state->view.color_plane[0].x ||
+ old_plane_state->view.color_plane[0].y !=
+ new_plane_state->view.color_plane[0].y)
+ return false;
+
+ if (old_plane_state->hw.rotation != new_plane_state->hw.rotation)
+ return false;
+
+ if (old_plane_state->hw.alpha != new_plane_state->hw.alpha)
+ return false;
+
+ if (skl_plane_aux_dist(old_plane_state, 0) !=
+ skl_plane_aux_dist(new_plane_state, 0))
+ return false;
+
+ if (old_plane_state->decrypt != new_plane_state->decrypt)
+ return false;
+
+ if (old_plane_state->cus_ctl != new_plane_state->cus_ctl)
+ return false;
+
return true;
}
static void
-__intel_fbc_prepare_dirty_rect(const struct intel_plane_state *plane_state,
+__intel_fbc_prepare_dirty_rect(struct intel_atomic_state *state,
+ const struct intel_plane_state *plane_state,
const struct intel_crtc_state *crtc_state)
{
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct intel_display *display = to_intel_display(plane_state);
struct intel_fbc *fbc = plane->fbc;
struct drm_rect *fbc_dirty_rect = &fbc->state.dirty_rect;
@@ -1573,7 +1623,15 @@ __intel_fbc_prepare_dirty_rect(const struct intel_plane_state *plane_state,
return;
}
- if (drm_rect_visible(damage)) {
+ if (!intel_fbc_can_flip_nuke(state, crtc, plane)) {
+ if (HAS_FBC_DIRTY_RECT(display))
+ drm_dbg_kms(display->drm,
+ "[PLANE:%d:%s] Non surf addr changed for FBC DIRTY RECT\n",
+ plane->base.base.id, plane->base.name);
+
+ /* compress the entire region due to non PLANE_SURF updating. */
+ *fbc_dirty_rect = DRM_RECT_INIT(0, y_offset, width, height);
+ } else if (drm_rect_visible(damage)) {
int y1, y2;
if (plane_state->hw.rotation & DRM_MODE_ROTATE_180) {
@@ -1633,8 +1691,7 @@ intel_fbc_prepare_dirty_rect(struct intel_atomic_state *state,
mutex_lock(&fbc->lock);
if (fbc->state.plane == plane)
- __intel_fbc_prepare_dirty_rect(plane_state,
- crtc_state);
+ __intel_fbc_prepare_dirty_rect(state, plane_state, crtc_state);
mutex_unlock(&fbc->lock);
}
--
2.34.1
next prev parent reply other threads:[~2026-09-25 17:38 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
2026-09-25 17:36 ` Austin Hu [this message]
2026-09-25 17:55 ` [PATCH v4 3/3] drm/i915/fbc: nuke CFB if Plane setting (except for surf addr) changes 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=20260925173658.1042048-4-austin.hu@intel.com \
--to=austin.hu@intel.com \
--cc=huchao426@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=ville.syrjala@linux.intel.com \
--cc=vinod.govindapillai@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