Patch Detail
Show a patch.
GET /api/1.1/patches/15020/?format=api
{ "id": 15020, "url": "https://patchwork.libcamera.org/api/1.1/patches/15020/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15020/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20211203164619.1541033-8-hiroh@chromium.org>", "date": "2021-12-03T16:46:19", "name": "[libcamera-devel,7/7] v4l2: v4l2_camera: Apply clang thread safety annotation", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "3f455b58fc8b4a028831996f249850ea009f9491", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15020/mbox/", "series": [ { "id": 2812, "url": "https://patchwork.libcamera.org/api/1.1/series/2812/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2812", "date": "2021-12-03T16:46:12", "name": "Apply clang thread safety annotation libcamera-core and v4l2", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2812/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15020/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15020/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 83B9CBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 3 Dec 2021 16:46:41 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 396DB60868;\n\tFri, 3 Dec 2021 17:46:41 +0100 (CET)", "from mail-pf1-x433.google.com (mail-pf1-x433.google.com\n\t[IPv6:2607:f8b0:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 508B760862\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 3 Dec 2021 17:46:38 +0100 (CET)", "by mail-pf1-x433.google.com with SMTP id z6so3428901pfe.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 03 Dec 2021 08:46:38 -0800 (PST)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:cd78:3a5f:d792:6177])\n\tby smtp.gmail.com with ESMTPSA id\n\th18sm4123149pfh.172.2021.12.03.08.46.35\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 03 Dec 2021 08:46:36 -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=\"dKS7Ycer\"; 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=8AjrLQa6KvevGIzZ2Uw7/ytvhbTojq+0pxD3Ib25aUw=;\n\tb=dKS7Ycer1TOUHoU2S6dY1xd4I8vgUEoKYWvPq4G4bWQcgKXxIppNoFeJSW9BNrUY+I\n\tGP38FyiB04MmoifR4wrRK2oK32Qdje2/a/rRUU1iznnAJl7Dmk/V6OQWAEkL2daXIYuI\n\tG07CaSqY26CWvUU8giTGCfifXi9UdxULr6mJc=", "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=8AjrLQa6KvevGIzZ2Uw7/ytvhbTojq+0pxD3Ib25aUw=;\n\tb=hGIqN/FuPqkNH5QCcvFI2IBGysN8YYfJdr5QutT8jt7nXtfNdjztvt9eb4rkWJYahV\n\taBci/FGs19p2lu/TzjpdA+NI8VGiMVbPlLa/rCSR86zgmKLRjnfHNyCWCuKpx3NdBJTz\n\tc4R/kVG/K12/Z+ZX3Z4St13WlTq+knQXhKy22WrF7kTS8vQuwj31FhkIzWYZNZEvkAmb\n\tlc6GSyIbrYD0Ghb11F2ceNKqPEioaGmMQKftkpb5yjvC9KOw2Q8uTez1okWDzlv67Q22\n\taxfhARQAs680xPkbfDTwgTZyS5cVIDtr71i5zNpPsUtJmltTuAp3L02k0DBIFBrjFa/T\n\tt2zw==", "X-Gm-Message-State": "AOAM533U9+DMzEJ1XRE+GbJcFdVAKiQoF9d5E1b8tRPhOSmIO9U77A7W\n\toKIr+m8c28gQWTSYPHyH2QPXtr9uiVPgFQ==", "X-Google-Smtp-Source": "ABdhPJzj9rQDLkDu1KAuWSXZeIkWcG0qw9SKxh/KUpVO3RnIvrMS3b4cRhaxaXJE1JYtzgbnXq9iCQ==", "X-Received": "by 2002:a63:f651:: with SMTP id\n\tu17mr5212534pgj.256.1638549996666; \n\tFri, 03 Dec 2021 08:46:36 -0800 (PST)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 4 Dec 2021 01:46:19 +0900", "Message-Id": "<20211203164619.1541033-8-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.34.0.384.gca35af8252-goog", "In-Reply-To": "<20211203164619.1541033-1-hiroh@chromium.org>", "References": "<20211203164619.1541033-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 7/7] v4l2: v4l2_camera: Apply clang thread\n\tsafety 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 annotates member functions and variables of V4L2Camera by\nclang thread safety annotations.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/v4l2/v4l2_camera.cpp | 5 ++---\n src/v4l2/v4l2_camera.h | 14 ++++++++------\n 2 files changed, 10 insertions(+), 9 deletions(-)", "diff": "diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp\nindex 157ab94e..6d571953 100644\n--- a/src/v4l2/v4l2_camera.cpp\n+++ b/src/v4l2/v4l2_camera.cpp\n@@ -71,11 +71,10 @@ std::vector<V4L2Camera::Buffer> V4L2Camera::completedBuffers()\n {\n \tstd::vector<Buffer> v;\n \n-\tbufferLock_.lock();\n+\tMutexLocker lock(bufferLock_);\n \tfor (std::unique_ptr<Buffer> &metadata : completedBuffers_)\n \t\tv.push_back(*metadata.get());\n \tcompletedBuffers_.clear();\n-\tbufferLock_.unlock();\n \n \treturn v;\n }\n@@ -278,7 +277,7 @@ int V4L2Camera::qbuf(unsigned int index)\n void V4L2Camera::waitForBufferAvailable()\n {\n \tMutexLocker locker(bufferMutex_);\n-\tbufferCV_.wait(locker, [&] {\n+\tbufferCV_.wait(locker, [&]() LIBCAMERA_TSA_REQUIRES(bufferMutex_) {\n \t\t\t return bufferAvailableCount_ >= 1 || !isRunning_;\n \t\t });\n \tif (isRunning_)\ndiff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h\nindex 9307d61d..0d5a8948 100644\n--- a/src/v4l2/v4l2_camera.h\n+++ b/src/v4l2/v4l2_camera.h\n@@ -39,7 +39,7 @@ public:\n \tvoid bind(int efd);\n \tvoid unbind();\n \n-\tstd::vector<Buffer> completedBuffers();\n+\tstd::vector<Buffer> completedBuffers() LIBCAMERA_TSA_EXCLUDES(bufferLock_);\n \n \tint configure(libcamera::StreamConfiguration *streamConfigOut,\n \t\t const libcamera::Size &size,\n@@ -58,13 +58,14 @@ public:\n \n \tint qbuf(unsigned int index);\n \n-\tvoid waitForBufferAvailable();\n-\tbool isBufferAvailable();\n+\tvoid waitForBufferAvailable() LIBCAMERA_TSA_EXCLUDES(bufferMutex_);\n+\tbool isBufferAvailable() LIBCAMERA_TSA_EXCLUDES(bufferMutex_);\n \n \tbool isRunning();\n \n private:\n-\tvoid requestComplete(libcamera::Request *request);\n+\tvoid requestComplete(libcamera::Request *request)\n+\t\tLIBCAMERA_TSA_EXCLUDES(bufferLock_);\n \n \tstd::shared_ptr<libcamera::Camera> camera_;\n \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n@@ -77,11 +78,12 @@ private:\n \tstd::vector<std::unique_ptr<libcamera::Request>> requestPool_;\n \n \tstd::deque<libcamera::Request *> pendingRequests_;\n-\tstd::deque<std::unique_ptr<Buffer>> completedBuffers_;\n+\tstd::deque<std::unique_ptr<Buffer>> completedBuffers_\n+\t\tLIBCAMERA_TSA_GUARDED_BY(bufferLock_);\n \n \tint efd_;\n \n \tlibcamera::Mutex bufferMutex_;\n \tlibcamera::ConditionVariable bufferCV_;\n-\tunsigned int bufferAvailableCount_;\n+\tunsigned int bufferAvailableCount_ LIBCAMERA_TSA_GUARDED_BY(bufferMutex_);\n };\n", "prefixes": [ "libcamera-devel", "7/7" ] }