{"id":3907,"url":"https://patchwork.libcamera.org/api/1.1/patches/3907/?format=json","web_url":"https://patchwork.libcamera.org/patch/3907/","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":"<20200603141609.18584-4-paul.elder@ideasonboard.com>","date":"2020-06-03T14:16:07","name":"[libcamera-devel,3/5] v4l2: v4l2_camera_proxy: Acquire only one buffer semaphore on VIDIOC_DQBUF","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"bf3a9190cc82de317ede01104556989699e5d6c7","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3907/mbox/","series":[{"id":946,"url":"https://patchwork.libcamera.org/api/1.1/series/946/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=946","date":"2020-06-03T14:16:04","name":"Support qv4l2 with v4l2-compat","version":1,"mbox":"https://patchwork.libcamera.org/series/946/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3907/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3907/checks/","tags":{},"headers":{"Return-Path":"<paul.elder@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B988D6114D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jun 2020 16:16:26 +0200 (CEST)","from emerald.amanokami.net (fs76eef344.knge213.ap.nuro.jp\n\t[118.238.243.68])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8FE5827C;\n\tWed,  3 Jun 2020 16:16:25 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"rvA2fels\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591193786;\n\tbh=0jvjRyLFjW1dQ/QuY+iycDWse4ctjcTQ5yW9YRmxhMY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=rvA2felsjYH5KhBFV3+yP8g5F+dNeUzHatLLb0BNEQyeyfNS2ngmOA7uNsQZ3EWon\n\tti7KlIcORQJBCPhOlKmbYqWKqlwsJ93CKwEkN+zbbuPt3C5RpkdB93uHU6yN3jEa3L\n\t3xgtVaHGY/rkVGiXb/l5EZ8hVrH1QN+vPyybtR1Q=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  3 Jun 2020 23:16:07 +0900","Message-Id":"<20200603141609.18584-4-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20200603141609.18584-1-paul.elder@ideasonboard.com>","References":"<20200603141609.18584-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 3/5] v4l2: v4l2_camera_proxy: Acquire only\n\tone buffer semaphore on VIDIOC_DQBUF","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>","X-List-Received-Date":"Wed, 03 Jun 2020 14:16:27 -0000"},"content":"We use a semaphore to atomically keep track of how many buffers are\navailable for dequeueing. The check for how to acquire the semaphore was\nincorrect, leading to a double acquire upon a successful nonblocking\nacquire. Fix this.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/v4l2/v4l2_camera_proxy.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex ec6d265d..d2419b96 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -428,7 +428,7 @@ int V4L2CameraProxy::vidioc_dqbuf(struct v4l2_buffer *arg)\n \n \tif (nonBlocking_ && !vcam_->bufferSema_.tryAcquire())\n \t\treturn -EAGAIN;\n-\telse\n+\telse if (!nonBlocking_)\n \t\tvcam_->bufferSema_.acquire();\n \n \tupdateBuffers();\n","prefixes":["libcamera-devel","3/5"]}