[Mesa-dev] [PATCH 9/9] anv: Implement support for exporting semaphores as FENCE_FD

Dave Airlie airlied at gmail.com
Wed Mar 8 03:52:26 UTC 2017


> +#ifndef SYNC_IOC_MAGIC
> +/* duplicated from linux/sync_file.h to avoid build-time depnedency
> + * on new (v4.7) kernel headers.  Once distro's are mostly using
> + * something newer than v4.7 drop this and #include <linux/sync_file.h>
> + * instead.
> + */
> +struct sync_merge_data {
> +   char  name[32];
> +   __s32 fd2;
> +   __s32 fence;
> +   __u32 flags;
> +   __u32 pad;
> +};
> +
> +#define SYNC_IOC_MAGIC '>'
> +#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
> +#endif
> +
> +int
> +anv_gem_sync_file_merge(struct anv_device *device, int fd1, int fd2)
> +{
> +   const char name[] = "anv merge fence";
> +   struct sync_merge_data args = {
> +      .fd2 = fd2,
> +      .fence = -1,
> +   };
> +   memcpy(args.name, name, sizeof(name));
> +
> +   int ret = anv_ioctl(device->fd, SYNC_IOC_MERGE, &args);
> +   if (ret == -1)
> +      return -1;
> +
> +   return args.fence;
> +}

This seems wrong, surely device->fd should be fd1 here?

Dave.


More information about the mesa-dev mailing list