Patch Detail
Show a patch.
GET /api/1.1/patches/19053/?format=api
{ "id": 19053, "url": "https://patchwork.libcamera.org/api/1.1/patches/19053/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19053/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20230918085222.500697-2-chenghaoyang@chromium.org>", "date": "2023-09-18T08:49:21", "name": "[libcamera-devel,v1,1/1] libcamera: Fix ipu3's issue of first black frame", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3fe966468393ec18383eb1fc3cfcf7ad12d2424f", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/1.1/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19053/mbox/", "series": [ { "id": 4028, "url": "https://patchwork.libcamera.org/api/1.1/series/4028/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4028", "date": "2023-09-18T08:49:20", "name": "Fix ipu3 pipeline handler's first frame", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4028/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19053/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19053/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 4098DC326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Sep 2023 08:52:33 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BDB636293A;\n\tMon, 18 Sep 2023 10:52:31 +0200 (CEST)", "from mail-pl1-x635.google.com (mail-pl1-x635.google.com\n\t[IPv6:2607:f8b0:4864:20::635])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B580061DEC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Sep 2023 10:52:30 +0200 (CEST)", "by mail-pl1-x635.google.com with SMTP id\n\td9443c01a7336-1bf6ea270b2so30799515ad.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Sep 2023 01:52:30 -0700 (PDT)", "from chenghaoyang-low.c.googlers.com.com\n\t(148.175.199.104.bc.googleusercontent.com. [104.199.175.148])\n\tby smtp.gmail.com with ESMTPSA id\n\tz4-20020a170902ee0400b001b88da737c6sm2387020plb.54.2023.09.18.01.52.27\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 18 Sep 2023 01:52:28 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1695027151;\n\tbh=ofju62HOyCtZ6JUZksTiTTT6w3TW7UHt4tNWV4WHyOA=;\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=od1h6r9IczlOrNbRGJ13pNNxVBThTA4nDcTZ8xdX6hW2Hp7lOhvjGtNjthgMIZ0Wg\n\tCn3zIRoA8/WdxIIjyRwwqmfUMelg0hXXrUGXIaUSGrwCDJMgI0BC79bWPizKv71kxh\n\t3ZHT5juq6BzsLdGdnrMYMLYrb6p1d9LwED/VYP6HrT8YRKr6oyn/ILi6J+CPg920JB\n\tugqj1Iy9zlvG+zkFxX2mv7tW7Qsjz6L23mpSqFaqfCjrmKTEVsgzO8Z9ACbqiPLuj5\n\tAWHhjFZC16b7ME9rB5TaDvcL/C+7LPo9OR+VhvRazhclpojy0TAJyBolY+n7cZiITG\n\tlKPpHkjcKeztA==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1695027149; x=1695631949;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=gFJVI0hL49KJbYXVhYGFATbY93lQH2D1fxPPxOdUZg4=;\n\tb=SIt2Y6+BaRBTKYsCcakYpX5dW1rAy/hLFGcDXqt+RAJpvWzDH8SRMlakLs0HGO955H\n\tDhpHJAj3I4cBpDgwO2Vls5ghKuhf9R59F/SvcyMu3f6JUKNnbwnJiQrkTffCOS6rqi0a\n\tZyCLDrkY9iP0XMjrtFnyJtt6IZvw5hzmT2u9E=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"SIt2Y6+B\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1695027149; x=1695631949;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=gFJVI0hL49KJbYXVhYGFATbY93lQH2D1fxPPxOdUZg4=;\n\tb=CNUr+eaZ0nCbultd01B5/yFr9KMeJECD+CeT0HgOucJ8fJd7SsTlA6c7C5nSnmPTh5\n\tF42pAveu/nmVJS0wRN8xjM4PqWcAyM6fgAi8MKU9haSzBP3fOzHgwBAMnauSpdcmvfSm\n\tq0Oc6LQWYmRQOsvrFR2IzO2rYnQkH5knFa6aMKF7QI+ogzz/NZ13WgLg8hVcRw71Ma1t\n\tzyeo5C2IRBKQ9edEvOpQPsI70yeiYPJyGWv467oKx7GCyjepH4debBhQS9EnckWFF/Da\n\tpj+JDb+Pnya0oPiIi+XkvVfCvnTk7IZp+/CbJSlm4T/Q7OaNHiAYWG3HaWS/UhuN0IKD\n\tPqWA==", "X-Gm-Message-State": "AOJu0YwzH+VPwAql2hQtWIaQMomJns6d5H/1rneVge5Q6QUfjkPSwjXE\n\tzk8aHtlituQ6EU2NS9dkFBDTSLMme+3D6cCb9cfnuPXZ", "X-Google-Smtp-Source": "AGHT+IG7Ut/8eBeULHlOgMw49uGEcRRBKLlh89u+p/vfZ0MmbQX1fTh7Cs3qvMZTwD6cacdt+OlcAA==", "X-Received": "by 2002:a17:902:e845:b0:1b6:bced:1dc2 with SMTP id\n\tt5-20020a170902e84500b001b6bced1dc2mr8485331plg.0.1695027148855; \n\tMon, 18 Sep 2023 01:52:28 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 18 Sep 2023 08:49:21 +0000", "Message-ID": "<20230918085222.500697-2-chenghaoyang@chromium.org>", "X-Mailer": "git-send-email 2.42.0.459.ge4e396fd5e-goog", "In-Reply-To": "<20230918085222.500697-1-chenghaoyang@chromium.org>", "References": "<20230918085222.500697-1-chenghaoyang@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1 1/1] libcamera: Fix ipu3's issue of\n\tfirst black frame", "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@chromium.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "As ipu3 ISP requires two frames in the pipeline to generate non-delayed\noutput, this CL fixes the problem of the first frame (preview and\ncapture) being black by queueing the first buffer twice.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 50 ++++++++++++++++++++++++----\n 1 file changed, 43 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex a81c817a..fa4a8a10 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -86,11 +86,15 @@ public:\n \n \tControlInfoMap ipaControls_;\n \n+\tbool firstRequest_ = true;\n+\n private:\n \tvoid metadataReady(unsigned int id, const ControlList &metadata);\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@@ -721,6 +725,8 @@ int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] const ControlLis\n \tImgUDevice *imgu = data->imgu_;\n \tint ret;\n \n+\tdata->firstRequest_ = true;\n+\n \t/* Disable test pattern mode on the sensor, if any. */\n \tret = cio2->sensor()->setTestPatternMode(\n \t\tcontrols::draft::TestPatternModeEnum::TestPatternModeOff);\n@@ -1224,22 +1230,37 @@ void IPU3CameraData::paramsBufferReady(unsigned int id)\n \tif (!info)\n \t\treturn;\n \n+\tconst int yuvCount = firstRequest_ ? 2 : 1;\n+\tfirstRequest_ = 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\t\timgu_->output_->queueBuffer(outbuffer);\n-\t\telse if (stream == &vfStream_)\n-\t\t\timgu_->viewfinder_->queueBuffer(outbuffer);\n+\t\tif (stream == &outStream_) {\n+\t\t\tfor (int i = 0; i < yuvCount; ++i) {\n+\t\t\t\tbufferReturnCounters_[outbuffer] += 1;\n+\t\t\t\timgu_->output_->queueBuffer(outbuffer);\n+\t\t\t}\n+\t\t} else if (stream == &vfStream_) {\n+\t\t\tfor (int i = 0; i < yuvCount; ++i) {\n+\t\t\t\tbufferReturnCounters_[outbuffer] += 1;\n+\t\t\t\timgu_->viewfinder_->queueBuffer(outbuffer);\n+\t\t\t}\n+\t\t}\n \t}\n \n \tinfo->paramBuffer->_d()->metadata().planes()[0].bytesused =\n \t\tsizeof(struct ipu3_uapi_params);\n-\timgu_->param_->queueBuffer(info->paramBuffer);\n-\timgu_->stat_->queueBuffer(info->statBuffer);\n-\timgu_->input_->queueBuffer(info->rawBuffer);\n+\tfor (int i = 0; i < yuvCount; ++i) {\n+\t\tbufferReturnCounters_[info->paramBuffer] += 1;\n+\t\tbufferReturnCounters_[info->statBuffer] += 1;\n+\t\tbufferReturnCounters_[info->rawBuffer] += 1;\n+\n+\t\timgu_->param_->queueBuffer(info->paramBuffer);\n+\t\timgu_->stat_->queueBuffer(info->statBuffer);\n+\t\timgu_->input_->queueBuffer(info->rawBuffer);\n+\t}\n }\n \n void IPU3CameraData::metadataReady(unsigned int id, const ControlList &metadata)\n@@ -1268,6 +1289,11 @@ void IPU3CameraData::metadataReady(unsigned int id, const ControlList &metadata)\n */\n void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer)\n {\n+\tif (--bufferReturnCounters_[buffer] > 0)\n+\t\treturn;\n+\n+\tbufferReturnCounters_.erase(buffer);\n+\n \tIPU3Frames::Info *info = frameInfos_.find(buffer);\n \tif (!info)\n \t\treturn;\n@@ -1334,6 +1360,11 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n \n void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)\n {\n+\tif (--bufferReturnCounters_[buffer] > 0)\n+\t\treturn;\n+\n+\tbufferReturnCounters_.erase(buffer);\n+\n \tIPU3Frames::Info *info = frameInfos_.find(buffer);\n \tif (!info)\n \t\treturn;\n@@ -1354,6 +1385,11 @@ void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)\n \n void IPU3CameraData::statBufferReady(FrameBuffer *buffer)\n {\n+\tif (--bufferReturnCounters_[buffer] > 0)\n+\t\treturn;\n+\n+\tbufferReturnCounters_.erase(buffer);\n+\n \tIPU3Frames::Info *info = frameInfos_.find(buffer);\n \tif (!info)\n \t\treturn;\n", "prefixes": [ "libcamera-devel", "v1", "1/1" ] }