From patchwork Fri Sep 16 10:05:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17372 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C90FAC0DA4 for ; Fri, 16 Sep 2022 10:05:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1A4C561FB0; Fri, 16 Sep 2022 12:05:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1663322727; bh=bdeiGJbr7u7LP9iu01w1eABMxGGF0KnxyR9VCC3RH8w=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Lp4q8Nb3vF7xlhX/A56pU+sM51bEbZqlZwYsbgi/vkWwVDhHLInJxzTopHMGdH9rR BZ3Qmr40TQkhKfohMY/x3FIgNiJDy3rfb73EBH0SV2ks2XHE4XtJx9TZj+ArrRwnjz Wofo/24Yi2Abf6qHiUpRZr1e8NjxcQ6wA26KDPs6gIdPmQdwhir7OLL3uFopytVNxT c1kfP4Kg0TegLmT/knZe/WC1A2oUKFZ9Abd9dP2dqirKbghBXuCVDpMx5BsNez205n 18zeMN03AWNW3DX2wvx6peuVrOedUxOneDFVHTZX832+noLFT2jv0a8ygdZbSm/0Hj JH3L39yweK1rw== Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CDB0C6099B for ; Fri, 16 Sep 2022 12:05:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="QH5QneBI"; dkim-atps=neutral Received: by mail-wr1-x429.google.com with SMTP id z6so2704807wrq.1 for ; Fri, 16 Sep 2022 03:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=++Pp3uxOune9JHLV8GT78Y14hhcSIm7V/rRyxRBxhtE=; b=QH5QneBIvJoNtRKiCIXxr/XhHI/9IjblztCw09+GviQ8vJI5PyiHrN7IWc52KkDvt3 Q5fcXmEqzjdYrOmBIwocZTN+pp5zAwquGUL8NKlmIWN2ygYNq2aBznvNMNDpn5T6j3f3 IoCkDjjVAPxtmU2X6oJGJi6RI286TTsoAEA41/J+3wpY4ylB7llZGVg+fjtcHs6/cZeI JHZ/S8NkOLQ/lYRmsYp5mOrwJWxGPIapdcJRrfrXbZvbLWCB5U8FSPQofZ92YR0TQWpK GEhfBgo8jQH5GSFMYzLrJGKFghSDDRZHwnYBdg1VjfG9n5eQByTEYpsAoFpF2z7QTK8B JMSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=++Pp3uxOune9JHLV8GT78Y14hhcSIm7V/rRyxRBxhtE=; b=L+k2HpmM2atdnflpOjw8zB61KZgK/Gb33Kqrwd0Qk0VA8wuTgmOjz9L0VL2/TclFqp WNUqQrgyQa9XunI6Q+3te1q3xyG5kIgJJz9c4i4pLtSWTB4Qesw0fEG9RmVmbT6ACfPP tKPF7CQjbHxibqXtjXP/FEg/jyW5r313HIj00ZDiISwySEbgjFQo7Yiu3Z4HxrIlbpyc 4G4PNEoE7vTeB0rSUd5c33kzhQDvQbitfBO+l0r+xPGvusRCZIHaL+D3Rv06IEh8GE8v BD+5c2AmdbpfPVKxtK7llezB2u8+uQ8jEDE36PPtQ2VAmiKtKgljLz4b2DWKOV38l7b7 tzcg== X-Gm-Message-State: ACrzQf3OaWtqHK7f0eKPRqP1P04xueEYEGe4A+gutOqQgzYrricmlO6I AKGWMkorRp9QehD1ZvAciAOGsuQc6PCyHOBN X-Google-Smtp-Source: AMsMyM5G7Gfi+aZnJs6Tv5eItK0g/17NJgVKvKayJgwirGE7tqIQkSJe8/iv1LEeDmGs/iuwRSl0Kw== X-Received: by 2002:adf:d1ce:0:b0:22a:36d6:da05 with SMTP id b14-20020adfd1ce000000b0022a36d6da05mr2434562wrd.719.1663322725098; Fri, 16 Sep 2022 03:05:25 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id e13-20020adfa74d000000b002286231f479sm4632026wrd.50.2022.09.16.03.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 03:05:24 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 16 Sep 2022 11:05:16 +0100 Message-Id: <20220916100517.12446-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220916100517.12446-1-naush@raspberrypi.com> References: <20220916100517.12446-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 1/2] pipeline: raspberrypi: Add an error state X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add an error state used internally in the Raspberry Pi pipeline handler. Currently this state is never set, but will be in a subsequent commit when a device timeout has been signalled. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham --- .../pipeline/raspberrypi/raspberrypi.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index b4094898ca6c..d429cb444d58 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -253,7 +253,7 @@ public: * thread. So, we do not need to have any mutex to protect access to any * of the variables below. */ - enum class State { Stopped, Idle, Busy, IpaComplete }; + enum class State { Stopped, Idle, Busy, IpaComplete, Error }; State state_; struct BayerFrame { @@ -1109,7 +1109,8 @@ int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request) { RPiCameraData *data = cameraData(camera); - if (data->state_ == RPiCameraData::State::Stopped) + if (data->state_ == RPiCameraData::State::Stopped || + data->state_ == RPiCameraData::State::Error) return -EINVAL; LOG(RPI, Debug) << "queueRequestDevice: New request."; @@ -1708,7 +1709,7 @@ void RPiCameraData::enumerateVideoDevices(MediaLink *link) void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &controls) { - if (state_ == State::Stopped) + if (state_ == State::Stopped || state_ == State::Error) return; FrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId); @@ -1744,7 +1745,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList & void RPiCameraData::runIsp(uint32_t bufferId) { - if (state_ == State::Stopped) + if (state_ == State::Stopped || state_ == State::Error) return; FrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId); @@ -1759,7 +1760,7 @@ void RPiCameraData::runIsp(uint32_t bufferId) void RPiCameraData::embeddedComplete(uint32_t bufferId) { - if (state_ == State::Stopped) + if (state_ == State::Stopped || state_ == State::Error) return; FrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId); @@ -1825,7 +1826,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer) RPi::Stream *stream = nullptr; int index; - if (state_ == State::Stopped) + if (state_ == State::Stopped || state_ == State::Error) return; for (RPi::Stream &s : unicam_) { @@ -1864,7 +1865,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer) void RPiCameraData::ispInputDequeue(FrameBuffer *buffer) { - if (state_ == State::Stopped) + if (state_ == State::Stopped || state_ == State::Error) return; LOG(RPI, Debug) << "Stream ISP Input buffer complete" @@ -1881,7 +1882,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer) RPi::Stream *stream = nullptr; int index; - if (state_ == State::Stopped) + if (state_ == State::Stopped || state_ == State::Error) return; for (RPi::Stream &s : isp_) { @@ -1991,6 +1992,7 @@ void RPiCameraData::handleState() switch (state_) { case State::Stopped: case State::Busy: + case State::Error: break; case State::IpaComplete: