{"id":17385,"url":"https://patchwork.libcamera.org/api/1.1/patches/17385/?format=json","web_url":"https://patchwork.libcamera.org/patch/17385/","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":"<20220921080258.5268-2-naush@raspberrypi.com>","date":"2022-09-21T08:02:57","name":"[libcamera-devel,v2,1/2] pipeline: raspberrypi: Add an error state","commit_ref":"883e2089db307955abecfcdc95f1a85ee0be56c0","pull_url":null,"state":"accepted","archived":false,"hash":"60b50f33348023654511fa2c92b2a49a1647a677","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/17385/mbox/","series":[{"id":3495,"url":"https://patchwork.libcamera.org/api/1.1/series/3495/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3495","date":"2022-09-21T08:02:56","name":"Raspberry Pi: Timeout error handling","version":2,"mbox":"https://patchwork.libcamera.org/series/3495/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17385/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17385/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 8AC05C327D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Sep 2022 08:03:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3646A621E1;\n\tWed, 21 Sep 2022 10:03:06 +0200 (CEST)","from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1933C621DA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Sep 2022 10:03:03 +0200 (CEST)","by mail-wm1-x32a.google.com with SMTP id\n\tfn7-20020a05600c688700b003b4fb113b86so368408wmb.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Sep 2022 01:03:03 -0700 (PDT)","from naush-laptop.localdomain (global-5-56.n-1.net.cam.ac.uk.\n\t[131.111.5.56]) by smtp.gmail.com with ESMTPSA id\n\tl36-20020a05600c08a400b003b4727d199asm1905782wmp.15.2022.09.21.01.03.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 21 Sep 2022 01:03:02 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1663747386;\n\tbh=p76Ra6oGRS2oGIAl/DgzwgcUTg1Gtz3X4lYsY/MwjxI=;\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=RO7GmfKjPgMxb4ZGrEhyMkmbKw3a5wqSy0g57gh7lHtg7RaYgLJgmcVWVsrg7zbEv\n\tT8D4hvxt5eR2XJKoCwIqmKXPuoBXIcv9hD8KIf6TNI0+1h0YIQC9iUWA3DMkJYx2KT\n\t7I1IxL0kX1eC42RKNKDTMAj+AkKoLOw+rMaDZnNIzeSB6FPdnEsoSUuhDEArU43OPI\n\tL8SCT0Ohn+R3kkzfMtnRQCNa7PpYhtx6SZ/P9faCndcVeOYHFUCYg4lp+kcxryN67P\n\t6ThUyKfReL6stQ+90pptQh7rHSeXKjOS6g9eIET+CxeTOOCMJnYRBs9EWs6e7o+YVo\n\t0hP3HbfKW9NLQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date;\n\tbh=Z7GOK/fFFzV59ouyerKPz+mBpJ1VsiYEYq2C9B2xYMM=;\n\tb=nqp0nAJrCbadCRxkmp1J58bibJdr8AgVciivCjZBTgfDjY1lo1mEF+SknyGIFo8+RO\n\thcIebsEKzK+Qsquima5kNp9f4iUuo2vR29su9B9Th0uTFzkDtk1tkasNwCT0V2yxcZBU\n\tSkEpFZeFqFGNDPhntdmkgy2EQ/yr/WRIdTw4X+BzXWrci9aVl/MyGuikzZUdAdHnzNyv\n\tV+XO94OlHNP6KUl9fjUUogiWSe3KlcnQ+YVU4WT8ionVKHeoMBUETYvKKsNs9i0G8wmO\n\t3QIZrKSBHGZGj4XYtr28/OnXhNhULIUjGqmAdcJu9gUUf0tBL0n0nFDGDQIiDEp/mwBY\n\t/QOg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"nqp0nAJr\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date;\n\tbh=Z7GOK/fFFzV59ouyerKPz+mBpJ1VsiYEYq2C9B2xYMM=;\n\tb=AKAGEDcKzvDb8v0E9i/65hUN0J4g7exRBLFO+Ck7wL3l0WmHKq8FGeYtZRCjS2fRKz\n\tnPCOatg0Ddwdzh5B/86jJs7HgKgTZ3Xkz3PKJzgmbnJX1cL8cVWBNq5YhTjKyMSVOQFo\n\tlYkLnob3ExqtuFP+f7Enf468hlxvqINDO1iDFjiFrECy3jxFptQQ663HGyw8JIRbL7X+\n\tZsIXoSfe3kae3Y1GKMXM2pq/HNv9NXdSb6sGd0nIXEMfNAG6P/5fb5hUbYdeRZBENWRW\n\tVx3SXTzOKH92mlGUzamhWgNACiGYptMiVUlRVmlWGSuLkZVNo7D7eugLRTHf0qjcydUb\n\tnhLQ==","X-Gm-Message-State":"ACrzQf2dyC6udGLklLT1GeBDLMlu5YTtEfCg4KDW4HMq2mOUh8kGvpCL\n\t0dRDBkV7RLgQFmnvrZ6SfE0AlbGqtbobrE0m","X-Google-Smtp-Source":"AMsMyM6z2OULktCCJ19wI90YcoipPi84X6Lwzdm23QRdQicjv10GXgmQ+lBjC38AxgmJmOEsECzS8g==","X-Received":"by 2002:a05:600c:22d3:b0:3a8:424d:f386 with SMTP id\n\t19-20020a05600c22d300b003a8424df386mr4991159wmg.57.1663747382463; \n\tWed, 21 Sep 2022 01:03:02 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 21 Sep 2022 09:02:57 +0100","Message-Id":"<20220921080258.5268-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220921080258.5268-1-naush@raspberrypi.com>","References":"<20220921080258.5268-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 1/2] pipeline: raspberrypi: Add an\n\terror 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":"Add an error state used internally in the Raspberry Pi pipeline handler.\nCurrently this state is never set, but will be in a subsequent commit when a\ndevice timeout has been signalled.\n\nAdd a isRunning() helper to identify if the state machine is in a stopped/error\nstate.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 22 ++++++++++++-------\n 1 file changed, 14 insertions(+), 8 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex b4094898ca6c..5c8c89585200 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -253,9 +253,14 @@ public:\n \t * thread. So, we do not need to have any mutex to protect access to any\n \t * of the variables below.\n \t */\n-\tenum class State { Stopped, Idle, Busy, IpaComplete };\n+\tenum class State { Stopped, Idle, Busy, IpaComplete, Error };\n \tState state_;\n \n+\tbool isRunning()\n+\t{\n+\t\treturn state_ != State::Stopped && state_ != State::Error;\n+\t}\n+\n \tstruct BayerFrame {\n \t\tFrameBuffer *buffer;\n \t\tControlList controls;\n@@ -1109,7 +1114,7 @@ int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request)\n {\n \tRPiCameraData *data = cameraData(camera);\n \n-\tif (data->state_ == RPiCameraData::State::Stopped)\n+\tif (!data->isRunning())\n \t\treturn -EINVAL;\n \n \tLOG(RPI, Debug) << \"queueRequestDevice: New request.\";\n@@ -1708,7 +1713,7 @@ void RPiCameraData::enumerateVideoDevices(MediaLink *link)\n \n void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &controls)\n {\n-\tif (state_ == State::Stopped)\n+\tif (!isRunning())\n \t\treturn;\n \n \tFrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId);\n@@ -1744,7 +1749,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &\n \n void RPiCameraData::runIsp(uint32_t bufferId)\n {\n-\tif (state_ == State::Stopped)\n+\tif (!isRunning())\n \t\treturn;\n \n \tFrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId);\n@@ -1759,7 +1764,7 @@ void RPiCameraData::runIsp(uint32_t bufferId)\n \n void RPiCameraData::embeddedComplete(uint32_t bufferId)\n {\n-\tif (state_ == State::Stopped)\n+\tif (!isRunning())\n \t\treturn;\n \n \tFrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId);\n@@ -1825,7 +1830,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n \tRPi::Stream *stream = nullptr;\n \tint index;\n \n-\tif (state_ == State::Stopped)\n+\tif (!isRunning())\n \t\treturn;\n \n \tfor (RPi::Stream &s : unicam_) {\n@@ -1864,7 +1869,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n \n void RPiCameraData::ispInputDequeue(FrameBuffer *buffer)\n {\n-\tif (state_ == State::Stopped)\n+\tif (!isRunning())\n \t\treturn;\n \n \tLOG(RPI, Debug) << \"Stream ISP Input buffer complete\"\n@@ -1881,7 +1886,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)\n \tRPi::Stream *stream = nullptr;\n \tint index;\n \n-\tif (state_ == State::Stopped)\n+\tif (!isRunning())\n \t\treturn;\n \n \tfor (RPi::Stream &s : isp_) {\n@@ -1991,6 +1996,7 @@ void RPiCameraData::handleState()\n \tswitch (state_) {\n \tcase State::Stopped:\n \tcase State::Busy:\n+\tcase State::Error:\n \t\tbreak;\n \n \tcase State::IpaComplete:\n","prefixes":["libcamera-devel","v2","1/2"]}