Patch Detail
Show a patch.
GET /api/1.1/patches/23344/?format=api
{ "id": 23344, "url": "https://patchwork.libcamera.org/api/1.1/patches/23344/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23344/", "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": "<20250507082753.2306743-4-naush@raspberrypi.com>", "date": "2025-05-07T07:52:10", "name": "[RFC,3/6] pipeline: ipa: rpi: Split RPiCameraData::dropFrameCount_", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d2a0959af87fbdfc473cf30a4e1aeaf288cf168c", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23344/mbox/", "series": [ { "id": 5164, "url": "https://patchwork.libcamera.org/api/1.1/series/5164/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5164", "date": "2025-05-07T07:52:07", "name": "Eliminating startup frames", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5164/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23344/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23344/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 4DEA6C3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 7 May 2025 08:28:13 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A270368B36;\n\tWed, 7 May 2025 10:28:10 +0200 (CEST)", "from mail-wr1-x429.google.com (mail-wr1-x429.google.com\n\t[IPv6:2a00:1450:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 40EA968B30\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 7 May 2025 10:28:00 +0200 (CEST)", "by mail-wr1-x429.google.com with SMTP id\n\tffacd0b85a97d-39d73b97500so374091f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 07 May 2025 01:28:00 -0700 (PDT)", "from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-441d440fff6sm22182575e9.25.2025.05.07.01.27.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 07 May 2025 01:27:58 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"FObYVrtc\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1746606479; x=1747211279;\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=85vcpWZxa6mtEJPyiFwMvAsazIU0BVD2UXwGQZLD+8o=;\n\tb=FObYVrtcEFP/HnCR36dC2LysZVbcwhR8i5fRp/kpK93UqmEhev42u6fcmLfVDY0gDR\n\tk3+anq+kwl9WzhSqn9k4eqqwKkDwuhAxFLL7DSjgi+16FZkeOirO0J0Qjkfpn5B11Pgg\n\tVwjmWuSEtL16ITqY9VgN55tNtTeBs95CwE9wi0SkaM7ywzPsHWZpt1ymh+FQ+IpSnK5n\n\tM85KIMu+Jo0RzR2mby1EzHO2JumFReNwQaFlB/PoWN+zgIrKotgsUQNQIj5KlcmbUNXp\n\tbSVaGvWz0b+qw++K1eGGFGCQ67UaBBVwzWiFeSuk2rGI8pVx893mnkwd9zINZQTMBM01\n\tYRcw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1746606479; x=1747211279;\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=85vcpWZxa6mtEJPyiFwMvAsazIU0BVD2UXwGQZLD+8o=;\n\tb=AowHmf2hQUttsB61ohS+CvDhu1bR1yj4GwkTy0VyhXqoN3AcVTFLgD5zu0/4ChUSuP\n\tlq7LUKqN1Nxw04rfJiiIaKDspyM98ZI+GcTSJpk/aDlXyH5aiuW90sUeFddtHXPv29mU\n\tLSSZtLfy7WOSeRfqd8CPJB5GLn88O03SVecwAOBr7WTjgVTzml9y5TTSpKrSpgu9shQn\n\tcV2y+Wo+dyEdIBDJ4yfX38/qIfNxloVpBoRZdwINLW1NJUr73nVJj0a9QbPG9up3FHkC\n\tfBFbF+CB/lje3v3nR+xPeM0jpHSRONVq4goLvkrLotcJg751ke5wSY3RKCyYde7hsE5a\n\tV/ow==", "X-Gm-Message-State": "AOJu0Yz4hrAvqCvlzC6tUIIhfqJlRBhAQOdDtN0/IAU6w0vnzzKjqSuZ\n\tbgHKHlt1ohZHufjO6K7bTC3NSO9NYEc+sGI5/ML/IsbDMhsrYh0ZSb+x8k9OfOordSjYEJ8eHCT\n\tS", "X-Gm-Gg": "ASbGncs7qMAk4hwQwrVzeaSbG4maYklDqWM1kdes234EvwNbUGqj/y6ELj8StP8kTPV\n\tvKNUsl698CoxkURF7RZoQBNA94XAlsEN1w6wMpghcdQ8SrNa7d8d2FX+qUiXwtiohaWTXpIoLwn\n\tq5JSeGo3vZykeKZWWxRej3vOpFh5L2Ra4fJElyKBW6wna8hDpRgJEDzL4q0dbLLhgB47jH6S8kc\n\twCu/YYbseq5seV57+f2N2mCMMMyMNSA6LsrDJkipV+wgbkXxxJ91S9IkdIN7jSEujDPI7jW0J0i\n\t5Wm6BOviUn1n/Mtf6JqcHKN5Jjt1RjJnx6DZJN2OsdlquYVk9/ud/luNvVUb", "X-Google-Smtp-Source": "AGHT+IFkly/sLzhr8DUSEzBSGmqUPAXtZLWb6diApNul9uJAcrq0/XAgZLu/sa3J01RUUj7XCXwxvA==", "X-Received": "by 2002:a05:600c:4ecc:b0:439:9fde:da76 with SMTP id\n\t5b1f17b1804b1-441d448cab2mr6312545e9.0.1746606479162; \n\tWed, 07 May 2025 01:27:59 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Naushir Patuck <naush@raspberrypi.com>", "Subject": "[RFC PATCH 3/6] pipeline: ipa: rpi: Split\n\tRPiCameraData::dropFrameCount_", "Date": "Wed, 7 May 2025 08:52:10 +0100", "Message-ID": "<20250507082753.2306743-4-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250507082753.2306743-1-naush@raspberrypi.com>", "References": "<20250507082753.2306743-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Split the pipeline handler drop frame tracking into startup frames and\ninvalid frames, as reported by the IPA.\n\nRemove the drop buffer handling logic in the pipeline handler. Now all\nimage buffers are returned out with the appropriate FrameStatus set\nfor startup or invalid frames.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/rpi/common/pipeline_base.cpp | 88 +++++++------------\n .../pipeline/rpi/common/pipeline_base.h | 5 +-\n 2 files changed, 37 insertions(+), 56 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 5956485953a2..21f2daf5bab5 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -659,9 +659,9 @@ int PipelineHandlerBase::start(Camera *camera, const ControlList *controls)\n \tif (!result.controls.empty())\n \t\tdata->setSensorControls(result.controls);\n \n-\t/* Configure the number of dropped frames required on startup. */\n-\tdata->dropFrameCount_ = data->config_.disableStartupFrameDrops ?\n-\t\t\t0 : result.startupFrameCount + result.invalidFrameCount;\n+\t/* Configure the number of startup and invalid frames reported by the IPA. */\n+\tdata->startupFrameCount_ = result.startupFrameCount;\n+\tdata->invalidFrameCount_ = result.invalidFrameCount;\n \n \tfor (auto const stream : data->streams_)\n \t\tstream->resetBuffers();\n@@ -678,7 +678,6 @@ int PipelineHandlerBase::start(Camera *camera, const ControlList *controls)\n \t\tdata->buffersAllocated_ = true;\n \t}\n \n-\t/* We need to set the dropFrameCount_ before queueing buffers. */\n \tret = queueAllBuffers(camera);\n \tif (ret) {\n \t\tLOG(RPI, Error) << \"Failed to queue buffers\";\n@@ -898,23 +897,6 @@ int PipelineHandlerBase::queueAllBuffers(Camera *camera)\n \t\t\tret = stream->queueAllBuffers();\n \t\t\tif (ret < 0)\n \t\t\t\treturn ret;\n-\t\t} else {\n-\t\t\t/*\n-\t\t\t * For external streams, we must queue up a set of internal\n-\t\t\t * buffers to handle the number of drop frames requested by\n-\t\t\t * the IPA. This is done by passing nullptr in queueBuffer().\n-\t\t\t *\n-\t\t\t * The below queueBuffer() call will do nothing if there\n-\t\t\t * are not enough internal buffers allocated, but this will\n-\t\t\t * be handled by queuing the request for buffers in the\n-\t\t\t * RPiStream object.\n-\t\t\t */\n-\t\t\tunsigned int i;\n-\t\t\tfor (i = 0; i < data->dropFrameCount_; i++) {\n-\t\t\t\tret = stream->queueBuffer(nullptr);\n-\t\t\t\tif (ret)\n-\t\t\t\t\treturn ret;\n-\t\t\t}\n \t\t}\n \t}\n \n@@ -1412,7 +1394,15 @@ void CameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream)\n \t * buffer back to the stream.\n \t */\n \tRequest *request = requestQueue_.empty() ? nullptr : requestQueue_.front();\n-\tif (!dropFrameCount_ && request && request->findBuffer(stream) == buffer) {\n+\tif (request && request->findBuffer(stream) == buffer) {\n+\t\tFrameMetadata &md = buffer->_d()->metadata();\n+\n+\t\t/* Mark the non-converged and invalid frames in the metadata. */\n+\t\tif (startupFrameCount_)\n+\t\t\tmd.status = FrameMetadata::Status::FrameStartup;\n+\t\tif (invalidFrameCount_)\n+\t\t\tmd.status = FrameMetadata::Status::FrameError;\n+\n \t\t/*\n \t\t * Tag the buffer as completed, returning it to the\n \t\t * application.\n@@ -1458,42 +1448,32 @@ void CameraData::handleState()\n \n void CameraData::checkRequestCompleted()\n {\n-\tbool requestCompleted = false;\n-\t/*\n-\t * If we are dropping this frame, do not touch the request, simply\n-\t * change the state to IDLE when ready.\n-\t */\n-\tif (!dropFrameCount_) {\n-\t\tRequest *request = requestQueue_.front();\n-\t\tif (request->hasPendingBuffers())\n-\t\t\treturn;\n+\tRequest *request = requestQueue_.front();\n+\tif (request->hasPendingBuffers())\n+\t\treturn;\n \n-\t\t/* Must wait for metadata to be filled in before completing. */\n-\t\tif (state_ != State::IpaComplete)\n-\t\t\treturn;\n+\t/* Must wait for metadata to be filled in before completing. */\n+\tif (state_ != State::IpaComplete)\n+\t\treturn;\n \n-\t\tLOG(RPI, Debug) << \"Completing request sequence: \"\n-\t\t\t\t<< request->sequence();\n+\tLOG(RPI, Debug) << \"Completing request sequence: \"\n+\t\t\t<< request->sequence();\n \n-\t\tpipe()->completeRequest(request);\n-\t\trequestQueue_.pop();\n-\t\trequestCompleted = true;\n-\t}\n+\tpipe()->completeRequest(request);\n+\trequestQueue_.pop();\n \n-\t/*\n-\t * Make sure we have three outputs completed in the case of a dropped\n-\t * frame.\n-\t */\n-\tif (state_ == State::IpaComplete &&\n-\t ((ispOutputCount_ == ispOutputTotal_ && dropFrameCount_) ||\n-\t requestCompleted)) {\n-\t\tLOG(RPI, Debug) << \"Going into Idle state\";\n-\t\tstate_ = State::Idle;\n-\t\tif (dropFrameCount_) {\n-\t\t\tdropFrameCount_--;\n-\t\t\tLOG(RPI, Debug) << \"Dropping frame at the request of the IPA (\"\n-\t\t\t\t\t<< dropFrameCount_ << \" left)\";\n-\t\t}\n+\tLOG(RPI, Debug) << \"Going into Idle state\";\n+\tstate_ = State::Idle;\n+\n+\tif (startupFrameCount_) {\n+\t\tstartupFrameCount_--;\n+\t\tLOG(RPI, Debug) << \"Decrementing startup frames to \"\n+\t\t\t\t<< startupFrameCount_;\n+\t}\n+\tif (invalidFrameCount_) {\n+\t\tinvalidFrameCount_--;\n+\t\tLOG(RPI, Debug) << \"Decrementing invalid frames to \"\n+\t\t\t\t<< invalidFrameCount_;\n \t}\n }\n \ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h\nindex aae0c2f35888..6023f9f9d6b3 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h\n@@ -48,7 +48,7 @@ class CameraData : public Camera::Private\n public:\n \tCameraData(PipelineHandler *pipe)\n \t\t: Camera::Private(pipe), state_(State::Stopped),\n-\t\t dropFrameCount_(0), buffersAllocated_(false),\n+\t\t startupFrameCount_(0), invalidFrameCount_(0), buffersAllocated_(false),\n \t\t ispOutputCount_(0), ispOutputTotal_(0)\n \t{\n \t}\n@@ -151,7 +151,8 @@ public:\n \t/* Mapping of CropParams keyed by the output stream order in CameraConfiguration */\n \tstd::map<unsigned int, CropParams> cropParams_;\n \n-\tunsigned int dropFrameCount_;\n+\tunsigned int startupFrameCount_;\n+\tunsigned int invalidFrameCount_;\n \n \t/*\n \t * If set, this stores the value that represets a gain of one for\n", "prefixes": [ "RFC", "3/6" ] }