iris: Print warning and return *out = NULL when fd to syncobj fails
authorKristian H. Kristensen <hoegsberg@google.com>
Wed, 15 Jan 2020 00:56:41 +0000 (16:56 -0800)
committerKristian H. Kristensen <hoegsberg@google.com>
Wed, 15 Jan 2020 22:47:46 +0000 (14:47 -0800)
Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_fence.c

index 3de906cca2903c5dd86e2865e6d549290811108d..dbd2d8265881eefc84ca02bfd4cc3592eea5876a 100644 (file)
@@ -343,7 +343,12 @@ iris_fence_create_fd(struct pipe_context *ctx,
       .flags = DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE,
       .fd = fd,
    };
-   gen_ioctl(screen->fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args);
+   if (gen_ioctl(screen->fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args) == -1) {
+      fprintf(stderr, "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE failed: %s\n",
+              strerror(errno));
+      *out = NULL;
+      return;
+   }
 
    struct iris_syncpt *syncpt = malloc(sizeof(*syncpt));
    syncpt->handle = args.handle;