From patchwork Fri Oct 18 07:57:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 21667 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 B3B2CC32FC for ; Fri, 18 Oct 2024 07:59:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7D44565390; Fri, 18 Oct 2024 09:59:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cyQbgRdW"; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9556D65387 for ; Fri, 18 Oct 2024 09:59:53 +0200 (CEST) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-71e592d7f6eso1173452b3a.3 for ; Fri, 18 Oct 2024 00:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729238392; x=1729843192; 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=lW2cNMVwigeRVpF1Gtevk7QOmbQNzwnJV93oTQIgePA=; b=cyQbgRdWZyRhYR/MGNwmX1f6CMxxIJ4uXqhVsTov/OIJfeeC2o6ceqHYX9++PtO1vf jf5IvT4LxbmLbk+W7YOGBCBKRJb96bYa7v/eitaqPZM9hTTdV89YV+oMthwk6ZONVSSj Fzuo+u92aI9CgJaXR7VEk4Q5Srwqt4p6feCWQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729238392; x=1729843192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lW2cNMVwigeRVpF1Gtevk7QOmbQNzwnJV93oTQIgePA=; b=S6HRhC6u+xpkqueAjmj2MR8qwF/HeWYy/vMmzgMAydafY3q8isXQhti6zvYivH3sIx 9mj2U+cquAFGoh8blQ0t0DYO9wlys9cOgS0DZIcVzmE2/oMOi6fsovtLez4C3Q0Xdcdt 02zy2FG5cPPF0eLGFxFVBIahcktrJG537xPvgbU9lg1N7XQC1jA9xGioWJynasgqx2XR k8OE+D1AyU2xDHIDPVOhcqP6WrXT41wf8k90fUHtJcMc/xAfOOffMkwbhNUlYTGnCBFq nTZvbZJUhcy5seCG3R4A7LIsT5XExoADkcTSe9zgvQSPD3tkwgSvGetAR+o5mgTr/Gva emrg== X-Gm-Message-State: AOJu0Yz4aySmXvjNuo3fIOMZMUmoG4EjDMhSjkNSkIdkhTFvzTcVcmQq yMyN180683Fa0ha+kjzcbSWaWLClrrgPMA1p5h2O1CmweXDQt/JLUA/NURqfCKuTAPN1sm6nU6A = X-Google-Smtp-Source: AGHT+IHR5SRAbTYxjDC+C2Q9IuiA5Ye+afUHDmi24J+SbFTqB6Rtfomfc1YFZnOG9Nu7A3MWNwgKQQ== X-Received: by 2002:a05:6a00:1993:b0:718:ea3c:35c3 with SMTP id d2e1a72fcca58-71ea316a93bmr2280495b3a.15.1729238391599; Fri, 18 Oct 2024 00:59:51 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (27.247.221.35.bc.googleusercontent.com. [35.221.247.27]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ea345b0c3sm901274b3a.172.2024.10.18.00.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 00:59:51 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Yudhistira Erlandinata Subject: [PATCH 2/4] libcamera: Use disconnect signal in ipa proxy worker Date: Fri, 18 Oct 2024 07:57:35 +0000 Message-ID: <20241018075942.1150378-3-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog In-Reply-To: <20241018075942.1150378-1-chenghaoyang@chromium.org> References: <20241018075942.1150378-1-chenghaoyang@chromium.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" 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 Co-developed-by: Yudhistira Erlandinata Signed-off-by: Yudhistira Erlandinata --- .../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_) {