Patch Detail
Show a patch.
GET /api/patches/14906/?format=api
{ "id": 14906, "url": "https://patchwork.libcamera.org/api/patches/14906/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14906/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20211130155600.2203123-10-hiroh@chromium.org>", "date": "2021-11-30T15:55:57", "name": "[libcamera-devel,v3,09/12] android: camera_stream: Add thread safety annotation", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "517b1c1e757a2e005cd88de56638b53cbf35c97c", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14906/mbox/", "series": [ { "id": 2785, "url": "https://patchwork.libcamera.org/api/series/2785/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2785", "date": "2021-11-30T15:55:48", "name": "Introduce clang thread safety annotations", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2785/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14906/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14906/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B2395BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 15:56:30 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 689CC60732;\n\tTue, 30 Nov 2021 16:56:30 +0100 (CET)", "from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com\n\t[IPv6:2607:f8b0:4864:20::52b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A8A560732\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 16:56:25 +0100 (CET)", "by mail-pg1-x52b.google.com with SMTP id k4so10108442pgb.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 07:56:25 -0800 (PST)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:c90a:5a53:b139:1336])\n\tby smtp.gmail.com with ESMTPSA id\n\tpc10sm3510283pjb.9.2021.11.30.07.56.21\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 30 Nov 2021 07:56:23 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"YGQa92f6\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=p0wg4tkm5r0N24uGxepa+fD7mFrPPlTowXc6iiDkvuY=;\n\tb=YGQa92f6L0xiioUkgo/I/6vQHqthKYUlSgSq4LvK+Bj1z/82AmOs8tgLBSHRP+7Zle\n\t6NRJ89ae7EdwWibRO1wciKa9LOuq6GswTmNkLMJrRWgSuPK+geKGosPBS3Y93WIm6ZnH\n\tcd9eQMeo3y+Q6/kOPzmRPEODzBZ4GWBNhnX50=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=p0wg4tkm5r0N24uGxepa+fD7mFrPPlTowXc6iiDkvuY=;\n\tb=R8CIyLmSyyrmCOrL5BEeKU3M/OXkshptQpaCe365wl0IyRG9nI87P++ebmRxr740tY\n\tDgOVktsqAgYLSxkNu6PB9N2XwLA+gPXHMP+d320LHhxB04EVr3i5tZ+1RUwhCeTVfcI5\n\tNJoK0J41XtmtqQ68T/ln6NarkYkLYZde2ZHwY3W96L3HaAmQktUZq6mhuIBR030cz7Vz\n\t12Pqh8aFXwRjg010bOHF7/JETt2Q7na+KwnzacBBvF3d7Nfv+BQa/NASsJWbJw37kSPO\n\tIV4/0wND6w6kJmNgH4YdvZbLxNm4RldVMl+Lvl0jsT4wKiJKlKZpXOn3EJegyazGdRMx\n\tDMcA==", "X-Gm-Message-State": "AOAM533KAxd2jyp8b/C+5DQwH1vfBOT+7SzK1g7LP6hpWkAmatcitkgl\n\t9nf8izMTnNuGHGi2X1MN2gLiwGBHIK5eXg==", "X-Google-Smtp-Source": "ABdhPJztii9AUAjdRcEn7DPfpJ9pI2uOzaM/zT6kyHLY6pDr4C9NAe9h0AIqrNXndEu7N3zq/Ej4lQ==", "X-Received": "by 2002:a05:6a00:148d:b0:49f:def7:9cfe with SMTP id\n\tv13-20020a056a00148d00b0049fdef79cfemr48470475pfu.69.1638287783587; \n\tTue, 30 Nov 2021 07:56:23 -0800 (PST)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 1 Dec 2021 00:55:57 +0900", "Message-Id": "<20211130155600.2203123-10-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.34.0.rc2.393.gf8c9666880-goog", "In-Reply-To": "<20211130155600.2203123-1-hiroh@chromium.org>", "References": "<20211130155600.2203123-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 09/12] android: camera_stream: Add\n\tthread safety annotation", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "This applies clang thread safety annotation to CameraStream.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_stream.cpp | 2 +-\n src/android/camera_stream.h | 9 ++++++---\n 2 files changed, 7 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 2181d094..ae659808 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -275,7 +275,7 @@ void CameraStream::PostProcessorWorker::run()\n \tMutexLocker locker(mutex_);\n \n \twhile (1) {\n-\t\tcv_.wait(locker, [&] {\n+\t\tcv_.wait(locker, [&]() LIBCAMERA_TSA_REQUIRES(mutex_) {\n \t\t\treturn state_ != State::Running || !requests_.empty();\n \t\t});\n \ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex e4eb953a..6737bd2d 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -15,6 +15,7 @@\n \n #include <libcamera/base/mutex.h>\n #include <libcamera/base/thread.h>\n+#include <libcamera/base/thread_annotations.h>\n \n #include <libcamera/camera.h>\n #include <libcamera/framebuffer.h>\n@@ -155,8 +156,10 @@ private:\n \t\tlibcamera::Mutex mutex_;\n \t\tlibcamera::ConditionVariable cv_;\n \n-\t\tstd::queue<Camera3RequestDescriptor::StreamBuffer *> requests_;\n-\t\tState state_ = State::Stopped;\n+\t\tstd::queue<Camera3RequestDescriptor::StreamBuffer *> requests_\n+\t\t\tLIBCAMERA_TSA_GUARDED_BY(mutex_);\n+\n+\t\tState state_ LIBCAMERA_TSA_GUARDED_BY(mutex_) = State::Stopped;\n \t};\n \n \tint waitFence(int fence);\n@@ -168,7 +171,7 @@ private:\n \tconst unsigned int index_;\n \n \tstd::unique_ptr<libcamera::FrameBufferAllocator> allocator_;\n-\tstd::vector<libcamera::FrameBuffer *> buffers_;\n+\tstd::vector<libcamera::FrameBuffer *> buffers_ LIBCAMERA_TSA_GUARDED_BY(mutex_);\n \t/*\n \t * The class has to be MoveConstructible as instances are stored in\n \t * an std::vector in CameraDevice.\n", "prefixes": [ "libcamera-devel", "v3", "09/12" ] }