Patch Detail
Show a patch.
GET /api/patches/8454/?format=api
{ "id": 8454, "url": "https://patchwork.libcamera.org/api/patches/8454/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8454/", "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": "<20200627030043.2088585-13-niklas.soderlund@ragnatech.se>", "date": "2020-06-27T03:00:42", "name": "[libcamera-devel,12/13] libcamera: ipu3: Align how CIO2 and ImgU are stored in CameraData", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "de227759cf231bbf9b9c8edd16c55562d4272f06", "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/8454/mbox/", "series": [ { "id": 1046, "url": "https://patchwork.libcamera.org/api/series/1046/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1046", "date": "2020-06-27T03:00:30", "name": "libcamera: ipu3: Refactoring of ImgU", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1046/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8454/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8454/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 87EBAC2E67\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Jun 2020 03:01:03 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 35B9A60B08;\n\tSat, 27 Jun 2020 05:01:03 +0200 (CEST)", "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 85F5C60B08\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 05:00:58 +0200 (CEST)", "from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de\n\t[79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 58ed2642-b822-11ea-86ee-0050569116f7;\n\tSat, 27 Jun 2020 05:00:25 +0200 (CEST)" ], "X-Halon-ID": "58ed2642-b822-11ea-86ee-0050569116f7", "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, 27 Jun 2020 05:00:42 +0200", "Message-Id": "<20200627030043.2088585-13-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200627030043.2088585-1-niklas.soderlund@ragnatech.se>", "References": "<20200627030043.2088585-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 12/13] libcamera: ipu3: Align how CIO2 and\n\tImgU are stored in CameraData", "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": "One is a pointer and the other is not. It is unintuitive to interact\nwith and with our current design of one ImgU for each camera there is no\nadvantage of having it as a pointer. Our current design is unlikely to\nchange as the system really only has one ImgU. Align the two to make the\npipeline more consistent.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 48 ++++++++++++----------------\n 1 file changed, 20 insertions(+), 28 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 0ebd762982142471..6ae4728b470f9487 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -43,7 +43,7 @@ public:\n \tvoid cio2BufferReady(FrameBuffer *buffer);\n \n \tCIO2Device cio2_;\n-\tImgUDevice *imgu_;\n+\tImgUDevice imgu_;\n \n \tStream outStream_;\n \tStream vfStream_;\n@@ -117,8 +117,6 @@ private:\n \tint allocateBuffers(Camera *camera);\n \tint freeBuffers(Camera *camera);\n \n-\tImgUDevice imgu0_;\n-\tImgUDevice imgu1_;\n \tMediaDevice *cio2MediaDev_;\n \tMediaDevice *imguMediaDev_;\n };\n@@ -414,7 +412,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \tStream *outStream = &data->outStream_;\n \tStream *vfStream = &data->vfStream_;\n \tCIO2Device *cio2 = &data->cio2_;\n-\tImgUDevice *imgu = data->imgu_;\n+\tImgUDevice *imgu = &data->imgu_;\n \tV4L2DeviceFormat outputFormat;\n \tint ret;\n \n@@ -456,7 +454,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t * stream which is for raw capture, in which case no buffers will\n \t * ever be queued to the ImgU.\n \t */\n-\tret = data->imgu_->enableLinks(true);\n+\tret = data->imgu_.enableLinks(true);\n \tif (ret)\n \t\treturn ret;\n \n@@ -563,9 +561,9 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n \tunsigned int count = stream->configuration().bufferCount;\n \n \tif (stream == &data->outStream_)\n-\t\treturn data->imgu_->output_.dev->exportBuffers(count, buffers);\n+\t\treturn data->imgu_.output_.dev->exportBuffers(count, buffers);\n \telse if (stream == &data->vfStream_)\n-\t\treturn data->imgu_->viewfinder_.dev->exportBuffers(count, buffers);\n+\t\treturn data->imgu_.viewfinder_.dev->exportBuffers(count, buffers);\n \telse if (stream == &data->rawStream_)\n \t\treturn data->cio2_.exportBuffers(count, buffers);\n \n@@ -583,7 +581,7 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n {\n \tIPU3CameraData *data = cameraData(camera);\n-\tImgUDevice *imgu = data->imgu_;\n+\tImgUDevice *imgu = &data->imgu_;\n \tunsigned int bufferCount;\n \tint ret;\n \n@@ -604,7 +602,7 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera)\n {\n \tIPU3CameraData *data = cameraData(camera);\n \n-\tdata->imgu_->freeBuffers();\n+\tdata->imgu_.freeBuffers();\n \n \treturn 0;\n }\n@@ -613,7 +611,7 @@ int PipelineHandlerIPU3::start(Camera *camera)\n {\n \tIPU3CameraData *data = cameraData(camera);\n \tCIO2Device *cio2 = &data->cio2_;\n-\tImgUDevice *imgu = data->imgu_;\n+\tImgUDevice *imgu = &data->imgu_;\n \tint ret;\n \n \t/* Allocate buffers for internal pipeline usage. */\n@@ -650,7 +648,7 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \tIPU3CameraData *data = cameraData(camera);\n \tint ret = 0;\n \n-\tret |= data->imgu_->stop();\n+\tret |= data->imgu_.stop();\n \tret |= data->cio2_.stop();\n \tif (ret)\n \t\tLOG(IPU3, Warning) << \"Failed to stop camera \"\n@@ -680,9 +678,9 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n \t\tint ret;\n \n \t\tif (stream == &data->outStream_)\n-\t\t\tret = data->imgu_->output_.dev->queueBuffer(buffer);\n+\t\t\tret = data->imgu_.output_.dev->queueBuffer(buffer);\n \t\telse if (stream == &data->vfStream_)\n-\t\t\tret = data->imgu_->viewfinder_.dev->queueBuffer(buffer);\n+\t\t\tret = data->imgu_.viewfinder_.dev->queueBuffer(buffer);\n \t\telse\n \t\t\tcontinue;\n \n@@ -757,16 +755,6 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n */\n int PipelineHandlerIPU3::registerCameras()\n {\n-\tint ret;\n-\n-\tret = imgu0_.init(imguMediaDev_, 0);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tret = imgu1_.init(imguMediaDev_, 1);\n-\tif (ret)\n-\t\treturn ret;\n-\n \t/*\n \t * For each CSI-2 receiver on the IPU3, create a Camera if an\n \t * image sensor is connected to it and the sensor can produce images\n@@ -774,6 +762,8 @@ int PipelineHandlerIPU3::registerCameras()\n \t */\n \tunsigned int numCameras = 0;\n \tfor (unsigned int id = 0; id < 4 && numCameras < 2; ++id) {\n+\t\tint ret;\n+\n \t\tstd::unique_ptr<IPU3CameraData> data =\n \t\t\tstd::make_unique<IPU3CameraData>(this);\n \t\tstd::set<Stream *> streams = {\n@@ -796,7 +786,9 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t * only, and assign imgu0 to the first one and imgu1 to the\n \t\t * second.\n \t\t */\n-\t\tdata->imgu_ = numCameras ? &imgu1_ : &imgu0_;\n+\t\tret = data->imgu_.init(imguMediaDev_, numCameras);\n+\t\tif (ret)\n+\t\t\treturn ret;\n \n \t\t/*\n \t\t * Connect video devices' 'bufferReady' signals to their\n@@ -808,11 +800,11 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t */\n \t\tdata->cio2_.bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n-\t\tdata->imgu_->input_->bufferReady.connect(&data->cio2_,\n+\t\tdata->imgu_.input_->bufferReady.connect(&data->cio2_,\n \t\t\t\t\t&CIO2Device::tryReturnBuffer);\n-\t\tdata->imgu_->output_.dev->bufferReady.connect(data.get(),\n+\t\tdata->imgu_.output_.dev->bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n-\t\tdata->imgu_->viewfinder_.dev->bufferReady.connect(data.get(),\n+\t\tdata->imgu_.viewfinder_.dev->bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n \n \t\t/* Create and register the Camera instance. */\n@@ -881,7 +873,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n \t\treturn;\n \t}\n \n-\timgu_->input_->queueBuffer(buffer);\n+\timgu_.input_->queueBuffer(buffer);\n }\n \n REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n", "prefixes": [ "libcamera-devel", "12/13" ] }