Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org, Petr Vorel <pvorel@suse.cz>
Subject: [PATCH 2/3] drm/i915/dmc: Fixup TGL/ADL-S HRR event handler type
Date: Wed, 22 Oct 2025 13:07:17 +0300	[thread overview]
Message-ID: <20251022100718.24803-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20251022100718.24803-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

TGL/ADL-S DMC firmware incorrectly uses the undelayed vblank
trigger for the HRR event, when it should be using the delayed
vblank trigger.

Fixed DMC firmware was never relaesed and isntead the Windows
driver just fixes this up by hand. Follow suit.

Not that we actually enable the HRR event currently. But let's
fix up the event ID, just in case someone ever needs to enable
this.

Tested-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_dmc.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
index 5ba531e3bc36..02ef0a252220 100644
--- a/drivers/gpu/drm/i915/display/intel_dmc.c
+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
@@ -577,6 +577,21 @@ static bool fixup_dmc_evt(struct intel_display *display,
 		return true;
 	}
 
+	/*
+	 * TGL/ADL-S DMC firmware incorrectly uses the undelayed vblank
+	 * event for the HRR handler, when it should be using the delayed
+	 * vblank event instead. Fixed firmware was never released
+	 * so the Windows driver just hacks around it by overriding
+	 * the event ID. Do the same.
+	 */
+	if ((display->platform.tigerlake || display->platform.alderlake_s) &&
+	    is_event_handler(display, dmc_id, MAINDMC_EVENT_VBLANK_A, reg_ctl, *data_ctl)) {
+		*data_ctl &= ~DMC_EVT_CTL_EVENT_ID_MASK;
+		*data_ctl |=  REG_FIELD_PREP(DMC_EVT_CTL_EVENT_ID_MASK,
+					     MAINDMC_EVENT_VBLANK_DELAYED_A);
+		return true;
+	}
+
 	return false;
 }
 
@@ -598,7 +613,7 @@ static bool disable_dmc_evt(struct intel_display *display,
 
 	/* also disable the HRR event on the main DMC on TGL/ADLS */
 	if ((display->platform.tigerlake || display->platform.alderlake_s) &&
-	    is_event_handler(display, dmc_id, MAINDMC_EVENT_VBLANK_A, reg, data))
+	    is_event_handler(display, dmc_id, MAINDMC_EVENT_VBLANK_DELAYED_A, reg, data))
 		return true;
 
 	return false;
-- 
2.49.1


  parent reply	other threads:[~2025-10-22 10:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 10:07 [PATCH 0/3] drm/i915/dmc: Event handler fixes Ville Syrjala
2025-10-22 10:07 ` [PATCH 1/3] drm/i915/dmc: Clear HRR EVT_CTL/HTP to zero on ADL-S Ville Syrjala
2025-10-22 11:21   ` Petr Vorel
2025-10-22 10:07 ` Ville Syrjala [this message]
2025-10-22 15:11   ` [PATCH 2/3] drm/i915/dmc: Fixup TGL/ADL-S HRR event handler type Petr Vorel
2025-10-22 10:07 ` [PATCH 3/3] drm/i915/dmc: Set DMC_EVT_CTL_ENABLE for disabled event handlers as well Ville Syrjala
2025-10-22 14:57   ` Petr Vorel
2025-10-22 15:18 ` ✗ CI.checkpatch: warning for drm/i915/dmc: Event handler fixes Patchwork
2025-10-22 15:20 ` ✓ CI.KUnit: success " Patchwork
2025-10-22 16:00 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-22 17:25 ` [PATCH 0/3] " Imre Deak
2025-10-22 18:25 ` ✗ Xe.CI.Full: failure for " 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=20251022100718.24803-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=pvorel@suse.cz \
    /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