{"id":25303,"url":"https://patchwork.libcamera.org/api/patches/25303/?format=json","web_url":"https://patchwork.libcamera.org/patch/25303/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20251202133157.661407-18-bryan.odonoghue@linaro.org>","date":"2025-12-02T13:31:48","name":"[v3,17/22] libcamera: software_isp: debayer: Introduce a stop() callback to the debayer object","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"cea425efefe8393aa370863cdaa932d92aecbaa0","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25303/mbox/","series":[{"id":5630,"url":"https://patchwork.libcamera.org/api/series/5630/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5630","date":"2025-12-02T13:31:31","name":"GPUISP precursor series","version":3,"mbox":"https://patchwork.libcamera.org/series/5630/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25303/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25303/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 9756CC32F3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Dec 2025 13:32:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 152F760D1F;\n\tTue,  2 Dec 2025 14:32:33 +0100 (CET)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 67E3360D1F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Dec 2025 14:32:21 +0100 (CET)","by mail-wr1-x42a.google.com with SMTP id\n\tffacd0b85a97d-42b3c5defb2so3807469f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Dec 2025 05:32:21 -0800 (PST)","from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie.\n\t[188.141.3.146]) by smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 02 Dec 2025 05:32:20 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"gBKbwXrs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1764682341; x=1765287141;\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=Tg/LFmOYwGkiUiyeOgsMC6wUGyRuydBpKVxRE0sdxus=;\n\tb=gBKbwXrsD8IQb/0mgoFC8m0tdIhPUM/0Iwy4K0UYsMf8L+gf64zwksIocgy2ibyDVe\n\t9gRuWjBsfXb9ubolbTxfX+KYWOhmh+J8usFfbKN+ZkEmLnEdBly2TtQDfPybPpsZl4Qg\n\tp5Mr3PQtjfU8NGEZoNYICB+AZbe+itmlvsf+5IGBZd3JlfsRNjLgDE9ytEJMlDwdPE3V\n\telnZmcwoFdhR+LWLdk6Yl7HprJ4yunnr86HVYESnx+TZDv9y+QD/N79GIWuU8WZwgNI4\n\tTA20mhKINWW40PeoURP5NO6+TFi/z4GgEI/YfDaYx/Wk7doVX+vUSXPCvmvP0r59fgzV\n\tQ6vw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764682341; x=1765287141;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=Tg/LFmOYwGkiUiyeOgsMC6wUGyRuydBpKVxRE0sdxus=;\n\tb=h+RgsCMpy32gUP3w5opy9LB1FAAZo4iMF6/yqVzJENlleyBKZt4SxPSa9OZgoAuTxp\n\tAjSQeD53Lui4Fjiociod1oVJh1dXEnAP6mhlQ8nzDWSS9Nz+pGno36JdMGGWk/GwrQcb\n\tq2hkCC//epWB1WFC95xxkY2b/rMlKsHq4ODGybRtYFR0uwLUFvr+B4noLLB4xF0EBwUw\n\trgX/qhwCj/nlnN2IGjCuIHSTIfnBKR2suhkZtBh8jZ1DbxIsNwzco5qoJdfTdsssAY0T\n\tvjWozc4J2zT0tyYBPfFKYPFf0AX8zkdLTr6cusIDLm2dVxJgZ0UoXP6IY+k2c360JKxR\n\tqjsg==","X-Gm-Message-State":"AOJu0Ywxj6/KFC3f73C+uTGqLHJQcBenKLdiw2UsQiCW0/qRvofAc1a4\n\tLvFvOtSWCvo6dtrRpDBV2Q2XtDDK1ouXbN/9wa8fQmWTYZrusOXOGkMVN506eRt4ChyONXVlFG6\n\tw6Da3","X-Gm-Gg":"ASbGncuVXOuHvLbVOQI9CAEX3KXB0o6hByOgWAJPymFZpLMNFDhSh3TEUulDffsEc0j\n\t6WeGInBD1YUroW8sK0r8jN524XSHgpyAFFOE0T8ExJ0B502sLmEhg0oNOp4jqtuD7U2u9euTyjW\n\tARxvW5GiLwap+SgDHoSFeN15CUnXHSOrQ11cqqHk0+f+t9nmhmzTbntJO3cAf0dHAigDoLoaRFC\n\tz2ktTRJTMGcah/Iez08v19i2PSqUlmHpNmGJaP5uk/9IWxwwdjWyZG+Be713tH3yHq1SqvmGb9n\n\tQPWmmnuQiV6y+i+MGhNcTFLMNMQAkU0Y4YX2DIzZNg90bhSgw0PCbJtPoL+hnVyKwZ79QfxKGhk\n\tVjLVPLyn4DT+L6S3dJSt3CbPBlL+mjKsxeQ5q77t76WI+MGUcm3U6KemWz6jhxzKyuTpFp8zJAA\n\tt1CTkS4clxD2A2LxBh/ol/YWmMWZ/g1cGJLtFTD+tkrgGyltLnbtmyQzReHeFPJBxexR7wOSD2U\n\tqgdbQ==","X-Google-Smtp-Source":"AGHT+IEqPPe24H6F2MIPekC3VJHco0AMtEVv7uhuBtKIb8y4S4Eqm0Mkr3gYeX9DIP4TmfN3Sf/MEA==","X-Received":"by 2002:a05:6000:4022:b0:42b:3746:3b85 with SMTP id\n\tffacd0b85a97d-42cc1d198c0mr42444785f8f.45.1764682340571; \n\tTue, 02 Dec 2025 05:32:20 -0800 (PST)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"pavel@ucw.cz, Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tMilan Zamazal <mzamazal@redhat.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v3 17/22] libcamera: software_isp: debayer: Introduce a\n\tstop() callback to the debayer object","Date":"Tue,  2 Dec 2025 13:31:48 +0000","Message-ID":"<20251202133157.661407-18-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20251202133157.661407-1-bryan.odonoghue@linaro.org>","References":"<20251202133157.661407-1-bryan.odonoghue@linaro.org>","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":"The eGL class wants to be able to teardown its sync_ data member\nproperly but, doing so in the destructor means we can't make the eGL\ncontext current and thus can't tear down the sync primitive properly.\n\nIntroduce a stop() method to the debayer class which triggers from the\nsoftisp's stop method, allowing a controlled and appropriate tear-down\nof debayer-egl and egl class related data well before the destructors\nget invoked.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n[bod: Made method blocking not queued per Robert's bugfixes]\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n src/libcamera/software_isp/debayer.cpp      | 9 +++++++++\n src/libcamera/software_isp/debayer.h        | 1 +\n src/libcamera/software_isp/software_isp.cpp | 4 +++-\n 3 files changed, 13 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\nindex 1d135b278..dae1f12d9 100644\n--- a/src/libcamera/software_isp/debayer.cpp\n+++ b/src/libcamera/software_isp/debayer.cpp\n@@ -336,6 +336,15 @@ Debayer::~Debayer()\n  * debayer processing.\n  */\n \n+/**\n+ * \\fn void Debayer::stop()\n+ * \\brief Stop the debayering process and perform cleanup\n+ *\n+ * In the DebayerCPU case this is an empty stub function but\n+ * for the GPU case this does something useful. The stub here is to\n+ * ensure the right version of the virtual gets called.\n+ */\n+\n /**\n  * \\fn void Debayer::setParams(DebayerParams &params)\n  * \\brief Select the bayer params to use for the next frame debayer\ndiff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\nindex ff4a92c15..30bad9651 100644\n--- a/src/libcamera/software_isp/debayer.h\n+++ b/src/libcamera/software_isp/debayer.h\n@@ -48,6 +48,7 @@ public:\n \tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0;\n \n \tvirtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0;\n+\tvirtual void stop() { }\n \n \tvirtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0;\n \ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex 4f6792122..c0ff91cc4 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -367,9 +367,11 @@ int SoftwareIsp::start()\n  */\n void SoftwareIsp::stop()\n {\n+\tdebayer_->invokeMethod(&DebayerCpu::stop,\n+\t\t\t       ConnectionTypeBlocking);\n+\n \tispWorkerThread_.exit();\n \tispWorkerThread_.wait();\n-\tispWorkerThread_.removeMessages(debayer_.get());\n \n \tThread::current()->dispatchMessages(Message::Type::InvokeMessage, this);\n \n","prefixes":["v3","17/22"]}