linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: 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,
	hverkuil-cisco@xs4all.nl, 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,
	Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	Zhou Peng <eagle.zhou@nxp.com>
Subject: [PATCH v12 10/56] media: amphion: Stop direct calls to queue num_buffers field
Date: Tue, 17 Oct 2023 16:47:10 +0200	[thread overview]
Message-ID: <20231017144756.34719-11-benjamin.gaignard@collabora.com> (raw)
In-Reply-To: <20231017144756.34719-1-benjamin.gaignard@collabora.com>

Use vb2_get_num_buffers() to avoid using queue num_buffers field directly.
This allows us to change how the number of buffers is computed in the
futur.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
CC: Ming Qian <ming.qian@nxp.com>
CC: Zhou Peng <eagle.zhou@nxp.com>
---
 drivers/media/platform/amphion/vpu_dbg.c  | 8 ++++----
 drivers/media/platform/amphion/vpu_v4l2.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c
index a462d6fe4ea9..940e5bda5fa3 100644
--- a/drivers/media/platform/amphion/vpu_dbg.c
+++ b/drivers/media/platform/amphion/vpu_dbg.c
@@ -87,7 +87,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data)
 	num = scnprintf(str, sizeof(str),
 			"output (%2d, %2d): fmt = %c%c%c%c %d x %d, %d;",
 			vb2_is_streaming(vq),
-			vq->num_buffers,
+			vb2_get_num_buffers(vq),
 			inst->out_format.pixfmt,
 			inst->out_format.pixfmt >> 8,
 			inst->out_format.pixfmt >> 16,
@@ -111,7 +111,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data)
 	num = scnprintf(str, sizeof(str),
 			"capture(%2d, %2d): fmt = %c%c%c%c %d x %d, %d;",
 			vb2_is_streaming(vq),
-			vq->num_buffers,
+			vb2_get_num_buffers(vq),
 			inst->cap_format.pixfmt,
 			inst->cap_format.pixfmt >> 8,
 			inst->cap_format.pixfmt >> 16,
@@ -139,7 +139,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data)
 		return 0;
 
 	vq = v4l2_m2m_get_src_vq(inst->fh.m2m_ctx);
-	for (i = 0; i < vq->num_buffers; i++) {
+	for (i = 0; i < vb2_get_num_buffers(vq); i++) {
 		struct vb2_buffer *vb;
 		struct vb2_v4l2_buffer *vbuf;
 
@@ -161,7 +161,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data)
 	}
 
 	vq = v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx);
-	for (i = 0; i < vq->num_buffers; i++) {
+	for (i = 0; i < vb2_get_num_buffers(vq); i++) {
 		struct vb2_buffer *vb;
 		struct vb2_v4l2_buffer *vbuf;
 
diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c
index 0f6e4c666440..87afb4a18d5d 100644
--- a/drivers/media/platform/amphion/vpu_v4l2.c
+++ b/drivers/media/platform/amphion/vpu_v4l2.c
@@ -439,7 +439,7 @@ int vpu_get_num_buffers(struct vpu_inst *inst, u32 type)
 	else
 		q = v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx);
 
-	return q->num_buffers;
+	return vb2_get_num_buffers(q);
 }
 
 static void vpu_m2m_device_run(void *priv)
@@ -587,7 +587,7 @@ static int vpu_vb2_start_streaming(struct vb2_queue *q, unsigned int count)
 		  fmt->sizeimage[0], fmt->bytesperline[0],
 		  fmt->sizeimage[1], fmt->bytesperline[1],
 		  fmt->sizeimage[2], fmt->bytesperline[2],
-		  q->num_buffers);
+		  vb2_get_num_buffers(q));
 	vb2_clear_last_buffer_dequeued(q);
 	ret = call_vop(inst, start, q->type);
 	if (ret)
-- 
2.39.2


  parent reply	other threads:[~2023-10-17 14:49 UTC|newest]

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