linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com,
	ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar,
	p.zabel@pengutronix.de, gregkh@linuxfoundation.org,
	nicolas.dufresne@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-staging@lists.linux.dev, kernel@collabora.com
Subject: Re: [PATCH v11 40/56] sample: v4l: Stop direct calls to queue num_buffers field
Date: Mon, 16 Oct 2023 10:23:39 +0200	[thread overview]
Message-ID: <21864437-bfdd-4d39-91fa-f24fc1c7cf97@xs4all.nl> (raw)
In-Reply-To: <20231012114642.19040-41-benjamin.gaignard@collabora.com>

On 12/10/2023 13:46, Benjamin Gaignard wrote:
> Use vb2_get_num_buffers() to avoid using queue num_buffers field directly.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> ---
>  samples/v4l/v4l2-pci-skeleton.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/samples/v4l/v4l2-pci-skeleton.c b/samples/v4l/v4l2-pci-skeleton.c
> index a61f94db18d9..a65aa9d1e9da 100644
> --- a/samples/v4l/v4l2-pci-skeleton.c
> +++ b/samples/v4l/v4l2-pci-skeleton.c
> @@ -155,6 +155,7 @@ static int queue_setup(struct vb2_queue *vq,
>  		       unsigned int sizes[], struct device *alloc_devs[])
>  {
>  	struct skeleton *skel = vb2_get_drv_priv(vq);
> +	unsigned int q_num_bufs = vb2_get_num_buffers(vq);
>  
>  	skel->field = skel->format.field;
>  	if (skel->field == V4L2_FIELD_ALTERNATE) {
> @@ -167,8 +168,8 @@ static int queue_setup(struct vb2_queue *vq,
>  		skel->field = V4L2_FIELD_TOP;
>  	}
>  
> -	if (vq->num_buffers + *nbuffers < 3)
> -		*nbuffers = 3 - vq->num_buffers;
> +	if (q_num_bufs + *nbuffers < 3)
> +		*nbuffers = 3 - q_num_bufs;

This should be dropped, and instead update q->min_buffers_needed from
2 to 3.

Regards,

	Hans

>  
>  	if (*nplanes)
>  		return sizes[0] < skel->format.sizeimage ? -EINVAL : 0;


  reply	other threads:[~2023-10-16  8:23 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 11:45 [PATCH v11 00/56] Add DELETE_BUF ioctl Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 01/56] media: videobuf2: Rename offset parameter Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 02/56] media: videobuf2: Rework offset 'cookie' encoding pattern Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 03/56] media: videobuf2: Stop spamming kernel log with all queue counter Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 04/56] media: videobuf2: Use vb2_buffer instead of index Benjamin Gaignard
2023-10-16  7:34   ` Hans Verkuil
2023-10-12 11:45 ` [PATCH v11 05/56] media: videobuf2: Access vb2_queue bufs array through helper functions Benjamin Gaignard
2023-10-16  7:50   ` Hans Verkuil
2023-10-12 11:45 ` [PATCH v11 06/56] media: videobuf2: Remove duplicated index vs q->num_buffers check Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 07/56] media: videobuf2: Add helper to get queue number of buffers Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 08/56] media: videobuf2: Use vb2_get_num_buffers() helper Benjamin Gaignard
2023-10-16  8:08   ` Hans Verkuil
2023-10-12 11:45 ` [PATCH v11 09/56] media: amphion: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-10-16  8:13   ` Hans Verkuil
2023-10-12 11:45 ` [PATCH v11 10/56] media: amphion: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 11/56] media: mediatek: jpeg: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 12/56] media: mediatek: vdec: Remove useless loop Benjamin Gaignard
2023-10-12 11:45 ` [PATCH v11 13/56] media: mediatek: vcodec: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 14/56] media: sti: hva: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 15/56] media: visl: " Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 16/56] media: atomisp: " Benjamin Gaignard
2023-10-12 12:10   ` Hans de Goede
2023-10-12 11:46 ` [PATCH v11 17/56] media: atomisp: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-12 12:10   ` Hans de Goede
2023-10-12 11:46 ` [PATCH v11 18/56] media: dvb-core: Use vb2_get_buffer() instead of directly access to buffers array Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 19/56] media: dvb-core: Do not initialize twice queue num_buffer field Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 20/56] media: dvb-frontends: rtl2832_srd: Use queue min_buffers_needed field Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 21/56] media: video-i2c: Set min_buffers_needed to 2 Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 22/56] media: pci: cx18: Set correct value to min_buffers_needed field Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 23/56] media: pci: dt3155: Remove useless check Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 24/56] media: pci: netup_unidvb: Remove useless number of buffers check Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 25/56] media: pci: tw68: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 26/56] media: pci: tw686x: Set min_buffers_needed to 3 Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 27/56] media: coda: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 28/56] media: nxp: " Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 29/56] media: renesas: Set min_buffers_needed to 16 Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 30/56] media: ti: Use queue min_buffers_needed field to set the min number of buffers Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 31/56] media: verisilicon: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 32/56] media: test-drivers: " Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 33/56] media: usb: airspy: Set min_buffers_needed to 8 Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 34/56] media: usb: cx231xx: Set min_buffers_needed to CX231XX_MIN_BUF Benjamin Gaignard
2023-10-16  8:20   ` Hans Verkuil
2023-10-12 11:46 ` [PATCH v11 35/56] media: usb: hackrf: Set min_buffers_needed to 8 Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 36/56] media: usb: usbtv: Set min_buffers_needed to 2 Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 37/56] media: imx: Stop direct calls to queue num_buffers field Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 38/56] media: meson: vdec: " Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 39/56] touchscreen: sur40: " Benjamin Gaignard
2023-10-16  8:22   ` Hans Verkuil
2023-10-12 11:46 ` [PATCH v11 40/56] sample: v4l: " Benjamin Gaignard
2023-10-16  8:23   ` Hans Verkuil [this message]
2023-10-16 10:17     ` Hans Verkuil
2023-10-12 11:46 ` [PATCH v11 41/56] media: cedrus: " Benjamin Gaignard
2023-10-17  8:54   ` Paul Kocialkowski
2023-10-17  9:59     ` Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 42/56] media: nuvoton: " Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 43/56] media: videobuf2: Be more flexible on the number of queue stored buffers Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 44/56] media: core: Report the maximum possible number of buffers for the queue Benjamin Gaignard
2023-10-16 10:27   ` Hans Verkuil
2023-10-12 11:46 ` [PATCH v11 45/56] media: test-drivers: vivid: Increase max supported buffers for capture queues Benjamin Gaignard
2023-10-16 10:32   ` Hans Verkuil
2023-10-16 14:20     ` Benjamin Gaignard
2023-10-16 14:33       ` Hans Verkuil
2023-10-12 11:46 ` [PATCH v11 46/56] media: test-drivers: vicodec: Increase max supported capture queue buffers Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 47/56] media: verisilicon: Refactor postprocessor to store more buffers Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 48/56] media: verisilicon: Store chroma and motion vectors offset Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 49/56] media: verisilicon: g2: Use common helpers to compute chroma and mv offsets Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 50/56] media: verisilicon: vp9: Allow to change resolution while streaming Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 51/56] media: core: Rework how create_buf index returned value is computed Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 52/56] media: core: Add bitmap manage bufs array entries Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 53/56] media: core: Free range of buffers Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 54/56] media: v4l2: Add DELETE_BUFS ioctl Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 55/56] media: v4l2: Add mem2mem helpers for " Benjamin Gaignard
2023-10-12 11:46 ` [PATCH v11 56/56] media: test-drivers: Use helper " Benjamin Gaignard
2023-10-16 10:39 ` [PATCH v11 00/56] Add DELETE_BUF ioctl Hans Verkuil
2023-10-16 12:03   ` Benjamin Gaignard

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=21864437-bfdd-4d39-91fa-f24fc1c7cf97@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=benjamin.gaignard@collabora.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@nxp.com \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=tfiga@chromium.org \
    /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).