From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 05/13] drm/i915/dsb: Introduce intel_dsb_vblank_evade()
Date: Mon, 2 Sep 2024 16:53:34 +0300 [thread overview]
Message-ID: <20240902135342.1050-6-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240902135342.1050-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Add a helper for performing vblank evasion on the DSB. DSB based
plane updates will need this to guarantee all the double buffered
arming registers will get programmed atomically within the same
frame.
With VRR we more or less have two vblanks to worry about:
- vmax vblank start in case no push was sent
- vmin vblank start in case a push was already sent during
the vertical active. Only a concern for mailbox updates,
which I suppose could happen if the legacy cursor updates
take the non-fastpath without setting
state->legacy_cursor_update to false.
Since we don't know which case is relevant we'll just evade
both.
We must also make sure to evade both the delayed vblank
(for pipe/plane registers) and the undelayed vblank
(for transcoder registers and chained DSBs w/
DSB_WAIT_FOR_VBLANK).
TODO: come up with a sensible usec number for the evasion...
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_dsb.c | 31 ++++++++++++++++++++++++
drivers/gpu/drm/i915/display/intel_dsb.h | 2 ++
2 files changed, 33 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
index 6de33c0c16c3..997196ba69ca 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.c
+++ b/drivers/gpu/drm/i915/display/intel_dsb.c
@@ -126,6 +126,12 @@ pre_commit_crtc_state(struct intel_atomic_state *state,
return old_crtc_state;
}
+static int dsb_vblank_delay(const struct intel_crtc_state *crtc_state)
+{
+ return intel_mode_vblank_start(&crtc_state->hw.adjusted_mode) -
+ intel_mode_vdisplay(&crtc_state->hw.adjusted_mode);
+}
+
static int dsb_vtotal(struct intel_atomic_state *state,
struct intel_crtc *crtc)
{
@@ -525,6 +531,31 @@ static u32 dsb_error_int_en(struct intel_display *display)
return errors;
}
+void intel_dsb_vblank_evade(struct intel_atomic_state *state,
+ struct intel_dsb *dsb)
+{
+ struct intel_crtc *crtc = dsb->crtc;
+ const struct intel_crtc_state *crtc_state = pre_commit_crtc_state(state, crtc);
+ /* FIXME calibrate sensibly */
+ int latency = intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode, 20);
+ int vblank_delay = dsb_vblank_delay(crtc_state);
+ int start, end;
+
+ if (pre_commit_is_vrr_active(state, crtc)) {
+ end = intel_vrr_vmin_vblank_start(crtc_state);
+ start = end - vblank_delay - latency;
+ intel_dsb_wait_scanline_out(state, dsb, start, end);
+
+ end = intel_vrr_vmax_vblank_start(crtc_state);
+ start = end - vblank_delay - latency;
+ intel_dsb_wait_scanline_out(state, dsb, start, end);
+ } else {
+ end = intel_mode_vblank_start(&crtc_state->hw.adjusted_mode);
+ start = end - vblank_delay - latency;
+ intel_dsb_wait_scanline_out(state, dsb, start, end);
+ }
+}
+
static void _intel_dsb_chain(struct intel_atomic_state *state,
struct intel_dsb *dsb,
struct intel_dsb *chained_dsb,
diff --git a/drivers/gpu/drm/i915/display/intel_dsb.h b/drivers/gpu/drm/i915/display/intel_dsb.h
index ff3b89dfffc1..cce5cb1c6071 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.h
+++ b/drivers/gpu/drm/i915/display/intel_dsb.h
@@ -46,6 +46,8 @@ void intel_dsb_wait_scanline_in(struct intel_atomic_state *state,
void intel_dsb_wait_scanline_out(struct intel_atomic_state *state,
struct intel_dsb *dsb,
int lower, int upper);
+void intel_dsb_vblank_evade(struct intel_atomic_state *state,
+ struct intel_dsb *dsb);
void intel_dsb_chain(struct intel_atomic_state *state,
struct intel_dsb *dsb,
struct intel_dsb *chained_dsb,
--
2.44.2
next prev parent reply other threads:[~2024-09-02 13:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 13:53 [PATCH 00/13] drm/i915: Use DSB for plane/color management commits Ville Syrjala
2024-09-02 13:53 ` [PATCH 01/13] drm/i915/dsb: Avoid reads of the DSB buffer for indexed register writes Ville Syrjala
2024-09-02 13:53 ` [PATCH 02/13] drm/i915: Prepare clear color before wait_for_dependencies() Ville Syrjala
2024-09-02 13:53 ` [PATCH 03/13] drm/i915/dsb: Generate the DSB buffer in commit_tail() Ville Syrjala
2024-09-02 13:53 ` [PATCH 04/13] drm/i915/dsb: Enable programmable DSB interrupt Ville Syrjala
2024-09-02 13:53 ` Ville Syrjala [this message]
2024-09-02 13:53 ` [PATCH 06/13] drm/i915/dsb: Introduce intel_dsb_wait_usec() Ville Syrjala
2024-09-02 13:53 ` [PATCH 07/13] drm/i915/dsb: Introduce intel_dsb_wait_vblanks() Ville Syrjala
2024-09-02 13:53 ` [PATCH 08/13] drm/i915: Introduce intel_scanlines_to_usecs() Ville Syrjala
2024-09-02 13:53 ` [PATCH 09/13] drm/i915/dsb: Introduce intel_dsb_wait_vblank_delay() Ville Syrjala
2024-09-02 13:53 ` [PATCH 10/13] drm/i915: Extract intel_crtc_prepare_vblank_event() Ville Syrjala
2024-09-02 13:53 ` [PATCH 11/13] drm/i915: Plumb 'dsb' all way to the plane hooks Ville Syrjala
2024-09-02 13:53 ` [PATCH 12/13] drm/i915: Plumb 'dsb' all way to the color commit hooks Ville Syrjala
2024-09-02 13:53 ` [PATCH 13/13] drm/i915/dsb: Use DSB for plane/color management updates Ville Syrjala
2024-09-02 14:45 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Use DSB for plane/color management commits Patchwork
2024-09-02 14:45 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-09-02 15:05 ` ✓ Fi.CI.BAT: success " Patchwork
2024-09-03 7:56 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-09-17 7:00 ` [PATCH 00/13] " Manna, Animesh
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=20240902135342.1050-6-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@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