{"id":25231,"url":"https://patchwork.libcamera.org/api/patches/25231/?format=json","web_url":"https://patchwork.libcamera.org/patch/25231/","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":"<20251127022256.178929-18-bryan.odonoghue@linaro.org>","date":"2025-11-27T02:22:49","name":"[v2,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":"1ae4035c5ff52bf6da15d1aaa09b1e5c2cc7c031","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/25231/mbox/","series":[{"id":5616,"url":"https://patchwork.libcamera.org/api/series/5616/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5616","date":"2025-11-27T02:22:32","name":"GPUISP precursor series","version":2,"mbox":"https://patchwork.libcamera.org/series/5616/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25231/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25231/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 1CD9DC3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 27 Nov 2025 02:23:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C2CA860B2F;\n\tThu, 27 Nov 2025 03:23:45 +0100 (CET)","from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D08D60AC5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Nov 2025 03:23:42 +0100 (CET)","by mail-wm1-x32d.google.com with SMTP id\n\t5b1f17b1804b1-477632d9326so1652895e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Nov 2025 18:23:42 -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\t5b1f17b1804b1-4790b0e21e8sm71549495e9.15.2025.11.26.18.23.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 26 Nov 2025 18:23:41 -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=\"GBhld6OY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1764210221; x=1764815021;\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=B9KW+pVIFbG1cr3wsRdFTzVVgHUhwNDNjNTuP9XwgZ8=;\n\tb=GBhld6OYadgyjT7lAmatR9mU4+V+KEpiCDu7M7IlAN+2N7Ueu5x8Sg/obO5hzz1V5k\n\tIvIGBKwLgQbGeyArkTR6Ce+17eiKCTLXtGzjeuE/VyW0crnPvz3Vxsu5FLcC8bgTw/u+\n\t9S6wLBiAOi/2yVqZLeveveEtCfAZp9MJm3n2tN6YyMsjPQim8K3kJfoDLuCzstbRKo+Y\n\tjwMA4C4ZoAanbE9hIly3UtGd41lTTx8JHdiij1jtnVHhNOPezaC1g5JOngr5/VT++TFS\n\t93OPdwxvnwfwLnx1rn7I0ayNfPtXZMMuNWT6BRZuU1KOuDcJba3fPPVoK4YVHBWouHsa\n\t75WQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1764210221; x=1764815021;\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=B9KW+pVIFbG1cr3wsRdFTzVVgHUhwNDNjNTuP9XwgZ8=;\n\tb=KmvAbUet9ANqKJULrOQO0dqe537c7PE/2RDEk3WLbmBtnXMY2p5RPVPxgush2BeJF7\n\tA7CC+k+l0ac9Snl3gGWcHihv37SLaOP43xBpYcpo+ZNqDwO7Z1pfs5HaSvdm3/sO8FIk\n\tlSgaK5xab60kL0HSSFnNGS4orT8BRQGJLvHJyIAvglWuH6zjL1wis5s/iCgM0NAul25P\n\tmJmy/LmInKdI9vnzd1mrEvSwKzMSYc2lywvvW6gk0YciPj4SXrjwHmgZ/49ImPKAQVvN\n\t8/hXt7Q7E4q+WmCsll01xUgG5WKW2xZ0zEEjm5qCoj/AiNa2ufBe+GO9G7JI0DFpjvrE\n\tsPqg==","X-Gm-Message-State":"AOJu0YxDJAbDPRiiQmg8rmvg46WalCdi1qQp0MPF/49XyfnMga/4M+3K\n\tccvI1fKqHnHiWv0gRWyuIgWR132CFDqsfJBitwjKGRtDpHtiYblwoamy+FAa8pr/X7w4UmQmTF7\n\t4yXuszi0=","X-Gm-Gg":"ASbGncsuWVLcSLcnvBlTzoQf+F956uwygP0LnUhYDYN7tyJEJ13ylOpo0SnO+eMNMz+\n\t/9qjBPDD8d7xfVi1gTT/sFNhUdGU+DEaiD1tOLl6B9SlopRIkIWcy1l+KflMV6usaKlcLZKzCE8\n\tgMn9myphuG8mFqUkPrESCKgO5yLNn6g0Zd2/MJLguXeAUoMuAXaygIb1HPSMdkqDFCIglSKZsUh\n\t901Ey7gx9ME1zqvqB2XrM/qspEiLMWUpa5nV4WP+riA69Pt3Ej0OpA52cGR+0HCrsyFBQItT6Du\n\tSTmyrCeblqpXo7ibKdrQT6HiYK0NYWesSumBjkx3aTdMynASiAMUgPetljqfYge45wMPy3D0HDx\n\tR7del69k06th8KEIXJc6oip8ZbJteTe18ikrvK7OQXia/auKQM3Zo1RZv3Th3Ob1tN2YMJZ6b1a\n\tkqNYX/ZVYDH0haVNEdMiGSK7v9o986zE3dk0icd4Hq5epiaHrBtynmRPOZcDaU1fV5ElE=","X-Google-Smtp-Source":"AGHT+IFluLnn0M1BNwxleHGMBuC7MZO/4YoU/9raAp8G+PvU9fziFn7xpy/Di0FoxYq7tfXORjK0Xw==","X-Received":"by 2002:a05:600c:4e88:b0:46e:7247:cbc0 with SMTP id\n\t5b1f17b1804b1-477c01d4af2mr218994195e9.18.1764210221492; \n\tWed, 26 Nov 2025 18:23:41 -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>","Subject":"[PATCH v2 17/22] libcamera: software_isp: debayer: Introduce a\n\tstop() callback to the debayer object","Date":"Thu, 27 Nov 2025 02:22:49 +0000","Message-ID":"<20251127022256.178929-18-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.51.2","In-Reply-To":"<20251127022256.178929-1-bryan.odonoghue@linaro.org>","References":"<20251127022256.178929-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]\nSigned-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n---\n src/libcamera/software_isp/debayer.h        |  1 +\n src/libcamera/software_isp/debayer_cpu.cpp  | 10 ++++++++++\n src/libcamera/software_isp/debayer_cpu.h    |  1 +\n src/libcamera/software_isp/software_isp.cpp |  3 +++\n 4 files changed, 15 insertions(+)","diff":"diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\nindex 451c1c9ac..088b062c0 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() = 0;\n \n \tvirtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0;\n \ndiff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\nindex 00738c56b..28fb8ca50 100644\n--- a/src/libcamera/software_isp/debayer_cpu.cpp\n+++ b/src/libcamera/software_isp/debayer_cpu.cpp\n@@ -788,6 +788,16 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n \tinputBufferReady.emit(input);\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+void DebayerCpu::stop() {}\n+\n SizeRange DebayerCpu::sizes(PixelFormat inputFormat, const Size &inputSize)\n {\n \tSize patternSize = this->patternSize(inputFormat);\ndiff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h\nindex ecc4f9dd0..2d385cf01 100644\n--- a/src/libcamera/software_isp/debayer_cpu.h\n+++ b/src/libcamera/software_isp/debayer_cpu.h\n@@ -38,6 +38,7 @@ public:\n \tstd::tuple<unsigned int, unsigned int>\n \tstrideAndFrameSize(const PixelFormat &outputFormat, const Size &size);\n \tvoid process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params);\n+\tvoid stop();\n \tSizeRange sizes(PixelFormat inputFormat, const Size &inputSize);\n \tconst SharedFD &getStatsFD() { return stats_->getStatsFD(); }\n \ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex 4c232339b..aa4a40cb6 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -367,6 +367,9 @@ int SoftwareIsp::start()\n  */\n void SoftwareIsp::stop()\n {\n+\tdebayer_->invokeMethod(&Debayer::stop,\n+\t\t\t       ConnectionTypeBlocking);\n+\n \tispWorkerThread_.exit();\n \tispWorkerThread_.wait();\n \tispWorkerThread_.removeMessages(debayer_.get());\n","prefixes":["v2","17/22"]}