Re: [PATCH libdrm] add libsync.h helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 31, 2016 at 10:30:23AM -0400, Rob Clark wrote:
> On Mon, Oct 31, 2016 at 9:55 AM, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
> > What I liked was doing
> >
> > if (fd2 < 0)
> >         return dup(fd1);
> >
> > if (fd1 < 0)
> >         return dup(fd2);
> >
> > That makes accumulating the fences in the caller much easier (i.e. they
> > start with
> >         batch.fence_in = -1;
> > then
> >         batch.fence_in = sync_merge(batch.fence_in, fence);
> 
> note that if you don't want to leak fd's you'd have to do something more like:
> 
>   int new_fence = sync_merge(batch->fence_in, fence);
>   if (batch->fence_in != -1)
>      close(batch->fence_in);
>   batch->fence_in = new_fence;

Hmm. so I thought the ioctl was closing the input.
 
> so it isn't *that* much better..  I guess you could do the close()
> unconditionally and ignore the error if batch->fence_in==-1..

Yup, realised after writing that a bit more on the input side is
required.


if (fd2 < 0)
	return fd1;

if (fd1 < 0)
	return dup(fd2);

ret = ioctl();
if (ret < 0)
	return fd1;

close(fd1);
return result.fence;

Which discards the synchronisation on the new fence if there's an error,
are we meant to flag a GL_ERROR?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux