{"id":1478,"url":"https://patchwork.libcamera.org/api/patches/1478/?format=json","web_url":"https://patchwork.libcamera.org/patch/1478/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20190619110858.20980-6-jacopo@jmondi.org>","date":"2019-06-19T11:08:57","name":"[libcamera-devel,v4,5/6] libcamera: ipu3: Set pipe_mode based on stream configuration","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"47bb66c0398e7498233ec2a6a6c678fe0a38229f","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1478/mbox/","series":[{"id":364,"url":"https://patchwork.libcamera.org/api/series/364/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=364","date":"2019-06-19T11:08:52","name":"Add support for V4L2 Controls","version":4,"mbox":"https://patchwork.libcamera.org/series/364/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1478/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1478/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FC026194F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 13:07:52 +0200 (CEST)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id B30FEFF803;\n\tWed, 19 Jun 2019 11:07:51 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 19 Jun 2019 13:08:57 +0200","Message-Id":"<20190619110858.20980-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190619110858.20980-1-jacopo@jmondi.org>","References":"<20190619110858.20980-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 5/6] libcamera: ipu3: Set pipe_mode\n\tbased on stream configuration","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Wed, 19 Jun 2019 11:07:52 -0000"},"content":"Set the ImgU pipe_mode control based on the active stream configuration.\nUse 'Video' pipe mode unless the viewfinder stream is not active.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 34 ++++++++++++++++++++++++++++\n 1 file changed, 34 insertions(+)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 1c0a9825b4cd..8c26d2c8c60c 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -22,6 +22,8 @@\n #include \"media_device.h\"\n #include \"pipeline_handler.h\"\n #include \"utils.h\"\n+#include \"v4l2_controls.h\"\n+#include \"v4l2_device.h\"\n #include \"v4l2_subdevice.h\"\n #include \"v4l2_videodevice.h\"\n \n@@ -194,6 +196,12 @@ private:\n class PipelineHandlerIPU3 : public PipelineHandler\n {\n public:\n+\tstatic constexpr unsigned int V4L2_CID_IPU3_PIPE_MODE = 0x009819c1;\n+\tenum IPU3PipeModes {\n+\t\tIPU3PipeModeVideo = 0,\n+\t\tIPU3PipeModeStillCapture = 1,\n+\t};\n+\n \tPipelineHandlerIPU3(CameraManager *manager);\n \n \tCameraConfiguration *generateConfiguration(Camera *camera,\n@@ -535,7 +543,13 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t * As we need to set format also on the non-active streams, use\n \t * the configuration of the active one for that purpose (there should\n \t * be at least one active stream in the configuration request).\n+\t *\n+\t * Also set the IPU3 pipe mode: video mode by default, unless the only\n+\t * requested stream is the still capture output one.\n+\t * \\todo: This works as long as only two concurrent streams per pipe\n+\t * are supported.\n \t */\n+\tint pipeMode = IPU3PipeModeVideo;\n \tif (!outStream->active_) {\n \t\tret = imgu->configureOutput(outStream->device_, config->at(0));\n \t\tif (ret)\n@@ -546,6 +560,8 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t\tret = imgu->configureOutput(vfStream->device_, config->at(0));\n \t\tif (ret)\n \t\t\treturn ret;\n+\n+\t\tpipeMode = IPU3PipeModeStillCapture;\n \t}\n \n \t/*\n@@ -559,6 +575,24 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \tif (ret)\n \t\treturn ret;\n \n+\t/* Apply the \"pipe_mode\" control to the ImgU subdevice. */\n+\tV4L2Controls ctrls;\n+\tctrls.add(V4L2_CID_IPU3_PIPE_MODE, pipeMode);\n+\tret = imgu->imgu_->setControls(&ctrls);\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Unable to set pipe_mode control\";\n+\t\treturn ret;\n+\t}\n+\n+\tret = imgu->imgu_->getControls(&ctrls);\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Unable to get pipe_mode control value\";\n+\t\treturn ret;\n+\t}\n+\n+\tpipeMode = ctrls.get(V4L2_CID_IPU3_PIPE_MODE);\n+\tLOG(IPU3, Debug) << \"ImgU pipe mode set to: \"\n+\t\t\t << (pipeMode ? \"'Still Capture'\" : \"'Video'\");\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","v4","5/6"]}