On 2/17/26 15:45, Christian König wrote:
> On 2/17/26 15:35, Michel Dänzer wrote:
>> On 2/17/26 11:29, Christian König wrote:
>>>>
>>>> @@ -732,6 +732,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
>>>> DRM_IOCTL_DEF(DRM_IOCTL_MODE_LIST_LESSEES, drm_mode_list_lessees_ioctl,
>>>> DRM_MASTER),
>>>> DRM_IOCTL_DEF(DRM_IOCTL_MODE_GET_LEASE, drm_mode_get_lease_ioctl,
>>>> DRM_MASTER),
>>>> DRM_IOCTL_DEF(DRM_IOCTL_MODE_REVOKE_LEASE, drm_mode_revoke_lease_ioctl,
>>>> DRM_MASTER),
>>>> + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY_ERROR,
>>>> drm_syncobj_query_error_ioctl,
>>>> + DRM_RENDER_ALLOW),
>>>
>>> My educated guess is that userspace doesn't want to call this IOCTL
>>> separately because of performance reasons.
>>>
>>> Instead add some additional flag to DRM_SYNCOBJ_WAIT_FLAGS_* so that the
>>> IOCTL aborts the wait and returns an error as soon as it sees any fence
>>> with an error.
>>>
>>> Another DRM_SYNCOBJ_QUERY_FLAGS_* is potentially also useful to query the
>>> error on a number of drm_syncobjs at the same time.
>>>
>>> But in general since this is not a HW feature the userspace developers need
>>> to voice their requirements and explain how they want to have that
>>> implemented.
>>
>> mutter currently doesn't use the syncobj-specific ioctls to wait for a
>> syncobj (timeline point) to signal / check if it has. Instead, it uses
>> drmSyncobjEventfd / drmSyncobjExportSyncFile to get an eventfd / sync_file
>> representing the timeline point / fence, then checks the status of the fd
>> and waits for it to signal using generic poll()-style functionality. So
>> unless the error condition can be communicated via the latter (and plumbed
>> through glib APIs), mutter would need to check for fence errors separately.
>
> Good point, poll() has a POLLERR flag for that but I have no idea if eventfd
> supports that in any way. So potentially doable as well but a bit more work.
>
> Using a new DRM_SYNCOBJ_QUERY_FLAGS_ERROR on all signaled syncobj as separate
> way to query if there was an error should work for you in the meantime?
Yeah should be fine, though if POLLERR is possible, that might save constantly
calling into the kernel to check for an error status that won't happen the vast
majority of the time?
The bigger question might be what user space can do with the error status. I
wrote down some ideas for mutter in
https://gitlab.gnome.org/GNOME/mutter/-/issues/4624 .
--
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer
https://redhat.com \ Libre software enthusiast