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

Jason Ekstrand jason at jlekstrand.net
Wed Mar 8 04:10:23 UTC 2017


On Tue, Mar 7, 2017 at 7:52 PM, Dave Airlie <airlied at gmail.com> wrote:

> > +#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?
>

 Thanks! Fixed locally.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170307/1c26d61b/attachment.html>


More information about the mesa-dev mailing list