Commit 060cebb2 authored by Lionel Landwerlin's avatar Lionel Landwerlin Committed by Dave Airlie

drm: introduce a capability flag for syncobj timeline support

Unfortunately userspace users of this API cannot be publicly disclosed
yet.

This commit effectively disables timeline syncobj ioctls for all
drivers. Each driver wishing to support this feature will need to
expose DRIVER_SYNCOBJ_TIMELINE.

v2: Add uAPI capability check (Christian)
Signed-off-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
Cc: Dave Airlie <airlied@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190416125750.31370-1-lionel.g.landwerlin@intel.com
parent 5ec77638
...@@ -245,6 +245,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ ...@@ -245,6 +245,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
case DRM_CAP_SYNCOBJ: case DRM_CAP_SYNCOBJ:
req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ); req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ);
return 0; return 0;
case DRM_CAP_SYNCOBJ_TIMELINE:
req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE);
return 0;
} }
/* Other caps only work with KMS drivers */ /* Other caps only work with KMS drivers */
......
...@@ -740,7 +740,7 @@ drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data, ...@@ -740,7 +740,7 @@ drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data,
struct drm_syncobj_transfer *args = data; struct drm_syncobj_transfer *args = data;
int ret; int ret;
if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (args->pad) if (args->pad)
...@@ -1091,7 +1091,7 @@ drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data, ...@@ -1091,7 +1091,7 @@ drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,
struct drm_syncobj **syncobjs; struct drm_syncobj **syncobjs;
int ret = 0; int ret = 0;
if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL | if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |
...@@ -1195,7 +1195,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, ...@@ -1195,7 +1195,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
uint32_t i, j; uint32_t i, j;
int ret; int ret;
if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (args->pad != 0) if (args->pad != 0)
...@@ -1266,8 +1266,8 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, ...@@ -1266,8 +1266,8 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
uint32_t i; uint32_t i;
int ret; int ret;
if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
return -ENODEV; return -EOPNOTSUPP;
if (args->pad != 0) if (args->pad != 0)
return -EINVAL; return -EINVAL;
......
...@@ -91,6 +91,13 @@ enum drm_driver_feature { ...@@ -91,6 +91,13 @@ enum drm_driver_feature {
* submission. * submission.
*/ */
DRIVER_SYNCOBJ = BIT(5), DRIVER_SYNCOBJ = BIT(5),
/**
* @DRIVER_SYNCOBJ_TIMELINE:
*
* Driver supports the timeline flavor of &drm_syncobj for explicit
* synchronization of command submission.
*/
DRIVER_SYNCOBJ_TIMELINE = BIT(6),
/* IMPORTANT: Below are all the legacy flags, add new ones above. */ /* IMPORTANT: Below are all the legacy flags, add new ones above. */
......
...@@ -649,6 +649,7 @@ struct drm_gem_open { ...@@ -649,6 +649,7 @@ struct drm_gem_open {
#define DRM_CAP_PAGE_FLIP_TARGET 0x11 #define DRM_CAP_PAGE_FLIP_TARGET 0x11
#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12
#define DRM_CAP_SYNCOBJ 0x13 #define DRM_CAP_SYNCOBJ 0x13
#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
/** DRM_IOCTL_GET_CAP ioctl argument type */ /** DRM_IOCTL_GET_CAP ioctl argument type */
struct drm_get_cap { struct drm_get_cap {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment