From patchwork Mon Mar 29 09:15:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11763 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 4F2F5C32EA for ; Mon, 29 Mar 2021 09:16:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 96B1A68789; Mon, 29 Mar 2021 11:16:05 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NRKEP16P"; dkim-atps=neutral Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C42416877F for ; Mon, 29 Mar 2021 11:16:02 +0200 (CEST) Received: by mail-pj1-x1033.google.com with SMTP id k23-20020a17090a5917b02901043e35ad4aso7403946pji.3 for ; Mon, 29 Mar 2021 02:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vdx1G6q8gRT+ZTYY4TA1JLBhswZthEfpjAnfwKAzYK0=; b=NRKEP16PjS/1UaErjpelRTYg3Ha/Wi6KgxRrpR7UvmaX7GHaWlwakgvWm8tNXVgWQj ZBd1elduWIaWM//smvJGMHfmr34KmKuYf0avGmlub2YElm2/Ua8udnNFf6flSgd4SY9V DTKfFqVYJIAGYKUDBsSFb0qjY3+8csZiSIFYo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vdx1G6q8gRT+ZTYY4TA1JLBhswZthEfpjAnfwKAzYK0=; b=hcMRE0OatiJgBJ/Qg5I6wuzCDGfDnkDu2Q0xTx0Oxku+/CpwzXHogSC/u28y6cS8DD 2IIYp6VSJt8HaElMe7fZv6CTTRFjUYZA09pPIlwLFQuiUPmMiTv9TUg0fLghZ8P2LYU2 HG9W9Dd47GT4yRsdiR+6pOTqBFZdrafqq8umMWKXvNvQXMHInM3WZIsJRmDIDs2OeUX7 cNq/HADDJaRKDPxwBqXZ3NWZwwSoiVdA0Damqhp3P+2jWjCUzslL76s7bkxeppKjIeTj ajvew2VAWVwa8qjl9anWVpG5S5+9DdV1rtLQZfeT9RiFA5h7gXLdsLYnfmVP+yGc0kzv 5m4A== X-Gm-Message-State: AOAM533RtUd7Ofl+Id3T+9r7Kr5OOJHI9wQbF9saIBW9xGdH5xpm2juD iWPH12I5xCardcycW53KpBVKWLRIz3eWDw== X-Google-Smtp-Source: ABdhPJzp6DHTmIhiaK0IKKZaO7wdKXX81qlVtiZ49uxxxYZHhIYLN8oTYo87XTeN5zjP4u0V5J/OzA== X-Received: by 2002:a17:902:e051:b029:e7:37d9:f32e with SMTP id x17-20020a170902e051b02900e737d9f32emr10282403plx.78.1617009361207; Mon, 29 Mar 2021 02:16:01 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:1db7:ae60:9288:b906]) by smtp.gmail.com with ESMTPSA id n2sm15818122pga.57.2021.03.29.02.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 02:16:00 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 29 Mar 2021 18:15:51 +0900 Message-Id: <20210329091552.157208-3-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210329091552.157208-1-hiroh@chromium.org> References: <20210329091552.157208-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/3] libcamera: Request: Add RequestError to Status 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This adds a new libcamera::Request::Status, RequestError, which represents a request isn't successfully processed due to some error. Signed-off-by: Hirokazu Honda --- include/libcamera/request.h | 2 ++ src/libcamera/pipeline_handler.cpp | 5 ++++- src/libcamera/request.cpp | 17 +++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/include/libcamera/request.h b/include/libcamera/request.h index 6e5aad5f..598fcf86 100644 --- a/include/libcamera/request.h +++ b/include/libcamera/request.h @@ -30,6 +30,7 @@ public: RequestPending, RequestComplete, RequestCancelled, + RequestError, }; enum ReuseFlag { @@ -73,6 +74,7 @@ private: const uint64_t cookie_; Status status_; + bool error_; bool cancelled_; }; diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index eba00ed3..66326ce0 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -381,8 +381,11 @@ void PipelineHandler::queueRequest(Request *request) data->queuedRequests_.push_back(request); int ret = queueRequestDevice(camera, request); - if (ret) + if (ret) { + request->error_ = true; data->queuedRequests_.remove(request); + completeRequest(request); + } } /** diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index 0071667e..176f59dd 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -36,6 +36,8 @@ LOG_DEFINE_CATEGORY(Request) * The request has completed * \var Request::RequestCancelled * The request has been cancelled due to capture stop + * \var Request::RequestError + * The request is not completed successfully due to an error. */ /** @@ -73,7 +75,7 @@ LOG_DEFINE_CATEGORY(Request) */ Request::Request(Camera *camera, uint64_t cookie) : camera_(camera), cookie_(cookie), status_(RequestPending), - cancelled_(false) + error_(false), cancelled_(false) { /** * \todo Should the Camera expose a validator instance, to avoid @@ -126,6 +128,7 @@ void Request::reuse(ReuseFlag flags) } status_ = RequestPending; + error_ = false; cancelled_ = false; controls_->clear(); @@ -256,20 +259,22 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const /** * \brief Complete a queued request * - * Mark the request as complete by updating its status to RequestComplete, - * unless buffers have been cancelled in which case the status is set to - * RequestCancelled. + * Mark the request as complete by updating its status to RequestError on error, + * RequestCancelled if buffers have been cancelled, or otherwise RequestComplete. */ void Request::complete() { ASSERT(status_ == RequestPending); ASSERT(!hasPendingBuffers()); - status_ = cancelled_ ? RequestCancelled : RequestComplete; + if (error_) + status_ = RequestError; + else + status_ = cancelled_ ? RequestCancelled : RequestComplete; LOG(Request, Debug) << "Request has completed - cookie: " << cookie_ - << (cancelled_ ? " [Cancelled]" : ""); + << (error_ ? " [Error]" : (cancelled_ ? " [Cancelled]" : "")); LIBCAMERA_TRACEPOINT(request_complete, this); }