Show a patch.

GET /api/patches/4132/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 4132,
    "url": "https://patchwork.libcamera.org/api/patches/4132/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4132/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20200623020930.1781469-6-niklas.soderlund@ragnatech.se>",
    "date": "2020-06-23T02:09:25",
    "name": "[libcamera-devel,v3,05/10] libcamera: ipu3: cio2: Move the CIO2Device class to separate files",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "dda272898466a4c7778c380a3d2f47a7ddead2c6",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4132/mbox/",
    "series": [
        {
            "id": 1027,
            "url": "https://patchwork.libcamera.org/api/series/1027/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1027",
            "date": "2020-06-23T02:09:20",
            "name": "libcamera: ipu3: Allow zero-copy RAW stream",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1027/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4132/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4132/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C27C9603BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jun 2020 04:09:46 +0200 (CEST)",
            "from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de\n\t[79.202.46.202]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 9b59b4eb-b4f6-11ea-933e-005056917a89;\n\tTue, 23 Jun 2020 04:09:45 +0200 (CEST)"
        ],
        "X-Halon-ID": "9b59b4eb-b4f6-11ea-933e-005056917a89",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 23 Jun 2020 04:09:25 +0200",
        "Message-Id": "<20200623020930.1781469-6-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200623020930.1781469-1-niklas.soderlund@ragnatech.se>",
        "References": "<20200623020930.1781469-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 05/10] libcamera: ipu3: cio2: Move the\n\tCIO2Device class to separate files",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "X-List-Received-Date": "Tue, 23 Jun 2020 02:09:47 -0000"
    },
    "content": "In preparation of refactoring the IPU3 pipeline handler breakout the\nCIO2Device into its own .cpp and .h file, no functional change.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n* Changes since v1\n- Remove CIO2Device::mediaBusToFormat() which was unintentionally left in.\n- Retain 2019 as copyright for new files.\n- Use forward declaration and only include headers in cio2.cpp\n---\n src/libcamera/pipeline/ipu3/cio2.cpp    | 233 ++++++++++++++++++++++\n src/libcamera/pipeline/ipu3/cio2.h      |  55 ++++++\n src/libcamera/pipeline/ipu3/ipu3.cpp    | 246 +-----------------------\n src/libcamera/pipeline/ipu3/meson.build |   1 +\n 4 files changed, 291 insertions(+), 244 deletions(-)\n create mode 100644 src/libcamera/pipeline/ipu3/cio2.cpp\n create mode 100644 src/libcamera/pipeline/ipu3/cio2.h",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nnew file mode 100644\nindex 0000000000000000..dbbcf79c7b2ed5c1\n--- /dev/null\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -0,0 +1,233 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * cio2.cpp - Intel IPU3 CIO2\n+ */\n+\n+#include \"cio2.h\"\n+\n+#include <linux/media-bus-format.h>\n+\n+#include \"libcamera/internal/camera_sensor.h\"\n+#include \"libcamera/internal/media_device.h\"\n+#include \"libcamera/internal/v4l2_subdevice.h\"\n+#include \"libcamera/internal/v4l2_videodevice.h\"\n+\n+namespace libcamera {\n+\n+LOG_DECLARE_CATEGORY(IPU3)\n+\n+CIO2Device::CIO2Device()\n+\t: output_(nullptr), csi2_(nullptr), sensor_(nullptr)\n+{\n+}\n+\n+CIO2Device::~CIO2Device()\n+{\n+\tdelete output_;\n+\tdelete csi2_;\n+\tdelete sensor_;\n+}\n+\n+/**\n+ * \\brief Initialize components of the CIO2 device with \\a index\n+ * \\param[in] media The CIO2 media device\n+ * \\param[in] index The CIO2 device index\n+ *\n+ * Create and open the video device and subdevices in the CIO2 instance at \\a\n+ * index, if a supported image sensor is connected to the CSI-2 receiver of\n+ * this CIO2 instance.  Enable the media links connecting the CIO2 components\n+ * to prepare for capture operations and cached the sensor maximum size.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ * \\retval -ENODEV No supported image sensor is connected to this CIO2 instance\n+ */\n+int CIO2Device::init(const MediaDevice *media, unsigned int index)\n+{\n+\tint ret;\n+\n+\t/*\n+\t * Verify that a sensor subdevice is connected to this CIO2 instance\n+\t * and enable the media link between the two.\n+\t */\n+\tstd::string csi2Name = \"ipu3-csi2 \" + std::to_string(index);\n+\tMediaEntity *csi2Entity = media->getEntityByName(csi2Name);\n+\tconst std::vector<MediaPad *> &pads = csi2Entity->pads();\n+\tif (pads.empty())\n+\t\treturn -ENODEV;\n+\n+\t/* IPU3 CSI-2 receivers have a single sink pad at index 0. */\n+\tMediaPad *sink = pads[0];\n+\tconst std::vector<MediaLink *> &links = sink->links();\n+\tif (links.empty())\n+\t\treturn -ENODEV;\n+\n+\tMediaLink *link = links[0];\n+\tMediaEntity *sensorEntity = link->source()->entity();\n+\tsensor_ = new CameraSensor(sensorEntity);\n+\tret = sensor_->init();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = link->setEnabled(true);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/*\n+\t * Make sure the sensor produces at least one format compatible with\n+\t * the CIO2 requirements.\n+\t */\n+\tconst std::set<unsigned int> cio2Codes{ MEDIA_BUS_FMT_SBGGR10_1X10,\n+\t\t\t\t\t\tMEDIA_BUS_FMT_SGRBG10_1X10,\n+\t\t\t\t\t\tMEDIA_BUS_FMT_SGBRG10_1X10,\n+\t\t\t\t\t\tMEDIA_BUS_FMT_SRGGB10_1X10 };\n+\tconst std::set<unsigned int> &sensorCodes = sensor_->mbusCodes();\n+\tif (!utils::set_overlap(sensorCodes.begin(), sensorCodes.end(),\n+\t\t\t\tcio2Codes.begin(), cio2Codes.end())) {\n+\t\tLOG(IPU3, Error)\n+\t\t\t<< \"Sensor \" << sensor_->entity()->name()\n+\t\t\t<< \" has not format compatible with the IPU3\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/*\n+\t * \\todo Define when to open and close video device nodes, as they\n+\t * might impact on power consumption.\n+\t */\n+\n+\tcsi2_ = new V4L2Subdevice(csi2Entity);\n+\tret = csi2_->open();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tstd::string cio2Name = \"ipu3-cio2 \" + std::to_string(index);\n+\toutput_ = V4L2VideoDevice::fromEntityName(media, cio2Name);\n+\tret = output_->open();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * \\brief Configure the CIO2 unit\n+ * \\param[in] size The requested CIO2 output frame size\n+ * \\param[out] outputFormat The CIO2 unit output image format\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int CIO2Device::configure(const Size &size, V4L2DeviceFormat *outputFormat)\n+{\n+\tV4L2SubdeviceFormat sensorFormat;\n+\tint ret;\n+\n+\t/*\n+\t * Apply the selected format to the sensor, the CSI-2 receiver and\n+\t * the CIO2 output device.\n+\t */\n+\tsensorFormat = sensor_->getFormat({ MEDIA_BUS_FMT_SBGGR10_1X10,\n+\t\t\t\t\t    MEDIA_BUS_FMT_SGBRG10_1X10,\n+\t\t\t\t\t    MEDIA_BUS_FMT_SGRBG10_1X10,\n+\t\t\t\t\t    MEDIA_BUS_FMT_SRGGB10_1X10 },\n+\t\t\t\t\t  size);\n+\tret = sensor_->setFormat(&sensorFormat);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = csi2_->setFormat(0, &sensorFormat);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tV4L2PixelFormat v4l2Format;\n+\tswitch (sensorFormat.mbus_code) {\n+\tcase MEDIA_BUS_FMT_SBGGR10_1X10:\n+\t\tv4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10);\n+\t\tbreak;\n+\tcase MEDIA_BUS_FMT_SGBRG10_1X10:\n+\t\tv4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10);\n+\t\tbreak;\n+\tcase MEDIA_BUS_FMT_SGRBG10_1X10:\n+\t\tv4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10);\n+\t\tbreak;\n+\tcase MEDIA_BUS_FMT_SRGGB10_1X10:\n+\t\tv4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\toutputFormat->fourcc = v4l2Format;\n+\toutputFormat->size = sensorFormat.size;\n+\toutputFormat->planesCount = 1;\n+\n+\tret = output_->setFormat(outputFormat);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tLOG(IPU3, Debug) << \"CIO2 output format \" << outputFormat->toString();\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * \\brief Allocate frame buffers for the CIO2 output\n+ *\n+ * Allocate frame buffers in the CIO2 video device to be used to capture frames\n+ * from the CIO2 output. The buffers are stored in the CIO2Device::buffers_\n+ * vector.\n+ *\n+ * \\return Number of buffers allocated or negative error code\n+ */\n+int CIO2Device::allocateBuffers()\n+{\n+\tint ret = output_->allocateBuffers(CIO2_BUFFER_COUNT, &buffers_);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tfor (std::unique_ptr<FrameBuffer> &buffer : buffers_)\n+\t\tavailableBuffers_.push(buffer.get());\n+\n+\treturn ret;\n+}\n+\n+void CIO2Device::freeBuffers()\n+{\n+\t/* The default std::queue constructor is explicit with gcc 5 and 6. */\n+\tavailableBuffers_ = std::queue<FrameBuffer *>{};\n+\n+\tbuffers_.clear();\n+\n+\tif (output_->releaseBuffers())\n+\t\tLOG(IPU3, Error) << \"Failed to release CIO2 buffers\";\n+}\n+\n+FrameBuffer *CIO2Device::getBuffer()\n+{\n+\tif (availableBuffers_.empty()) {\n+\t\tLOG(IPU3, Error) << \"CIO2 buffer underrun\";\n+\t\treturn nullptr;\n+\t}\n+\n+\tFrameBuffer *buffer = availableBuffers_.front();\n+\n+\tavailableBuffers_.pop();\n+\n+\treturn buffer;\n+}\n+\n+void CIO2Device::putBuffer(FrameBuffer *buffer)\n+{\n+\tavailableBuffers_.push(buffer);\n+}\n+\n+int CIO2Device::start()\n+{\n+\treturn output_->streamOn();\n+}\n+\n+int CIO2Device::stop()\n+{\n+\treturn output_->streamOff();\n+}\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h\nnew file mode 100644\nindex 0000000000000000..b2c4f89d682d6cfb\n--- /dev/null\n+++ b/src/libcamera/pipeline/ipu3/cio2.h\n@@ -0,0 +1,55 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * cio2.h - Intel IPU3 CIO2\n+ */\n+#ifndef __LIBCAMERA_PIPELINE_IPU3_CIO2_H__\n+#define __LIBCAMERA_PIPELINE_IPU3_CIO2_H__\n+\n+#include <memory>\n+#include <queue>\n+#include <vector>\n+\n+namespace libcamera {\n+\n+class CameraSensor;\n+class FrameBuffer;\n+class MediaDevice;\n+class V4L2DeviceFormat;\n+class V4L2Subdevice;\n+class V4L2VideoDevice;\n+struct Size;\n+\n+class CIO2Device\n+{\n+public:\n+\tstatic constexpr unsigned int CIO2_BUFFER_COUNT = 4;\n+\n+\tCIO2Device();\n+\t~CIO2Device();\n+\n+\tint init(const MediaDevice *media, unsigned int index);\n+\tint configure(const Size &size, V4L2DeviceFormat *outputFormat);\n+\n+\tint allocateBuffers();\n+\tvoid freeBuffers();\n+\n+\tFrameBuffer *getBuffer();\n+\tvoid putBuffer(FrameBuffer *buffer);\n+\n+\tint start();\n+\tint stop();\n+\n+\tV4L2VideoDevice *output_;\n+\tV4L2Subdevice *csi2_;\n+\tCameraSensor *sensor_;\n+\n+private:\n+\tstd::vector<std::unique_ptr<FrameBuffer>> buffers_;\n+\tstd::queue<FrameBuffer *> availableBuffers_;\n+};\n+\n+} /* namespace libcamera */\n+\n+#endif /* __LIBCAMERA_PIPELINE_IPU3_CIO2_H__ */\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 7967fde9c39b1547..6e5eb5609a3c2388 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -28,6 +28,8 @@\n #include \"libcamera/internal/v4l2_subdevice.h\"\n #include \"libcamera/internal/v4l2_videodevice.h\"\n \n+#include \"cio2.h\"\n+\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPU3)\n@@ -104,45 +106,6 @@ public:\n \t/* \\todo Add param video device for 3A tuning */\n };\n \n-class CIO2Device\n-{\n-public:\n-\tstatic constexpr unsigned int CIO2_BUFFER_COUNT = 4;\n-\n-\tCIO2Device()\n-\t\t: output_(nullptr), csi2_(nullptr), sensor_(nullptr)\n-\t{\n-\t}\n-\n-\t~CIO2Device()\n-\t{\n-\t\tdelete output_;\n-\t\tdelete csi2_;\n-\t\tdelete sensor_;\n-\t}\n-\n-\tint init(const MediaDevice *media, unsigned int index);\n-\tint configure(const Size &size,\n-\t\t      V4L2DeviceFormat *outputFormat);\n-\n-\tint allocateBuffers();\n-\tvoid freeBuffers();\n-\n-\tFrameBuffer *getBuffer();\n-\tvoid putBuffer(FrameBuffer *buffer);\n-\n-\tint start();\n-\tint stop();\n-\n-\tV4L2VideoDevice *output_;\n-\tV4L2Subdevice *csi2_;\n-\tCameraSensor *sensor_;\n-\n-private:\n-\tstd::vector<std::unique_ptr<FrameBuffer>> buffers_;\n-\tstd::queue<FrameBuffer *> availableBuffers_;\n-};\n-\n class IPU3Stream : public Stream\n {\n public:\n@@ -1408,211 +1371,6 @@ int ImgUDevice::enableLinks(bool enable)\n \treturn linkSetup(name_, PAD_STAT, statName, 0, enable);\n }\n \n-/*------------------------------------------------------------------------------\n- * CIO2 Device\n- */\n-\n-/**\n- * \\brief Initialize components of the CIO2 device with \\a index\n- * \\param[in] media The CIO2 media device\n- * \\param[in] index The CIO2 device index\n- *\n- * Create and open the video device and subdevices in the CIO2 instance at \\a\n- * index, if a supported image sensor is connected to the CSI-2 receiver of\n- * this CIO2 instance.  Enable the media links connecting the CIO2 components\n- * to prepare for capture operations and cached the sensor maximum size.\n- *\n- * \\return 0 on success or a negative error code otherwise\n- * \\retval -ENODEV No supported image sensor is connected to this CIO2 instance\n- */\n-int CIO2Device::init(const MediaDevice *media, unsigned int index)\n-{\n-\tint ret;\n-\n-\t/*\n-\t * Verify that a sensor subdevice is connected to this CIO2 instance\n-\t * and enable the media link between the two.\n-\t */\n-\tstd::string csi2Name = \"ipu3-csi2 \" + std::to_string(index);\n-\tMediaEntity *csi2Entity = media->getEntityByName(csi2Name);\n-\tconst std::vector<MediaPad *> &pads = csi2Entity->pads();\n-\tif (pads.empty())\n-\t\treturn -ENODEV;\n-\n-\t/* IPU3 CSI-2 receivers have a single sink pad at index 0. */\n-\tMediaPad *sink = pads[0];\n-\tconst std::vector<MediaLink *> &links = sink->links();\n-\tif (links.empty())\n-\t\treturn -ENODEV;\n-\n-\tMediaLink *link = links[0];\n-\tMediaEntity *sensorEntity = link->source()->entity();\n-\tsensor_ = new CameraSensor(sensorEntity);\n-\tret = sensor_->init();\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tret = link->setEnabled(true);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\t/*\n-\t * Make sure the sensor produces at least one format compatible with\n-\t * the CIO2 requirements.\n-\t */\n-\tconst std::set<unsigned int> cio2Codes{ MEDIA_BUS_FMT_SBGGR10_1X10,\n-\t\t\t\t\t\tMEDIA_BUS_FMT_SGRBG10_1X10,\n-\t\t\t\t\t\tMEDIA_BUS_FMT_SGBRG10_1X10,\n-\t\t\t\t\t\tMEDIA_BUS_FMT_SRGGB10_1X10 };\n-\tconst std::set<unsigned int> &sensorCodes = sensor_->mbusCodes();\n-\tif (!utils::set_overlap(sensorCodes.begin(), sensorCodes.end(),\n-\t\t\t\tcio2Codes.begin(), cio2Codes.end())) {\n-\t\tLOG(IPU3, Error)\n-\t\t\t<< \"Sensor \" << sensor_->entity()->name()\n-\t\t\t<< \" has not format compatible with the IPU3\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\t/*\n-\t * \\todo Define when to open and close video device nodes, as they\n-\t * might impact on power consumption.\n-\t */\n-\n-\tcsi2_ = new V4L2Subdevice(csi2Entity);\n-\tret = csi2_->open();\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tstd::string cio2Name = \"ipu3-cio2 \" + std::to_string(index);\n-\toutput_ = V4L2VideoDevice::fromEntityName(media, cio2Name);\n-\tret = output_->open();\n-\tif (ret)\n-\t\treturn ret;\n-\n-\treturn 0;\n-}\n-\n-/**\n- * \\brief Configure the CIO2 unit\n- * \\param[in] size The requested CIO2 output frame size\n- * \\param[out] outputFormat The CIO2 unit output image format\n- * \\return 0 on success or a negative error code otherwise\n- */\n-int CIO2Device::configure(const Size &size,\n-\t\t\t  V4L2DeviceFormat *outputFormat)\n-{\n-\tV4L2SubdeviceFormat sensorFormat;\n-\tint ret;\n-\n-\t/*\n-\t * Apply the selected format to the sensor, the CSI-2 receiver and\n-\t * the CIO2 output device.\n-\t */\n-\tsensorFormat = sensor_->getFormat({ MEDIA_BUS_FMT_SBGGR10_1X10,\n-\t\t\t\t\t    MEDIA_BUS_FMT_SGBRG10_1X10,\n-\t\t\t\t\t    MEDIA_BUS_FMT_SGRBG10_1X10,\n-\t\t\t\t\t    MEDIA_BUS_FMT_SRGGB10_1X10 },\n-\t\t\t\t\t  size);\n-\tret = sensor_->setFormat(&sensorFormat);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tret = csi2_->setFormat(0, &sensorFormat);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tV4L2PixelFormat v4l2Format;\n-\tswitch (sensorFormat.mbus_code) {\n-\tcase MEDIA_BUS_FMT_SBGGR10_1X10:\n-\t\tv4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10);\n-\t\tbreak;\n-\tcase MEDIA_BUS_FMT_SGBRG10_1X10:\n-\t\tv4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10);\n-\t\tbreak;\n-\tcase MEDIA_BUS_FMT_SGRBG10_1X10:\n-\t\tv4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10);\n-\t\tbreak;\n-\tcase MEDIA_BUS_FMT_SRGGB10_1X10:\n-\t\tv4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10);\n-\t\tbreak;\n-\tdefault:\n-\t\treturn -EINVAL;\n-\t}\n-\n-\toutputFormat->fourcc = v4l2Format;\n-\toutputFormat->size = sensorFormat.size;\n-\toutputFormat->planesCount = 1;\n-\n-\tret = output_->setFormat(outputFormat);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tLOG(IPU3, Debug) << \"CIO2 output format \" << outputFormat->toString();\n-\n-\treturn 0;\n-}\n-\n-/**\n- * \\brief Allocate frame buffers for the CIO2 output\n- *\n- * Allocate frame buffers in the CIO2 video device to be used to capture frames\n- * from the CIO2 output. The buffers are stored in the CIO2Device::buffers_\n- * vector.\n- *\n- * \\return Number of buffers allocated or negative error code\n- */\n-int CIO2Device::allocateBuffers()\n-{\n-\tint ret = output_->allocateBuffers(CIO2_BUFFER_COUNT, &buffers_);\n-\tif (ret < 0)\n-\t\treturn ret;\n-\n-\tfor (std::unique_ptr<FrameBuffer> &buffer : buffers_)\n-\t\tavailableBuffers_.push(buffer.get());\n-\n-\treturn ret;\n-}\n-\n-void CIO2Device::freeBuffers()\n-{\n-\t/* The default std::queue constructor is explicit with gcc 5 and 6. */\n-\tavailableBuffers_ = std::queue<FrameBuffer *>{};\n-\n-\tbuffers_.clear();\n-\n-\tif (output_->releaseBuffers())\n-\t\tLOG(IPU3, Error) << \"Failed to release CIO2 buffers\";\n-}\n-\n-FrameBuffer *CIO2Device::getBuffer()\n-{\n-\tif (availableBuffers_.empty()) {\n-\t\tLOG(IPU3, Error) << \"CIO2 buffer underrun\";\n-\t\treturn nullptr;\n-\t}\n-\n-\tFrameBuffer *buffer = availableBuffers_.front();\n-\n-\tavailableBuffers_.pop();\n-\n-\treturn buffer;\n-}\n-\n-void CIO2Device::putBuffer(FrameBuffer *buffer)\n-{\n-\tavailableBuffers_.push(buffer);\n-}\n-\n-int CIO2Device::start()\n-{\n-\treturn output_->streamOn();\n-}\n-\n-int CIO2Device::stop()\n-{\n-\treturn output_->streamOff();\n-}\n-\n REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/ipu3/meson.build b/src/libcamera/pipeline/ipu3/meson.build\nindex 0e8c5a14f2b3317b..b2602d30123f908d 100644\n--- a/src/libcamera/pipeline/ipu3/meson.build\n+++ b/src/libcamera/pipeline/ipu3/meson.build\n@@ -1,5 +1,6 @@\n # SPDX-License-Identifier: CC0-1.0\n \n libcamera_sources += files([\n+    'cio2.cpp',\n     'ipu3.cpp',\n ])\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "05/10"
    ]
}