From: Yicong Hui <yiconghui@gmail.com>
To: christian.koenig@amd.com
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org, david.hunter.linux@gmail.com,
Yicong Hui <yiconghui@gmail.com>
Subject: [RFC PATCH v1 1/2] drm/syncobj: Add DRM_IOCTL_SYNCOBJ_QUERY_ERROR to query fence error status
Date: Fri, 13 Feb 2026 12:08:34 +0000 [thread overview]
Message-ID: <20260213120836.81283-2-yiconghui@gmail.com> (raw)
In-Reply-To: <20260213120836.81283-1-yiconghui@gmail.com>
Add DRM_IOCTL_SYNCOBJ_QUERY_ERROR to allow userspace to query the error
status of a fence held by a timeline/binary syncobj.
Signed-off-by: Yicong Hui <yiconghui@gmail.com>
---
drivers/gpu/drm/drm_internal.h | 2 ++
drivers/gpu/drm/drm_ioctl.c | 2 ++
drivers/gpu/drm/drm_syncobj.c | 22 ++++++++++++++++++++++
include/uapi/drm/drm.h | 13 +++++++++++++
4 files changed, 39 insertions(+)
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index f893b1e3a596..d4d722983544 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -285,6 +285,8 @@ int drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_private);
int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_private);
+int drm_syncobj_query_error_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_private);
/* drm_framebuffer.c */
void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index ff193155129e..61b114a6a65f 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -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),
};
#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE(drm_ioctls)
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 2d4ab745fdad..2152cd029070 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -1717,3 +1717,25 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
return ret;
}
+
+int drm_syncobj_query_error_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_private)
+{
+ struct drm_syncobj_error *args = data;
+ struct dma_fence *fence;
+ int ret;
+
+ if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
+ return -EOPNOTSUPP;
+
+ ret = drm_syncobj_find_fence(file_private, args->handle, args->point, 0, &fence);
+
+ if (ret)
+ return ret;
+
+ args->error = fence->error;
+
+ dma_fence_put(fence);
+
+ return 0;
+}
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 27cc159c1d27..087c0f2120ec 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -1051,6 +1051,11 @@ struct drm_syncobj_timeline_array {
__u32 flags;
};
+struct drm_syncobj_error {
+ __u32 handle;
+ __s32 error;
+ __u64 point;
+};
/* Query current scanout sequence number */
struct drm_crtc_get_sequence {
@@ -1363,6 +1368,14 @@ extern "C" {
*/
#define DRM_IOCTL_GEM_CHANGE_HANDLE DRM_IOWR(0xD2, struct drm_gem_change_handle)
+/**
+ * DRM_IOCTL_SYNCOBJ_QUERY_ERROR - Query the error code from a failed drm_syncobj
+ *
+ * This ioctl provides userspace a way to query the error code of a binary and
+ * timeline drm_syncobj in the case that the submission fails.
+ */
+#define DRM_IOCTL_SYNCOBJ_QUERY_ERROR DRM_IOWR(0xD3, struct drm_syncobj_error)
+
/*
* Device specific ioctls should only be in their respective headers
* The device specific ioctl range is from 0x40 to 0x9f.
--
2.53.0
next prev parent reply other threads:[~2026-02-13 12:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 12:08 [RFC PATCH v1 0/2] Starter task: Querying errors from Yicong Hui
2026-02-13 12:08 ` Yicong Hui [this message]
2026-02-17 10:29 ` [RFC PATCH v1 1/2] drm/syncobj: Add DRM_IOCTL_SYNCOBJ_QUERY_ERROR to query fence error status Christian König
2026-02-17 11:35 ` Yicong Hui
2026-02-17 14:35 ` Michel Dänzer
2026-02-17 14:45 ` Christian König
2026-02-18 14:49 ` Michel Dänzer
2026-02-19 0:15 ` Yicong Hui
2026-02-19 7:31 ` Christian König
2026-02-13 12:08 ` [RFC PATCH v1 2/2] drm/syncobj/doc: Remove starter task from todo list Yicong Hui
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=20260213120836.81283-2-yiconghui@gmail.com \
--to=yiconghui@gmail.com \
--cc=christian.koenig@amd.com \
--cc=david.hunter.linux@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®