Show a patch.

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

{
    "id": 8432,
    "url": "https://patchwork.libcamera.org/api/patches/8432/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8432/",
    "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": "<20200625223900.1282164-8-niklas.soderlund@ragnatech.se>",
    "date": "2020-06-25T22:38:58",
    "name": "[libcamera-devel,v4,7/9] libcamera: ipu3: cio2: Make the V4L2 devices private",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "fcf7475b1e912ffa83e41ac0879e361f35db7826",
    "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/8432/mbox/",
    "series": [
        {
            "id": 1042,
            "url": "https://patchwork.libcamera.org/api/series/1042/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1042",
            "date": "2020-06-25T22:38:51",
            "name": "libcamera: ipu3: Allow zero-copy RAW stream",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1042/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8432/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8432/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C50C2C2E66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Jun 2020 22:39:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8961160B09;\n\tFri, 26 Jun 2020 00:39:26 +0200 (CEST)",
            "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 53A9760B01\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2020 00:39:24 +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 b58739eb-b734-11ea-933e-005056917a89;\n\tFri, 26 Jun 2020 00:39:20 +0200 (CEST)"
        ],
        "X-Halon-ID": "b58739eb-b734-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": "Fri, 26 Jun 2020 00:38:58 +0200",
        "Message-Id": "<20200625223900.1282164-8-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200625223900.1282164-1-niklas.soderlund@ragnatech.se>",
        "References": "<20200625223900.1282164-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 7/9] libcamera: ipu3: cio2: Make the\n\tV4L2 devices private",
        "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>",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "In order to make the CIO2 easier to extend with new features make the\nV4L2 devices (sensor, CIO2 and video device) private members. This\nrequires a few helper functions to be added to allow for the IPU3 driver\nto still be able to interact with all parts of the CIO2. These helper\nfunctions will later be extended to add new features to the IPU3\npipeline.\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 v2\n- Style changes.\n\n* Changes since v1\n- Drop sensor access helpers and replace with a sensor() call to get\n  hold of the CameraSensor pointer directly.\n---\n src/libcamera/pipeline/ipu3/cio2.cpp | 20 +++++++++++++++++++-\n src/libcamera/pipeline/ipu3/cio2.h   | 17 ++++++++++++++---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 19 ++++++++-----------\n 3 files changed, 41 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex cf5ccd6013c64d4d..972787a83dede203 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -33,7 +33,7 @@ static const std::map<uint32_t, PixelFormat> mbusCodesToInfo = {\n } /* namespace */\n \n CIO2Device::CIO2Device()\n-\t: output_(nullptr), csi2_(nullptr), sensor_(nullptr)\n+\t: sensor_(nullptr), csi2_(nullptr), output_(nullptr)\n {\n }\n \n@@ -125,6 +125,8 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)\n \tif (ret)\n \t\treturn ret;\n \n+\toutput_->bufferReady.connect(this, &CIO2Device::cio2BufferReady);\n+\n \treturn 0;\n }\n \n@@ -226,6 +228,12 @@ int CIO2Device::allocateBuffers()\n \treturn ret;\n }\n \n+int CIO2Device::exportBuffers(unsigned int count,\n+\t\t\t      std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n+{\n+\treturn output_->exportBuffers(count, buffers);\n+}\n+\n void CIO2Device::freeBuffers()\n {\n \t/* The default std::queue constructor is explicit with gcc 5 and 6. */\n@@ -266,4 +274,14 @@ int CIO2Device::stop()\n \treturn output_->streamOff();\n }\n \n+int CIO2Device::queueBuffer(FrameBuffer *buffer)\n+{\n+\treturn output_->queueBuffer(buffer);\n+}\n+\n+void CIO2Device::cio2BufferReady(FrameBuffer *buffer)\n+{\n+\tbufferReady.emit(buffer);\n+}\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h\nindex 5825433246c7fb89..8cb90c9da7f19ecb 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.h\n+++ b/src/libcamera/pipeline/ipu3/cio2.h\n@@ -11,6 +11,8 @@\n #include <queue>\n #include <vector>\n \n+#include <libcamera/signal.h>\n+\n namespace libcamera {\n \n class CameraSensor;\n@@ -36,6 +38,8 @@ public:\n \tStreamConfiguration generateConfiguration(Size size) const;\n \n \tint allocateBuffers();\n+\tint exportBuffers(unsigned int count,\n+\t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n \tvoid freeBuffers();\n \n \tFrameBuffer *getBuffer();\n@@ -44,11 +48,18 @@ public:\n \tint start();\n \tint stop();\n \n-\tV4L2VideoDevice *output_;\n-\tV4L2Subdevice *csi2_;\n-\tCameraSensor *sensor_;\n+\tCameraSensor *sensor() { return sensor_; }\n+\n+\tint queueBuffer(FrameBuffer *buffer);\n+\tSignal<FrameBuffer *> bufferReady;\n \n private:\n+\tvoid cio2BufferReady(FrameBuffer *buffer);\n+\n+\tCameraSensor *sensor_;\n+\tV4L2Subdevice *csi2_;\n+\tV4L2VideoDevice *output_;\n+\n \tstd::vector<std::unique_ptr<FrameBuffer>> buffers_;\n \tstd::queue<FrameBuffer *> availableBuffers_;\n };\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex c0e727e592f46883..2d1ec707ea4b08fe 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -431,7 +431,7 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \n \t\t\tstream = &data->rawStream_;\n \n-\t\t\tcfg.size = data->cio2_.sensor_->resolution();\n+\t\t\tcfg.size = data->cio2_.sensor()->resolution();\n \n \t\t\tcfg = data->cio2_.generateConfiguration(cfg.size);\n \t\t\tbreak;\n@@ -460,7 +460,7 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\t\t * available sensor resolution and to the IPU3\n \t\t\t * alignment constraints.\n \t\t\t */\n-\t\t\tconst Size &res = data->cio2_.sensor_->resolution();\n+\t\t\tconst Size &res = data->cio2_.sensor()->resolution();\n \t\t\tunsigned int width = std::min(1280U, res.width);\n \t\t\tunsigned int height = std::min(720U, res.height);\n \t\t\tcfg.size = { width & ~7, height & ~3 };\n@@ -640,14 +640,11 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n \tIPU3CameraData *data = cameraData(camera);\n \tIPU3Stream *ipu3stream = static_cast<IPU3Stream *>(stream);\n \tunsigned int count = stream->configuration().bufferCount;\n-\tV4L2VideoDevice *video;\n \n \tif (ipu3stream->raw_)\n-\t\tvideo = data->cio2_.output_;\n-\telse\n-\t\tvideo = ipu3stream->device_->dev;\n+\t\treturn data->cio2_.exportBuffers(count, buffers);\n \n-\treturn video->exportBuffers(count, buffers);\n+\treturn ipu3stream->device_->dev->exportBuffers(count, buffers);\n }\n \n /**\n@@ -757,7 +754,7 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n \t\treturn -EINVAL;\n \n \tbuffer->setRequest(request);\n-\tdata->cio2_.output_->queueBuffer(buffer);\n+\tdata->cio2_.queueBuffer(buffer);\n \n \tfor (auto it : request->buffers()) {\n \t\tIPU3Stream *stream = static_cast<IPU3Stream *>(it.first);\n@@ -870,7 +867,7 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t\tcontinue;\n \n \t\t/* Initialize the camera properties. */\n-\t\tdata->properties_ = cio2->sensor_->properties();\n+\t\tdata->properties_ = cio2->sensor()->properties();\n \n \t\t/**\n \t\t * \\todo Dynamically assign ImgU and output devices to each\n@@ -894,7 +891,7 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t * associated ImgU input where they get processed and\n \t\t * returned through the ImgU main and secondary outputs.\n \t\t */\n-\t\tdata->cio2_.output_->bufferReady.connect(data.get(),\n+\t\tdata->cio2_.bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n \t\tdata->imgu_->input_->bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n@@ -904,7 +901,7 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n \n \t\t/* Create and register the Camera instance. */\n-\t\tstd::string cameraName = cio2->sensor_->entity()->name();\n+\t\tstd::string cameraName = cio2->sensor()->entity()->name();\n \t\tstd::shared_ptr<Camera> camera = Camera::create(this,\n \t\t\t\t\t\t\t\tcameraName,\n \t\t\t\t\t\t\t\tstreams);\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "7/9"
    ]
}