From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5FA7DD72347 for ; Fri, 23 Jan 2026 08:20:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0523010EA6B; Fri, 23 Jan 2026 08:20:22 +0000 (UTC) Received: from h5.fbrelay.privateemail.com (h5.fbrelay.privateemail.com [162.0.218.228]) by gabe.freedesktop.org (Postfix) with ESMTPS id D438E10EBBD; Fri, 23 Jan 2026 00:15:49 +0000 (UTC) Received: from MTA-06-4.privateemail.com (mta-06.privateemail.com [198.54.118.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by h5.fbrelay.privateemail.com (Postfix) with ESMTPSA id 4dxyrw5cwTz2xB8; Fri, 23 Jan 2026 00:06:24 +0000 (UTC) Received: from localhost.localdomain (bras-base-toroon4332w-grc-44-142-112-152-160.dsl.bell.ca [142.112.152.160]) by mta-06.privateemail.com (Postfix) with ESMTPA id 4dxyrG4jCnz3hhTB; Thu, 22 Jan 2026 19:05:50 -0500 (EST) From: Hamza Mahfooz To: dri-devel@lists.freedesktop.org Cc: Hamza Mahfooz , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Sunil Khatri , Ce Sun , Lijo Lazar , Kenneth Feng , Ivan Lipski , Alex Hung , Tom Chung , Melissa Wen , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Fangzhi Zuo , =?UTF-8?q?Timur=20Krist=C3=B3f?= , amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drm: introduce page_flip_timeout() Date: Thu, 22 Jan 2026 19:05:27 -0500 Message-ID: <20260123000537.2450496-1-someguy@effective-light.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4dxyrw5cwTz2xB8 X-Mailman-Approved-At: Fri, 23 Jan 2026 08:20:06 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" There should be a mechanism for drivers to respond to flip_done time outs. Since, as it stands it is possible for the display to stall indefinitely, necessitating a hard reset. So, introduce a new crtc callback that is called by drm_atomic_helper_wait_for_flip_done() to give drivers a shot at recovering from page flip timeouts. Signed-off-by: Hamza Mahfooz --- drivers/gpu/drm/drm_atomic_helper.c | 6 +++++- include/drm/drm_crtc.h | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 5840e9cc6f66..3a144c324b19 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1881,9 +1881,13 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, continue; ret = wait_for_completion_timeout(&commit->flip_done, 10 * HZ); - if (ret == 0) + if (!ret) { drm_err(dev, "[CRTC:%d:%s] flip_done timed out\n", crtc->base.id, crtc->name); + + if (crtc->funcs->page_flip_timeout) + crtc->funcs->page_flip_timeout(crtc); + } } if (state->fake_commit) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 66278ffeebd6..45dc5a76e915 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -609,6 +609,15 @@ struct drm_crtc_funcs { uint32_t flags, uint32_t target, struct drm_modeset_acquire_ctx *ctx); + /** + * @page_flip_timeout: + * + * This optional hook is called if &drm_crtc_commit.flip_done times out, + * and can be used by drivers to attempt to recover from a page flip + * timeout. + */ + void (*page_flip_timeout)(struct drm_crtc *crtc); + /** * @set_property: * -- 2.52.0