Show a patch.

GET /api/patches/14846/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 14846,
    "url": "https://patchwork.libcamera.org/api/patches/14846/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14846/",
    "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": "<20211129114453.3186042-11-hiroh@chromium.org>",
    "date": "2021-11-29T11:44:52",
    "name": "[libcamera-devel,v2,10/11] android: camera_device: Add thread safety annotation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "490e6f2d982eceaf9a8130372338f721117bd29f",
    "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/14846/mbox/",
    "series": [
        {
            "id": 2770,
            "url": "https://patchwork.libcamera.org/api/series/2770/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2770",
            "date": "2021-11-29T11:44:42",
            "name": "Introduce clang thread safety annotations",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2770/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14846/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14846/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 2D9AEBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 11:45:22 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D89D0605BB;\n\tMon, 29 Nov 2021 12:45:21 +0100 (CET)",
            "from mail-pg1-x534.google.com (mail-pg1-x534.google.com\n\t[IPv6:2607:f8b0:4864:20::534])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CA61660592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 12:45:18 +0100 (CET)",
            "by mail-pg1-x534.google.com with SMTP id r5so15782194pgi.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 03:45:18 -0800 (PST)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:f254:cda9:46e8:17b7])\n\tby smtp.gmail.com with ESMTPSA id\n\thg4sm17951966pjb.1.2021.11.29.03.45.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Nov 2021 03:45:16 -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=\"AgO1xoFp\"; 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=7N6nOACUKphc6ZSF1ybQg9PRBU9NHpQ5TXKsVKJlUr4=;\n\tb=AgO1xoFp0frMy8aSI94cAmJt0kmTcN4Tl0L6qF1b5ssclW+Reu143PVmChGBarWF6X\n\tusUWuLldiXUApbcTEQxfstxj4af3adz/IdTI00FNUXkCZ/emc367WO5Rq3Rvnjm0P2ZC\n\tXFUWJ2tnJ7U0NES99KBlm8I4Zputhf470N+1E=",
        "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=7N6nOACUKphc6ZSF1ybQg9PRBU9NHpQ5TXKsVKJlUr4=;\n\tb=xf00C5i4mC52xzV+iKLXZMybdpPfiNr7UsoofrYmVCClaJfmv/HaJ+U5zkQ5GyfWLB\n\td48Q0jJPc+TKCp+X2BRrirpm4+s3bW/1wBiPLS/TpLecC+DEUgnzvlDQtRHm1zlY72Vd\n\tigq6ftkDWIa8aEEY4lY+Ilw8ee9cW/TjtU/Ly2ATgvLH8uYz6hMAHvde5UDUVy1dLWZW\n\tQPF4rHre6UekkaPx6xEMhDT+Z2ppbpmRdqK98oiojM6GY47jchcF8Wdu6lHvgB9oFFou\n\tmrs43Spms/3kb8314gLJHLAZx8tFz+qgLd5UXiQQRHFu907SLd6LRgpbZeD/cm1YwawC\n\tNUJA==",
        "X-Gm-Message-State": "AOAM531KSQ/te+F/MmGC+YgO2FsL5B+pOl+3R37TvSIHeGDUlosj5CrC\n\tFizVaL7y/rd3mj4ireSeBZQZjZ7InG2elg==",
        "X-Google-Smtp-Source": "ABdhPJw3/2GP/3tKa+EYt+7fTsOt/ZfLcp8B13ejQhg2pd63SdMrjpc2yYOLtWiajnH1sHH14eMFaQ==",
        "X-Received": "by 2002:a63:8248:: with SMTP id\n\tw69mr33777594pgd.342.1638186317093; \n\tMon, 29 Nov 2021 03:45:17 -0800 (PST)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 29 Nov 2021 20:44:52 +0900",
        "Message-Id": "<20211129114453.3186042-11-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.34.0.rc2.393.gf8c9666880-goog",
        "In-Reply-To": "<20211129114453.3186042-1-hiroh@chromium.org>",
        "References": "<20211129114453.3186042-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 10/11] android: camera_device: 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 CameraDevice.\nMutex and MutexLocker there are replaced with Mutex2 and\nMutexLocer2.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp |  2 --\n src/android/camera_device.h   | 18 ++++++++++--------\n 2 files changed, 10 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 59185e7f..e7365175 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -14,7 +14,6 @@\n #include <vector>\n \n #include <libcamera/base/log.h>\n-#include <libcamera/base/thread.h>\n #include <libcamera/base/utils.h>\n \n #include <libcamera/control_ids.h>\n@@ -932,7 +931,6 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques\n \t\t\t * Request.\n \t\t\t */\n \t\t\tLOG(HAL, Debug) << ss.str() << \" (mapped)\";\n-\n \t\t\tdescriptor->pendingStreamsToProcess_.insert(\n \t\t\t\t{ cameraStream, &buffer });\n \t\t\tcontinue;\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 51fe7da2..2083dac1 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -9,7 +9,6 @@\n \n #include <map>\n #include <memory>\n-#include <mutex>\n #include <queue>\n #include <vector>\n \n@@ -18,7 +17,8 @@\n #include <libcamera/base/class.h>\n #include <libcamera/base/log.h>\n #include <libcamera/base/message.h>\n-#include <libcamera/base/thread.h>\n+#include <libcamera/base/mutex.h>\n+#include <libcamera/base/thread_annotations.h>\n \n #include <libcamera/camera.h>\n #include <libcamera/framebuffer.h>\n@@ -83,7 +83,7 @@ private:\n \t\tRunning,\n \t};\n \n-\tvoid stop();\n+\tvoid stop() LIBCAMERA_TSA_EXCLUDES(stateMutex_);\n \n \tstd::unique_ptr<libcamera::FrameBuffer>\n \tcreateFrameBuffer(const buffer_handle_t camera3buffer,\n@@ -95,8 +95,9 @@ private:\n \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream,\n \t\t\t camera3_error_msg_code code) const;\n \tint processControls(Camera3RequestDescriptor *descriptor);\n-\tvoid completeDescriptor(Camera3RequestDescriptor *descriptor);\n-\tvoid sendCaptureResults();\n+\tvoid completeDescriptor(Camera3RequestDescriptor *descriptor)\n+\t\tLIBCAMERA_TSA_EXCLUDES(descriptorsMutex_);\n+\tvoid sendCaptureResults() LIBCAMERA_TSA_REQUIRES(descriptorsMutex_);\n \tvoid setBufferStatus(Camera3RequestDescriptor::StreamBuffer &buffer,\n \t\t\t     Camera3RequestDescriptor::Status status);\n \tstd::unique_ptr<CameraMetadata> getResultMetadata(\n@@ -108,7 +109,7 @@ private:\n \tCameraWorker worker_;\n \n \tlibcamera::Mutex stateMutex_; /* Protects access to the camera state. */\n-\tState state_;\n+\tState state_ LIBCAMERA_TSA_GUARDED_BY(stateMutex_);\n \n \tstd::shared_ptr<libcamera::Camera> camera_;\n \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n@@ -119,8 +120,9 @@ private:\n \n \tstd::vector<CameraStream> streams_;\n \n-\tlibcamera::Mutex descriptorsMutex_; /* Protects descriptors_. */\n-\tstd::queue<std::unique_ptr<Camera3RequestDescriptor>> descriptors_;\n+\tlibcamera::Mutex descriptorsMutex_ LIBCAMERA_TSA_ACQUIRED_AFTER(stateMutex_);\n+\tstd::queue<std::unique_ptr<Camera3RequestDescriptor>> descriptors_\n+\t\tLIBCAMERA_TSA_GUARDED_BY(descriptorsMutex_);\n \n \tstd::string maker_;\n \tstd::string model_;\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "10/11"
    ]
}