From: Ville Syrjälä <[email protected]> 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 <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> --- 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
