{"id":15546,"url":"https://patchwork.libcamera.org/api/1.1/patches/15546/?format=json","web_url":"https://patchwork.libcamera.org/patch/15546/","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":"<20220325090903.880311-7-naush@raspberrypi.com>","date":"2022-03-25T09:09:01","name":"[libcamera-devel,v5,6/8] libcamera: v4l2_videodevice: Do not allow buffer queueing in stopping state","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"24733a10f996cb3ade285bca8a399d45d0d7bdbc","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15546/mbox/","series":[{"id":2999,"url":"https://patchwork.libcamera.org/api/1.1/series/2999/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2999","date":"2022-03-25T09:08:55","name":"Raspberry Pi: Efficient start/stop/start sequences","version":5,"mbox":"https://patchwork.libcamera.org/series/2999/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15546/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15546/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 2829FC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 25 Mar 2022 09:09:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D2867632E8;\n\tFri, 25 Mar 2022 10:09:14 +0100 (CET)","from mail-wr1-x429.google.com (mail-wr1-x429.google.com\n\t[IPv6:2a00:1450:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 50B65604C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Mar 2022 10:09:12 +0100 (CET)","by mail-wr1-x429.google.com with SMTP id h4so9925444wrc.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Mar 2022 02:09:12 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:478c:773f:4734:d0bc])\n\tby smtp.gmail.com with ESMTPSA id\n\tc4-20020a056000184400b0020584c40778sm4915297wri.103.2022.03.25.02.09.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 25 Mar 2022 02:09:11 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648199354;\n\tbh=s5y2qLBZYfMPw4FyQu8zhn3G4H/9ocLISzpueUvx/F0=;\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=fVCNLMqXzmfe3/+8kZcoH3fSNZhjVDRqU9GJgJI9Gzh81XO6C6MRzfVNhy2fGpU+k\n\thqxDIwKw4eBa6zrvWjaJ/Yk2ejtEngGTGEzU63IQldt53aSUyEu/c/LXEzGDNWJdTC\n\tFTxu+iT78mjnBUmAJxOvHjTKsJocAs+ibz6eOTbk0h0OQqObwbN1NWOv2CcZXdKVA9\n\tAV7QectAApUJKoyCJWI4KE27Rr2huJdD9dBUsN0Go0bnG+QSjmMPnSlY14qD9B5hnj\n\tpZp32zmCBMTGPUOUDhngYcm29nQTUutMvHPuH3E0JNnYfu290/ghQ+EhxmYaOQq0Gm\n\tY4OQcC7L2MHwQ==","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=1H2qLEHnAgihB+y26jW/31zTk3ZzfqSkaZ7pYckt22c=;\n\tb=nnaRRZMlOUoWbvD6tqISlRJwOFV9/4pVgR7EuAIblUmXhFzHMcp++YEzlcbf1ZH2FO\n\thzgYYduKPnfu7xNXlMQkMwDEbF2spy+2g6T5yYt20dxnv44YliewxMWiKY3LBItQryk6\n\t/usg4ha/ZkXGC/OJwTzeOQ5nUcbQ29sXDAwiO161vjZl8+POXv/uThMTEw8OLLlOUiTn\n\t3WJCWKQrC5txWIxDoTyiVzM9mhec0dCzj3VNa9nNFQ/5mPagX7wP5fEBg+FafN5KTn7n\n\tvFlaK5eg7IBpzVLXyW4eEBZn1Kn0wrTEbTLOZRK0lkUBQ8FlE2O5478EWWNrS9lwkQz5\n\tTC7Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"nnaRRZMl\"; 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=1H2qLEHnAgihB+y26jW/31zTk3ZzfqSkaZ7pYckt22c=;\n\tb=pJDs4sjQGZ+feWmddjJdKJgOKlS1QfCMiyT/s7n+bM6JrY5ySNG6I1wRWEjJtxbPkg\n\tMNue/vLuncZPjbxKPoasPTyAkMBeFq4WKwaYk5P7Li1H9YsfQH5oJL4gGomy3wJDSdYX\n\t67L+ZE6pKmJTmSQ1k/x+oFBjLkwISH/Es6W9mI5kxnrP+TiAdgGuvK2Quwi31xgbca5w\n\tZmgqyjDOXZgDwmoprG1Qc1KtohrKEihjuWk0emq1rGHLmkzNjee2qmuObP15kPRJLfzI\n\t9x+AoPFYicpIXjZ9cH1X+2uHtUtwBlczodDR2P9jwU6YWx7FtHychlMFH586DF5aWD62\n\tDyIQ==","X-Gm-Message-State":"AOAM530AX/hq6Uybnlnm04q76G0T+5qiqIJKbOitHzfOu2So/TmhGC11\n\tVEvywpkP/zBhTpcRJalo7sxUjnESFlLNtw==","X-Google-Smtp-Source":"ABdhPJyV+dFiZ5TlrUZTRQHUzM5HchpQmf1HehlwKF3p5WL4dwjOm0plp70/tTGz138vPbJou6D2RQ==","X-Received":"by 2002:adf:e108:0:b0:1ef:97ad:5372 with SMTP id\n\tt8-20020adfe108000000b001ef97ad5372mr8037972wrz.658.1648199351812; \n\tFri, 25 Mar 2022 02:09:11 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 25 Mar 2022 09:09:01 +0000","Message-Id":"<20220325090903.880311-7-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220325090903.880311-1-naush@raspberrypi.com>","References":"<20220325090903.880311-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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..28f336086b49 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 queueBuffer() will fail if the device is in the process of being\n+ * stopped from a streaming state through streamOff().\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 -ESHUTDOWN;\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","v5","6/8"]}