[PATCH 2/4] libcamera: Use disconnect signal in ipa proxy worker

Harvey Yang chenghaoyang at chromium.org
Fri Oct 18 09:57:35 CEST 2024


Previously the worker might not receive the disconnect signal, and the
forked process might stay alive forever.

This CL also helps DMA buf recycling, as the algo process might hold DMA
buf file descriptors.

Signed-off-by: Harvey Yang <chenghaoyang at chromium.org>
Co-developed-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
Signed-off-by: Yudhistira Erlandinata <yerlandinata at chromium.org>
---
 .../libcamera_templates/module_ipa_proxy_worker.cpp.tmpl     | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
index 1f990d3f9..68d68c4a5 100644
--- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
+++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
@@ -60,6 +60,10 @@ public:
 
 	~{{proxy_worker_name}}() {}
 
+	void disconnected() {
+		exit_ = true;
+	}
+
 	void readyRead()
 	{
 		IPCUnixSocket::Payload _message;
@@ -131,6 +135,7 @@ public:
 			return EXIT_FAILURE;
 		}
 		socket_.readyRead.connect(this, &{{proxy_worker_name}}::readyRead);
+		socket_.disconnected.connect(this, &{{proxy_worker_name}}::disconnected);
 
 		ipa_ = dynamic_cast<{{interface_name}} *>(ipam->createInterface());
 		if (!ipa_) {
-- 
2.47.0.rc1.288.g06298d1525-goog



More information about the libcamera-devel mailing list