From patchwork Fri Oct 18 07:57:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 21669 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 04299C32FF for ; Fri, 18 Oct 2024 08:00:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5506465391; Fri, 18 Oct 2024 10:00:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="iMiv3Jig"; dkim-atps=neutral Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 83A1E65396 for ; Fri, 18 Oct 2024 09:59:56 +0200 (CEST) Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-7163489149eso1452971a12.1 for ; Fri, 18 Oct 2024 00:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729238395; x=1729843195; 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=hfrj4edOfJQQuugH+68k4Cui4kLDvuRKByjOOu3KAFw=; b=iMiv3JigucTUJMriKyn4UPF83ubgM3eyZGgQSXPoTwihTKGlETp+b79QLGNvr7bkBD LfcB7NVrF4dLKlCkz7ks29iYJQu21ubkfvnBdR9+Rzq1PZnIRIwjbGzyavMCmTM1zxZr VJZG/RK6o+Ty61W2ci9RR3/UpkTTPvvyw1tdw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729238395; x=1729843195; 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=hfrj4edOfJQQuugH+68k4Cui4kLDvuRKByjOOu3KAFw=; b=R63bZIGmLhSwjj3WlBXmUJV3AjhMKd01aUTci5enc6w6vvkMUC4NaQmmeSfggMr0p7 Yml/A+amYc9C/fXy2/2Vdaen5ctS4BmHuJeKDUgrg+biZUOaIM75isMleJKLPZj0h2Gx MqlmSSMxgMWEyV3btXfpcvE+pWUt7g0BFVsX2pNEp7FLwi0rihBXeEeqMHmF1zkMed5o 9EpBDX3cjUPSCdskWweHNWRUI9OEjSX81+F681WA1nCLvMmbHX59IX/EMvfDKaEotWGG +n/EJcXV+/6qOuT0z2gGqraj+m75FFuX7Oq8mEVkv7HRjq5aEe3OkTN3/Fc9QD1LWcWL +uvg== X-Gm-Message-State: AOJu0Yw5eeQFivyXe7FQLr2/zR1eZPlX4LIsZE7Mh2UvFMEiWaKu1nBL ElilixmrO825n+9YkZ8z7WvuTi1IlCMtPXuO47VTX96HDsnL0ycELq421uT6zDtex4ps1M0I8ps = X-Google-Smtp-Source: AGHT+IGMkGWtc4zZ0GJpKnPkLT9xm+q0yfOPE53hqYDrflXPHwAMVwHWqyaEzUy+FEjwVYhoncYyfQ== X-Received: by 2002:a05:6a21:181a:b0:1d9:2846:997e with SMTP id adf61e73a8af0-1d92c4babf6mr1981600637.4.1729238394745; Fri, 18 Oct 2024 00:59:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2024 00:59:54 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Yudhistira Erlandinata Subject: [PATCH 4/4] libcamera: Make Camera::Private::isAcquired() protected Date: Fri, 18 Oct 2024 07:57:37 +0000 Message-ID: <20241018075942.1150378-5-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" As some pipeline handlers need to know if a CameraData is currently acquired, this patch makes the function protected, instead of private. For example, the upcoming mtkisp7 needs the information to determine if it should send camera disconnect signal. Signed-off-by: Harvey Yang Co-developed-by: Yudhistira Erlandinata Signed-off-by: Yudhistira Erlandinata --- include/libcamera/internal/camera.h | 4 +++- src/libcamera/camera.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h index 0bef0980e..fe47a49b7 100644 --- a/include/libcamera/internal/camera.h +++ b/include/libcamera/internal/camera.h @@ -43,6 +43,9 @@ public: const CameraControlValidator *validator() const { return validator_.get(); } +protected: + bool isAcquired() const; + private: enum State { CameraAvailable, @@ -52,7 +55,6 @@ private: CameraRunning, }; - bool isAcquired() const; bool isRunning() const; int isAccessAllowed(State state, bool allowDisconnected = false, const char *from = __builtin_FUNCTION()) const; diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index ef5a6725f..38aa4ad22 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -670,6 +670,9 @@ static const char *const camera_state_names[] = { "Running", }; +/** + * \return True if the camera is acquired, false otherwise + */ bool Camera::Private::isAcquired() const { return state_.load(std::memory_order_acquire) != CameraAvailable;