Patch Detail
Show a patch.
GET /api/patches/16432/?format=api
{ "id": 16432, "url": "https://patchwork.libcamera.org/api/patches/16432/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16432/", "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": "<20220629103018.4025635-7-chenghaoyang@google.com>", "date": "2022-06-29T10:30:15", "name": "[libcamera-devel,v3,6/9] ipu3: Configure imgu1 when necessary", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "7a0df4eabfb4c3bb66ab371e4fd41dfffd3cb30f", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": { "id": 12, "url": "https://patchwork.libcamera.org/api/users/12/?format=api", "username": "uajain", "first_name": "Umang", "last_name": "Jain", "email": "umang.jain@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/16432/mbox/", "series": [ { "id": 3232, "url": "https://patchwork.libcamera.org/api/series/3232/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3232", "date": "2022-06-29T10:30:09", "name": "Use two imgus in ipu3 pipeline handler", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3232/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16432/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16432/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 71A40BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Jun 2022 10:30:37 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 243566564A;\n\tWed, 29 Jun 2022 12:30:37 +0200 (CEST)", "from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com\n\t[IPv6:2607:f8b0:4864:20::52f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9694265643\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Jun 2022 12:30:31 +0200 (CEST)", "by mail-pg1-x52f.google.com with SMTP id e63so14913392pgc.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Jun 2022 03:30:31 -0700 (PDT)", "from chenghaoyang-low.c.googlers.com.com\n\t(208.158.221.35.bc.googleusercontent.com. [35.221.158.208])\n\tby smtp.gmail.com with ESMTPSA id\n\tjb4-20020a170903258400b00169071538a0sm10946059plb.267.2022.06.29.03.30.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 29 Jun 2022 03:30:29 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656498637;\n\tbh=tCsDkvLIRPMp8NkbSM+fZjmRxr1XZq/dIBbbebw9z2U=;\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=s2LshpeHrg52a2he6ER54HPkmPRfcu8Vp3Dhs6+6UAZ7mfOCexE6kNyOvvcdGct6D\n\tCfcFDzLje3CH+jn7N9pKTh1tUruVSSgkacp0SPzTHVNDCt0sxWwvtbfGEt82fkCkqV\n\tFYNY4T06d4P0kF73lB1bNub1x8E2j/Dl+vk2RvZc5fbSwB6K7TKAlSoW9GBcW97TPX\n\t+uMl0yl3hvAgkygQrFkrN7wX4quwlgKVapS8XfxpdvdtLga3x8EAttJYhbn+tr/LOb\n\tpL0JRtvrho/Hp/jb5UgJ0No7MbIYsgRpE7qvn7d5STtz4sIXVgXbql7pT63U6aOEbE\n\tZ//utCvxCcX8g==", "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=lLE8xkogtcdUmvJ6QKLyJkUAIsGf0UlLlM995CLC/gY=;\n\tb=GWwBpi/ZunZdG5o0f8oPs6ozzxn3cyZdtAih6cuNpto0HOIxXil65TTZNVRiA5UQ9O\n\tOT670Udpb6MhDd1lLJ7+43jzb1/Ro7l4Ttd6x/R9lQ5fbwM5ydmk4/wDyqlR4Otxx2cE\n\twyX1wmTO1e9N8FDARKr/L3dLTKov6XzIBbRiQ=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"GWwBpi/Z\"; \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=lLE8xkogtcdUmvJ6QKLyJkUAIsGf0UlLlM995CLC/gY=;\n\tb=4sj0hZVBFlzBvphCnpmvYgfMejzV15ckEAqZyV+HlOwtAIcBLHhBC5b3iXe234b+V9\n\tW4gtII6aMuBcMMqan6WXVyIBLGuziYtwzdizO5bOB6hFwl3Rzipltrv9/WjgQ4zZKJKh\n\tr8DZtH3igVL2j+UC0c/WBNvm5VajYvmvRqWF8ZJ7oG/oJX+39H2Jv+gMiYtG+Rwd5Lyw\n\t+MNUexOfjO4wQNnICglYcVF/td8uE7cU49bPs3AB9yQvydQ5LcoQ/iCd8eEVDds848EF\n\tkuW8zC+5hteErNpa3Bac90XhwqEThS2DDMBqo3zjNxPRYi6ie4qB+uHmqdOqbRcTossb\n\tTYVQ==", "X-Gm-Message-State": "AJIora9A1RmyA1/Snez0dexhzrFt6m510Hk3a6d1ycFCeRpfN06erf5w\n\tUttjkdMcsbikaVIpn5zB+qpVK+3vs+n0gJ68", "X-Google-Smtp-Source": "AGRyM1tNe7vUmw6FqW6dypY6pK6t8ejlIA8CMUbZIKq5phh+9YFIhT6aLwv3tcuv0VuBIzZUMqi1Vg==", "X-Received": "by 2002:a63:803:0:b0:40d:dfde:a822 with SMTP id\n\t3-20020a630803000000b0040ddfdea822mr2451326pgi.93.1656498629886; \n\tWed, 29 Jun 2022 03:30:29 -0700 (PDT)", "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 29 Jun 2022 10:30:15 +0000", "Message-Id": "<20220629103018.4025635-7-chenghaoyang@google.com>", "X-Mailer": "git-send-email 2.37.0.rc0.161.g10f37bed90-goog", "In-Reply-To": "<20220629103018.4025635-1-chenghaoyang@google.com>", "References": "<20220629103018.4025635-1-chenghaoyang@google.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 6/9] ipu3: Configure imgu1 when\n\tnecessary", "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": "This patch configure and setup imgu1 when still capture and other\nstreams are enabled. If only still capture is enabled, imgu0 is still\nbeing used with IPU3PipeModeVideo (i.e. VideoSnapshot) to ensure 3A is\nworking.\n\nStill capture stream will be enabled in the following patches.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 173 +++++++++++++++++++++++----\n 1 file changed, 149 insertions(+), 24 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex a13fb881..ec9d14d1 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -55,9 +55,11 @@ public:\n \n \tint loadIPA();\n \n+\tvoid tryReturnBuffer(FrameBuffer *buffer);\n \tvoid imguOutputBufferReady(FrameBuffer *buffer);\n \tvoid cio2BufferReady(FrameBuffer *buffer);\n \tvoid paramBufferReady(FrameBuffer *buffer);\n+\tvoid captureParamBufferReady(FrameBuffer *buffer);\n \tvoid statBufferReady(FrameBuffer *buffer);\n \tvoid queuePendingRequests();\n \tvoid cancelPendingRequests();\n@@ -93,6 +95,8 @@ private:\n \tvoid paramsBufferReady(unsigned int id);\n \tvoid setSensorControls(unsigned int id, const ControlList &sensorControls,\n \t\t\t const ControlList &lensControls);\n+\n+\tstd::map<FrameBuffer *, int> bufferReturnCounters;\n };\n \n class IPU3CameraConfiguration : public CameraConfiguration\n@@ -106,7 +110,8 @@ public:\n \tStatus validate() override;\n \n \tconst StreamConfiguration &cio2Format() const { return cio2Configuration_; }\n-\tconst ImgUDevice::PipeConfig imguConfig() const { return pipeConfig_; }\n+\tconst ImgUDevice::PipeConfig imguConfig0() const { return pipeConfig0_; }\n+\tconst ImgUDevice::PipeConfig imguConfig1() const { return pipeConfig1_; }\n \n \t/* Cache the combinedTransform_ that will be applied to the sensor */\n \tTransform combinedTransform_;\n@@ -120,7 +125,8 @@ private:\n \tconst IPU3CameraData *data_;\n \n \tStreamConfiguration cio2Configuration_;\n-\tImgUDevice::PipeConfig pipeConfig_;\n+\tImgUDevice::PipeConfig pipeConfig0_;\n+\tImgUDevice::PipeConfig pipeConfig1_;\n };\n \n class PipelineHandlerIPU3 : public PipelineHandler\n@@ -168,6 +174,8 @@ private:\n \tMediaDevice *cio2MediaDev_;\n \tMediaDevice *imguMediaDev_;\n \n+\tbool useImgu1_ = false;\n+\n \tCamera *inUseCamera_ = nullptr;\n \n \tstd::vector<IPABuffer> ipaBuffers_;\n@@ -408,8 +416,8 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \n \t/* Only compute the ImgU configuration if a YUV stream has been requested. */\n \tif (yuvCount) {\n-\t\tpipeConfig_ = data_->imgu0_->calculatePipeConfig(&pipe);\n-\t\tif (pipeConfig_.isNull()) {\n+\t\tpipeConfig0_ = data_->imgu0_->calculatePipeConfig(&pipe);\n+\t\tif (pipeConfig0_.isNull()) {\n \t\t\tLOG(IPU3, Error) << \"Failed to calculate pipe configuration: \"\n \t\t\t\t\t << \"unsupported resolutions.\";\n \t\t\treturn Invalid;\n@@ -519,8 +527,13 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \tIPU3CameraData *data = cameraData(camera);\n \tStream *outStream = &data->outStream_;\n \tStream *vfStream = &data->vfStream_;\n+\tStream *outCaptureStream = &data->outCaptureStream_;\n \tCIO2Device *cio2 = &data->cio2_;\n \tV4L2DeviceFormat outputFormat;\n+\n+\tImgUDevice::PipeConfig imguConfig1 = config->imguConfig1();\n+\tuseImgu1_ = !imguConfig1.isNull();\n+\n \tint ret;\n \n \t/*\n@@ -565,6 +578,12 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \tif (ret)\n \t\treturn ret;\n \n+\tif (useImgu1_) {\n+\t\tret = imgu1_.enableLinks(true);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \t/*\n \t * Pass the requested stream size to the CIO2 unit and get back the\n \t * adjusted format to be propagated to the ImgU output devices.\n@@ -607,14 +626,20 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t * stream has been requested: return here to skip the ImgU configuration\n \t * part.\n \t */\n-\tImgUDevice::PipeConfig imguConfig = config->imguConfig();\n-\tif (imguConfig.isNull())\n+\tImgUDevice::PipeConfig imguConfig0 = config->imguConfig0();\n+\tif (imguConfig0.isNull())\n \t\treturn 0;\n \n-\tret = imgu0_.configure(imguConfig, &cio2Format);\n+\tret = imgu0_.configure(imguConfig0, &cio2Format);\n \tif (ret)\n \t\treturn ret;\n \n+\tif (useImgu1_) {\n+\t\tret = imgu1_.configure(imguConfig1, &cio2Format);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \t/* Apply the format to the configured streams output devices. */\n \tStreamConfiguration *mainCfg = nullptr;\n \tStreamConfiguration *vfCfg = nullptr;\n@@ -633,6 +658,15 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t\t\tret = imgu0_.configureViewfinder(cfg, &outputFormat);\n \t\t\tif (ret)\n \t\t\t\treturn ret;\n+\t\t} else if (stream == outCaptureStream) {\n+\t\t\tASSERT(useImgu1_);\n+\t\t\tret = imgu1_.configureOutput(cfg, &outputFormat);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\tret = imgu1_.configureViewfinder(cfg, &outputFormat);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n \t\t}\n \t}\n \n@@ -648,22 +682,34 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t}\n \n \t/* Apply the \"pipe_mode\" control to the ImgU subdevice. */\n-\tControlList ctrls(imgu0_.imgu_->controls());\n+\tControlList ctrls0(imgu0_.imgu_->controls());\n \t/*\n \t * Set the ImgU pipe mode to 'Video' unconditionally to have statistics\n \t * generated.\n-\t *\n-\t * \\todo Figure out what the 'Still Capture' mode is meant for, and use\n-\t * it accordingly.\n \t */\n-\tctrls.set(V4L2_CID_IPU3_PIPE_MODE,\n-\t\t static_cast<int32_t>(IPU3PipeModeVideo));\n-\tret = imgu0_.imgu_->setControls(&ctrls);\n+\tctrls0.set(V4L2_CID_IPU3_PIPE_MODE,\n+\t\t static_cast<int32_t>(IPU3PipeModeVideo));\n+\tret = imgu0_.imgu_->setControls(&ctrls0);\n \tif (ret) {\n \t\tLOG(IPU3, Error) << \"Unable to set pipe_mode control\";\n \t\treturn ret;\n \t}\n \n+\tif (useImgu1_) {\n+\t\tControlList ctrls1(imgu1_.imgu_->controls());\n+\t\t/*\n+\t\t * \\todo Figure out what the 'Still Capture' mode is meant for,\n+\t\t * and use it accordingly.\n+\t\t */\n+\t\tctrls1.set(V4L2_CID_IPU3_PIPE_MODE,\n+\t\t\t static_cast<int32_t>(IPU3PipeModeStillCapture));\n+\t\tret = imgu1_.imgu_->setControls(&ctrls1);\n+\t\tif (ret) {\n+\t\t\tLOG(IPU3, Error) << \"Unable to set pipe_mode control\";\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n \tipa::ipu3::IPAConfigInfo configInfo;\n \tconfigInfo.sensorControls = data->cio2_.sensor()->controls();\n \n@@ -672,8 +718,8 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t\tconfigInfo.lensControls = lens->controls();\n \n \tconfigInfo.sensorInfo = sensorInfo;\n-\tconfigInfo.bdsOutputSize = config->imguConfig().bds;\n-\tconfigInfo.iif = config->imguConfig().iif;\n+\tconfigInfo.bdsOutputSize = config->imguConfig0().bds;\n+\tconfigInfo.iif = config->imguConfig0().iif;\n \n \tret = data->ipa_->configure(configInfo, &data->ipaControls_);\n \tif (ret) {\n@@ -793,8 +839,8 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis\n \tCIO2Device *cio2 = &data->cio2_;\n \tint ret;\n \n-\timgu0_.input_->bufferReady.connect(&data->cio2_,\n-\t\t\t\t\t &CIO2Device::tryReturnBuffer);\n+\timgu0_.input_->bufferReady.connect(data,\n+\t\t\t\t\t &IPU3CameraData::tryReturnBuffer);\n \timgu0_.output_->bufferReady.connect(data,\n \t\t\t\t\t &IPU3CameraData::imguOutputBufferReady);\n \timgu0_.viewfinder_->bufferReady.connect(data,\n@@ -803,6 +849,16 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis\n \t\t\t\t\t &IPU3CameraData::paramBufferReady);\n \timgu0_.stat_->bufferReady.connect(data,\n \t\t\t\t\t &IPU3CameraData::statBufferReady);\n+\n+\tif (useImgu1_) {\n+\t\timgu1_.input_->bufferReady.connect(data,\n+\t\t\t\t&IPU3CameraData::tryReturnBuffer);\n+\t\timgu1_.output_->bufferReady.connect(data,\n+\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n+\t\timgu1_.param_->bufferReady.connect(data,\n+\t\t\t\t&IPU3CameraData::captureParamBufferReady);\n+\t}\n+\n \t/* Disable test pattern mode on the sensor, if any. */\n \tret = cio2->sensor()->setTestPatternMode(\n \t\tcontrols::draft::TestPatternModeEnum::TestPatternModeOff);\n@@ -834,10 +890,17 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis\n \tif (ret)\n \t\tgoto error;\n \n+\tif (useImgu1_) {\n+\t\tret = imgu1_.start();\n+\t\tif (ret)\n+\t\t\tgoto error;\n+\t}\n+\n \treturn 0;\n \n error:\n \timgu0_.stop();\n+\timgu1_.stop();\n \tcio2->stop();\n \tdata->ipa_->stop();\n \tfreeBuffers(camera);\n@@ -848,6 +911,11 @@ error:\n \timgu0_.viewfinder_->bufferReady.disconnect();\n \timgu0_.param_->bufferReady.disconnect();\n \timgu0_.stat_->bufferReady.disconnect();\n+\timgu1_.input_->bufferReady.disconnect();\n+\timgu1_.output_->bufferReady.disconnect();\n+\timgu1_.param_->bufferReady.disconnect();\n+\n+\tuseImgu1_ = false;\n \tinUseCamera_ = nullptr;\n \n \treturn ret;\n@@ -863,6 +931,7 @@ void PipelineHandlerIPU3::stopDevice(Camera *camera)\n \tdata->ipa_->stop();\n \n \tret |= imgu0_.stop();\n+\tret |= imgu1_.stop();\n \tret |= data->cio2_.stop();\n \tif (ret)\n \t\tLOG(IPU3, Warning) << \"Failed to stop camera \" << camera->id();\n@@ -874,7 +943,11 @@ void PipelineHandlerIPU3::stopDevice(Camera *camera)\n \tdata->imgu0_->viewfinder_->bufferReady.disconnect();\n \tdata->imgu0_->param_->bufferReady.disconnect();\n \tdata->imgu0_->stat_->bufferReady.disconnect();\n+\tdata->imgu1_->input_->bufferReady.disconnect();\n+\tdata->imgu1_->output_->bufferReady.disconnect();\n+\tdata->imgu1_->param_->bufferReady.disconnect();\n \n+\tuseImgu1_ = false;\n \tinUseCamera_ = nullptr;\n }\n \n@@ -1320,22 +1393,45 @@ void IPU3CameraData::paramsBufferReady(unsigned int id)\n \tif (!info)\n \t\treturn;\n \n+\tbool hasYuv = false;\n+\tbool hasCapture = false;\n \t/* Queue all buffers from the request aimed for the ImgU. */\n \tfor (auto it : info->request->buffers()) {\n \t\tconst Stream *stream = it.first;\n \t\tFrameBuffer *outbuffer = it.second;\n \n-\t\tif (stream == &outStream_)\n+\t\tif (stream == &outStream_) {\n+\t\t\thasYuv = true;\n \t\t\timgu0_->output_->queueBuffer(outbuffer);\n-\t\telse if (stream == &vfStream_)\n+\t\t} else if (stream == &vfStream_) {\n+\t\t\thasYuv = true;\n \t\t\timgu0_->viewfinder_->queueBuffer(outbuffer);\n+\t\t} else if (stream == &outCaptureStream_) {\n+\t\t\thasCapture = true;\n+\n+\t\t\timgu1_->output_->queueBuffer(outbuffer);\n+\t\t}\n \t}\n \n-\timgu0_->param_->queueBuffer(info->paramBuffer);\n-\timgu0_->stat_->queueBuffer(info->statBuffer);\n-\timgu0_->input_->queueBuffer(info->rawBuffer);\n+\tif (hasYuv) {\n+\t\tbufferReturnCounters[info->rawBuffer] += 1;\n \n-\tinfo->captureParamDequeued = true;\n+\t\timgu0_->param_->queueBuffer(info->paramBuffer);\n+\t\timgu0_->stat_->queueBuffer(info->statBuffer);\n+\t\timgu0_->input_->queueBuffer(info->rawBuffer);\n+\t} else {\n+\t\tinfo->paramDequeued = true;\n+\t\tinfo->metadataProcessed = true;\n+\t}\n+\n+\tif (hasCapture) {\n+\t\tbufferReturnCounters[info->rawBuffer] += 1;\n+\n+\t\timgu1_->param_->queueBuffer(info->captureParamBuffer);\n+\t\timgu1_->input_->queueBuffer(info->rawBuffer);\n+\t} else {\n+\t\tinfo->captureParamDequeued = true;\n+\t}\n }\n \n void IPU3CameraData::metadataReady(unsigned int id, const ControlList &metadata)\n@@ -1356,6 +1452,15 @@ void IPU3CameraData::metadataReady(unsigned int id, const ControlList &metadata)\n * Buffer Ready slots\n */\n \n+void IPU3CameraData::tryReturnBuffer(FrameBuffer *buffer)\n+{\n+\tif (--bufferReturnCounters[buffer] > 0)\n+\t\treturn;\n+\n+\tbufferReturnCounters.erase(buffer);\n+\tcio2_.tryReturnBuffer(buffer);\n+}\n+\n /**\n * \\brief Handle buffers completion at the ImgU output\n * \\param[in] buffer The completed buffer\n@@ -1448,6 +1553,26 @@ void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)\n \t\tpipe()->completeRequest(request);\n }\n \n+void IPU3CameraData::captureParamBufferReady(FrameBuffer *buffer)\n+{\n+\tIPU3Frames::Info *info = frameInfos_.find(buffer);\n+\tif (!info)\n+\t\treturn;\n+\n+\tinfo->captureParamDequeued = true;\n+\n+\t/*\n+\t * tryComplete() will delete info if it completes the IPU3Frame.\n+\t * In that event, we must have obtained the Request before hand.\n+\t *\n+\t * \\todo Improve the FrameInfo API to avoid this type of issue\n+\t */\n+\tRequest *request = info->request;\n+\n+\tif (frameInfos_.tryComplete(info))\n+\t\tpipe()->completeRequest(request);\n+}\n+\n void IPU3CameraData::statBufferReady(FrameBuffer *buffer)\n {\n \tIPU3Frames::Info *info = frameInfos_.find(buffer);\n", "prefixes": [ "libcamera-devel", "v3", "6/9" ] }