drm-shim: provide a valid fake syncobj handle at creation
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 16 Apr 2020 14:55:30 +0000 (17:55 +0300)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 24 Apr 2020 07:19:43 +0000 (10:19 +0300)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4726>

src/drm-shim/device.c

index 8020c2ae5ccaf1fbe1f74553d452826abb614feb..a2176f8d058eb46ed17774fe5c439796343219ba 100644 (file)
@@ -189,6 +189,16 @@ drm_shim_ioctl_gem_close(int fd, unsigned long request, void *arg)
    return 0;
 }
 
+static int
+drm_shim_ioctl_syncobj_create(int fd, unsigned long request, void *arg)
+{
+   struct drm_syncobj_create *create = arg;
+
+   create->handle = 1; /* 0 is invalid */
+
+   return 0;
+}
+
 static int
 drm_shim_ioctl_stub(int fd, unsigned long request, void *arg)
 {
@@ -199,7 +209,7 @@ ioctl_fn_t core_ioctls[] = {
    [_IOC_NR(DRM_IOCTL_VERSION)] = drm_shim_ioctl_version,
    [_IOC_NR(DRM_IOCTL_GET_CAP)] = drm_shim_ioctl_get_cap,
    [_IOC_NR(DRM_IOCTL_GEM_CLOSE)] = drm_shim_ioctl_gem_close,
-   [_IOC_NR(DRM_IOCTL_SYNCOBJ_CREATE)] = drm_shim_ioctl_stub,
+   [_IOC_NR(DRM_IOCTL_SYNCOBJ_CREATE)] = drm_shim_ioctl_syncobj_create,
    [_IOC_NR(DRM_IOCTL_SYNCOBJ_DESTROY)] = drm_shim_ioctl_stub,
    [_IOC_NR(DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD)] = drm_shim_ioctl_stub,
    [_IOC_NR(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE)] = drm_shim_ioctl_stub,