Re: [PATCH v9 11/15] vb2: add in-fence support to QBUF
From: Hans Verkuil
Date: Wed May 09 2018 - 03:04:53 EST
On 05/08/2018 09:16 PM, Ezequiel Garcia wrote:
> On Mon, 2018-05-07 at 14:07 +0200, Hans Verkuil wrote:
>> On 04/05/18 22:06, Ezequiel Garcia wrote:
>>> @@ -1421,15 +1505,40 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb)
>>> trace_vb2_qbuf(q, vb);
>>> - * If already streaming, give the buffer to driver for processing.
>>> - * If not, the buffer will be given to driver on next streamon.
>>> + * For explicit synchronization: If the fence didn't signal
>>> + * yet we setup a callback to queue the buffer once the fence
>>> + * signals and then return successfully. But if the fence
>>> + * already signaled we lose the reference we held and queue the
>>> + * buffer to the driver.
>> What happens if the fence signaled an error? Is that error returned to userspace?
>> (i.e. VIDIOC_QBUF will fail in that case)
> Hm, good question. If the fence signals with an error, we won't catch it apparently.
> We should fix dma_fence_add_callback to know about signaled vs. error signaled.
OK, so in the meantime we need a comment explaining this in the code. Perhaps as
a FIXME or TODO.