Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755533AbdLUUcM (ORCPT ); Thu, 21 Dec 2017 15:32:12 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:39665 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752543AbdLUUcJ (ORCPT ); Thu, 21 Dec 2017 15:32:09 -0500 X-Google-Smtp-Source: ACJfBot8NlAMcYxvrI0/I15HUfv/dyyqwcBV2qil3/zOIRXdpxdt+JPaWJ2F/LS/Ab8XlfoccytmUg== Date: Thu, 21 Dec 2017 18:32:03 -0200 From: Gustavo Padovan To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, Hans Verkuil , Shuah Khan , Pawel Osciak , Alexandre Courbot , Sakari Ailus , Brian Starkey , Thierry Escande , linux-kernel@vger.kernel.org, Gustavo Padovan Subject: Re: [PATCH v6 1/6] [media] vb2: add is_unordered callback for drivers Message-ID: <20171221203203.GB12003@jade> References: <20171211182741.29712-1-gustavo@padovan.org> <20171211182741.29712-2-gustavo@padovan.org> <20171221165128.31e16dc4@vento.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171221165128.31e16dc4@vento.lan> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2329 Lines: 59 2017-12-21 Mauro Carvalho Chehab : > Em Mon, 11 Dec 2017 16:27:36 -0200 > Gustavo Padovan escreveu: > > > From: Gustavo Padovan > > > > Explicit synchronization benefits a lot from ordered queues, they fit > > better in a pipeline with DRM for example so create a opt-in way for > > drivers notify videobuf2 that the queue is unordered. > > > > Drivers don't need implement it if the queue is ordered. > > > > Signed-off-by: Gustavo Padovan > > --- > > include/media/videobuf2-core.h | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h > > index ef9b64398c8c..eddb38a2a2f3 100644 > > --- a/include/media/videobuf2-core.h > > +++ b/include/media/videobuf2-core.h > > @@ -368,6 +368,9 @@ struct vb2_buffer { > > * callback by calling vb2_buffer_done() with either > > * %VB2_BUF_STATE_DONE or %VB2_BUF_STATE_ERROR; may use > > * vb2_wait_for_all_buffers() function > > + * @is_unordered: tell if the queue format is unordered. The default is > > + * assumed to be ordered and this function only needs to > > + * be implemented for unordered queues. > > * @buf_queue: passes buffer vb to the driver; driver may start > > * hardware operation on this buffer; driver should give > > * the buffer back by calling vb2_buffer_done() function; > > @@ -391,6 +394,7 @@ struct vb2_ops { > > > > int (*start_streaming)(struct vb2_queue *q, unsigned int count); > > void (*stop_streaming)(struct vb2_queue *q); > > + int (*is_unordered)(struct vb2_queue *q); > > > > void (*buf_queue)(struct vb2_buffer *vb); > > }; > > @@ -564,6 +568,7 @@ struct vb2_queue { > > u32 cnt_wait_finish; > > u32 cnt_start_streaming; > > u32 cnt_stop_streaming; > > + u32 cnt_is_unordered; > > If I understand, this is just a bit, right? > > if so, better to declare it as: > > u32 cnt_is_unordered : 1; no, is_unordered() is a vb2 callback to ask drivers if their current queue is not ordered and cnt_is_unordered is the counter of how many times this callback was called. This happens for all vb2 callbacks, see the other counters above, so I decided to add one for is_unordered() as well. Gustavo