Re: [PATCH v2 1/2] drm: introduce KMS recovery mechanism
From: Christian König
Date: Tue Feb 10 2026 - 03:28:56 EST
On 2/10/26 00:04, Hamza Mahfooz wrote:
> On Mon, Feb 09, 2026 at 10:35:05AM +0100, Christian König wrote:
>>> + /**
>>> + * @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);
>>
>> As far as I can see a callback is clearly not the right approach.
>>
>> The drm_atomic_helper_wait_for_flip_done() helper is called by the driver, isn't it?
>>
>> So what we need is just to give an error code back to the driver.
>>
>
> I guess we could just have the function return -ETIMEOUT, but then
> drivers wouldn't know which crtc is timing out and AFAIK drivers aren't
> supposed to touch `drm_crtc_commit`s so they don't really have a
> sanctioned means to figure that out on their own.
Well we can add a helper to allow the driver to query each crtc for pending flips.
What you do here is usually called mid-layering (e.g. driver calls function, function calls back into driver) and is a clear no-go for acceptable upstream code.
Regards,
Christian.