From: Mario Limonciello <superm1@kernel.org>
To: Hamza Mahfooz <someguy@effective-light.com>,
dri-devel@lists.freedesktop.org
Cc: "Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Rodrigo Siqueira" <siqueira@igalia.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Alex Hung" <alex.hung@amd.com>, "Wayne Lin" <Wayne.Lin@amd.com>,
"Timur Kristóf" <timur.kristof@gmail.com>,
"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
"Mario Limonciello (AMD)" <superm1@kernel.org>,
"Ivan Lipski" <ivan.lipski@amd.com>,
"Chenyu Chen" <chen-yu.chen@amd.com>,
"Matthew Schwartz" <matthew.schwartz@linux.dev>,
"Tom Chung" <chiahsuan.chung@amd.com>,
"Roman Li" <Roman.Li@amd.com>, "Takashi Iwai" <tiwai@suse.de>,
"Colin Ian King" <colin.i.king@gmail.com>,
"Charlene Liu" <charlene.liu@amd.com>,
"Kees Cook" <kees@kernel.org>,
amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/2] drm/atomic: attempt full modeset on page flip timeout
Date: Tue, 5 May 2026 13:31:16 -0500 [thread overview]
Message-ID: <68563e7d-bba7-4b83-99da-e8b8f4bf67a6@kernel.org> (raw)
In-Reply-To: <20260505182105.420525-1-someguy@effective-light.com>
On 5/5/26 13:20, Hamza Mahfooz wrote:
> We should try to recover from page flip timeouts. Forcing
> a full modeset should be generic across all atomic KMS drivers,
> so try that first.
>
> Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 49 +++++++++++++++++++++++++++--
> 1 file changed, 46 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index a768398a1884..7ee9d52f63c5 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1926,6 +1926,43 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> }
> EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks);
>
> +static int force_full_modeset(struct drm_crtc *crtc)
> +{
> + struct drm_modeset_acquire_ctx ctx;
> + struct drm_crtc_state *crtc_state;
> + struct drm_atomic_state *state;
> + int ret;
> + int err;
> +
> + if (drm_atomic_crtc_needs_modeset(crtc->state))
> + return -EBUSY;
> +
> + DRM_MODESET_LOCK_ALL_BEGIN(crtc->dev, ctx, 0, err);
> + state = drm_atomic_state_alloc(crtc->dev);
> + if (!state)
> + return -ENOMEM;
> +
> + state->acquire_ctx = &ctx;
> +
> + crtc_state = drm_atomic_get_crtc_state(state, crtc);
> + if (IS_ERR(crtc_state)) {
> + ret = PTR_ERR(crtc_state);
> + goto out;
> + }
> +
> + crtc_state->mode_changed = true;
> +
> + drm_info(crtc->dev,
> + "[CRTC:%d:%s] Attempting force full modeset...\n",
> + crtc->base.id, crtc->name);
> +
> + ret = drm_atomic_commit(state);
> +out:
> + drm_atomic_state_put(state);
> + DRM_MODESET_LOCK_ALL_END(crtc->dev, ctx, err);
> + return ret;
> +}
> +
> /**
> * drm_atomic_helper_wait_for_flip_done - wait for all page flips to be done
> * @dev: DRM device
> @@ -1949,17 +1986,23 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev,
>
> for (i = 0; i < dev->mode_config.num_crtc; i++) {
> struct drm_crtc_commit *commit = state->crtcs[i].commit;
> - int ret;
>
> crtc = state->crtcs[i].ptr;
>
> if (!crtc || !commit)
> continue;
>
> - ret = wait_for_completion_timeout(&commit->flip_done, 10 * HZ);
> - if (ret == 0)
> + if (!wait_for_completion_timeout(&commit->flip_done, 10 * HZ)) {
> + int ret;
> drm_err(dev, "[CRTC:%d:%s] flip_done timed out\n",
> crtc->base.id, crtc->name);
> +
> + ret = force_full_modeset(crtc);
> + if (ret)
> + drm_err(dev,
> + "[CRTC:%d:%s] force full modeset failed! ret=%d\n",
> + crtc->base.id, crtc->name, ret);
> + }
> }
>
> if (state->fake_commit)
next prev parent reply other threads:[~2026-05-05 18:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 18:20 [PATCH v6 1/2] drm/atomic: attempt full modeset on page flip timeout Hamza Mahfooz
2026-05-05 18:20 ` [PATCH v6 2/2] drm/amd/display: add DMU timeout recovery support Hamza Mahfooz
2026-05-05 18:31 ` Mario Limonciello
2026-05-06 17:36 ` Hamza Mahfooz
2026-05-06 19:31 ` Leo Li
2026-05-05 18:31 ` Mario Limonciello [this message]
2026-05-06 18:47 ` [PATCH v6 1/2] drm/atomic: attempt full modeset on page flip timeout Ville Syrjälä
2026-05-07 0:22 ` Hamza Mahfooz
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=68563e7d-bba7-4b83-99da-e8b8f4bf67a6@kernel.org \
--to=superm1@kernel.org \
--cc=Roman.Li@amd.com \
--cc=Wayne.Lin@amd.com \
--cc=airlied@gmail.com \
--cc=alex.hung@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=charlene.liu@amd.com \
--cc=chen-yu.chen@amd.com \
--cc=chiahsuan.chung@amd.com \
--cc=christian.koenig@amd.com \
--cc=colin.i.king@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=ivan.lipski@amd.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.schwartz@linux.dev \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=siqueira@igalia.com \
--cc=someguy@effective-light.com \
--cc=sunpeng.li@amd.com \
--cc=timur.kristof@gmail.com \
--cc=tiwai@suse.de \
--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.