{"id":11869,"url":"https://patchwork.libcamera.org/api/patches/11869/?format=json","web_url":"https://patchwork.libcamera.org/patch/11869/","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":"<20210408085101.1691729-4-hiroh@chromium.org>","date":"2021-04-08T08:51:01","name":"[libcamera-devel,RFC,v3,3/3] libcamera: ipu3: Cancel pending requests correctly","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"63ed716ba5918c30da7a1fc39e8420a5d085d8b9","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/11869/mbox/","series":[{"id":1904,"url":"https://patchwork.libcamera.org/api/series/1904/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1904","date":"2021-04-08T08:50:58","name":"ipu3: Enable to handle a number of concurrent requests","version":3,"mbox":"https://patchwork.libcamera.org/series/1904/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11869/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11869/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 D7FD4BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Apr 2021 08:51:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 913C5687F6;\n\tThu,  8 Apr 2021 10:51:15 +0200 (CEST)","from mail-pl1-x634.google.com (mail-pl1-x634.google.com\n\t[IPv6:2607:f8b0:4864:20::634])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AA38D687F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Apr 2021 10:51:13 +0200 (CEST)","by mail-pl1-x634.google.com with SMTP id y2so672557plg.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 08 Apr 2021 01:51:13 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:8822:ec6c:14d8:eea9])\n\tby smtp.gmail.com with ESMTPSA id\n\tg80sm1755993pfb.181.2021.04.08.01.51.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 08 Apr 2021 01:51:11 -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=\"ZgJOGWmy\"; 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=mQqZcpFm3UO7FM2H86Vrjewz6c/Xzh1LXMTgj5/NsN4=;\n\tb=ZgJOGWmye3XJ2bJSQKPNxpp++dn2EEUIrzOo9xXGdSuYsl2Uv5jDl+yE2at2YaD//j\n\t/3oM2xhQpVtULseI6n8zUekOBBiPsacSyM7k3xjcDP55/a+ghHqVEtqMluvXOewq7KsF\n\tjl5AyL/hW3EIy8C0bNx2gHUVIhiNfvbMLhEC0=","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=mQqZcpFm3UO7FM2H86Vrjewz6c/Xzh1LXMTgj5/NsN4=;\n\tb=ZvKkxj71jw3sWMrZNEhnXL+WUpekT45rqj7yUsnl4g8kCyqYnSBUKbMbSa/4nh3xbJ\n\tLE02fuAG7srh02A7V/sbPzkyEjXePrWc5P2LRovSlpzxHMyiGMurvnl1zI5sCrk2/ETE\n\tMVfVUZB60BIlDXI77uZFTv8eF61GeKo2xkQ6Rnu24RTpeNHiL6RC5+Pm+oQuZ4RWYY+E\n\tsZ/RD1oipOhFjAwN7VS5ROc0fokAuOTCoC/LeGNG0hU97Z8An0pTNuwJZLZ33irc6uuR\n\txzeTP0uxXAUhRjw4C7pmsVBKCtwyMftFvZn0tFpBQsrs1LVEudqwqb1xOuLDYqso40iB\n\ttJRw==","X-Gm-Message-State":"AOAM530MKY4IjHh+MX8+KdyPJ6DhdapT9Yjj8G7a/AAfBg0jcrp1RmgT\n\t9qSx9hpcVIcp+z0Lg1YBZwiU1iRmJOSePQ==","X-Google-Smtp-Source":"ABdhPJyLDLerA6PMhDotUtv3n4BjwQMaNYWbjtGg6W6MOwZ5Y7dxj97gUs5SYsxXZ4MuvgRbprdIgQ==","X-Received":"by 2002:a17:902:b201:b029:e8:bf9e:990a with SMTP id\n\tt1-20020a170902b201b02900e8bf9e990amr6781413plr.56.1617871871983; \n\tThu, 08 Apr 2021 01:51:11 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  8 Apr 2021 17:51:01 +0900","Message-Id":"<20210408085101.1691729-4-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.208.g409f899ff0-goog","In-Reply-To":"<20210408085101.1691729-1-hiroh@chromium.org>","References":"<20210408085101.1691729-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [RFC PATCH v3 3/3] libcamera: ipu3: Cancel\n\tpending requests correctly","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":"IPU3CameraData stores requests that are not queued yet to a\ncamera node. They should be reported as cancel upon\nPipelineHandlerIPU3::stop().\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/buffer.h           |  3 +++\n src/libcamera/pipeline/ipu3/ipu3.cpp | 19 ++++++++++++++++++-\n 2 files changed, 21 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\nindex 620f8a66..72c62144 100644\n--- a/include/libcamera/buffer.h\n+++ b/include/libcamera/buffer.h\n@@ -58,6 +58,9 @@ private:\n \n \tfriend class V4L2VideoDevice; /* Needed to update metadata_. */\n \n+\t/*! HACK! */\n+\tfriend class IPU3CameraData; /* Needed to update metadata_. */\n+\n \tstd::vector<Plane> planes_;\n \n \tRequest *request_;\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 462a0d9b..f89b8f3f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -66,6 +66,7 @@ public:\n \tvoid cio2BufferReady(FrameBuffer *buffer);\n \tvoid paramBufferReady(FrameBuffer *buffer);\n \tvoid statBufferReady(FrameBuffer *buffer);\n+\tvoid cancelPendingRequests();\n \tint queuePendingRequests();\n \n \tCIO2Device cio2_;\n@@ -768,7 +769,7 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \tIPU3CameraData *data = cameraData(camera);\n \tint ret = 0;\n \n-\tdata->pendingRequests_ = {};\n+\tdata->cancelPendingRequests();\n \n \tdata->ipa_->stop();\n \n@@ -780,6 +781,22 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \tfreeBuffers(camera);\n }\n \n+void IPU3CameraData::cancelPendingRequests()\n+{\n+\twhile (!pendingRequests_.empty()) {\n+\t\tRequest *request = pendingRequests_.front();\n+\n+\t\tfor (auto it : request->buffers()) {\n+\t\t\tFrameBuffer *buffer = it.second;\n+\t\t\tbuffer->metadata_.status = FrameMetadata::FrameCancelled;\n+\t\t\tpipe_->completeBuffer(request, buffer);\n+\t\t}\n+\n+\t\tpipe_->completeRequest(request);\n+\t\tpendingRequests_.pop();\n+\t}\n+}\n+\n int IPU3CameraData::queuePendingRequests()\n {\n \twhile (!pendingRequests_.empty()) {\n","prefixes":["libcamera-devel","RFC","v3","3/3"]}