Patch Detail
Show a patch.
GET /api/patches/3970/?format=api
{ "id": 3970, "url": "https://patchwork.libcamera.org/api/patches/3970/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3970/", "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": "<20200606150436.1851700-9-niklas.soderlund@ragnatech.se>", "date": "2020-06-06T15:04:34", "name": "[libcamera-devel,v2,08/10] libcamera: ipu3: cio2: Make the V4L2 devices private", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d8f11e6c54719e1b9e729044b988bfe16113be30", "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/3970/mbox/", "series": [ { "id": 964, "url": "https://patchwork.libcamera.org/api/series/964/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=964", "date": "2020-06-06T15:04:26", "name": "libcamera: ipu3: Allow zero-copy RAW stream", "version": 2, "mbox": "https://patchwork.libcamera.org/series/964/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3970/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3970/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 A6FA163C29\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 6 Jun 2020 17:04:58 +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 14c9d8d4-a807-11ea-933e-005056917a89;\n\tSat, 06 Jun 2020 17:04:55 +0200 (CEST)" ], "X-Halon-ID": "14c9d8d4-a807-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": "Sat, 6 Jun 2020 17:04:34 +0200", "Message-Id": "<20200606150436.1851700-9-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.26.2", "In-Reply-To": "<20200606150436.1851700-1-niklas.soderlund@ragnatech.se>", "References": "<20200606150436.1851700-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 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": "Sat, 06 Jun 2020 15:04:59 -0000" }, "content": "In order to make the CIO2 easier to extend with new features make the\nV4L2 deices (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 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 | 16 +++++++++++++---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 16 +++++++---------\n 3 files changed, 39 insertions(+), 13 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex 0d961ae8f5a0682b..2399be8de974ff92 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -32,7 +32,7 @@ const std::map<uint32_t, PixelFormat> sensorMbusToPixel = {\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@@ -123,6 +123,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@@ -248,6 +250,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@@ -288,4 +296,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 b7eb69a4e104f400..8c3d9dd24188ef1c 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.h\n+++ b/src/libcamera/pipeline/ipu3/cio2.h\n@@ -13,6 +13,7 @@\n \n #include <libcamera/geometry.h>\n #include <libcamera/pixel_format.h>\n+#include <libcamera/signal.h>\n \n namespace libcamera {\n \n@@ -39,6 +40,8 @@ public:\n \t\t\t\t\t\t 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@@ -47,11 +50,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 85d4e64396e77222..55958a6c5e64dbf1 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -447,7 +447,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@@ -627,13 +627,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+\tV4L2VideoDevice *video = ipu3stream->device_->dev;\n \treturn video->exportBuffers(count, buffers);\n }\n \n@@ -744,7 +742,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@@ -857,7 +855,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@@ -881,7 +879,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@@ -891,7 +889,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", "v2", "08/10" ] }