All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hamza Mahfooz <someguy@effective-light.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: "Timur Kristóf" <timur.kristof@gmail.com>,
	"Alex Deucher" <alexdeucher@gmail.com>,
	"Michel Dänzer" <michel.daenzer@mailbox.org>,
	"Mario Limonciello" <mario.limonciello@amd.com>,
	dri-devel@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Rodrigo Siqueira" <siqueira@igalia.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Sunil Khatri" <sunil.khatri@amd.com>,
	"Ce Sun" <cesun102@amd.com>, "Lijo Lazar" <lijo.lazar@amd.com>,
	"Kenneth Feng" <kenneth.feng@amd.com>,
	"Ivan Lipski" <ivan.lipski@amd.com>,
	"Alex Hung" <alex.hung@amd.com>,
	"Tom Chung" <chiahsuan.chung@amd.com>,
	"Melissa Wen" <mwen@igalia.com>,
	"Fangzhi Zuo" <Jerry.Zuo@amd.com>,
	amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm: introduce page_flip_timeout()
Date: Thu, 29 Jan 2026 09:04:23 -0500	[thread overview]
Message-ID: <aXto53g2mSNsNmFM@hal-station> (raw)
In-Reply-To: <2f9bc706-02d6-4dec-a56c-53abc5d43f46@amd.com>

On Thu, Jan 29, 2026 at 01:59:00PM +0100, Christian König wrote:
> > How do you propose to do that?
> 
> I need to dig a bit into the DAL/DC code and see how the signaling path actually goes.
> 
> Going to give that a try tomorrow.
> 

For recent ASICs, something along the lines of the following should do
the trick:

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index dc8d2f52c7d6..fac668c2fcfb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -510,6 +510,7 @@ struct amdgpu_crtc {
 	bool wb_pending;
 	bool wb_enabled;
 	struct drm_writeback_connector *wb_conn;
+	int pflip_cnt;
 };
 
 struct amdgpu_encoder_atom_dig {
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 740711ac1037..1c3b7fbab1c6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -427,6 +427,18 @@ static inline bool update_planes_and_stream_adapter(struct dc *dc,
 					   stream_update);
 }
 
+static inline bool update_pflip_cnt(struct amdgpu_crtc *acrtc)
+{
+	int cnt = acrtc->pflip_cnt++;
+
+	if (cnt == 300) {
+		acrtc->pflip_cnt = 0;
+		return true;
+	}
+
+	return false;
+}
+
 /**
  * dm_pflip_high_irq() - Handle pageflip interrupt
  * @interrupt_params: ignored
@@ -454,6 +466,9 @@ static void dm_pflip_high_irq(void *interrupt_params)
 		return;
 	}
 
+	if (update_pflip_cnt(amdgpu_crtc))
+		return;
+
 	spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);
 
 	if (amdgpu_crtc->pflip_status != AMDGPU_FLIP_SUBMITTED) {
@@ -589,6 +604,9 @@ static void dm_vupdate_high_irq(void *interrupt_params)
 	acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VUPDATE);
 
 	if (acrtc) {
+		if (update_pflip_cnt(acrtc))
+			return;
+
 		vrr_active = amdgpu_dm_crtc_vrr_active_irq(acrtc);
 		drm_dev = acrtc->base.dev;
 		vblank = drm_crtc_vblank_crtc(&acrtc->base);
@@ -659,6 +677,9 @@ static void dm_crtc_high_irq(void *interrupt_params)
 	if (!acrtc)
 		return;
 
+	if (update_pflip_cnt(acrtc))
+		return;
+
 	if (acrtc->wb_conn) {
 		spin_lock_irqsave(&acrtc->wb_conn->job_lock, flags);

  reply	other threads:[~2026-01-30  9:22 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23  0:05 [PATCH 1/2] drm: introduce page_flip_timeout() Hamza Mahfooz
2026-01-23  0:05 ` [PATCH 2/2] drm/amdgpu: implement page_flip_timeout() support Hamza Mahfooz
2026-01-23 11:20   ` Timur Kristóf
2026-01-23 14:25     ` Hamza Mahfooz
2026-01-23 12:26   ` kernel test robot
2026-01-23 15:16   ` kernel test robot
2026-01-23 17:49   ` Alex Deucher
2026-01-23 18:10     ` Alex Deucher
2026-01-23 13:52 ` [PATCH 1/2] drm: introduce page_flip_timeout() Christian König
2026-01-23 14:44   ` Hamza Mahfooz
2026-01-23 16:12     ` Christian König
2026-01-23 19:41     ` Alex Deucher
2026-01-23 14:44   ` Timur Kristóf
2026-01-23 22:30     ` Mario Limonciello
2026-01-24 18:32       ` Hamza Mahfooz
2026-01-24 18:43         ` Mario Limonciello
2026-01-24 19:49           ` Hamza Mahfooz
2026-01-27 22:44             ` Hamza Mahfooz
2026-01-26 14:20         ` Alex Deucher
2026-01-27 22:52           ` Hamza Mahfooz
2026-01-27 22:57             ` Alex Deucher
2026-01-28 10:39               ` Christian König
2026-01-28 11:26                 ` Michel Dänzer
2026-01-28 12:14                   ` Timur Kristóf
2026-01-28 12:48                     ` Christian König
2026-01-28 14:25                       ` Michel Dänzer
2026-01-29 10:06                         ` Michel Dänzer
2026-01-29 11:25                           ` Timur Kristóf
2026-01-29 11:38                             ` Christian König
2026-01-29 12:06                               ` Timur Kristóf
2026-01-29 12:59                                 ` Christian König
2026-01-29 14:04                                   ` Hamza Mahfooz [this message]
2026-01-29 14:24                                     ` Christian König
2026-01-29 14:33                                       ` Hamza Mahfooz
2026-01-29 14:41                                         ` Christian König
2026-02-03 21:48                                   ` Timur Kristóf
2026-01-29 21:56                           ` Xaver Hugl
2026-01-26 10:14     ` Christian König
2026-01-26 10:27       ` Michel Dänzer
2026-01-26 13:00         ` Christian König
2026-01-26 14:31           ` Michel Dänzer
2026-01-28  9:19           ` Timur Kristóf
2026-01-28 11:25             ` Christian König
2026-01-28 12:22               ` Timur Kristóf
2026-01-28 14:25               ` Michel Dänzer
2026-01-28 14:35                 ` Christian König
2026-01-29 21:39           ` Xaver Hugl

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=aXto53g2mSNsNmFM@hal-station \
    --to=someguy@effective-light.com \
    --cc=Jerry.Zuo@amd.com \
    --cc=airlied@gmail.com \
    --cc=alex.hung@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=cesun102@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=ivan.lipski@amd.com \
    --cc=kenneth.feng@amd.com \
    --cc=lijo.lazar@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mario.limonciello@amd.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=sunil.khatri@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=timur.kristof@gmail.com \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.