{"id":11752,"url":"https://patchwork.libcamera.org/api/1.1/patches/11752/?format=json","web_url":"https://patchwork.libcamera.org/patch/11752/","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":"<20210329002715.74403-3-hiroh@chromium.org>","date":"2021-03-29T00:27:14","name":"[libcamera-devel,2/3] libcamera: Request: Add an error value","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"315aa3a344536e9058cc6f4a8fe429e8d0a5fc30","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11752/mbox/","series":[{"id":1856,"url":"https://patchwork.libcamera.org/api/1.1/series/1856/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1856","date":"2021-03-29T00:27:12","name":"Handle an request error","version":1,"mbox":"https://patchwork.libcamera.org/series/1856/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11752/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11752/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 38C12C32ED\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Mar 2021 00:27:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EA8FD6878B;\n\tMon, 29 Mar 2021 02:27:29 +0200 (CEST)","from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com\n\t[IPv6:2607:f8b0:4864:20::62a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 76D626877C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Mar 2021 02:27:27 +0200 (CEST)","by mail-pl1-x62a.google.com with SMTP id g10so3577665plt.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 28 Mar 2021 17:27:27 -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\tj188sm15227209pfd.64.2021.03.28.17.27.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 28 Mar 2021 17:27:25 -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=\"AYzK/x21\"; 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=wdPP1Ko5IWsl0/+XDtJ9kFAPZim+486TEQ9K9uaCUEo=;\n\tb=AYzK/x212EgUM4i2AawObJZJp4w4XkD5R54CXIBkyQ+Jk1JNb8BksXJRWnd6c9rLjY\n\tbuzC4o7QXXs88d/mX7YX+qRLJ9mVSyaZ6ZWFqgRITWsBvlZxx7Pz9HnwQXryZwAq9Y+R\n\t6mbF5eV1HfWMVFEvOfaepyF2epPsh2eZPlCBM=","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=wdPP1Ko5IWsl0/+XDtJ9kFAPZim+486TEQ9K9uaCUEo=;\n\tb=iBCwhCFuqTQl+P0JXqhWNxymKjmwS2a9Con0AxBmTU1tXIJkHCZiDME6WNbzV4WyXm\n\tGvn9nYop4PqL/Sin5c+wL229d0+Wb7dnVu00FgvuFIrf53/4Kf4Xdq1lX2lg2fGsCCzK\n\tR9IPlMOob/Q8NNVKM2ru5iYqdR9G4tQ70ysWKti4zmfLply+oPUWh71A55Ns3NRpuWeV\n\tN4+xaa+aoVckS8GpDXl+A2IF1PD5rK4ZLOGT1Qkz5LwPkvm0EF+EvjTQzE44G6lBdy2P\n\tGARLpPbwGedskOuQNKbXTcq+V0N0J2x9aXDWAYjRhserhthslzm+/3FN9x4MAoZAmCd7\n\t8DQw==","X-Gm-Message-State":"AOAM532qLHVugWHkf9P2oXmHADUGYtlDHMtggUEkeT1XUAmRy94IsLHm\n\teYxGoGdPAhOuqZQ56JHBOAeHFyEDV0EwRQ==","X-Google-Smtp-Source":"ABdhPJzSzsQfwDWfIZwXsBNfys2eg/f8vIsrubw3VMNG7wLFTrTTwRWb9abBD3GgI44RGhFtq7HZuw==","X-Received":"by 2002:a17:902:a9c2:b029:e7:147f:76a1 with SMTP id\n\tb2-20020a170902a9c2b02900e7147f76a1mr21486022plr.5.1616977645973; \n\tSun, 28 Mar 2021 17:27:25 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 29 Mar 2021 09:27:14 +0900","Message-Id":"<20210329002715.74403-3-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.291.g576ba9dcdaf-goog","In-Reply-To":"<20210329002715.74403-1-hiroh@chromium.org>","References":"<20210329002715.74403-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 2/3] libcamera: Request: Add an error value","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":"libcamera::Request returned by Camera::requestComplete() is\nalways assumed. Therefore, an error occurred in\nPipelineHandler::queueRequest() is ignored.\nThis adds an error value, which is zero on success, to\nlibcamera::Request() so that a Camera client can know the request\nerror in completing request.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/request.h        |  2 ++\n src/libcamera/pipeline_handler.cpp |  6 ++++--\n src/libcamera/request.cpp          | 21 ++++++++++++++++-----\n 3 files changed, 22 insertions(+), 7 deletions(-)","diff":"diff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex 6e5aad5f..60e91d5f 100644\n--- a/include/libcamera/request.h\n+++ b/include/libcamera/request.h\n@@ -52,6 +52,7 @@ public:\n \n \tuint64_t cookie() const { return cookie_; }\n \tStatus status() const { return status_; }\n+\tint result() const { return result_; }\n \n \tbool hasPendingBuffers() const { return !pending_.empty(); }\n \n@@ -73,6 +74,7 @@ private:\n \n \tconst uint64_t cookie_;\n \tStatus status_;\n+\tint result_;\n \tbool cancelled_;\n };\n \ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 05b807d6..a9a5523b 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -383,8 +383,10 @@ void PipelineHandler::queueRequest(Request *request)\n \tdata->queuedRequests_.push_back(request);\n \n \tint ret = queueRequestDevice(camera, request);\n-\tif (ret)\n-\t\tdata->queuedRequests_.remove(request);\n+\tif (ret) {\n+\t\trequest->result_ = ret;\n+\t\tcompleteRequest(request);\n+\t}\n }\n \n /**\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex 0071667e..8106437e 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -72,7 +72,7 @@ LOG_DEFINE_CATEGORY(Request)\n  *\n  */\n Request::Request(Camera *camera, uint64_t cookie)\n-\t: camera_(camera), cookie_(cookie), status_(RequestPending),\n+\t: camera_(camera), cookie_(cookie), status_(RequestPending), result_(0),\n \t  cancelled_(false)\n {\n \t/**\n@@ -236,15 +236,26 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const\n  * \\fn Request::status()\n  * \\brief Retrieve the request completion status\n  *\n- * The request status indicates whether the request has completed successfully\n- * or with an error. When requests are created and before they complete the\n- * request status is set to RequestPending, and is updated at completion time\n- * to RequestComplete. If a request is cancelled at capture stop before it has\n+ * The request status indicates whether the request has pended, completed or\n+ * cancelled.. When requests are created and before they complete the request\n+ * status is set to RequestPending, and is updated at completion time to\n+ * RequestComplete. If a request is cancelled at capture stop before it has\n  * completed, its status is set to RequestCancelled.\n  *\n  * \\return The request completion status\n  */\n \n+/**\n+ * \\fn Request::result()\n+ * \\brief Retrieve the error value of the request .\n+ *\n+ * The request error indicates whether the request has completed successfully or\n+ * with an error. It is a negative value if an error happens in queueing and\n+ * processing the request, or 0 on success.\n+ *\n+ * \\return The request error value.\n+ */\n+\n /**\n  * \\fn Request::hasPendingBuffers()\n  * \\brief Check if a request has buffers yet to be completed\n","prefixes":["libcamera-devel","2/3"]}