History

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)

Lionel Landwerlin committed 7 years ago

Commit 060cebb1 parent 5ec77634 files · +16 −5Browse files

Unified · Split

4 files
  1. drivers/gpu/drm/drm_ioctl.c +3 −0
  2. drivers/gpu/drm/drm_syncobj.c +5 −5
  3. include/drm/drm_drv.h +7 −0
  4. include/uapi/drm/drm.h +1 −0
drivers/gpu/drm/drm_ioctl.c+3−0
@@ -245,6 +245,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ · 244 unmodified lines
245245 case DRM_CAP_SYNCOBJ:
246246 req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ);
247247 return 0;
248+ case DRM_CAP_SYNCOBJ_TIMELINE:
249+ req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE);
250+ return 0;
248251 }
249252
250253 /* Other caps only work with KMS drivers */
drivers/gpu/drm/drm_syncobj.c+5−5
@@ -740,7 +740,7 @@ drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data, · 739 unmodified lines
740740 struct drm_syncobj_transfer *args = data;
741741 int ret;
742742
743− if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
743+ if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
744744 return -EOPNOTSUPP;
745745
746746 if (args->pad)
@@ -1091,7 +1091,7 @@ drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data, · 344 unmodified lines
10911091 struct drm_syncobj **syncobjs;
10921092 int ret = 0;
10931093
1094− if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
1094+ if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
10951095 return -EOPNOTSUPP;
10961096
10971097 if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |
@@ -1195,7 +1195,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, · 97 unmodified lines
11951195 uint32_t i, j;
11961196 int ret;
11971197
1198− if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
1198+ if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
11991199 return -EOPNOTSUPP;
12001200
12011201 if (args->pad != 0)
@@ -1266,8 +1266,8 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, · 64 unmodified lines
12661266 uint32_t i;
12671267 int ret;
12681268
1269− if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
1270− return -ENODEV;
1269+ if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
1270+ return -EOPNOTSUPP;
12711271
12721272 if (args->pad != 0)
12731273 return -EINVAL;
include/drm/drm_drv.h+7−0
@@ -91,6 +91,13 @@ enum drm_driver_feature { · 90 unmodified lines
9191 * submission.
9292 */
9393 DRIVER_SYNCOBJ = BIT(5),
94+ /**
95+ * @DRIVER_SYNCOBJ_TIMELINE:
96+ *
97+ * Driver supports the timeline flavor of &drm_syncobj for explicit
98+ * synchronization of command submission.
99+ */
100+ DRIVER_SYNCOBJ_TIMELINE = BIT(6),
94101
95102 /* IMPORTANT: Below are all the legacy flags, add new ones above. */
96103
include/uapi/drm/drm.h+1−0
@@ -649,6 +649,7 @@ struct drm_gem_open { · 648 unmodified lines
649649 #define DRM_CAP_PAGE_FLIP_TARGET 0x11
650650 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12
651651 #define DRM_CAP_SYNCOBJ 0x13
652+#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
652653
653654 /** DRM_IOCTL_GET_CAP ioctl argument type */
654655 struct drm_get_cap {