From patchwork Fri Dec 3 19:55:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 15024 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 47C50BDB13 for ; Fri, 3 Dec 2021 19:55:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F2ECC6084B; Fri, 3 Dec 2021 20:55:52 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Di9J04HU"; dkim-atps=neutral Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A98856084B for ; Fri, 3 Dec 2021 20:55:50 +0100 (CET) Received: by mail-pg1-x52b.google.com with SMTP id k4so4088355pgb.8 for ; Fri, 03 Dec 2021 11:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RO9Q2ZQfZqnHQ5NMyWgaNj8q6JB0rVcfDQk63o9NYHk=; b=Di9J04HUAGfLV61wyyM1pKTbiI9S0vZHHapGYcgCPPlgFjykZJg8P+GSP0e31mLsfC SUkNb2SdFN9i2M9izfftBST+Z5rGlbbthKjcsGr4RCS0dBQIuKanrEIe/bM7PDWM2X/Z 3DBAlEQDW2KA8Y6GtY5eGo5sfTGkokmYGyqng= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RO9Q2ZQfZqnHQ5NMyWgaNj8q6JB0rVcfDQk63o9NYHk=; b=c7hZgvD9vNmB1rcwnoE/zgUNxDJx+2BSLbIPEb2KQlhfJIEfm7F71nSA8G5AbSBUTv cAXiEqFSqu13lD5QtvguWoQLJXa+LfjSWhCnvivFC+LF0ES7oPWt3StNlcar1jjUMA/p M3c2nLanKrKmqtk6eOAqBtWTLL3kTE4XWlCB0TAwTIENVgjpn1Og0Lgm1N10P3d8rGdS TUz6BbVrg7Mhd6y9gWJJMXvtH7DLS4XHIyQV2E+1sZVEquJIsPk68lDa7d8MNGNgoC5O IDzkqVoHp2QvrDIQpPx/MEdtdVz5qv4o9NleEJ71JKF9binpayhIyzqk0HZTq+RQmuod 9lqA== X-Gm-Message-State: AOAM532TvYl9QOC7PXUDr2cFcQbVt7Af8DmYM2/npWzJFFaMF9/Z+rrO 18VuJjmMUfq3F76m/LAPdhB6zSm4OAo7cA== X-Google-Smtp-Source: ABdhPJwgW0cNFlneVTKcmeT81A5vUv7OolqwmqIc0HxfNy4ya0LRN62YuVcfv5EUsw1y3YxgwROdmw== X-Received: by 2002:a63:490c:: with SMTP id w12mr6252535pga.398.1638561348880; Fri, 03 Dec 2021 11:55:48 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:cd78:3a5f:d792:6177]) by smtp.gmail.com with ESMTPSA id t3sm4265891pfj.207.2021.12.03.11.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 11:55:48 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Dec 2021 04:55:34 +0900 Message-Id: <20211203195539.1574621-3-hiroh@chromium.org> X-Mailer: git-send-email 2.34.1.400.ga245620fadb-goog In-Reply-To: <20211203195539.1574621-1-hiroh@chromium.org> References: <20211203195539.1574621-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/7] ipa: raspberrypi: alsc: Apply clang thread annotation 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" This annotates member functions and variables of Alsc by clang thread safety annotations. Signed-off-by: Hirokazu Honda --- src/ipa/raspberrypi/controller/rpi/alsc.cpp | 4 ++-- src/ipa/raspberrypi/controller/rpi/alsc.hpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp index 97a05a30..8f954106 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp @@ -180,7 +180,7 @@ void Alsc::waitForAysncThread() if (async_started_) { async_started_ = false; MutexLocker lock(mutex_); - sync_signal_.wait(lock, [&] { + sync_signal_.wait(lock, [&]() LIBCAMERA_TSA_REQUIRES(mutex_) { return async_finished_; }); async_finished_ = false; @@ -371,7 +371,7 @@ void Alsc::asyncFunc() while (true) { { MutexLocker lock(mutex_); - async_signal_.wait(lock, [&] { + async_signal_.wait(lock, [&]() LIBCAMERA_TSA_REQUIRES(mutex_) { return async_start_ || async_abort_; }); async_start_ = false; diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.hpp b/src/ipa/raspberrypi/controller/rpi/alsc.hpp index 3f9d6837..f1f2aa0d 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.hpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.hpp @@ -69,11 +69,11 @@ private: // condvar for synchronous thread to wait on libcamera::ConditionVariable sync_signal_; // for sync thread to check if async thread finished (requires mutex) - bool async_finished_; + bool async_finished_ LIBCAMERA_TSA_GUARDED_BY(mutex_); // for async thread to check if it's been told to run (requires mutex) - bool async_start_; + bool async_start_ LIBCAMERA_TSA_GUARDED_BY(mutex_); // for async thread to check if it's been told to quit (requires mutex) - bool async_abort_; + bool async_abort_ LIBCAMERA_TSA_GUARDED_BY(mutex_); // The following are only for the synchronous thread to use: // for sync thread to note its has asked async thread to run @@ -91,7 +91,7 @@ private: // thread can set/reset them if the async thread is known to be idle: void restartAsync(StatisticsPtr &stats, Metadata *image_metadata); // copy out the results from the async thread so that it can be restarted - void fetchAsyncResults(); + void fetchAsyncResults() LIBCAMERA_TSA_REQUIRES(mutex_); double ct_; bcm2835_isp_stats_region statistics_[ALSC_CELLS_Y * ALSC_CELLS_X]; double async_results_[3][ALSC_CELLS_Y][ALSC_CELLS_X];