Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Lionel 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: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190416125750.31370-1-lionel.g.landwerlin@intel.com

authored by

Lionel Landwerlin and committed by
Dave Airlie
060cebb2 5ec77638

+16 -5
+3
drivers/gpu/drm/drm_ioctl.c
··· 245 245 case DRM_CAP_SYNCOBJ: 246 246 req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ); 247 247 return 0; 248 + case DRM_CAP_SYNCOBJ_TIMELINE: 249 + req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE); 250 + return 0; 248 251 } 249 252 250 253 /* Other caps only work with KMS drivers */
+5 -5
drivers/gpu/drm/drm_syncobj.c
··· 740 740 struct drm_syncobj_transfer *args = data; 741 741 int ret; 742 742 743 - if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) 743 + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE)) 744 744 return -EOPNOTSUPP; 745 745 746 746 if (args->pad) ··· 1091 1091 struct drm_syncobj **syncobjs; 1092 1092 int ret = 0; 1093 1093 1094 - if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) 1094 + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE)) 1095 1095 return -EOPNOTSUPP; 1096 1096 1097 1097 if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL | ··· 1195 1195 uint32_t i, j; 1196 1196 int ret; 1197 1197 1198 - if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) 1198 + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE)) 1199 1199 return -EOPNOTSUPP; 1200 1200 1201 1201 if (args->pad != 0) ··· 1266 1266 uint32_t i; 1267 1267 int ret; 1268 1268 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; 1271 1271 1272 1272 if (args->pad != 0) 1273 1273 return -EINVAL;
+7
include/drm/drm_drv.h
··· 91 91 * submission. 92 92 */ 93 93 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), 94 101 95 102 /* IMPORTANT: Below are all the legacy flags, add new ones above. */ 96 103
+1
include/uapi/drm/drm.h
··· 649 649 #define DRM_CAP_PAGE_FLIP_TARGET 0x11 650 650 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 651 651 #define DRM_CAP_SYNCOBJ 0x13 652 + #define DRM_CAP_SYNCOBJ_TIMELINE 0x14 652 653 653 654 /** DRM_IOCTL_GET_CAP ioctl argument type */ 654 655 struct drm_get_cap {