From: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>,
Arun R Murthy <arun.r.murthy@intel.com>,
Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Subject: [PATCH v18 8/9] drm/i915/display: Compute vrr_vsync params
Date: Thu, 21 Mar 2024 21:08:22 +0530 [thread overview]
Message-ID: <20240321153828.3815870-9-mitulkumar.ajitkumar.golani@intel.com> (raw)
In-Reply-To: <20240311094238.3320888-2-mitulkumar.ajitkumar.golani@intel.com>
Compute vrr_vsync_start/end, which sets the position
for hardware to send the Vsync at a fixed position
relative to the end of the Vblank.
--v2:
- Updated VSYNC_START/END macros to VRR_VSYNC_START/END. (Ankit)
- Updated bit fields of VRR_VSYNC_START/END. (Ankit)
--v3:
- Add PIPE_CONF_CHECK_I(vrr.vsync_start/end).
- Read/write vrr_vsync params only when we intend to send
adaptive_sync sdp.
--v4:
- Use VRR_SYNC_START/END macros correctly.
--v5:
- Send AS SDP only when VRR is enabled.
--v6:
- Add TRANS_VRR_VSYNC befor enabling VRR as per bspec. (Ankit)
Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
drivers/gpu/drm/i915/display/intel_display.c | 2 ++
.../drm/i915/display/intel_display_types.h | 1 +
drivers/gpu/drm/i915/display/intel_vrr.c | 33 +++++++++++++++++--
drivers/gpu/drm/i915/i915_reg.h | 7 ++++
4 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index da3e840a3b70..9c8ed9ce4bb6 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -5396,6 +5396,8 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
PIPE_CONF_CHECK_I(vrr.flipline);
PIPE_CONF_CHECK_I(vrr.pipeline_full);
PIPE_CONF_CHECK_I(vrr.guardband);
+ PIPE_CONF_CHECK_I(vrr.vsync_start);
+ PIPE_CONF_CHECK_I(vrr.vsync_end);
}
#undef PIPE_CONF_CHECK_X
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index c00f6c3548b9..3c154d2a38e8 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1431,6 +1431,7 @@ struct intel_crtc_state {
bool enable, in_range;
u8 pipeline_full;
u16 flipline, vmin, vmax, guardband;
+ u32 vsync_end, vsync_start;
} vrr;
/* Stream Splitter for eDP MSO */
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index eb5bd0743902..856378f8b90e 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -9,6 +9,7 @@
#include "intel_de.h"
#include "intel_display_types.h"
#include "intel_vrr.h"
+#include "intel_dp.h"
bool intel_vrr_is_capable(struct intel_connector *connector)
{
@@ -113,6 +114,7 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
struct intel_connector *connector =
to_intel_connector(conn_state->connector);
+ struct intel_dp *intel_dp = intel_attached_dp(connector);
struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
const struct drm_display_info *info = &connector->base.display_info;
int vmin, vmax;
@@ -165,6 +167,14 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
if (crtc_state->uapi.vrr_enabled) {
crtc_state->vrr.enable = true;
crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
+ if (intel_dp_as_sdp_supported(intel_dp)) {
+ crtc_state->vrr.vsync_start =
+ (crtc_state->hw.adjusted_mode.crtc_vtotal -
+ crtc_state->hw.adjusted_mode.vsync_start);
+ crtc_state->vrr.vsync_end =
+ (crtc_state->hw.adjusted_mode.crtc_vtotal -
+ crtc_state->hw.adjusted_mode.vsync_end);
+ }
}
}
@@ -240,6 +250,12 @@ void intel_vrr_enable(const struct intel_crtc_state *crtc_state)
return;
intel_de_write(dev_priv, TRANS_PUSH(cpu_transcoder), TRANS_PUSH_EN);
+
+ if (HAS_AS_SDP(dev_priv))
+ intel_de_write(dev_priv, TRANS_VRR_VSYNC(cpu_transcoder),
+ VRR_VSYNC_END(crtc_state->vrr.vsync_end) |
+ VRR_VSYNC_START(crtc_state->vrr.vsync_start));
+
intel_de_write(dev_priv, TRANS_VRR_CTL(cpu_transcoder),
VRR_CTL_VRR_ENABLE | trans_vrr_ctl(crtc_state));
}
@@ -258,13 +274,16 @@ void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state)
intel_de_wait_for_clear(dev_priv, TRANS_VRR_STATUS(cpu_transcoder),
VRR_STATUS_VRR_EN_LIVE, 1000);
intel_de_write(dev_priv, TRANS_PUSH(cpu_transcoder), 0);
+
+ if (HAS_AS_SDP(dev_priv))
+ intel_de_write(dev_priv, TRANS_VRR_VSYNC(cpu_transcoder), 0);
}
void intel_vrr_get_config(struct intel_crtc_state *crtc_state)
{
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
- u32 trans_vrr_ctl;
+ u32 trans_vrr_ctl, trans_vrr_vsync;
trans_vrr_ctl = intel_de_read(dev_priv, TRANS_VRR_CTL(cpu_transcoder));
@@ -284,6 +303,16 @@ void intel_vrr_get_config(struct intel_crtc_state *crtc_state)
crtc_state->vrr.vmin = intel_de_read(dev_priv, TRANS_VRR_VMIN(cpu_transcoder)) + 1;
}
- if (crtc_state->vrr.enable)
+ if (crtc_state->vrr.enable) {
crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
+
+ if (HAS_AS_SDP(dev_priv)) {
+ trans_vrr_vsync =
+ intel_de_read(dev_priv, TRANS_VRR_VSYNC(cpu_transcoder));
+ crtc_state->vrr.vsync_start =
+ REG_FIELD_GET(VRR_VSYNC_START_MASK, trans_vrr_vsync);
+ crtc_state->vrr.vsync_end =
+ REG_FIELD_GET(VRR_VSYNC_END_MASK, trans_vrr_vsync);
+ }
+ }
}
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3ff6a38826cb..2ede6982175c 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2095,6 +2095,13 @@
#define TRANS_PUSH_EN REG_BIT(31)
#define TRANS_PUSH_SEND REG_BIT(30)
+#define _TRANS_VRR_VSYNC_A 0x60078
+#define TRANS_VRR_VSYNC(trans) _MMIO_TRANS2(trans, _TRANS_VRR_VSYNC_A)
+#define VRR_VSYNC_END_MASK REG_GENMASK(28, 16)
+#define VRR_VSYNC_END(vsync_end) REG_FIELD_PREP(VRR_VSYNC_END_MASK, (vsync_end))
+#define VRR_VSYNC_START_MASK REG_GENMASK(12, 0)
+#define VRR_VSYNC_START(vsync_start) REG_FIELD_PREP(VRR_VSYNC_START_MASK, (vsync_start))
+
/* VGA port control */
#define ADPA _MMIO(0x61100)
#define PCH_ADPA _MMIO(0xe1100)
--
2.25.1
next prev parent reply other threads:[~2024-03-21 15:45 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-11 9:42 [PATCH v17 0/9] Enable Adaptive Sync SDP Support for DP Mitul Golani
2024-03-11 9:42 ` [PATCH v17 1/9] drm/dp: Add support to indicate if sink supports AS SDP Mitul Golani
2024-03-21 15:38 ` [v17,1/9] " Mitul Golani
2024-03-21 15:38 ` [PATCH v18 0/9] Enable Adaptive Sync SDP Support for DP Mitul Golani
2024-03-21 15:38 ` [PATCH v18 1/9] drm/dp: Add support to indicate if sink supports AS SDP Mitul Golani
2024-03-21 15:38 ` [PATCH v18 2/9] drm: Add Adaptive Sync SDP logging Mitul Golani
2024-03-21 15:38 ` [PATCH v18 3/9] drm/i915/display: Add crtc state dump for Adaptive Sync SDP Mitul Golani
2024-03-21 15:38 ` [PATCH v18 4/9] drm/i915/dp: Add Read/Write support " Mitul Golani
2024-03-21 15:38 ` [PATCH v18 5/9] drm/i915/dp: Add wrapper function to check AS SDP Mitul Golani
2024-03-21 15:38 ` [PATCH v18 6/9] drm/i915/display: Compute AS SDP parameters Mitul Golani
2024-03-21 15:38 ` [PATCH v18 7/9] drm/i915/display: Add state checker for Adaptive Sync SDP Mitul Golani
2024-03-21 15:38 ` Mitul Golani [this message]
2024-03-21 15:38 ` [PATCH v18 9/9] drm/i915/display: Read/Write " Mitul Golani
2024-03-11 9:42 ` [PATCH v17 2/9] drm: Add Adaptive Sync SDP logging Mitul Golani
2024-03-11 9:42 ` [PATCH v17 3/9] drm/i915/display: Add crtc state dump for Adaptive Sync SDP Mitul Golani
2024-03-19 6:53 ` [PATCH v18 " Mitul Golani
2024-03-11 9:42 ` [PATCH v17 4/9] drm/i915/dp: Add Read/Write support " Mitul Golani
2024-03-11 9:42 ` [PATCH v17 5/9] drm/i915/dp: Add wrapper function to check AS SDP Mitul Golani
2024-03-11 9:42 ` [PATCH v17 6/9] drm/i915/display: Compute AS SDP parameters Mitul Golani
2024-03-11 9:42 ` [PATCH v17 7/9] drm/i915/display: Add state checker for Adaptive Sync SDP Mitul Golani
2024-03-11 9:42 ` [PATCH v17 8/9] drm/i915/display: Compute vrr_vsync params Mitul Golani
2024-03-13 3:56 ` [PATCH v18 " Mitul Golani
2024-03-14 9:04 ` Nautiyal, Ankit K
2024-03-18 11:12 ` [PATCH v19 " Mitul Golani
2024-03-20 4:29 ` Murthy, Arun R
2024-03-20 5:00 ` [PATCH v20 " Mitul Golani
2024-03-21 4:08 ` Nautiyal, Ankit K
2024-03-11 9:42 ` [PATCH v17 9/9] drm/i915/display: Read/Write Adaptive Sync SDP Mitul Golani
2024-03-12 1:01 ` ✗ Fi.CI.CHECKPATCH: warning for Enable Adaptive Sync SDP Support for DP (rev17) Patchwork
2024-03-12 1:01 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-03-12 1:18 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-03-13 4:51 ` ✗ Fi.CI.CHECKPATCH: warning for Enable Adaptive Sync SDP Support for DP (rev18) Patchwork
2024-03-13 4:51 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-03-13 5:06 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-03-18 14:37 ` [PATCH v17 0/9] Enable Adaptive Sync SDP Support for DP Jani Nikula
2024-03-19 9:46 ` Maxime Ripard
2024-04-04 14:59 ` Nautiyal, Ankit K
2024-04-19 12:35 ` Jani Nikula
2024-04-19 12:51 ` Maxime Ripard
2024-04-19 14:09 ` Jani Nikula
2024-04-19 14:33 ` Maxime Ripard
2024-04-21 4:11 ` Nautiyal, Ankit K
2024-03-18 21:12 ` ✗ Fi.CI.BUILD: failure for Enable Adaptive Sync SDP Support for DP (rev19) Patchwork
2024-03-19 7:28 ` ✗ Fi.CI.CHECKPATCH: warning for Enable Adaptive Sync SDP Support for DP (rev20) Patchwork
2024-03-19 7:28 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-03-19 7:46 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-03-19 10:17 ` ✓ Fi.CI.BAT: success " Patchwork
2024-03-19 14:27 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-03-20 5:44 ` ✗ Fi.CI.CHECKPATCH: warning for Enable Adaptive Sync SDP Support for DP (rev21) Patchwork
2024-03-20 5:44 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-03-20 5:57 ` ✓ Fi.CI.BAT: success " Patchwork
2024-03-20 17:08 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-03-21 9:35 ` Patchwork
2024-03-21 10:42 ` ✓ Fi.CI.IGT: success " Patchwork
2024-03-21 21:36 ` ✗ Fi.CI.BUILD: failure for Enable Adaptive Sync SDP Support for DP (rev30) Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-03-22 3:11 [PATCH v18 0/9] Enable Adaptive Sync SDP Support for DP Mitul Golani
2024-03-22 3:11 ` [PATCH v18 8/9] drm/i915/display: Compute vrr_vsync params Mitul Golani
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=20240321153828.3815870-9-mitulkumar.ajitkumar.golani@intel.com \
--to=mitulkumar.ajitkumar.golani@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=arun.r.murthy@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