On 07/03/17 20:16, Gustavo Padovan wrote:
>>> @@ -1436,6 +1481,11 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int
>>> index, void *pb)
>>> if (pb)
>>> call_void_bufop(q, fill_user_buffer, vb, pb);
>>>
>>> + vb->in_fence = fence;
>>> + if (fence && !dma_fence_add_callback(fence, &vb->fence_cb,
>>> + vb2_qbuf_fence_cb))
>>> + return 0;
>>
>> Maybe we should provide some error or debug log here or a WARN_ON(), if
>> dma_fence_add_callback() fails instead of silently ignore any errors.
>
> This is not an error. If the if succeeds it mean we have installed a
> callback for the fence. If not, it means the fence signaled already and
> we don't can call __vb2_core_qbuf right away.
I had the same question as Mauro. After looking at the dma_fence_add_callback
code I see what you mean, but a comment would certainly be helpful.
Also, should you set vb->in_fence to NULL if the fence signaled already?
I'm not sure if you need to call 'dma_fence_put(vb->in_fence);' as well.
You would know that better than I do.
Regards,
Hans