From patchwork Wed Dec 10 00:31:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25411 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A8AF4BD1F1 for ; Wed, 10 Dec 2025 00:32:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6D60C6145F; Wed, 10 Dec 2025 01:32:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GtkkB4k2"; dkim-atps=neutral Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A4EAC6144C for ; Wed, 10 Dec 2025 01:32:36 +0100 (CET) Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-340c39ee02dso5040258a91.1 for ; Tue, 09 Dec 2025 16:32:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765326755; x=1765931555; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5TmeYZw4sP3gvIeKkN5VVzOzrCwOWv0nwPHkPwkgQcc=; b=GtkkB4k2XrIibGZjyHh5iRGjJpKBM4mcKTLM76K4voDJn5u7b6/2uyGw56YgeRE4QM 0ObXGeULJPP6dallunelZ1zrpt0bhKK5fPcoKu5ZSpgxFC8j5mZIWhXjsiaUwhXjMjpD c5w5TuPjih7Y3DODrwNON1y4o/9mLcWvA1yI/z89CPdifdgLaJP5CX8vg4LZtfUR5qPf FWM7mDKNgcpkz81a6FQJnvKMcNDt0WPTBu/SxtjJsqXQTaqgaGZHF2Cdxa0YhnwT2Uf0 HnsUDVNyyI1cHmxI+kvMSVidXTmUGwGcoiol9hANG0ogn8srex5czC4za0PkO837JTDc 1HlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765326755; x=1765931555; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5TmeYZw4sP3gvIeKkN5VVzOzrCwOWv0nwPHkPwkgQcc=; b=Vfp5mBKUnScs/oljkK4MGqiC6KV7T/HIBuRROjoi469x/0E4Hjj5Gunj7cuvTLnMV+ OjAn4gNboK3ZV69l3WWBw2L6QdzCF+djziMEVU77tCtW34fVhBvQueL7Rbd9UcXUD1iD x9l1rV2kMM7qXSeaT8ezUK4XG+DOKezK1ZcByFoq12r3n3VKr2kVicHmYZXoRCqxv0VM 6KtvnHnrWAKDH/8N03WeHbPFH1V/EWjFCOYto1mVPtWHrvOoNL0DLLqCs3XQ/RrkHoaX w3ZhYpS8KpK2lFEXpkfcfZA5Ogk+Hme30ArL6cseSRDS0bMhEb5hDsFhgrFXI4hTlykd i83g== X-Gm-Message-State: AOJu0YwTijBtbEcQK3KVwQtftR5gpSwpOHD0CSGVrkDKlDhnhhPpabwf kGLaSp0by7IzNcgCYU2EFoUGBLbnDoKVSm4wHzQegJuCzSNtqsZt4+CgueG6gyEtQPo8Ze9cGie UHXxD X-Gm-Gg: AY/fxX7POt9dtwz62FSUMzTvkNpjbPO0UhbVuUryY7au+H7QN48x9eJi0Y615+EwiWw qKDUvTv+8dmZUXfBU4jYsXcAxNQXARTvskf+DUt/0JveEMKEi6DXVNkltxmM3riET9osKuRfSnr 3DBnCFbzNlZVnZJDPoT+qBCLINrxoY7RSxXH/PleruWAW7KcxjBU7jZ39ebH59snoUhVkHKeBnG BggAZLSy51qTAYcz1cGvh2Q9JXT6S9jbzmNLwnm6qHnbvIihnk/hms3fMwEOUzsMH2mEvEIDdft yBDOTRF5dkJZmctF/YZu9RyKg79hYh40uLURwKPclbP/ex00j183E1Z+5A/2pLimcKopq965pcB 0petyycCpOTplMo3+TMcjrCIlUub72zNv0owhPmR2+3ieDkCyX09swDjHwDjpQyKohpssMF7BcF IjAcLE1qIdFINyzdoXUDoCX8GRSC7OsFEpErW7haZ9LdltPDmS/lW48JhunUDMAR2F X-Google-Smtp-Source: AGHT+IF2YvXThUQpzYSn1BpTMUGc+R2eL3OazSbVEyE1Pe0wxk0g+GR1mLpLqYr+Cr/3QApxXqAPow== X-Received: by 2002:a17:90a:dfc6:b0:349:3fe8:e7df with SMTP id 98e67ed59e1d1-34a72874747mr501225a91.22.1765326754886; Tue, 09 Dec 2025 16:32:34 -0800 (PST) Received: from inspiron14p-linux (p96936b06.osaknt01.ap.so-net.ne.jp. [150.147.107.6]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34a70427ea6sm566580a91.3.2025.12.09.16.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 16:32:34 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH v4 15/20] libcamera: software_isp: debayer: Introduce a start() / stop() methods to the debayer object Date: Wed, 10 Dec 2025 00:31:32 +0000 Message-ID: <20251210003139.43606-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251210003139.43606-1-bryan.odonoghue@linaro.org> References: <20251210003139.43606-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In order to initialise and deinitialise gpuisp we need to be able to setup EGL in the same thread as Debayer::process() happens in. In order to do this we need to extend the Debayer object to provide start and stop methods which are triggered through invokeMethod in the same way as process() is. Introduce start() and stop() methods to the debayer class. Trigger those methods as described above via invokeMethod. The debayer_egl class will take care of initialising and de-initialising as necessary. Debayer CPU sees no functional change. [bod: Made method blocking not queued per Robert's bugfixes] Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 18 ++++++++++++++++++ src/libcamera/software_isp/debayer.h | 2 ++ src/libcamera/software_isp/software_isp.cpp | 8 ++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 1d135b278..32a2c8378 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -336,6 +336,24 @@ Debayer::~Debayer() * debayer processing. */ +/** + * \fn int Debayer::start() + * \brief Execute a start signal in the debayer object from workerthread context. + * + * In the DebayerCPU case this is an empty stub function but + * for the GPU case this does something useful. The stub here is to + * ensure the right version of the virtual gets called. + */ + +/** + * \fn void Debayer::stop() + * \brief Stop the debayering process and perform cleanup + * + * In the DebayerCPU case this is an empty stub function but + * for the GPU case this does something useful. The stub here is to + * ensure the right version of the virtual gets called. + */ + /** * \fn void Debayer::setParams(DebayerParams ¶ms) * \brief Select the bayer params to use for the next frame debayer diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index ff4a92c15..5c0cb3914 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -48,6 +48,8 @@ public: strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0; virtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0; + virtual int start() { return 0; } + virtual void stop() { } virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0; diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 928a2520c..7c9ad9160 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -347,7 +347,9 @@ int SoftwareIsp::start() return ret; ispWorkerThread_.start(); - return 0; + + return debayer_->invokeMethod(&DebayerCpu::start, + ConnectionTypeBlocking); } /** @@ -358,9 +360,11 @@ int SoftwareIsp::start() */ void SoftwareIsp::stop() { + debayer_->invokeMethod(&DebayerCpu::stop, + ConnectionTypeBlocking); + ispWorkerThread_.exit(); ispWorkerThread_.wait(); - ispWorkerThread_.removeMessages(debayer_.get()); Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);