Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	Daniel Stone <daniels@collabora.com>
Subject: [PATCH 2/5] drm/uapi: Introduce the DRM_MODE_DUMB_CURSOR flag
Date: Tue, 21 Oct 2025 22:44:52 +0300	[thread overview]
Message-ID: <20251021194455.24297-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20251021194455.24297-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

On certain hardware (eg. all Intel GPUs) normal planes vs. cursor
planes have wildly different hardware capabilities. Currently
DRM_IOCTL_MODE_CREATE_DUMB is only really suitable for allocating
buffers for normal planes.

Introduce a new DRM_MODE_DUMB_CURSOR flag for DRM_IOCTL_MODE_CREATE_DUMB
so that the driver can attempt to make sure the dumb buffer will
be actually suitable for cursor planes.

Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_dumb_buffers.c | 2 +-
 include/uapi/drm/drm_mode.h        | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
index fdc249198022..e4a9692c099d 100644
--- a/drivers/gpu/drm/drm_dumb_buffers.c
+++ b/drivers/gpu/drm/drm_dumb_buffers.c
@@ -197,7 +197,7 @@ int drm_mode_create_dumb(struct drm_device *dev,
 		return -ENOSYS;
 	if (!args->width || !args->height || !args->bpp)
 		return -EINVAL;
-	if (args->flags)
+	if (args->flags & ~DRM_MODE_DUMB_CURSOR)
 		return -EINVAL;
 
 	/* overflow checks for 32bit size calculations */
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 1e0e02a79b5c..3b7e13a29244 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -1062,12 +1062,14 @@ struct drm_mode_crtc_page_flip_target {
 	__u64 user_data;
 };
 
+#define DRM_MODE_DUMB_CURSOR	(1<<0) /* dumb buffer is intended for a cursor */
+
 /**
  * struct drm_mode_create_dumb - Create a KMS dumb buffer for scanout.
  * @height: buffer height in pixels
  * @width: buffer width in pixels
  * @bpp: color mode
- * @flags: must be zero
+ * @flags: bitmask of flags, see DRM_MODE_DUMB_* defines
  * @handle: buffer object handle
  * @pitch: number of bytes between two consecutive lines
  * @size: size of the whole buffer in bytes
-- 
2.49.1


  parent reply	other threads:[~2025-10-21 19:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 19:44 [PATCH 0/5] drm/uapi: Intoduce DRM_MODE_DUMB_CURSOR Ville Syrjala
2025-10-21 19:44 ` [PATCH 1/5] drm/uapi: Validate DRM_IOCTL_MODE_CREATE_DUMB flags Ville Syrjala
2025-10-21 19:44 ` Ville Syrjala [this message]
2025-10-21 19:44 ` [PATCH 3/5] drm/i915/dumb: Move the display dumb buffer stuff into the display code Ville Syrjala
2025-10-21 19:44 ` [PATCH 4/5] drm/i915/dumb: Reject dumb buffer that exceed max fb dimensions Ville Syrjala
2025-10-21 19:44 ` [PATCH 5/5] drm/i915/dumb: Handle DRM_MODE_DUMB_CURSOR Ville Syrjala
2025-10-21 19:51 ` ✗ CI.checkpatch: warning for drm/uapi: Intoduce DRM_MODE_DUMB_CURSOR Patchwork
2025-10-21 19:52 ` ✓ CI.KUnit: success " Patchwork
2025-10-21 20:07 ` ✗ CI.checksparse: warning " Patchwork
2025-10-21 20:31 ` ✓ Xe.CI.BAT: success " Patchwork
2025-10-21 23:07 ` ✓ 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=20251021194455.24297-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.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