All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arun R Murthy <arun.r.murthy@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	 intel-xe@lists.freedesktop.org
Cc: Simona Vetter <simona@ffwll.ch>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Jani Nikula <jani.nikula@linux.intel.com>,
	 Rodrigo Vivi <rodrigo.vivi@intel.com>,
	 Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	naveen1.kumar@intel.com,  xaver.hugl@kde.org,
	uma.shankar@intel.com, harry.wentland@amd.com,
	 Arun R Murthy <arun.r.murthy@intel.com>
Subject: [PATCH v2 1/4] drm: Define user readable error codes for atomic ioctl
Date: Wed, 30 Jul 2025 15:46:36 +0530	[thread overview]
Message-ID: <20250730-atomic-v2-1-cc02ce0263dd@intel.com> (raw)
In-Reply-To: <20250730-atomic-v2-0-cc02ce0263dd@intel.com>

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@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


  reply	other threads:[~2025-07-30 10:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 10:16 [PATCH v2 0/4] User readable error codes on atomic_ioctl failure Arun R Murthy
2025-07-30 10:16 ` Arun R Murthy [this message]
2025-07-30 11:22   ` [PATCH v2 1/4] drm: Define user readable error codes for atomic ioctl Biju Das
2025-07-30 13:45     ` Murthy, Arun R
2025-07-31 11:32   ` Xaver Hugl
2025-08-01  4:48     ` Murthy, Arun R
2025-07-30 10:16 ` [PATCH v2 2/4] drm/atomic: Add error_code element in atomic_state Arun R Murthy
2025-07-30 10:16 ` [PATCH v2 3/4] drm/atomic: Return user readable error in atomic_ioctl Arun R Murthy
2025-07-30 13:14   ` Harry Wentland
2025-07-30 13:55     ` Murthy, Arun R
2025-07-30 14:19       ` Harry Wentland
2025-07-30 10:16 ` [PATCH v2 4/4] drm/i915/display: Error codes for async flip failures Arun R Murthy
2025-07-30 10:43 ` ✓ CI.KUnit: success for User readable error codes on atomic_ioctl failure Patchwork
2025-07-30 10:58 ` ✗ CI.checksparse: warning " Patchwork
2025-07-30 11:22 ` ✓ Xe.CI.BAT: success " Patchwork
2025-07-30 12:57 ` ✗ i915.CI.BAT: failure " Patchwork
2025-07-30 13:25 ` ✗ Xe.CI.Full: " Patchwork

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=20250730-atomic-v2-1-cc02ce0263dd@intel.com \
    --to=arun.r.murthy@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=naveen1.kumar@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=uma.shankar@intel.com \
    --cc=xaver.hugl@kde.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.