Skip to content

Commit 8716ed4

Browse files
committed
drm: add DRM_CAPs for cursor size
Some hardware may not support standard 64x64 cursors. Add a drm cap to query the cursor size from the kernel. Some examples include radeon CIK parts (128x128 cursors) and armada (32x64 or 64x32). This allows things like device specific ddxes to remove asics specific logic and also allows xf86-video-modesetting to work properly with hw cursors on this hardware. Default to 64 if the driver doesn't specify a size. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
1 parent 7d5a33b commit 8716ed4

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎drivers/gpu/drm/drm_ioctl.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,18 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
296296
case DRM_CAP_ASYNC_PAGE_FLIP:
297297
req->value = dev->mode_config.async_page_flip;
298298
break;
299+
case DRM_CAP_CURSOR_WIDTH:
300+
if (dev->mode_config.cursor_width)
301+
req->value = dev->mode_config.cursor_width;
302+
else
303+
req->value = 64;
304+
break;
305+
case DRM_CAP_CURSOR_HEIGHT:
306+
if (dev->mode_config.cursor_height)
307+
req->value = dev->mode_config.cursor_height;
308+
else
309+
req->value = 64;
310+
break;
299311
default:
300312
return -EINVAL;
301313
}

‎include/drm/drm_crtc.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,9 @@ struct drm_mode_config {
907907

908908
/* whether async page flip is supported or not */
909909
bool async_page_flip;
910+
911+
/* cursor size */
912+
uint32_t cursor_width, cursor_height;
910913
};
911914

912915
#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)

‎include/uapi/drm/drm.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ struct drm_gem_open {
619619
#define DRM_PRIME_CAP_EXPORT 0x2
620620
#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
621621
#define DRM_CAP_ASYNC_PAGE_FLIP 0x7
622+
#define DRM_CAP_CURSOR_WIDTH 0x8
623+
#define DRM_CAP_CURSOR_HEIGHT 0x9
622624

623625
/** DRM_IOCTL_GET_CAP ioctl argument type */
624626
struct drm_get_cap {

0 commit comments

Comments
 (0)