{"id":8455,"url":"https://patchwork.libcamera.org/api/1.1/patches/8455/?format=json","web_url":"https://patchwork.libcamera.org/patch/8455/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","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-14-niklas.soderlund@ragnatech.se>","date":"2020-06-27T03:00:43","name":"[libcamera-devel,13/13] libcamera: ipu3: imgu: Remove ImgUOutput","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1546a10de7d926d3097e98820c7b247c3c1756a7","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8455/mbox/","series":[{"id":1046,"url":"https://patchwork.libcamera.org/api/1.1/series/1046/?format=json","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/8455/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8455/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 E354CC2E66\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 4FCBD60C50;\n\tSat, 27 Jun 2020 05:01:03 +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 51B7E60BEB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 05:00:59 +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 594ea5c4-b822-11ea-86ee-0050569116f7;\n\tSat, 27 Jun 2020 05:00:25 +0200 (CEST)"],"X-Halon-ID":"594ea5c4-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:43 +0200","Message-Id":"<20200627030043.2088585-14-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 13/13] libcamera: ipu3: imgu: Remove\n\tImgUOutput","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":"The struct ImgUOutput now only contains one member that are in use, the\nvideo device. Remove the struct and use the video device directly\ninstead.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/pipeline/ipu3/imgu.cpp | 55 ++++++++++++----------------\n src/libcamera/pipeline/ipu3/imgu.h   | 25 ++++---------\n src/libcamera/pipeline/ipu3/ipu3.cpp | 12 +++---\n 3 files changed, 37 insertions(+), 55 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\nindex d54e844d9bfc5147..a601ca3fa2b1803f 100644\n--- a/src/libcamera/pipeline/ipu3/imgu.cpp\n+++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n@@ -55,31 +55,22 @@ int ImgUDevice::init(MediaDevice *media, unsigned int index)\n \tif (ret)\n \t\treturn ret;\n \n-\toutput_.dev = V4L2VideoDevice::fromEntityName(media, name_ + \" output\");\n-\tret = output_.dev->open();\n+\toutput_ = V4L2VideoDevice::fromEntityName(media, name_ + \" output\");\n+\tret = output_->open();\n \tif (ret)\n \t\treturn ret;\n \n-\toutput_.pad = PAD_OUTPUT;\n-\toutput_.name = \"output\";\n-\n-\tviewfinder_.dev = V4L2VideoDevice::fromEntityName(media,\n+\tviewfinder_ = V4L2VideoDevice::fromEntityName(media,\n \t\t\t\t\t\t\t  name_ + \" viewfinder\");\n-\tret = viewfinder_.dev->open();\n+\tret = viewfinder_->open();\n \tif (ret)\n \t\treturn ret;\n \n-\tviewfinder_.pad = PAD_VF;\n-\tviewfinder_.name = \"viewfinder\";\n-\n-\tstat_.dev = V4L2VideoDevice::fromEntityName(media, name_ + \" 3a stat\");\n-\tret = stat_.dev->open();\n+\tstat_ = V4L2VideoDevice::fromEntityName(media, name_ + \" 3a stat\");\n+\tret = stat_->open();\n \tif (ret)\n \t\treturn ret;\n \n-\tstat_.pad = PAD_STAT;\n-\tstat_.name = \"stat\";\n-\n \treturn 0;\n }\n \n@@ -142,19 +133,19 @@ int ImgUDevice::configureInput(const Size &size,\n int ImgUDevice::configureOutput(const StreamConfiguration &cfg,\n \t\t\t\tV4L2DeviceFormat *outputFormat)\n {\n-\treturn configureVideoDevice(output_.dev, PAD_OUTPUT, cfg, outputFormat);\n+\treturn configureVideoDevice(output_, PAD_OUTPUT, cfg, outputFormat);\n }\n \n int ImgUDevice::configureViewfinder(const StreamConfiguration &cfg,\n \t\t\t\t    V4L2DeviceFormat *outputFormat)\n {\n-\treturn configureVideoDevice(viewfinder_.dev, PAD_VF, cfg, outputFormat);\n+\treturn configureVideoDevice(viewfinder_, PAD_VF, cfg, outputFormat);\n }\n \n int ImgUDevice::configureStat(const StreamConfiguration &cfg,\n \t\t\t      V4L2DeviceFormat *outputFormat)\n {\n-\treturn configureVideoDevice(stat_.dev, PAD_STAT, cfg, outputFormat);\n+\treturn configureVideoDevice(stat_, PAD_STAT, cfg, outputFormat);\n }\n \n int ImgUDevice::configureVideoDevice(V4L2VideoDevice *dev, unsigned int pad,\n@@ -170,7 +161,7 @@ int ImgUDevice::configureVideoDevice(V4L2VideoDevice *dev, unsigned int pad,\n \t\treturn ret;\n \n \t/* No need to apply format to the stat node. */\n-\tif (dev == stat_.dev)\n+\tif (dev == stat_)\n \t\treturn 0;\n \n \t*outputFormat = {};\n@@ -182,7 +173,7 @@ int ImgUDevice::configureVideoDevice(V4L2VideoDevice *dev, unsigned int pad,\n \tif (ret)\n \t\treturn ret;\n \n-\tconst char *name = dev == output_.dev ? \"output\" : \"viewfinder\";\n+\tconst char *name = dev == output_ ? \"output\" : \"viewfinder\";\n \tLOG(IPU3, Debug) << \"ImgU \" << name << \" format = \"\n \t\t\t << outputFormat->toString();\n \n@@ -208,19 +199,19 @@ int ImgUDevice::allocateBuffers(unsigned int bufferCount)\n \t *\n \t * \\todo To be revised when we'll actually use the stat node.\n \t */\n-\tret = stat_.dev->importBuffers(bufferCount);\n+\tret = stat_->importBuffers(bufferCount);\n \tif (ret < 0) {\n \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU stat buffers\";\n \t\tgoto error;\n \t}\n \n-\tret = output_.dev->importBuffers(bufferCount);\n+\tret = output_->importBuffers(bufferCount);\n \tif (ret < 0) {\n \t\tLOG(IPU3, Error) << \"Failed to import ImgU output buffers\";\n \t\tgoto error;\n \t}\n \n-\tret = viewfinder_.dev->importBuffers(bufferCount);\n+\tret = viewfinder_->importBuffers(bufferCount);\n \tif (ret < 0) {\n \t\tLOG(IPU3, Error) << \"Failed to import ImgU viewfinder buffers\";\n \t\tgoto error;\n@@ -241,15 +232,15 @@ void ImgUDevice::freeBuffers()\n {\n \tint ret;\n \n-\tret = output_.dev->releaseBuffers();\n+\tret = output_->releaseBuffers();\n \tif (ret)\n \t\tLOG(IPU3, Error) << \"Failed to release ImgU output buffers\";\n \n-\tret = stat_.dev->releaseBuffers();\n+\tret = stat_->releaseBuffers();\n \tif (ret)\n \t\tLOG(IPU3, Error) << \"Failed to release ImgU stat buffers\";\n \n-\tret = viewfinder_.dev->releaseBuffers();\n+\tret = viewfinder_->releaseBuffers();\n \tif (ret)\n \t\tLOG(IPU3, Error) << \"Failed to release ImgU viewfinder buffers\";\n \n@@ -263,19 +254,19 @@ int ImgUDevice::start()\n \tint ret;\n \n \t/* Start the ImgU video devices. */\n-\tret = output_.dev->streamOn();\n+\tret = output_->streamOn();\n \tif (ret) {\n \t\tLOG(IPU3, Error) << \"Failed to start ImgU output\";\n \t\treturn ret;\n \t}\n \n-\tret = viewfinder_.dev->streamOn();\n+\tret = viewfinder_->streamOn();\n \tif (ret) {\n \t\tLOG(IPU3, Error) << \"Failed to start ImgU viewfinder\";\n \t\treturn ret;\n \t}\n \n-\tret = stat_.dev->streamOn();\n+\tret = stat_->streamOn();\n \tif (ret) {\n \t\tLOG(IPU3, Error) << \"Failed to start ImgU stat\";\n \t\treturn ret;\n@@ -294,9 +285,9 @@ int ImgUDevice::stop()\n {\n \tint ret;\n \n-\tret = output_.dev->streamOff();\n-\tret |= viewfinder_.dev->streamOff();\n-\tret |= stat_.dev->streamOff();\n+\tret = output_->streamOff();\n+\tret |= viewfinder_->streamOff();\n+\tret |= stat_->streamOff();\n \tret |= input_->streamOff();\n \n \treturn ret;\ndiff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h\nindex f8fd54089753b40e..2ac77ce5719f88f1 100644\n--- a/src/libcamera/pipeline/ipu3/imgu.h\n+++ b/src/libcamera/pipeline/ipu3/imgu.h\n@@ -24,28 +24,19 @@ struct StreamConfiguration;\n class ImgUDevice\n {\n public:\n-\t/* ImgU output descriptor: group data specific to an ImgU output. */\n-\tstruct ImgUOutput {\n-\t\tV4L2VideoDevice *dev;\n-\t\tunsigned int pad;\n-\t\tstd::string name;\n-\t};\n-\n \tImgUDevice()\n-\t\t: imgu_(nullptr), input_(nullptr)\n+\t\t: imgu_(nullptr), input_(nullptr), output_(nullptr),\n+\t\t  viewfinder_(nullptr), stat_(nullptr)\n \t{\n-\t\toutput_.dev = nullptr;\n-\t\tviewfinder_.dev = nullptr;\n-\t\tstat_.dev = nullptr;\n \t}\n \n \t~ImgUDevice()\n \t{\n \t\tdelete imgu_;\n \t\tdelete input_;\n-\t\tdelete output_.dev;\n-\t\tdelete viewfinder_.dev;\n-\t\tdelete stat_.dev;\n+\t\tdelete output_;\n+\t\tdelete viewfinder_;\n+\t\tdelete stat_;\n \t}\n \n \tint init(MediaDevice *media, unsigned int index);\n@@ -68,9 +59,9 @@ public:\n \n \tV4L2Subdevice *imgu_;\n \tV4L2VideoDevice *input_;\n-\tImgUOutput output_;\n-\tImgUOutput viewfinder_;\n-\tImgUOutput stat_;\n+\tV4L2VideoDevice *output_;\n+\tV4L2VideoDevice *viewfinder_;\n+\tV4L2VideoDevice *stat_;\n \t/* \\todo Add param video device for 3A tuning */\n \n private:\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 6ae4728b470f9487..c25bcaaeb5fb813f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -561,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_->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_->exportBuffers(count, buffers);\n \telse if (stream == &data->rawStream_)\n \t\treturn data->cio2_.exportBuffers(count, buffers);\n \n@@ -678,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_->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_->queueBuffer(buffer);\n \t\telse\n \t\t\tcontinue;\n \n@@ -802,9 +802,9 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t\t\t\t&IPU3CameraData::cio2BufferReady);\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_->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_->bufferReady.connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n \n \t\t/* Create and register the Camera instance. */\n","prefixes":["libcamera-devel","13/13"]}