From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: [PATCH 5/9] drm/i915/fbc: Decouple FBC from intel_cdclk_atomic_check()
Date: Mon, 13 Oct 2025 23:12:32 +0300 [thread overview]
Message-ID: <20251013201236.30084-6-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20251013201236.30084-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Always account for FBC requirements in intel_crtc_compute_min_cdclk()
so that we don't to worry about the actual CDCLK frequency in
intel_fbc_check_plane() any longer.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_cdclk.c | 1 +
drivers/gpu/drm/i915/display/intel_fbc.c | 49 ++++++++++++++++------
drivers/gpu/drm/i915/display/intel_fbc.h | 1 +
3 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 80a6c98eea5d..d55b3dc23356 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -2838,6 +2838,7 @@ static int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_stat
min_cdclk = intel_pixel_rate_to_cdclk(crtc_state);
min_cdclk = max(min_cdclk, intel_crtc_bw_min_cdclk(crtc_state));
+ min_cdclk = max(min_cdclk, intel_fbc_min_cdclk(crtc_state));
min_cdclk = max(min_cdclk, hsw_ips_min_cdclk(crtc_state));
min_cdclk = max(min_cdclk, intel_audio_min_cdclk(crtc_state));
min_cdclk = max(min_cdclk, vlv_dsi_min_cdclk(crtc_state));
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 4edb4342833e..90060c60c5f4 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -53,7 +53,6 @@
#include "i915_vgpu.h"
#include "i915_vma.h"
#include "i9xx_plane_regs.h"
-#include "intel_cdclk.h"
#include "intel_de.h"
#include "intel_display_device.h"
#include "intel_display_regs.h"
@@ -1417,6 +1416,18 @@ intel_fbc_prepare_dirty_rect(struct intel_atomic_state *state,
}
}
+static int _intel_fbc_min_cdclk(const struct intel_crtc_state *crtc_state)
+{
+ struct intel_display *display = to_intel_display(crtc_state);
+
+ /* WaFbcExceedCdClockThreshold:hsw,bdw */
+ if (display->platform.haswell || display->platform.broadwell)
+ return DIV_ROUND_UP(crtc_state->pixel_rate * 100, 95);
+
+ /* no FBC specific limits to worry about */
+ return 0;
+}
+
static int intel_fbc_check_plane(struct intel_atomic_state *state,
struct intel_plane *plane)
{
@@ -1556,18 +1567,9 @@ static int intel_fbc_check_plane(struct intel_atomic_state *state,
return 0;
}
- /* WaFbcExceedCdClockThreshold:hsw,bdw */
- if (display->platform.haswell || display->platform.broadwell) {
- const struct intel_cdclk_state *cdclk_state;
-
- cdclk_state = intel_atomic_get_cdclk_state(state);
- if (IS_ERR(cdclk_state))
- return PTR_ERR(cdclk_state);
-
- if (crtc_state->pixel_rate >= intel_cdclk_logical(cdclk_state) * 95 / 100) {
- plane_state->no_fbc_reason = "pixel rate too high";
- return 0;
- }
+ if (_intel_fbc_min_cdclk(crtc_state) > display->cdclk.max_cdclk_freq) {
+ plane_state->no_fbc_reason = "pixel rate too high";
+ return 0;
}
plane_state->no_fbc_reason = NULL;
@@ -1575,6 +1577,27 @@ static int intel_fbc_check_plane(struct intel_atomic_state *state,
return 0;
}
+int intel_fbc_min_cdclk(const struct intel_crtc_state *crtc_state)
+{
+ struct intel_display *display = to_intel_display(crtc_state);
+ struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+ struct intel_plane *plane = to_intel_plane(crtc->base.primary);
+ int min_cdclk;
+
+ if (!plane->fbc)
+ return 0;
+
+ min_cdclk = _intel_fbc_min_cdclk(crtc_state);
+
+ /*
+ * Do not ask for more than the max CDCLK frequency,
+ * if that is not enough FBC will simply not be used.
+ */
+ if (min_cdclk > display->cdclk.max_cdclk_freq)
+ return 0;
+
+ return min_cdclk;
+}
static bool intel_fbc_can_flip_nuke(struct intel_atomic_state *state,
struct intel_crtc *crtc,
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.h b/drivers/gpu/drm/i915/display/intel_fbc.h
index 0e715cb6b4e6..c86562404a00 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.h
+++ b/drivers/gpu/drm/i915/display/intel_fbc.h
@@ -28,6 +28,7 @@ enum intel_fbc_id {
};
int intel_fbc_atomic_check(struct intel_atomic_state *state);
+int intel_fbc_min_cdclk(const struct intel_crtc_state *crtc_state);
bool intel_fbc_pre_update(struct intel_atomic_state *state,
struct intel_crtc *crtc);
void intel_fbc_post_update(struct intel_atomic_state *state,
--
2.49.1
next prev parent reply other threads:[~2025-10-13 20:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 20:12 [PATCH 0/9] drm/i915: Reorder cdclk stuff for vblank/guardband length checks Ville Syrjala
2025-10-13 20:12 ` [PATCH 1/9] drm/i915/bw: Untangle dbuf bw from the sagv/mem bw stuff Ville Syrjala
2025-10-16 10:39 ` Kahola, Mika
2025-10-13 20:12 ` [PATCH 2/9] drm/i915: s/"not not"/"not"/ Ville Syrjala
2025-10-16 10:41 ` Kahola, Mika
2025-10-13 20:12 ` [PATCH 3/9] drm/i915/bw: Relocate intel_bw_crtc_min_cdclk() Ville Syrjala
2025-10-16 10:43 ` Kahola, Mika
2025-10-13 20:12 ` [PATCH 4/9] drm/i915/ips: Eliminate the cdclk_state stuff from hsw_ips_compute_config() Ville Syrjala
2025-10-16 10:57 ` Kahola, Mika
2025-10-13 20:12 ` Ville Syrjala [this message]
2025-10-16 11:40 ` [PATCH 5/9] drm/i915/fbc: Decouple FBC from intel_cdclk_atomic_check() Kahola, Mika
2025-10-13 20:12 ` [PATCH 6/9] drm/i915: s/min_cdck[]/plane_min_cdclk[]/ Ville Syrjala
2025-10-16 11:44 ` Kahola, Mika
2025-10-13 20:12 ` [PATCH 7/9] drm/i915: Compute per-crtc min_cdclk earlier Ville Syrjala
2025-10-16 11:56 ` Kahola, Mika
2025-10-13 20:12 ` [PATCH 8/9] drm/i915: Include the per-crtc minimum cdclk in the crtc state dump Ville Syrjala
2025-10-16 11:56 ` Kahola, Mika
2025-10-13 20:12 ` [PATCH 9/9] drm/i915: Neuter cdclk_prefill_adjustment() Ville Syrjala
2025-10-16 11:59 ` Kahola, Mika
2025-10-13 23:44 ` ✓ i915.CI.BAT: success for drm/i915: Reorder cdclk stuff for vblank/guardband length checks Patchwork
2025-10-14 8:33 ` ✓ i915.CI.Full: " 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=20251013201236.30084-6-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/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