Patch Detail
Show a patch.
GET /api/patches/18560/?format=api
{ "id": 18560, "url": "https://patchwork.libcamera.org/api/patches/18560/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18560/", "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": "<20230426131057.21550-14-naush@raspberrypi.com>", "date": "2023-04-26T13:10:57", "name": "[libcamera-devel,13/13] pipeline: vc4: Connect/disconnect IPA and dequeue signals on start/stop", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "4a8555a4a249d9e1697f32afab72142c8582d750", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18560/mbox/", "series": [ { "id": 3847, "url": "https://patchwork.libcamera.org/api/series/3847/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3847", "date": "2023-04-26T13:10:44", "name": "Raspberry Pi: Code refactoring", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3847/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18560/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18560/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 6DBDCC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Apr 2023 13:13:44 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1EDB3627FF;\n\tWed, 26 Apr 2023 15:13:44 +0200 (CEST)", "from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7BAD8627E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Apr 2023 15:13:42 +0200 (CEST)", "by mail-wm1-x331.google.com with SMTP id\n\t5b1f17b1804b1-3f1cfed93e2so43567585e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Apr 2023 06:13:42 -0700 (PDT)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tk5-20020adff5c5000000b002f103ca90cdsm15780949wrp.101.2023.04.26.06.13.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 26 Apr 2023 06:13:41 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1682514824;\n\tbh=oY+NgQ2D+mWVJsnVUJdRNmCftrAmbxszpbVYstEIXzo=;\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:\n\tFrom;\n\tb=bui+jd2/0713KThCN1uGyCouuDjn7KKGTmLB3/ooXDxGoEswIG0XFt74cWX1HAdNg\n\tiy4AtiLUZ/rRSNhO0xWE1e5+fnu4QWZXyk4SG3yxNsRCjgQjSW6uyuNsB7S5YhazHc\n\tOIk5E+PNgUQDk16pVTAWdcb6nlvuPO1TXP8weqo2E90PNP2vfeL/fbx67XUOZsfaWa\n\t5tmn9mIeTES4n5omCZtjr6/4UCTQuzxUldDVlpgarmaOKX62CmpZVdPi+MDjrdhmnM\n\tKr8wIsQ2xCzCioURWuzklk8zfin7EVLKIUKpp8HdXxA0stPl1Arziz8+HTCytws6vO\n\tHZ8feF+R4T99Q==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1682514822; x=1685106822;\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=OSX7rX2yvtgqkMky+H6ao7ePsv7HtXEeq3H1rxSd1s0=;\n\tb=hpMjk2tyXf7CbHbA8SfpqctftPf/osyxor5WsxzHFiBd5LoG5bL/irrYt6C9ZPx+Za\n\tBMqdAcs9QQX7j/bVDweCO8vHY7+pwYBFmrAL+QYNn6FOAuMhRjHLQj863sVK5/G8el3M\n\tPnSI4XFr1l1UMJ8GmsSrUW8lF3pGLELOkrhOMr1EpijcmS7ikW4H4UNTlpTdqXskx4A+\n\tLci3P5jYYMQLn6IflKN6JvSUrTVSO3nh1xb5VnbjiEP2UgYz983daooWljyTmNbdBcl8\n\tsYqLEvonZtx9mM86YIe6p11qa/rJUg1u8Zf8OUTFHZ+qCoWRJRXTJel99tl1tlb8PHnG\n\tub0w==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"hpMjk2ty\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1682514822; x=1685106822;\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=OSX7rX2yvtgqkMky+H6ao7ePsv7HtXEeq3H1rxSd1s0=;\n\tb=GNnnlCkWDhehH5OrOzfUwQ33YJhGvE0rLgMkpUbD+8MRUXZOWMCHvVWGs6tTNK1vu1\n\tPhRzgp4E012QpDDpQXa60n3lRtlJoK8VVBBv00eAntwnEbbTSkVxfZgTw6p3yuJGGuwu\n\tULAR0/XIOF7Nb8shBuHvgv7XgUNIjNHSPKZxAPSurQJV2PVprAB+01kl8bx3a3A9ZHiT\n\tSHGqZFTrEkxCBdplw7P0VN01CgIkdg98ZYvuqXiAbK1ux23Kzm3RR11XPjizRehDZzOk\n\tiJ2sKWJv3N3vPdupIL2XYBnzLj+15i8DVy4oymLg71E4cZrb8HSugDMp3e8sd0O7PUjZ\n\tu0lw==", "X-Gm-Message-State": "AAQBX9cd/CCb+Zj89O9UTNTYXH1CS/r8iQdYkH6SqdPM4AL6YGtNYyvj\n\tSrJGNF3cnz0enCA4QMoHI9/kMDp55qdDyIhG+j37bA==", "X-Google-Smtp-Source": "AKy350YlAofyDRw1OzbgnKdWPhP9hsd1mNW8xscNxLEq+kdp3fHXA0ikyVd/nzmfZC5Q83G7KOMuPA==", "X-Received": "by 2002:a5d:4f07:0:b0:2f0:bd17:2d2c with SMTP id\n\tc7-20020a5d4f07000000b002f0bd172d2cmr13468851wru.9.1682514821870; \n\tWed, 26 Apr 2023 06:13:41 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 26 Apr 2023 14:10:57 +0100", "Message-Id": "<20230426131057.21550-14-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20230426131057.21550-1-naush@raspberrypi.com>", "References": "<20230426131057.21550-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 13/13] pipeline: vc4: Connect/disconnect\n\tIPA and dequeue signals on start/stop", "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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "We currently rely on a state check to see if any of the IPA and buffer\ndequeue signal functions need to run. Replace this check by explicitly\ndisconnecting the appropriate signals on camera stop. Re-connect the\nsignals on camera start.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/libcamera/pipeline/rpi/vc4/vc4.cpp | 54 +++++++++++---------------\n 1 file changed, 23 insertions(+), 31 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex bd7bfb3a7663..4b3f5a7fc9fe 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -315,11 +315,8 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr<RPi::CameraData> &camer\n \n \t/* An embedded data node will not be present if the sensor does not support it. */\n \tMediaEntity *unicamEmbedded = unicam->getEntityByName(\"unicam-embedded\");\n-\tif (unicamEmbedded) {\n+\tif (unicamEmbedded)\n \t\tdata->unicam_[Unicam::Embedded] = RPi::Stream(\"Unicam Embedded\", unicamEmbedded);\n-\t\tdata->unicam_[Unicam::Embedded].dev()->bufferReady.connect(data,\n-\t\t\t\t\t\t\t\t\t &Vc4CameraData::unicamBufferDequeue);\n-\t}\n \n \t/* Tag the ISP input stream as an import stream. */\n \tdata->isp_[Isp::Input] = RPi::Stream(\"ISP Input\", ispOutput0, Flag::ImportOnly);\n@@ -327,18 +324,9 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr<RPi::CameraData> &camer\n \tdata->isp_[Isp::Output1] = RPi::Stream(\"ISP Output1\", ispCapture2);\n \tdata->isp_[Isp::Stats] = RPi::Stream(\"ISP Stats\", ispCapture3);\n \n-\t/* Wire up all the buffer connections. */\n-\tdata->unicam_[Unicam::Image].dev()->bufferReady.connect(data, &Vc4CameraData::unicamBufferDequeue);\n-\tdata->isp_[Isp::Input].dev()->bufferReady.connect(data, &Vc4CameraData::ispInputDequeue);\n-\tdata->isp_[Isp::Output0].dev()->bufferReady.connect(data, &Vc4CameraData::ispOutputDequeue);\n-\tdata->isp_[Isp::Output1].dev()->bufferReady.connect(data, &Vc4CameraData::ispOutputDequeue);\n-\tdata->isp_[Isp::Stats].dev()->bufferReady.connect(data, &Vc4CameraData::ispOutputDequeue);\n-\n \tif (data->sensorMetadata_ ^ !!data->unicam_[Unicam::Embedded].dev()) {\n \t\tLOG(RPI, Warning) << \"Mismatch between Unicam and CamHelper for embedded data usage!\";\n \t\tdata->sensorMetadata_ = false;\n-\t\tif (data->unicam_[Unicam::Embedded].dev())\n-\t\t\tdata->unicam_[Unicam::Embedded].dev()->bufferReady.disconnect();\n \t}\n \n \t/*\n@@ -367,9 +355,7 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr<RPi::CameraData> &camer\n \t\treturn -EINVAL;\n \t}\n \n-\t/* Write up all the IPA connections. */\n-\tdata->ipa_->processStatsComplete.connect(data, &Vc4CameraData::processStatsComplete);\n-\tdata->ipa_->prepareIspComplete.connect(data, &Vc4CameraData::prepareIspComplete);\n+\t/* Wire up the default IPA connections. The others get connected on start() */\n \tdata->ipa_->setIspControls.connect(data, &Vc4CameraData::setIspControls);\n \tdata->ipa_->setCameraTimeout.connect(data, &Vc4CameraData::setCameraTimeout);\n \n@@ -691,10 +677,31 @@ int Vc4CameraData::platformConfigureIpa(ipa::RPi::ConfigParams ¶ms)\n \n void Vc4CameraData::platformStart()\n {\n+\tunicam_[Unicam::Image].dev()->bufferReady.connect(this, &Vc4CameraData::unicamBufferDequeue);\n+\tisp_[Isp::Input].dev()->bufferReady.connect(this, &Vc4CameraData::ispInputDequeue);\n+\tisp_[Isp::Output0].dev()->bufferReady.connect(this, &Vc4CameraData::ispOutputDequeue);\n+\tisp_[Isp::Output1].dev()->bufferReady.connect(this, &Vc4CameraData::ispOutputDequeue);\n+\tisp_[Isp::Stats].dev()->bufferReady.connect(this, &Vc4CameraData::ispOutputDequeue);\n+\tipa_->processStatsComplete.connect(this, &Vc4CameraData::processStatsComplete);\n+\tipa_->prepareIspComplete.connect(this, &Vc4CameraData::prepareIspComplete);\n+\n+\tif (sensorMetadata_)\n+\t\tunicam_[Unicam::Embedded].dev()->bufferReady.connect(this, &Vc4CameraData::unicamBufferDequeue);\n }\n \n void Vc4CameraData::platformStop()\n {\n+\tunicam_[Unicam::Image].dev()->bufferReady.disconnect();\n+\tisp_[Isp::Input].dev()->bufferReady.disconnect();\n+\tisp_[Isp::Output0].dev()->bufferReady.disconnect();\n+\tisp_[Isp::Output1].dev()->bufferReady.disconnect();\n+\tisp_[Isp::Stats].dev()->bufferReady.disconnect();\n+\tipa_->processStatsComplete.disconnect();\n+\tipa_->prepareIspComplete.disconnect();\n+\n+\tif (sensorMetadata_)\n+\t\tunicam_[Unicam::Embedded].dev()->bufferReady.disconnect();\n+\n \tbayerQueue_ = {};\n \tembeddedQueue_ = {};\n }\n@@ -704,9 +711,6 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer)\n \tRPi::Stream *stream = nullptr;\n \tunsigned int index;\n \n-\tif (!isRunning())\n-\t\treturn;\n-\n \tfor (RPi::Stream &s : unicam_) {\n \t\tindex = s.getBufferId(buffer);\n \t\tif (index) {\n@@ -743,9 +747,6 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer)\n \n void Vc4CameraData::ispInputDequeue(FrameBuffer *buffer)\n {\n-\tif (!isRunning())\n-\t\treturn;\n-\n \tLOG(RPI, Debug) << \"Stream ISP Input buffer complete\"\n \t\t\t<< \", buffer id \" << unicam_[Unicam::Image].getBufferId(buffer)\n \t\t\t<< \", timestamp: \" << buffer->metadata().timestamp;\n@@ -760,9 +761,6 @@ void Vc4CameraData::ispOutputDequeue(FrameBuffer *buffer)\n \tRPi::Stream *stream = nullptr;\n \tunsigned int index;\n \n-\tif (!isRunning())\n-\t\treturn;\n-\n \tfor (RPi::Stream &s : isp_) {\n \t\tindex = s.getBufferId(buffer);\n \t\tif (index) {\n@@ -803,9 +801,6 @@ void Vc4CameraData::ispOutputDequeue(FrameBuffer *buffer)\n \n void Vc4CameraData::processStatsComplete(const ipa::RPi::BufferIds &buffers)\n {\n-\tif (!isRunning())\n-\t\treturn;\n-\n \tFrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(buffers.stats & RPi::MaskID);\n \n \thandleStreamBuffer(buffer, &isp_[Isp::Stats]);\n@@ -846,9 +841,6 @@ void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers)\n \tunsigned int bayer = buffers.bayer & RPi::MaskID;\n \tFrameBuffer *buffer;\n \n-\tif (!isRunning())\n-\t\treturn;\n-\n \tbuffer = unicam_[Unicam::Image].getBuffers().at(bayer & RPi::MaskID);\n \tLOG(RPI, Debug) << \"Input re-queue to ISP, buffer id \" << (bayer & RPi::MaskID)\n \t\t\t<< \", timestamp: \" << buffer->metadata().timestamp;\n", "prefixes": [ "libcamera-devel", "13/13" ] }