{"id":15503,"url":"https://patchwork.libcamera.org/api/patches/15503/?format=json","web_url":"https://patchwork.libcamera.org/patch/15503/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220322092257.2713521-7-naush@raspberrypi.com>","date":"2022-03-22T09:22:55","name":"[libcamera-devel,v4,6/8] libcamera: v4l2_videodevice: Do not allow buffer queueing in stopping state","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"d2816ad5fc739cd39ea1f30f47bf75473c5c9720","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15503/mbox/","series":[{"id":2982,"url":"https://patchwork.libcamera.org/api/series/2982/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2982","date":"2022-03-22T09:22:49","name":"Raspberry Pi: Efficient start/stop/start sequences","version":4,"mbox":"https://patchwork.libcamera.org/series/2982/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15503/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15503/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 E6B3DC3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Mar 2022 09:23:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B7C9632E7;\n\tTue, 22 Mar 2022 10:23:09 +0100 (CET)","from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 61206604E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 10:23:05 +0100 (CET)","by mail-wm1-x32d.google.com with SMTP id\n\to7-20020a05600c4fc700b0038c87edc21eso1233729wmq.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 02:23:05 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:9e9a:99af:e5a6:319b])\n\tby smtp.gmail.com with ESMTPSA id\n\tr14-20020a05600c35ce00b0038c9f469979sm1471695wmq.40.2022.03.22.02.23.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Mar 2022 02:23:04 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647940989;\n\tbh=kLdJCoGqn9EWuZ/Y6wCBPOrNjqTq2/GaVdwfFx+Kr1I=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=KCD5bD8LOcgGvwbvpmz9vvAEtfQ/m1YviWUzyWNgYUkOUvk/MLROP0YR5f0PV5ryC\n\t34o32iB5ieUSWTbF+6dv86LpWTsszG1OULwdPDyaYSsC0OrdyqmkrJZ7zecY9AC+QE\n\tn9/hlKew/dIG44SB0LAl17+mOBQfwoxf9wTERoyqabCDobVOzRTuGq17gF/C3sjS39\n\tW3zOLwm4Szt+2LfPk2lp/mPo4i2XZKBK756SBrbNxiqd+hSwmT/beW+xQuM3q3aTMa\n\tytgphGvAqAA/aCjTYDQ11OC8GHQvHf2VsCqpu2MUA+VUXCITWSkITj1z+9ke70hhOc\n\txDJvIzRCEubuQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=XJt33N1ljP6weawLqxc7eqhgx8mv7TXz3ylgqjbNO8U=;\n\tb=C9BJbsT8td3C47nEb49XPsJOEHf3FOtqKVB3GteUmCjoo351+M+UuozXXniMePiEBO\n\tMl+ujDOqXj+/2lCf+TKV56ApoTiVzW7qYWLPdcrn2Wv2JgAGvUs+T39IAwzs6lb30rFz\n\tJNqDcmUJpWTOSMDuxFxvLgT2i1SnpqOHohUX1W2KLOLf0w2e+5RcihW+aetlEhqfOEp1\n\tvkBDXEA3dNQRTYH07IJ3fKqkrZY10cP1ur/g9NfotN1BHFec0Wr5W3tyExhQD5oj3gWl\n\tBWQnjpmhvMXajFrKsJnAbmlZX0KWWyGG7J4TEc7hklIgrK3bzJ4JrgKO7LJl5i7nSw0y\n\tj/Iw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"C9BJbsT8\"; dkim-atps=neutral","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=XJt33N1ljP6weawLqxc7eqhgx8mv7TXz3ylgqjbNO8U=;\n\tb=tT4eGB48GMaQGGK3cLMP68w0oJxX5t5hnN4DUxbMdeARBw/X3iNVzv+SqQolxpEFO3\n\tfF0bxbBcSNc2t/bEZVOojgVzb66MAnjpjACS1rv2lCcjiG1lUtOjreGg5+w/xwG0Gtet\n\t4qzB2/4iCG6a326iqv3BLMKkfhyLhn6MiTK/bc7j+Vy2Ae3SLzqyWtX63kTxO/q/Cr1j\n\tsw8bh+GKCi12i+b7j7l1tqDOOYa2AErWwC8l6osIsFVISk1KkJmvbAaKPl2OHfQy4duF\n\taoBPLvsJvgwwSo3794EnOaSvEoq4H0QeKmUsN89duB3ID55p4buP23s3PAzc41C1za2u\n\tG0lg==","X-Gm-Message-State":"AOAM533D6irdslvduSmQCS8P76XUj/fz+JknWxK4sxbrfWma+oNBs5Tx\n\tZ4VO4kq189ctEiNssWtHvaUz2hkneDIn/g==","X-Google-Smtp-Source":"ABdhPJyCkM3svCV6/nln8mKlclYscMBiJMgYq7HwCclxZO0NMxKNAViXZ/gqU22o3+IjFp6dTMPovw==","X-Received":"by 2002:a05:600c:4b83:b0:38c:49b5:5bfc with SMTP id\n\te3-20020a05600c4b8300b0038c49b55bfcmr2882952wmp.33.1647940984851; \n\tTue, 22 Mar 2022 02:23:04 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Mar 2022 09:22:55 +0000","Message-Id":"<20220322092257.2713521-7-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220322092257.2713521-1-naush@raspberrypi.com>","References":"<20220322092257.2713521-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 6/8] libcamera: v4l2_videodevice: Do\n\tnot allow buffer queueing in stopping state","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"If the device is in the process of being stopped (i.e. Stopping state), any\ncall to queueBuffer() must fail. This is to ensure the integrity of the buffer\nqueue, as it gets cleared at the end of streamOff.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/libcamera/v4l2_videodevice.cpp | 8 ++++++++\n 1 file changed, 8 insertions(+)","diff":"diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 9cea6a608660..1516be129d73 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1491,6 +1491,9 @@ int V4L2VideoDevice::releaseBuffers()\n  * The best available V4L2 buffer is picked for \\a buffer using the V4L2 buffer\n  * cache.\n  *\n+ * Note that \\a queueBuffer will fail if the device is in the process of being\n+ * stopped from a streaming state through the \\a streamOff function.\n+ *\n  * \\return 0 on success or a negative error code otherwise\n  */\n int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n@@ -1499,6 +1502,11 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n \tstruct v4l2_buffer buf = {};\n \tint ret;\n \n+\tif (state_ == State::Stopping) {\n+\t\tLOG(V4L2, Error) << \"Device is in a stopping state.\";\n+\t\treturn -EPERM;\n+\t}\n+\n \t/*\n \t * Pipeline handlers should not requeue buffers after releasing the\n \t * buffers on the device. Any occurence of this error should be fixed\n","prefixes":["libcamera-devel","v4","6/8"]}