{"id":14934,"url":"https://patchwork.libcamera.org/api/1.1/patches/14934/?format=json","web_url":"https://patchwork.libcamera.org/patch/14934/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20211201070728.3114247-9-hiroh@chromium.org>","date":"2021-12-01T07:07:24","name":"[libcamera-devel,v4,08/12] android: camera_stream: Protect buffers initialization by mutex_","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"bc04f6746da1cadb05a3690909b3a1f8da062293","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14934/mbox/","series":[{"id":2789,"url":"https://patchwork.libcamera.org/api/1.1/series/2789/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2789","date":"2021-12-01T07:07:16","name":"Introduce clang thread safety annotations","version":4,"mbox":"https://patchwork.libcamera.org/series/2789/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14934/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14934/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 2C931BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Dec 2021 07:07:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C439D60733;\n\tWed,  1 Dec 2021 08:07:51 +0100 (CET)","from mail-pl1-x634.google.com (mail-pl1-x634.google.com\n\t[IPv6:2607:f8b0:4864:20::634])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 255DB60723\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Dec 2021 08:07:50 +0100 (CET)","by mail-pl1-x634.google.com with SMTP id o14so16957664plg.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 23:07:50 -0800 (PST)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:3892:a049:59ba:c772])\n\tby smtp.gmail.com with ESMTPSA id\n\tm10sm16598962pgv.75.2021.11.30.23.07.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 30 Nov 2021 23:07:48 -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=\"Eq5l+sKk\"; 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=aisRSY5NBfEGCdy/9ndvSRH0p2htKgt/zk8gIFRC0cU=;\n\tb=Eq5l+sKk1W0jOMRADeIbtVPK009O9SFWnT+blrulAn6fP85hL6y8TYVyb+Z5rugRKL\n\tlm1YGDihPRoFG/Lov1guQf+ZugqWBAZfFioa3Q3m9AL5Dmy0flmBAaPJfyXCohLf+9+E\n\tEjesJhdYRegHbrbcJeDEbLXE8ZVqabUEwgITc=","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=aisRSY5NBfEGCdy/9ndvSRH0p2htKgt/zk8gIFRC0cU=;\n\tb=LrrB1B6Cl06M3+Hadr25YLOI2E/vHm5SRm/XEgsN7DIh8JA2ygwlXHP5GtWu7QO02x\n\tUkwZ9GT4NeuMrGOGwwFk9uNh/W94r/4bqp5/hUDKhli4kBBTm1HwsrybMmSR+A3vDyVI\n\tm05hL8SwaLE1NCILFxS/9DihTmksxLUeF5XJ/lFhf6K6gl2qKf2B9+q3IfiqkCl8gNEX\n\tSIkBlwoRj+wwJl9PNvCdqPRQ1eY79NMWJkJ18+BBYdk8h05wqnbYtaTWj28es0LseipT\n\tV4gmdNvk5UUf4T3we6t1iMHMAqQgoI12168+DCPmmgCudBPEoSAwnz3YV+/Om2RbwkvS\n\twOvQ==","X-Gm-Message-State":"AOAM533Jark84wav+lO/RncNJums/bwwNS8dmnFGAeEnlLj1tNAaRx83\n\tLF0BB/mfsl90wsqu6lZML56eWI1L2bB0OQ==","X-Google-Smtp-Source":"ABdhPJwWxyuqUyyMTkedNmDfpFhBTdg0cWyg2mEJv8v1PRP7rm3AAAp3koWdcem7D9mOpfNEZ5HQNw==","X-Received":"by 2002:a17:90b:94:: with SMTP id\n\tbb20mr5251057pjb.210.1638342468486; \n\tTue, 30 Nov 2021 23:07:48 -0800 (PST)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  1 Dec 2021 16:07:24 +0900","Message-Id":"<20211201070728.3114247-9-hiroh@chromium.org>","X-Mailer":"git-send-email 2.34.0.rc2.393.gf8c9666880-goog","In-Reply-To":"<20211201070728.3114247-1-hiroh@chromium.org>","References":"<20211201070728.3114247-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 08/12] android: camera_stream: Protect\n\tbuffers initialization by mutex_","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":"The initialization on buffers_ in CameraStrean::configure() is not\nprotected by mutex_. It is no problem because configure() is not\ninvoked simultaneously while other functions are called. This\nprotects it to keep the thread safety consistency for buffers access.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_stream.cpp | 1 +\n 1 file changed, 1 insertion(+)","diff":"diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 5a62b7cd..2181d094 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -125,6 +125,7 @@ int CameraStream::configure()\n \t\tif (ret < 0)\n \t\t\treturn ret;\n \n+\t\tMutexLocker lock(*mutex_);\n \t\t/* Save a pointer to the reserved frame buffers */\n \t\tfor (const auto &frameBuffer : allocator_->buffers(stream()))\n \t\t\tbuffers_.push_back(frameBuffer.get());\n","prefixes":["libcamera-devel","v4","08/12"]}