{"id":11763,"url":"https://patchwork.libcamera.org/api/patches/11763/?format=json","web_url":"https://patchwork.libcamera.org/patch/11763/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210329091552.157208-3-hiroh@chromium.org>","date":"2021-03-29T09:15:51","name":"[libcamera-devel,v2,2/3] libcamera: Request: Add RequestError to Status","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"542fffb6e1b5f6d914a8ee5f1461cfaef7d98a42","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11763/mbox/","series":[{"id":1860,"url":"https://patchwork.libcamera.org/api/series/1860/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1860","date":"2021-03-29T09:15:49","name":"Add RequestError to Request::Status","version":2,"mbox":"https://patchwork.libcamera.org/series/1860/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11763/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11763/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 4F2F5C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Mar 2021 09:16:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 96B1A68789;\n\tMon, 29 Mar 2021 11:16:05 +0200 (CEST)","from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com\n\t[IPv6:2607:f8b0:4864:20::1033])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C42416877F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Mar 2021 11:16:02 +0200 (CEST)","by mail-pj1-x1033.google.com with SMTP id\n\tk23-20020a17090a5917b02901043e35ad4aso7403946pji.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Mar 2021 02:16:02 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:1db7:ae60:9288:b906])\n\tby smtp.gmail.com with ESMTPSA id\n\tn2sm15818122pga.57.2021.03.29.02.16.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Mar 2021 02:16:00 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"NRKEP16P\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=vdx1G6q8gRT+ZTYY4TA1JLBhswZthEfpjAnfwKAzYK0=;\n\tb=NRKEP16PjS/1UaErjpelRTYg3Ha/Wi6KgxRrpR7UvmaX7GHaWlwakgvWm8tNXVgWQj\n\tZBd1elduWIaWM//smvJGMHfmr34KmKuYf0avGmlub2YElm2/Ua8udnNFf6flSgd4SY9V\n\tDTKfFqVYJIAGYKUDBsSFb0qjY3+8csZiSIFYo=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=vdx1G6q8gRT+ZTYY4TA1JLBhswZthEfpjAnfwKAzYK0=;\n\tb=hcMRE0OatiJgBJ/Qg5I6wuzCDGfDnkDu2Q0xTx0Oxku+/CpwzXHogSC/u28y6cS8DD\n\t2IIYp6VSJt8HaElMe7fZv6CTTRFjUYZA09pPIlwLFQuiUPmMiTv9TUg0fLghZ8P2LYU2\n\tHG9W9Dd47GT4yRsdiR+6pOTqBFZdrafqq8umMWKXvNvQXMHInM3WZIsJRmDIDs2OeUX7\n\tcNq/HADDJaRKDPxwBqXZ3NWZwwSoiVdA0Damqhp3P+2jWjCUzslL76s7bkxeppKjIeTj\n\tajvew2VAWVwa8qjl9anWVpG5S5+9DdV1rtLQZfeT9RiFA5h7gXLdsLYnfmVP+yGc0kzv\n\t5m4A==","X-Gm-Message-State":"AOAM533RtUd7Ofl+Id3T+9r7Kr5OOJHI9wQbF9saIBW9xGdH5xpm2juD\n\tiWPH12I5xCardcycW53KpBVKWLRIz3eWDw==","X-Google-Smtp-Source":"ABdhPJzp6DHTmIhiaK0IKKZaO7wdKXX81qlVtiZ49uxxxYZHhIYLN8oTYo87XTeN5zjP4u0V5J/OzA==","X-Received":"by 2002:a17:902:e051:b029:e7:37d9:f32e with SMTP id\n\tx17-20020a170902e051b02900e737d9f32emr10282403plx.78.1617009361207; \n\tMon, 29 Mar 2021 02:16:01 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","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\n\tRequestError to Status","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This adds a new libcamera::Request::Status, RequestError, which\nrepresents a request isn't successfully processed due to some\nerror.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/request.h        |  2 ++\n src/libcamera/pipeline_handler.cpp |  5 ++++-\n src/libcamera/request.cpp          | 17 +++++++++++------\n 3 files changed, 17 insertions(+), 7 deletions(-)","diff":"diff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex 6e5aad5f..598fcf86 100644\n--- a/include/libcamera/request.h\n+++ b/include/libcamera/request.h\n@@ -30,6 +30,7 @@ public:\n \t\tRequestPending,\n \t\tRequestComplete,\n \t\tRequestCancelled,\n+\t\tRequestError,\n \t};\n \n \tenum ReuseFlag {\n@@ -73,6 +74,7 @@ private:\n \n \tconst uint64_t cookie_;\n \tStatus status_;\n+\tbool error_;\n \tbool cancelled_;\n };\n \ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex eba00ed3..66326ce0 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -381,8 +381,11 @@ void PipelineHandler::queueRequest(Request *request)\n \tdata->queuedRequests_.push_back(request);\n \n \tint ret = queueRequestDevice(camera, request);\n-\tif (ret)\n+\tif (ret) {\n+\t\trequest->error_ = true;\n \t\tdata->queuedRequests_.remove(request);\n+\t\tcompleteRequest(request);\n+\t}\n }\n \n /**\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex 0071667e..176f59dd 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -36,6 +36,8 @@ LOG_DEFINE_CATEGORY(Request)\n  * The request has completed\n  * \\var Request::RequestCancelled\n  * The request has been cancelled due to capture stop\n+ * \\var Request::RequestError\n+ * The request is not completed successfully due to an error.\n  */\n \n /**\n@@ -73,7 +75,7 @@ LOG_DEFINE_CATEGORY(Request)\n  */\n Request::Request(Camera *camera, uint64_t cookie)\n \t: camera_(camera), cookie_(cookie), status_(RequestPending),\n-\t  cancelled_(false)\n+\t  error_(false), cancelled_(false)\n {\n \t/**\n \t * \\todo Should the Camera expose a validator instance, to avoid\n@@ -126,6 +128,7 @@ void Request::reuse(ReuseFlag flags)\n \t}\n \n \tstatus_ = RequestPending;\n+\terror_ = false;\n \tcancelled_ = false;\n \n \tcontrols_->clear();\n@@ -256,20 +259,22 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const\n /**\n  * \\brief Complete a queued request\n  *\n- * Mark the request as complete by updating its status to RequestComplete,\n- * unless buffers have been cancelled in which case the status is set to\n- * RequestCancelled.\n+ * Mark the request as complete by updating its status to RequestError on error,\n+ * RequestCancelled if buffers have been cancelled, or otherwise RequestComplete.\n  */\n void Request::complete()\n {\n \tASSERT(status_ == RequestPending);\n \tASSERT(!hasPendingBuffers());\n \n-\tstatus_ = cancelled_ ? RequestCancelled : RequestComplete;\n+\tif (error_)\n+\t\tstatus_ = RequestError;\n+\telse\n+\t\tstatus_ = cancelled_ ? RequestCancelled : RequestComplete;\n \n \tLOG(Request, Debug)\n \t\t<< \"Request has completed - cookie: \" << cookie_\n-\t\t<< (cancelled_ ? \" [Cancelled]\" : \"\");\n+\t\t<< (error_ ? \" [Error]\" : (cancelled_ ? \" [Cancelled]\" : \"\"));\n \n \tLIBCAMERA_TRACEPOINT(request_complete, this);\n }\n","prefixes":["libcamera-devel","v2","2/3"]}