From patchwork Fri Sep 16 10:05:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17373 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 0D804C327D for ; Fri, 16 Sep 2022 10:05:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A31E561FF4; Fri, 16 Sep 2022 12:05:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1663322729; bh=EzWkA6pk8E2g3hENOYf1fsFrzDirRIxhvEn2CQmvTgE=; 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=yObepkHa5Nczxe9YQLj7CGhKRG19HN+TCBGroGMsNKBq4Rsnf1DrdJMBcIxBhCwym A94wLuaLbfIEjgkLNDsyhnzn2baT9Y3wo9eM9mXeOJzCpScIsjm6es6DHzDE5tr+SK jtcnHjQhWlR0yjmAijRyEtTaZ1lKTqmsPy2GyP7s9s7yCEmX4i9n7bPs75wwofMsPr OLpbnViPpeATvQLWsfdD4VkjpjYYxXFszzIS20ckfRqkQVpIR5cLnsca0VVqnDqENO ZJvmc/+aMTh0pOy8zIMmANuiaHA8XbTaoRXRl9F4KDa67Mf+1dmc1MJsrokMCCiVfZ Szqb8vPicTG6w== Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B064361FB4 for ; Fri, 16 Sep 2022 12:05:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="sZufrU+Y"; dkim-atps=neutral Received: by mail-wr1-x42a.google.com with SMTP id t7so35167877wrm.10 for ; Fri, 16 Sep 2022 03:05:26 -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=zBdSbHDzOYtFo6cBPiKh6r56tg2FXiywwgw/c3JyCU0=; b=sZufrU+Yx/28YbXGUlV8FkyiR7HIMoXyMqFoIGOgrV/FdMituA7Skx1Ed3+NAuN5fg yZ/kZCjR9gb/ACuuQaX/HWf6t12FAgL2E8VpMEKSDxSSv2JyN/jJ2QgtCIajMoD8stKR 4Z4zL0ckJiP968Uh9bcG2kHmxMwI6rc3OW7rh/kxCWqi9Nfb31K1Q5eYgo0kEsQ0k4rk scopXNKowk0BY9gKRZtCbBhp5cOi4V+PDSgo2/oZreOoZy5FQ4dWGXe+2uLphW+t9f3F X1tTXC5enjFT7IU1us+kFKDfh3X9txr29jjg9DNdX68suwI9wQV7PmfJUvEUIhjumQfw YLTw== 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=zBdSbHDzOYtFo6cBPiKh6r56tg2FXiywwgw/c3JyCU0=; b=tTqlcb525OP6VWHr/5QU6ELd0RviFUdePHReG74YT3BkMgCxTUTnQipeAwKdO0QlnV 3tNZdqNDWqJTyT3E6rn+/kKU3OgVOqE4grSrvNRl61PDvfPtgCY+uWlv8lugOa5uLTYd SMrAfyj45WhF2Vx7cfES34tijP4BOtWSBWmB0mUjpi2kgwqlecTztvYKcJR/lOft/DA4 apvQ9IgwT5V2FxEwVt6CChFwo+EO1eRmIi6H+lZbvfLFtNRuh103eUIOHS4Y73uThsRf ozhgc2we9kB4Bn1SWtHQq9kDurpG5rWeif3YFDA+HMa1B6mpRnvxFv8xKNyuK3Mk0v+A NBSw== X-Gm-Message-State: ACrzQf1XKKtDJtmWX5jfcY3lK7+S6Cads4xazEIh0B/SE15tXObeJitn ZRzFWmaBtdo8yt1lK+uAXasFlaYrJLkr+bIr X-Google-Smtp-Source: AMsMyM7nFZYGP9bG2pgnG/Xr+7eyb5EqVyjjhESZfIdeqjvu0m5JoUiXeR3k6NDYkCxSQ4vKddjNmA== X-Received: by 2002:a05:6000:1048:b0:228:6898:aa50 with SMTP id c8-20020a056000104800b002286898aa50mr2277813wrx.233.1663322725996; 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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 03:05:25 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 16 Sep 2022 11:05:17 +0100 Message-Id: <20220916100517.12446-3-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 2/2] pipeline: raspberrypi: Improve Unicam timeout handling 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" Currently, if a Unicam timeout is signalled, the pipeline handler only raises an error message. Update the error handling to put the pipeline handler in an internal error state, disable all device streams, and return all outstanding requests as cancelled. Any subsequent requests that come into the pipeline handler will also be returned as cancelled. Any further error handling (e.g. a reset with camera stop()/start()) is up to the application to perform as it requires. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index d429cb444d58..4464d4d07f15 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1819,6 +1819,17 @@ void RPiCameraData::unicamTimeout() LOG(RPI, Error) << "Unicam has timed out!"; LOG(RPI, Error) << "Please check that your camera sensor connector is attached securely."; LOG(RPI, Error) << "Alternatively, try another cable and/or sensor."; + + state_ = RPiCameraData::State::Error; + /* + * To allow the application to attempt a recovery from this timeout, + * stop all device streaming, and return any outstanding requests as + * incomplete and cancelled. + */ + for (auto const stream : streams_) + stream->dev()->streamOff(); + + clearIncompleteRequests(); } void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)