[PATCH v2 1/4] drm: Define user readable error codes for atomic ioctl
Arun R Murthy
arun.r.murthy at intel.com
Wed Jul 30 10:16:36 UTC 2025
There can be multiple reasons for a failure in atomic_ioctl. Most often
in these error conditions -EINVAL is returned. User/Compositor would
have to blindly take a call on failure of this ioctl so as to use
ALLOW_MODESET or any. It would be good if user/compositor gets a
readable error code on failure so they can take proper corrections in
the next commit.
The struct drm_mode_atomic is being passed by the user/compositor which
holds the properties for modeset/flip. Reusing the same struct for
returning the error code in case of failure can save by creating a new
uapi/interface for returning the error code.
The element 'reserved' in the struct drm_mode_atomic is used for
returning the user readable error code.Its a 64bit variable and
should suffice 64 error codes that should be sufficient.
Signed-off-by: Arun R Murthy <arun.r.murthy at intel.com>
---
include/uapi/drm/drm_mode.h | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index a122bea2559387576150236e3a88f99c24ad3138..87e8f623bfaaab09135be104db04996f0be4dcb4 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -1157,6 +1157,46 @@ struct drm_mode_destroy_dumb {
DRM_MODE_ATOMIC_NONBLOCK |\
DRM_MODE_ATOMIC_ALLOW_MODESET)
+/* atomic not set in the drm_file */
+#define DRM_MODE_ATOMIC_CAP_NOT_ENABLED BIT(0)
+/* atomic flag passed not in DRM_MODE_ATOMIC_FLAGS list */
+#define DRM_MODE_ATOMIC_INVALID_FLAG BIT(1)
+/* DRM_MODE_PAGE_FLIP_LEGACY not supported with atomic ioctl */
+#define DRM_MODE_ATOMIC_PAGE_FLIP_ASYNC BIT(2)
+/* flip event with atomic check only not supported */
+#define DRM_MODE_ATOMIC_FLIP_EVENT_WITH_CHECKONLY BIT(3)
+/* atomic property change requested need full crtc modeset */
+#define DRM_MODE_ATOMIC_CRTC_NEED_FULL_MODESET BIT(4)
+/* atomic property change requested has impact on all connected crtc */
+#define DRM_MODE_ATOMIC_NEED_FULL_MODESET BIT(5)
+/* async flip supported on only primary plane */
+#define DRM_MODE_ATOMIC_ASYNC_NOT_PRIMARY BIT(6)
+/* modifier not supported by async flip */
+#define DRM_MODE_ATOMIC_ASYNC_MODIFIER_NOT_SUPPORTED BIT(7)
+/* async flip with pipe joiner not allowed */
+#define DRM_MODE_ATOMIC_ASYNC_PIPEJOINER_NOTALLOWED BIT(8)
+/* No properties can be changed with async flip */
+#define DRM_MODE_ATOMIC_ASYNC_PROP_CHANGED BIT(9)
+
+/**
+ * DRM_MODE_ATOMIC_ERR_FLAGS
+ *
+ * Bit field of the reserved element in drm_mode_atomic will be
+ * used for returning meaningful error message to the compositor
+ * so that compositor can take necessary correction going ahead.
+ */
+#define DRM_MODE_ATOMIC_ERR_FLAGS (\
+ DRM_MODE_ATOMIC_CAP_NOT_ENABLED |\
+ DRM_MODE_ATOMIC_INVALID_FLAG |\
+ DRM_MODE_ATOMIC_PAGE_FLIP_ASYNC |\
+ DRM_MODE_ATOMIC_FLIP_EVENT_WITH_CHECKONLY |\
+ DRM_MODE_ATOMIC_CRTC_NEED_FULL_MODESET |\
+ DRM_MODE_ATOMIC_NEED_FULL_MODESET |\
+ DRM_MODE_ATOMIC_ASYNC_NOT_PRIMARY |\
+ DRM_MODE_ATOMIC_ASYNC_MODIFIER_NOT_SUPPORTED |\
+ DRM_MODE_ATOMIC_ASYNC_PIPEJOINER_NOTALLOWED |\
+ DRM_MODE_ATOMIC_ASYNC_PROP_CHANGED)
+
struct drm_mode_atomic {
__u32 flags;
__u32 count_objs;
--
2.25.1
More information about the Intel-gfx
mailing list