{"id":1334,"url":"https://patchwork.libcamera.org/api/patches/1334/?format=json","web_url":"https://patchwork.libcamera.org/patch/1334/","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":"<20190602130435.18780-6-jacopo@jmondi.org>","date":"2019-06-02T13:04:34","name":"[libcamera-devel,5/6] libcamera: ipu3: Set pipe_mode based on stream configuration","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"b4752b444320e809df9580626b9c0c941e0b6339","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/1334/mbox/","series":[{"id":333,"url":"https://patchwork.libcamera.org/api/series/333/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=333","date":"2019-06-02T13:04:29","name":"libcamera: v4l2_controls: Add support for V4L2 controls","version":1,"mbox":"https://patchwork.libcamera.org/series/333/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1334/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1334/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 087E761905\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  2 Jun 2019 15:03:49 +0200 (CEST)","from uno.homenet.telecomitalia.it (unknown [79.35.79.123])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 61584100009;\n\tSun,  2 Jun 2019 13:03:48 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun,  2 Jun 2019 15:04:34 +0200","Message-Id":"<20190602130435.18780-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190602130435.18780-1-jacopo@jmondi.org>","References":"<20190602130435.18780-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 5/6] libcamera: ipu3: Set pipe_mode based\n\ton 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":"Sun, 02 Jun 2019 13:03:49 -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 | 30 ++++++++++++++++++++++++++++\n 1 file changed, 30 insertions(+)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 05005c42106b..0a50b6159782 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -22,6 +22,7 @@\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 \n@@ -29,6 +30,10 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPU3)\n \n+#define IPU3_PIPE_MODE_CTRL\t0x009819c1\n+static V4L2IntControl IPU3PipeModeStillCapture(IPU3_PIPE_MODE_CTRL, 1);\n+static V4L2IntControl IPU3PipeModeVideo(IPU3_PIPE_MODE_CTRL, 0);\n+\n class ImgUDevice\n {\n public:\n@@ -485,6 +490,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \tIPU3Stream *vfStream = &data->vfStream_;\n \tCIO2Device *cio2 = &data->cio2_;\n \tImgUDevice *imgu = data->imgu_;\n+\tV4L2IntControl *pipeMode;\n \tint ret;\n \n \t/*\n@@ -536,6 +542,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\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+\tpipeMode = &IPU3PipeModeVideo;\n \tif (!outStream->active_) {\n \t\tret = imgu->configureOutput(outStream->device_, config->at(0));\n \t\tif (ret)\n@@ -546,6 +553,12 @@ 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\t/*\n+\t\t * \\todo: This works as long as only two concurrent streams\n+\t\t * per pipe are supported.\n+\t\t */\n+\t\tpipeMode = &IPU3PipeModeStillCapture;\n \t}\n \n \t/*\n@@ -559,6 +572,23 @@ 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+\tret = imgu->imgu_->setControl(pipeMode);\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Unable to set pipe_mode control\";\n+\t\treturn ret;\n+\t}\n+\n+\tV4L2Control *pipeModeCtrl = imgu->imgu_->getControl(IPU3_PIPE_MODE_CTRL);\n+\tif (!pipeModeCtrl) {\n+\t\tLOG(IPU3, Error) << \"Unable to get pipe_mode control value\";\n+\t\treturn ret;\n+\t}\n+\n+\tpipeMode = static_cast<V4L2IntControl *>(pipeModeCtrl);\n+\tLOG(IPU3, Debug) << \"ImgU pipe mode set to: \"\n+\t\t\t << (pipeMode->value() ? \"'Still Capture'\"\n+\t\t\t\t\t       : \"'Video'\");\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","5/6"]}