LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: Hans Verkuil <hverkuil@xs4all.nl>, linux-media@vger.kernel.org
Cc: kernel@collabora.com,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Shuah Khan <shuahkh@osg.samsung.com>,
Pawel Osciak <pawel@osciak.com>,
Alexandre Courbot <acourbot@chromium.org>,
Sakari Ailus <sakari.ailus@iki.fi>,
Brian Starkey <brian.starkey@arm.com>,
linux-kernel@vger.kernel.org,
Gustavo Padovan <gustavo.padovan@collabora.com>
Subject: Re: [PATCH v10 12/16] vb2: add in-fence support to QBUF
Date: Tue, 22 May 2018 14:41:29 -0300 [thread overview]
Message-ID: <9836ca80e08574c6e77f45d069514c28f8867cb1.camel@collabora.com> (raw)
In-Reply-To: <8848cdb3-73cf-2122-4c50-a57fcd83e151@xs4all.nl>
On Tue, 2018-05-22 at 18:48 +0200, Hans Verkuil wrote:
> On 22/05/18 18:22, Ezequiel Garcia wrote:
> > > > @@ -1615,7 +1762,12 @@ static void __vb2_dqbuf(struct vb2_buffer *vb)
> > > > return;
> > > >
> > > > vb->state = VB2_BUF_STATE_DEQUEUED;
> > > > -
> > > > + if (vb->in_fence) {
> > > > + if (dma_fence_remove_callback(vb->in_fence, &vb->fence_cb))
> > > > + __vb2_buffer_put(vb);
> > > > + dma_fence_put(vb->in_fence);
> > > > + vb->in_fence = NULL;
> > > > + }
> > > > /* unmap DMABUF buffer */
> > > > if (q->memory == VB2_MEMORY_DMABUF)
> > > > for (i = 0; i < vb->num_planes; ++i) {
> > > > @@ -1653,7 +1805,7 @@ int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb,
> > > > if (pindex)
> > > > *pindex = vb->index;
> > > >
> > > > - /* Fill buffer information for the userspace */
> > > > + /* Fill buffer information for userspace */
> > > > if (pb)
> > > > call_void_bufop(q, fill_user_buffer, vb, pb);
> > > >
> > > > @@ -1700,8 +1852,8 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
> > > > if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
> > > > for (i = 0; i < q->num_buffers; ++i)
> > > > if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) {
> > > > - pr_warn("driver bug: stop_streaming operation is leaving buf %p in active
> > > > state\n",
> > > > - q->bufs[i]);
> > > > + pr_warn("driver bug: stop_streaming operation is leaving buf[%d] 0x%p in active
> > > > state\n",
> > > > + q->bufs[i]->index, q->bufs[i]);
> > > > vb2_buffer_done(q->bufs[i], VB2_BUF_STATE_ERROR);
> > > > }
> > >
> > > Shouldn't any pending fences be canceled here?
> > >
> >
> > No, we don't have to flush -- that's the reason of the refcount :)
> > The qbuf_work won't do anything if all the buffers are returned
> > by the driver (with error or done state), and if !streaming.
> >
> > Also, note that's why qbuf_work checks for the queued state, and not
> > for the error state.
> >
> > > I feel uncomfortable with the refcounting of buffers, I'd rather that when we
> > > cancel the queue all fences for buffers are removed/canceled/whatever.
> > >
> > > Is there any reason for refcounting if we cancel all pending fences here?
> > >
> > > Note that besides canceling fences you also need to cancel/flush __qbuf_work.
> > >
> > >
> >
> > Like I said above, I'm trying to avoid cancel/flushing the workqueue.
> > Currently, I believe it works fine without any flushing, provided we refcount
> > the buffers.
> >
> > The problem with cancelling the workqueue, is that you need to unlock the queue
> > lock, to avoid a deadlock. It seemed to me that having a refcount is more natural.
> >
> > Thoughts?
> >
>
> I'll take another look tomorrow morning. Do you have a public git tree containing
> this series that I can browse?
>
>
Sure, there you go http://git.infradead.org/users/ezequielg/linux/shortlog/refs/heads/fences_v10_v4.17-rc1
next prev parent reply other threads:[~2018-05-22 17:43 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-21 16:59 [PATCH v10 00/16] V4L2 Explicit Synchronization Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 01/16] videobuf2: Make struct vb2_buffer refcounted Ezequiel Garcia
2018-05-25 6:41 ` sathyam panda
2018-05-29 13:17 ` Ezequiel Garcia
2018-05-29 15:11 ` sathyam panda
2018-05-21 16:59 ` [PATCH v10 02/16] xilinx: regroup caps on querycap Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 03/16] hackrf: group device capabilities Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 04/16] omap3isp: " Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 05/16] vb2: move vb2_ops functions to videobuf2-core.[ch] Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 06/16] vb2: add is_unordered callback for drivers Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 07/16] v4l: add unordered flag to format description ioctl Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 08/16] v4l: mark unordered formats Ezequiel Garcia
2018-05-22 11:55 ` Hans Verkuil
2018-05-23 10:30 ` Ezequiel Garcia
2018-05-23 11:29 ` Hans Verkuil
2018-05-21 16:59 ` [PATCH v10 09/16] cobalt: add .is_unordered() for cobalt Ezequiel Garcia
2018-05-22 11:57 ` Hans Verkuil
2018-05-21 16:59 ` [PATCH v10 10/16] vb2: mark codec drivers as unordered Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 11/16] vb2: add explicit fence user API Ezequiel Garcia
2018-05-22 12:05 ` Hans Verkuil
2018-05-22 15:51 ` Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 12/16] vb2: add in-fence support to QBUF Ezequiel Garcia
2018-05-22 12:37 ` Hans Verkuil
2018-05-22 16:22 ` Ezequiel Garcia
2018-05-22 16:48 ` Hans Verkuil
2018-05-22 17:41 ` Ezequiel Garcia [this message]
2018-05-25 6:12 ` sathyam panda
2018-05-21 16:59 ` [PATCH v10 13/16] vb2: add out-fence " Ezequiel Garcia
2018-05-22 12:41 ` Hans Verkuil
2018-05-25 16:36 ` Brian Starkey
2018-05-21 16:59 ` [PATCH v10 14/16] v4l: introduce the fences capability Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 15/16] v4l: Add V4L2_CAP_FENCES to drivers Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 16/16] v4l: Document explicit synchronization behavior Ezequiel Garcia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9836ca80e08574c6e77f45d069514c28f8867cb1.camel@collabora.com \
--to=ezequiel@collabora.com \
--cc=acourbot@chromium.org \
--cc=brian.starkey@arm.com \
--cc=gustavo.padovan@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=pawel@osciak.com \
--cc=sakari.ailus@iki.fi \
--cc=shuahkh@osg.samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).