{"id":16906,"url":"https://patchwork.libcamera.org/api/1.1/patches/16906/?format=json","web_url":"https://patchwork.libcamera.org/patch/16906/","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":"<20220802102943.3221109-8-chenghaoyang@google.com>","date":"2022-08-02T10:29:41","name":"[libcamera-devel,v4,7/9] ipu3: Assign |outCaptureStream| to StillCapture configuration","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d441624de8aca1351f70baac848cd7ef448fee9d","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/1.1/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16906/mbox/","series":[{"id":3357,"url":"https://patchwork.libcamera.org/api/1.1/series/3357/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3357","date":"2022-08-02T10:29:34","name":"Use two imgus in ipu3 pipeline handler","version":4,"mbox":"https://patchwork.libcamera.org/series/3357/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16906/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16906/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 0E077C3276\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Aug 2022 10:30:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B963D63322;\n\tTue,  2 Aug 2022 12:30:02 +0200 (CEST)","from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com\n\t[IPv6:2607:f8b0:4864:20::52b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AAA9C63322\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Aug 2022 12:30:00 +0200 (CEST)","by mail-pg1-x52b.google.com with SMTP id bh13so11996353pgb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Aug 2022 03:30:00 -0700 (PDT)","from chenghaoyang-low.c.googlers.com.com\n\t(231.137.80.34.bc.googleusercontent.com. [34.80.137.231])\n\tby smtp.gmail.com with ESMTPSA id\n\tt15-20020a170902e84f00b0016db88f69a2sm1955128plg.141.2022.08.02.03.29.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 02 Aug 2022 03:29:59 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659436202;\n\tbh=fftKRZ8Zftn+0drHl4Az7GPNsW4B5X+NpZrUkBSDbxI=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=PvvSWWqK+tzi/qpTx/RMS5FXXn5iHWKD52gfjAePxaDDqtCY9F2ehY3hk/IzWx6+u\n\tPknWHi73A6c5TdZzEuceoljVB9ZCpEnKB7pdTKm3XmIG/qdJy4zzUFjZeTirN8BERE\n\tjqIoNgfb2Tng9IojTT9NZTnteGk3ScN0xheGi41er6aoSvpKBBP/Gnnouj+Jqy8OHe\n\tPM6tBDccUTCOaFtRMk+z+EjE08Zot1wGa95P47AOLBA5fhN2yPVwNYWq/o6ZpKaWhT\n\tENPWAbsMiyOgUqFuea/Y0194dxS9pmdyvK3WZjVaqZC9ItXZsdlcfCtfE+ZCMHMbtr\n\t9HNGWGPo3ATDQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=h4dGYpA4iZvZ1T7cXsIMETguxzq6lHaCODno5/mhFrM=;\n\tb=deV0JFxBMPSokv+92/1Ohs2evFpGWohbbh3CmbGR+RbHJLQ/jpHkyrPQhVo1XnIiMR\n\thQbby1y6GaSJ9KHdfpdtxl2YuuhM+OFvI9d/Oi5txvZ3mfzJL5+7mYny2oFVqG3rWwW6\n\tkyLUe/x6rJuWqVyb1IDyX6QUARf8VpGjLaMlY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"deV0JFxB\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=h4dGYpA4iZvZ1T7cXsIMETguxzq6lHaCODno5/mhFrM=;\n\tb=NtHC1E49Th3dRydUHynU6rYfG5HcI5k8d4+uxO3kUX7Tq9i3eWgT5pipd9n9FbIijA\n\tamiCEfBH5WnAL9JZz7u3dCElJ4xdIVhoIyNCT31mXIXWULhvmp2vP+DUCbVrl2nVU5rz\n\tQUBg4g04DIODKYVVy085K5Uuz4UWqie0ci9igTHvBfh3vdpRihXbHXAllssR1HMUno/G\n\txVqgwpNMuAdPaqVkYhRoTMVxUt/jxtugqMh+hQ19l5Nhe8O7qE8o+ruSJLuUC/cyzxLI\n\tlq/Vj7tjhVTQU5fuK11PB+cn+fZ9MZimNQhj+ocl7CzJBNreLsWC38lU+YjhYa/+dDo1\n\tkV5g==","X-Gm-Message-State":"AJIora9PJw82Jx6+g605kONkXW4kRB16/wYgWFYkJ2bLpSe0DToCeeKI\n\ts7ISRP9diypfYBnA3xFz8SCCGDaiORjBMA==","X-Google-Smtp-Source":"AGRyM1t7oMKaEhBfm9L7TA5ovfeS2V+MLAl9AlMT2LRL21LQmcFN2IfxanKGdVQDMsUyvkg3WinVDg==","X-Received":"by 2002:a63:211b:0:b0:41b:8f73:576d with SMTP id\n\th27-20020a63211b000000b0041b8f73576dmr16199913pgh.106.1659436199823; \n\tTue, 02 Aug 2022 03:29:59 -0700 (PDT)","X-Google-Original-From":"Harvey Yang <chenghaoyang@google.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  2 Aug 2022 10:29:41 +0000","Message-Id":"<20220802102943.3221109-8-chenghaoyang@google.com>","X-Mailer":"git-send-email 2.37.1.455.g008518b4e5-goog","In-Reply-To":"<20220802102943.3221109-1-chenghaoyang@google.com>","References":"<20220802102943.3221109-1-chenghaoyang@google.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 7/9] ipu3: Assign |outCaptureStream| to\n\tStillCapture configuration","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>","From":"Harvey Yang via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Harvey Yang <chenghaoyang@chromium.org>","Cc":"Harvey Yang <chenghaoyang@google.com>,\n\tHarvey Yang <chenghaoyang@chromium.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"When StillCapture and other non-raw configurations are requested,\nassigns |outCaptureStream| instead of |outStream| to the StillCapture\nconfiguration.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 56 ++++++++++++++++++++++++----\n 1 file changed, 48 insertions(+), 8 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 73f361f8..f8101c6c 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -254,8 +254,10 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t * \\todo Clarify the IF and BDS margins requirements.\n \t */\n \tunsigned int rawCount = 0;\n-\tunsigned int yuvCount = 0;\n+\tunsigned int videoCount = 0;\n+\tunsigned int stillCount = 0;\n \tSize maxYuvSize;\n+\tSize maxVideoSize;\n \tSize rawSize;\n \n \tfor (const StreamConfiguration &cfg : config_) {\n@@ -264,16 +266,34 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t\tif (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) {\n \t\t\trawCount++;\n \t\t\trawSize.expandTo(cfg.size);\n+\t\t} else if (cfg.streamRole == StreamRole::StillCapture) {\n+\t\t\tif (stillCount != 0)\n+\t\t\t\treturn Invalid;\n+\n+\t\t\tstillCount++;\n+\t\t\tmaxYuvSize.expandTo(cfg.size);\n \t\t} else {\n-\t\t\tyuvCount++;\n+\t\t\tvideoCount++;\n \t\t\tmaxYuvSize.expandTo(cfg.size);\n+\t\t\tmaxVideoSize.expandTo(cfg.size);\n \t\t}\n \t}\n \n-\tif (rawCount > 1 || yuvCount > 2) {\n+\tif (videoCount == 0 && stillCount == 1) {\n+\t\t/*\n+\t\t * If only the StillCapture stream is requested, it cannot be\n+\t\t * supported natively, as we need a video stream that enables\n+\t\t * the 3A. Therefore, use video snapshot instead.\n+\t\t */\n+\t\tstillCount = 0;\n+\t\tvideoCount = 1;\n+\t\tmaxVideoSize.expandTo(maxYuvSize);\n+\t}\n+\n+\tif (rawCount > 1 || videoCount > 2) {\n \t\tLOG(IPU3, Debug) << \"Camera configuration not supported\";\n \t\treturn Invalid;\n-\t} else if (rawCount && !yuvCount) {\n+\t} else if (rawCount && !stillCount && !videoCount) {\n \t\t/*\n \t\t * Disallow raw-only camera configuration. Currently, ImgU does\n \t\t * not get configured for raw-only streams and has early return\n@@ -316,6 +336,9 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \tImgUDevice::Pipe pipe{};\n \tpipe.input = cio2Configuration_.size;\n \n+\tImgUDevice::Pipe pipe1{};\n+\tpipe1.input = cio2Configuration_.size;\n+\n \t/*\n \t * Adjust the configurations if needed and assign streams while\n \t * iterating them.\n@@ -380,18 +403,35 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t\t\tcfg->stride = info.stride(cfg->size.width, 0, 1);\n \t\t\tcfg->frameSize = info.frameSize(cfg->size, 1);\n \n+\t\t\tif (cfg->streamRole == StreamRole::StillCapture) {\n+\t\t\t\tASSERT(stillCount == 1);\n+\t\t\t\tLOG(IPU3, Debug) << \"Assigned \"\n+\t\t\t\t\t\t << cfg->toString()\n+\t\t\t\t\t\t << \" to the imgu1 main output\";\n+\t\t\t\tcfg->setStream(const_cast<Stream *>(&data_->outCaptureStream_));\n+\n+\t\t\t\tpipe1.main = cfg->size;\n+\t\t\t\tpipe1.viewfinder = pipe1.main;\n+\n+\t\t\t\tpipeConfig1_ = data_->imgu1_->calculatePipeConfig(&pipe1);\n+\t\t\t\tif (pipeConfig1_.isNull()) {\n+\t\t\t\t\tLOG(IPU3, Error) << \"Failed to calculate pipe configuration: \"\n+\t\t\t\t\t\t\t << \"unsupported resolutions.\";\n+\t\t\t\t\treturn Invalid;\n+\t\t\t\t}\n \t\t\t/*\n \t\t\t * Use the main output stream in case only one stream is\n \t\t\t * requested or if the current configuration is the one\n \t\t\t * with the maximum YUV output size.\n \t\t\t */\n-\t\t\tif (mainOutputAvailable &&\n-\t\t\t    (originalCfg.size == maxYuvSize || yuvCount == 1)) {\n+\t\t\t} else if (mainOutputAvailable &&\n+\t\t\t\t   (originalCfg.size == maxVideoSize ||\n+\t\t\t\t    videoCount == 1)) {\n \t\t\t\tcfg->setStream(const_cast<Stream *>(&data_->outStream_));\n \t\t\t\tmainOutputAvailable = false;\n \n \t\t\t\tpipe.main = cfg->size;\n-\t\t\t\tif (yuvCount == 1)\n+\t\t\t\tif (videoCount == 1)\n \t\t\t\t\tpipe.viewfinder = pipe.main;\n \n \t\t\t\tLOG(IPU3, Debug) << \"Assigned \" << cfg->toString()\n@@ -415,7 +455,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \t}\n \n \t/* Only compute the ImgU configuration if a YUV stream has been requested. */\n-\tif (yuvCount) {\n+\tif (videoCount) {\n \t\tpipeConfig0_ = data_->imgu0_->calculatePipeConfig(&pipe);\n \t\tif (pipeConfig0_.isNull()) {\n \t\t\tLOG(IPU3, Error) << \"Failed to calculate pipe configuration: \"\n","prefixes":["libcamera-devel","v4","7/9"]}