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@chris-wilson.co.uk 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