From patchwork Fri Oct 29 04:14:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 14409 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 5742ABF415 for ; Fri, 29 Oct 2021 04:14:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6AA7C600BC; Fri, 29 Oct 2021 06:14:33 +0200 (CEST) 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="eLCuAr9n"; dkim-atps=neutral Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D2E1600B6 for ; Fri, 29 Oct 2021 06:14:31 +0200 (CEST) Received: by mail-pl1-x62d.google.com with SMTP id s24so6016877plp.0 for ; Thu, 28 Oct 2021 21:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Woryt8aUa1wgVOZkhHxuRkU1lMs91m3QSybI0HiLwhc=; b=eLCuAr9nHhFKhBPcKzxx5KtGWYtKr5P6PJCNKeJUTKWXYEndqPYzs5UpEI6WmOC0wC vk6a+HM/tNLi+qSWve8HMzLmLMInHeYEdUJKUbDb/wYay0RIpsfGyD0fAYbVvyUq2770 Z1cXpdbXr8gvupYD8syMumpM5N/rmHLywWT4w= 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:mime-version :content-transfer-encoding; bh=Woryt8aUa1wgVOZkhHxuRkU1lMs91m3QSybI0HiLwhc=; b=1WlCiE+sswq9gAtLzjNRW4l82rSGlX9eET8fafx9FqOFM0icvHBF7tOp3R044NMV9d ziHjbXE8bTFaYFaWHzTKgZOFFTFQQJB1L6wasdMz8EU/1fqodY1haWYEb9ohJ0UgHC7T eZjrR1wwd00mLd+gqHJ5HmLFPK2TzAyFYTnyi/8pTZ4lAV5EIS/YtmWWDMB04DTbMxeS n7JmXZsYDJq3j3DJJhSCsSLZljRfgBHYgOrFihOcN8+65Dj3Th3VgfEke7TvKjkoIIa8 B/X6XyipVq3uEZF2EZejv9OUIZtXQNBSkm25688QLxt6i8GHAGeqI8xtdTzpOASW+M6t Gcrg== X-Gm-Message-State: AOAM533Lfmkk9RfaKtbWMvTd685dNS4GZixPLyd5eH3zz9U7CFS8+UFI Vt8UN5PVY0LDAVs/mK15HI60TxtcuTcsmg== X-Google-Smtp-Source: ABdhPJxXgyCAnNvA0DLphQfwnAeVNyI8F/GVYlVt3JSSkMKi73/6vXT+FnBlAj3UUIBq6FUaFnd72A== X-Received: by 2002:a17:902:aa08:b0:13f:eb2e:8ce8 with SMTP id be8-20020a170902aa0800b0013feb2e8ce8mr7767148plb.0.1635480869621; Thu, 28 Oct 2021 21:14:29 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:fd56:8786:5663:b946]) by smtp.gmail.com with ESMTPSA id 11sm4826714pfl.41.2021.10.28.21.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 21:14:29 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Fri, 29 Oct 2021 13:14:18 +0900 Message-Id: <20211029041424.1430886-1-hiroh@chromium.org> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 0/6] Introduce clang thread safety annotations 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 introduces clang thread safety annotations and applies it to libcamera Android HAL adaptation layer. It is necessary to add new classes that wrap std::mutex and std::unique_lock with the annotations. It is because no C++ standard library annotates all the mutex classes today. libstdc++ doesn't annotate any classes. libc++ annotates for std::mutex, std::lock_guard and std::scoped_lock, but doesn't for std::unique_lock. Document: https://clang.llvm.org/docs/ThreadSafetyAnalysis.html Hirokazu Honda (6): libcamera: base: Add thread safety annotation macros libcamera: base: Add mutex classes with thread safety annotations android: camera_hal_manager: Add thread safety annotation android: camera_stream: Add thread safety annotation android: camera_device: Add thread safety annotation android: camera_request: Add thread safety annotation include/libcamera/base/meson.build | 2 + include/libcamera/base/mutex.h | 66 +++++++++ include/libcamera/base/thread.h | 5 +- include/libcamera/base/thread_annotations.h | 151 ++++++++++++++++++++ meson.build | 1 + src/android/camera_device.cpp | 26 ++-- src/android/camera_device.h | 18 +-- src/android/camera_hal_manager.cpp | 10 +- src/android/camera_hal_manager.h | 14 +- src/android/camera_request.h | 7 +- src/android/camera_stream.cpp | 22 +-- src/android/camera_stream.h | 13 +- 12 files changed, 278 insertions(+), 57 deletions(-) create mode 100644 include/libcamera/base/mutex.h create mode 100644 include/libcamera/base/thread_annotations.h --- 2.33.1.1089.g2158813163f-goog