drm: introduce DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP
authorSimon Ser <contact@emersion.fr>
Wed, 22 Nov 2023 16:19:40 +0000 (13:19 -0300)
committerSimon Ser <contact@emersion.fr>
Thu, 23 Nov 2023 16:13:13 +0000 (17:13 +0100)
This new kernel capability indicates whether async page-flips are
supported via the atomic uAPI. DRM clients can use it to check
for support before feeding DRM_MODE_PAGE_FLIP_ASYNC to the kernel.

Make it clear that DRM_CAP_ASYNC_PAGE_FLIP is for legacy uAPI only.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patchwork.freedesktop.org/patch/msgid/20231122161941.320564-4-andrealmeid@igalia.com
drivers/gpu/drm/drm_ioctl.c
include/uapi/drm/drm.h

index 44fda68..f461ed8 100644 (file)
@@ -301,6 +301,10 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
        case DRM_CAP_CRTC_IN_VBLANK_EVENT:
                req->value = 1;
                break;
+       case DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP:
+               req->value = drm_core_check_feature(dev, DRIVER_ATOMIC) &&
+                            dev->mode_config.async_page_flip;
+               break;
        default:
                return -EINVAL;
        }
index 8662b5a..796de83 100644 (file)
@@ -713,7 +713,8 @@ struct drm_gem_open {
 /**
  * DRM_CAP_ASYNC_PAGE_FLIP
  *
- * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC.
+ * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for legacy
+ * page-flips.
  */
 #define DRM_CAP_ASYNC_PAGE_FLIP                0x7
 /**
@@ -773,6 +774,13 @@ struct drm_gem_open {
  * :ref:`drm_sync_objects`.
  */
 #define DRM_CAP_SYNCOBJ_TIMELINE       0x14
+/**
+ * DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP
+ *
+ * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for atomic
+ * commits.
+ */
+#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15
 
 /* DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {