On 2/20/26 18:15, Hamza Mahfooz wrote:
> We now have a means to respond to page flip timeouts. So, hook up
> support by trying to reload DMUB firmware if
> drm_atomic_helper_wait_for_flip_done() fails. Also, send out a wedged
> event if the firmware reload fails.
>
> Signed-off-by: Hamza Mahfooz <[email protected]>
> ---
> v2: send a wedged event instead of attempting a GPU reset.
> v3: read return value of drm_atomic_helper_wait_for_flip_done().
> v4: only send wedged event if firmware reload fails and send out "fake"
> page flip completes.
> ---
> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 +++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
> 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 7c51d8d7e73c..0ae6ada22fb0 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -87,6 +87,7 @@
> #include <drm/drm_atomic_uapi.h>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_blend.h>
> +#include <drm/drm_drv.h>
> #include <drm/drm_fixed.h>
> #include <drm/drm_fourcc.h>
> #include <drm/drm_edid.h>
> @@ -10829,6 +10830,7 @@ static void amdgpu_dm_atomic_commit_tail(struct
> drm_atomic_state *state)
> struct drm_connector_state *old_con_state = NULL, *new_con_state = NULL;
> struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
> int crtc_disable_count = 0;
> + struct amdgpu_crtc *acrtc;
>
> trace_amdgpu_dm_atomic_commit_tail_begin(state);
>
> @@ -11085,8 +11087,26 @@ static void amdgpu_dm_atomic_commit_tail(struct
> drm_atomic_state *state)
> /* Signal HW programming completion */
> drm_atomic_helper_commit_hw_done(state);
>
> - if (wait_for_vblank)
> - drm_atomic_helper_wait_for_flip_done(dev, state);
> + if (wait_for_vblank &&
> + drm_atomic_helper_wait_for_flip_done(dev, state)) {
> + mutex_lock(&dm->dc_lock);
> + if (dm_dmub_hw_init(adev))
>From Michel's explanation that is pretty much a no-go because it potentially
>causes other atomic commits to react in unforeseen ways.
> + drm_dev_wedged_event(dev, DRM_WEDGE_RECOVERY_REBIND |
> + DRM_WEDGE_RECOVERY_BUS_RESET,
> + NULL);
Please completely drop that. This here is a sledge hammer and not going to fly
anywhere.
> + mutex_unlock(&dm->dc_lock);
> +
> + spin_lock_irqsave(&dev->event_lock, flags);
> + drm_for_each_crtc(crtc, dev) {
This should go over only the CRTCs in the atomic commit currently handled.
Have you tried sending a hotplug event for the connectors in question as Michel
suggested?
Regards,
Christian.
> + if (acrtc->event) {
> + drm_crtc_send_vblank_event(crtc, acrtc->event);
> + acrtc->event = NULL;
> + drm_crtc_vblank_put(crtc);
> + acrtc->pflip_status = AMDGPU_FLIP_NONE;
> + }
> + }
> + spin_unlock_irqrestore(&dev->event_lock, flags);
> + }
>
> drm_atomic_helper_cleanup_planes(dev, state);
>