From: Andreas Helbech Kleist <andreaskleist@gmail.com>
To: bingbu.cao@intel.com, linux-media@vger.kernel.org,
sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com,
andriy.shevchenko@linux.intel.com, hdegoede@redhat.com
Cc: ilpo.jarvinen@linux.intel.com, claus.stovgaard@gmail.com,
tomi.valkeinen@ideasonboard.com, tfiga@chromium.org,
senozhatsky@chromium.org, bingbu.cao@linux.intel.com,
tian.shu.qiu@intel.com, hongju.wang@intel.com
Subject: Re: [PATCH v3 11/17] media: intel/ipu6: input system video capture nodes
Date: Fri, 08 Mar 2024 10:58:14 +0100 [thread overview]
Message-ID: <fa09e43d971888f540ff346d8e49bf4f1a8b4b5b.camel@gmail.com> (raw)
In-Reply-To: <20240111065531.2418836-12-bingbu.cao@intel.com>
Hi Bingbu,
A small comment, discovered while using this code for IPU4.
On Thu, 2024-01-11 at 14:55 +0800, bingbu.cao@intel.com wrote:
> From: Bingbu Cao <bingbu.cao@intel.com>
>
> Register v4l2 video device and setup the vb2 queue to
> support basic video capture. Video streaming callback
> will trigger the input system driver to construct a
> input system stream configuration for firmware based on
> data type and stream ID and then queue buffers to firmware
> to do capture.
>
> Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
> ---
> .../media/pci/intel/ipu6/ipu6-isys-queue.c | 825 +++++++++++
> .../media/pci/intel/ipu6/ipu6-isys-queue.h | 76 +
> .../media/pci/intel/ipu6/ipu6-isys-video.c | 1253 +++++++++++++++++
> .../media/pci/intel/ipu6/ipu6-isys-video.h | 136 ++
> 4 files changed, 2290 insertions(+)
> create mode 100644 drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
> create mode 100644 drivers/media/pci/intel/ipu6/ipu6-isys-queue.h
> create mode 100644 drivers/media/pci/intel/ipu6/ipu6-isys-video.c
> create mode 100644 drivers/media/pci/intel/ipu6/ipu6-isys-video.h
>
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
> new file mode 100644
> index 000000000000..735d2d642d87
> --- /dev/null
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
...
> +void ipu6_isys_queue_buf_done(struct ipu6_isys_buffer *ib)
> +{
> + struct vb2_buffer *vb = ipu6_isys_buffer_to_vb2_buffer(ib);
> +
> + if (atomic_read(&ib->str2mmio_flag)) {
> + vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
> + /*
> + * Operation on buffer is ended with error and will be reported
> + * to the userspace when it is de-queued
> + */
> + atomic_set(&ib->str2mmio_flag, 0);
> + } else {
> + vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
> + }
> +}
> +void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream,
> + struct ipu6_fw_isys_resp_info_abi *info)
> +{
> + struct ipu6_isys_queue *aq = stream->output_pins[info->pin_id].aq;
> + struct ipu6_isys *isys = stream->isys;
> + struct device *dev = &isys->adev->auxdev.dev;
> + struct ipu6_isys_buffer *ib;
> + struct vb2_buffer *vb;
> + unsigned long flags;
> + bool first = true;
> + struct vb2_v4l2_buffer *buf;
> +
> + spin_lock_irqsave(&aq->lock, flags);
> + if (list_empty(&aq->active)) {
> + spin_unlock_irqrestore(&aq->lock, flags);
> + dev_err(dev, "active queue empty\n");
> + return;
> + }
> +
> + list_for_each_entry_reverse(ib, &aq->active, head) {
> + dma_addr_t addr;
> +
> + vb = ipu6_isys_buffer_to_vb2_buffer(ib);
> + addr = vb2_dma_contig_plane_dma_addr(vb, 0);
> +
> + if (info->pin.addr != addr) {
> + if (first)
> + dev_err(dev, "Unexpected buffer address %pad\n",
> + &addr);
> + first = false;
> + continue;
> + }
> +
> + if (info->error_info.error ==
> + IPU6_FW_ISYS_ERROR_HW_REPORTED_STR2MMIO) {
> + /*
> + * Check for error message:
> + * 'IPU6_FW_ISYS_ERROR_HW_REPORTED_STR2MMIO'
> + */
> + atomic_set(&ib->str2mmio_flag, 1);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> + }
> + dev_dbg(dev, "buffer: found buffer %pad\n", &addr);
> +
> + buf = to_vb2_v4l2_buffer(vb);
> + buf->field = V4L2_FIELD_NONE;
> +
> + list_del(&ib->head);
> + spin_unlock_irqrestore(&aq->lock, flags);
> +
> + ipu6_isys_buf_calc_sequence_time(ib, info);
> +
> + ipu6_isys_queue_buf_done(ib);
Why is `ib->str2mmio_flag`, which is set above an atomic? It seems like
it could just be a function argument to `ipu6_isys_queue_buf_done`,
which is the only place it is used.
> +
> + return;
> + }
> +
> + dev_err(dev, "Failed to find a matching video buffer");
> +
> + spin_unlock_irqrestore(&aq->lock, flags);
> +}
...
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.h b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.h
> new file mode 100644
> index 000000000000..9fb454577bb5
> --- /dev/null
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.h
...
> +void ipu6_isys_queue_buf_done(struct ipu6_isys_buffer *ib);
...
This function is only used in ipu6-isys-queue.c, so could be static.
/Andreas
next prev parent reply other threads:[~2024-03-08 9:58 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 6:55 [PATCH v3 00/15] Intel IPU6 and IPU6 input system drivers bingbu.cao
2024-01-11 6:55 ` [PATCH v3 01/17] media: intel/ipu6: add Intel IPU6 PCI device driver bingbu.cao
2024-01-15 13:36 ` Hans de Goede
2024-01-15 13:45 ` Sakari Ailus
2024-01-11 6:55 ` [PATCH v3 02/17] media: intel/ipu6: add IPU auxiliary devices bingbu.cao
2024-01-11 6:55 ` [PATCH v3 03/17] media: intel/ipu6: add IPU6 buttress interface driver bingbu.cao
2024-01-11 6:55 ` [PATCH v3 04/17] media: intel/ipu6: CPD parsing for get firmware components bingbu.cao
2024-01-11 6:55 ` [PATCH v3 05/17] media: intel/ipu6: add IPU6 DMA mapping API and MMU table bingbu.cao
2024-01-11 6:55 ` [PATCH v3 06/17] media: intel/ipu6: add syscom interfaces between firmware and driver bingbu.cao
2024-01-11 6:55 ` [PATCH v3 07/17] media: intel/ipu6: input system ABI " bingbu.cao
2024-01-15 12:17 ` Sakari Ailus
2024-01-11 6:55 ` [PATCH v3 08/17] media: intel/ipu6: add IPU6 CSI2 receiver v4l2 sub-device bingbu.cao
2024-01-11 6:55 ` [PATCH v3 09/17] media: intel/ipu6: add the CSI2 DPHY implementation bingbu.cao
2024-01-11 6:55 ` [PATCH v3 10/17] media: intel/ipu6: add input system driver bingbu.cao
2024-01-11 14:05 ` Sakari Ailus
2024-02-07 9:36 ` Andreas Helbech Kleist
2024-02-12 18:31 ` Sakari Ailus
2024-02-15 6:43 ` Andreas Helbech Kleist
2024-02-15 8:06 ` Sakari Ailus
2024-01-11 6:55 ` [PATCH v3 11/17] media: intel/ipu6: input system video capture nodes bingbu.cao
2024-03-08 9:58 ` Andreas Helbech Kleist [this message]
2024-01-11 6:55 ` [PATCH v3 12/17] media: add Kconfig and Makefile for IPU6 bingbu.cao
2024-01-11 6:55 ` [PATCH v3 13/17] MAINTAINERS: add maintainers for Intel IPU6 input system driver bingbu.cao
2024-01-11 6:55 ` [PATCH v3 14/17] Documentation: add Intel IPU6 ISYS driver admin-guide doc bingbu.cao
2024-01-11 6:55 ` [PATCH v3 15/17] Documentation: add documentation of Intel IPU6 driver and hardware overview bingbu.cao
2024-01-11 6:55 ` [PATCH v3 16/17] media: ipu6/isys: support line-based metadata capture support bingbu.cao
2024-01-11 12:52 ` Sakari Ailus
2024-01-11 21:20 ` kernel test robot
2024-01-12 3:31 ` kernel test robot
2024-01-11 6:55 ` [PATCH v3 17/17] media: ipu6/isys: support new v4l2 subdev state APIs bingbu.cao
2024-01-11 12:37 ` Sakari Ailus
2024-01-16 16:12 ` [PATCH v3 00/15] Intel IPU6 and IPU6 input system drivers Hans de Goede
2024-01-16 16:18 ` Laurent Pinchart
2024-01-16 16:38 ` Hans de Goede
2024-01-16 16:42 ` Laurent Pinchart
2024-01-16 16:43 ` Hans de Goede
2024-01-16 16:54 ` Sakari Ailus
2024-01-16 16:57 ` Hans de Goede
2024-01-16 17:48 ` Laurent Pinchart
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=fa09e43d971888f540ff346d8e49bf4f1a8b4b5b.camel@gmail.com \
--to=andreaskleist@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bingbu.cao@intel.com \
--cc=bingbu.cao@linux.intel.com \
--cc=claus.stovgaard@gmail.com \
--cc=hdegoede@redhat.com \
--cc=hongju.wang@intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=senozhatsky@chromium.org \
--cc=tfiga@chromium.org \
--cc=tian.shu.qiu@intel.com \
--cc=tomi.valkeinen@ideasonboard.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