Show a patch.

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

{
    "id": 4135,
    "url": "https://patchwork.libcamera.org/api/patches/4135/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4135/",
    "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-9-niklas.soderlund@ragnatech.se>",
    "date": "2020-06-23T02:09:28",
    "name": "[libcamera-devel,v3,08/10] libcamera: ipu3: cio2: Make the V4L2 devices private",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2c603d5755a48f985b8cd63de0a2d7522e3d06ac",
    "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/4135/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/4135/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4135/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 C08A6609C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jun 2020 04:09:48 +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 9d031aaf-b4f6-11ea-933e-005056917a89;\n\tTue, 23 Jun 2020 04:09:47 +0200 (CEST)"
        ],
        "X-Halon-ID": "9d031aaf-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:28 +0200",
        "Message-Id": "<20200623020930.1781469-9-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 08/10] 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>",
        "X-List-Received-Date": "Tue, 23 Jun 2020 02:09:49 -0000"
    },
    "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>\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 d6bab896706dd60e..3d7348782b0fa6cb 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -38,7 +38,7 @@ static const std::map<uint32_t, MbusInfo> 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@@ -126,6 +126,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 6276573f2b585b25..cc898f13fd73f865 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(const Size &desiredSize) 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",
        "v3",
        "08/10"
    ]
}