{"id":12258,"url":"https://patchwork.libcamera.org/api/1.1/patches/12258/?format=json","web_url":"https://patchwork.libcamera.org/patch/12258/","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":"<20210513022946.2194341-2-hiroh@chromium.org>","date":"2021-05-13T02:29:46","name":"[libcamera-devel,v5,2/2] libcamera: ipu3: Try queuing pending requests if a buffer is available","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"de9c3d2768ed590aca7b1bdc74cedf2658f1429a","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/12258/mbox/","series":[{"id":2021,"url":"https://patchwork.libcamera.org/api/1.1/series/2021/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2021","date":"2021-05-13T02:29:45","name":"[libcamera-devel,v5,1/2] pipeline: ipu3: Store requests in the case a buffer shortage","version":5,"mbox":"https://patchwork.libcamera.org/series/2021/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12258/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12258/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 08BDBC1D12\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 May 2021 02:29:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B313B6890C;\n\tThu, 13 May 2021 04:29:58 +0200 (CEST)","from mail-pg1-x536.google.com (mail-pg1-x536.google.com\n\t[IPv6:2607:f8b0:4864:20::536])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D3DC61538\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 May 2021 04:29:55 +0200 (CEST)","by mail-pg1-x536.google.com with SMTP id l70so5213271pga.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 May 2021 19:29:55 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:90f6:be0f:1d8a:d075])\n\tby smtp.gmail.com with ESMTPSA id\n\td23sm864358pfo.80.2021.05.12.19.29.52\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 12 May 2021 19:29:53 -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=\"G+2X2RIC\"; 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=oMa7Vy9hAg4h3M6ksclEDRx2X0pK1VHQzHhYJOvclkI=;\n\tb=G+2X2RIC1NLK9z9FlMU0AZMS+MlcinpTHyVWp/Hxh783XPLdFwIzycp+FVTqaWlPZw\n\t2a0wvkBS9agJHSuL5IvlC/ZQDopnqJJ6/QiZPTargX/txEc1QpdHZx/auvp2asmjy+AW\n\tAt5a9YYHw38idVqKmD6uLeF8uTpFknXcn68UE=","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=oMa7Vy9hAg4h3M6ksclEDRx2X0pK1VHQzHhYJOvclkI=;\n\tb=hmALgcdFNczmXtkyrFZY16x7y39cOJgCcoCjMf8MxhNwqcggKAQQSs62kC86f3tGnC\n\tQ7DFpHynGf5qSBPzOt5d4ESUGJAjBVrXRx2XbtlFabZPKXhEVEKIly9OGsleF0Kj8zRE\n\t7f29dSot4GlM3888v9lpcSD/m0iu3zICqEBBmC48Qg6DSJODaIiivJkM9r6T6LCRwstg\n\tnf3M8VDw1bPcGKs5edKs/wsgyA0oqpQy32d9kLshRGKZWP3KVihjz067zeztRL8fckr7\n\tqh1ROscJcZO+YUMtxKFuCLPY2Y4YNAwhzO2y0ir4TrVIPQ/aUkByalHKfJdRv7TI3zur\n\tLoug==","X-Gm-Message-State":"AOAM532vl+ASB93sx7SabM3SvKobHEnHF+fyM+UEx77vJgVi2fL4Af+J\n\thnsz/6Wb7qanEbOOGNnDaYLPw/w8lEDFug==","X-Google-Smtp-Source":"ABdhPJzEFO5pSORlLGiTcphtGDn10Xco33xwPUIQc7S3kJuJ6kPoXCIMZts1s0JQ7e2ux6z6Nisp9A==","X-Received":"by 2002:a17:90b:4a4e:: with SMTP id\n\tlb14mr1906031pjb.115.1620872993746; \n\tWed, 12 May 2021 19:29:53 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 13 May 2021 11:29:46 +0900","Message-Id":"<20210513022946.2194341-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.1.607.g51e8a6a459-goog","In-Reply-To":"<20210513022946.2194341-1-hiroh@chromium.org>","References":"<20210513022946.2194341-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v5 2/2] libcamera: ipu3: Try queuing\n\tpending requests if a buffer is available","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 have been failed due to a\nbuffer shortage. The requests should be retried once enough\nbuffers are available. This sets the retry function as signal to\nCIO2Device and IPU3Frame, and invokes it from\nCIO2Device::tryReturnBuffer() and IPU3Frame::remove().\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/libcamera/pipeline/ipu3/cio2.cpp   | 2 ++\n src/libcamera/pipeline/ipu3/cio2.h     | 2 ++\n src/libcamera/pipeline/ipu3/frames.cpp | 2 ++\n src/libcamera/pipeline/ipu3/frames.h   | 4 ++++\n src/libcamera/pipeline/ipu3/ipu3.cpp   | 4 ++++\n 5 files changed, 14 insertions(+)","diff":"diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex 8bbef174..1be2cbcd 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -302,6 +302,8 @@ void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)\n \t\t\tbreak;\n \t\t}\n \t}\n+\n+\tbufferAvailable.emit();\n }\n \n void CIO2Device::freeBuffers()\ndiff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h\nindex 5ecc4f47..d8d4a181 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.h\n+++ b/src/libcamera/pipeline/ipu3/cio2.h\n@@ -56,6 +56,8 @@ public:\n \tSignal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }\n \tSignal<uint32_t> &frameStart() { return csi2_->frameStart; }\n \n+\tSignal<> bufferAvailable;\n+\n private:\n \tvoid freeBuffers();\n \ndiff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp\nindex 29d9aafc..d9a2249b 100644\n--- a/src/libcamera/pipeline/ipu3/frames.cpp\n+++ b/src/libcamera/pipeline/ipu3/frames.cpp\n@@ -103,6 +103,8 @@ bool IPU3Frames::tryComplete(IPU3Frames::Info *info)\n \n \tremove(info);\n \n+\tbufferAvailable.emit();\n+\n \treturn true;\n }\n \ndiff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h\nindex 4acdf48e..59e64e81 100644\n--- a/src/libcamera/pipeline/ipu3/frames.h\n+++ b/src/libcamera/pipeline/ipu3/frames.h\n@@ -12,6 +12,8 @@\n #include <queue>\n #include <vector>\n \n+#include <libcamera/signal.h>\n+\n namespace libcamera {\n \n class FrameBuffer;\n@@ -49,6 +51,8 @@ public:\n \tInfo *find(unsigned int id);\n \tInfo *find(FrameBuffer *buffer);\n \n+\tSignal<> bufferAvailable;\n+\n private:\n \tstd::queue<FrameBuffer *> availableParamBuffers_;\n \tstd::queue<FrameBuffer *> availableStatBuffers_;\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 6961d498..8ae47c6d 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -701,6 +701,8 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n \tdata->ipa_->mapBuffers(ipaBuffers_);\n \n \tdata->frameInfos_.init(imgu->paramBuffers_, imgu->statBuffers_);\n+\tdata->frameInfos_.bufferAvailable.connect(\n+\t\tdata, &IPU3CameraData::queuePendingRequests);\n \n \treturn 0;\n }\n@@ -1147,6 +1149,8 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t */\n \t\tdata->cio2_.bufferReady().connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n+\t\tdata->cio2_.bufferAvailable.connect(\n+\t\t\tdata.get(), &IPU3CameraData::queuePendingRequests);\n \t\tdata->imgu_->input_->bufferReady.connect(&data->cio2_,\n \t\t\t\t\t&CIO2Device::tryReturnBuffer);\n \t\tdata->imgu_->output_->bufferReady.connect(data.get(),\n","prefixes":["libcamera-devel","v5","2/2"]}