{"id":3894,"url":"https://patchwork.libcamera.org/api/1.1/patches/3894/?format=json","web_url":"https://patchwork.libcamera.org/patch/3894/","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":"<20200602013909.3170593-6-niklas.soderlund@ragnatech.se>","date":"2020-06-02T01:39:04","name":"[libcamera-devel,05/10] libcamera: ipu3: Calculate number of buffers for ImgU","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"86d3acc2607adb503ab383a8e54179028cdb4e96","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3894/mbox/","series":[{"id":943,"url":"https://patchwork.libcamera.org/api/1.1/series/943/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=943","date":"2020-06-02T01:38:59","name":"libcamera: ipu3: Allow zero-copy RAW stream","version":1,"mbox":"https://patchwork.libcamera.org/series/943/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3894/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3894/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6665661080\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Jun 2020 03:39:30 +0200 (CEST)","from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de\n\t[79.202.35.146]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid d57809e7-a471-11ea-a73e-0050569116f7;\n\tTue, 02 Jun 2020 03:39:00 +0200 (CEST)"],"X-Halon-ID":"d57809e7-a471-11ea-a73e-0050569116f7","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  2 Jun 2020 03:39:04 +0200","Message-Id":"<20200602013909.3170593-6-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.26.2","In-Reply-To":"<20200602013909.3170593-1-niklas.soderlund@ragnatech.se>","References":"<20200602013909.3170593-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 05/10] libcamera: ipu3: Calculate number\n\tof buffers for ImgU","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>","X-List-Received-Date":"Tue, 02 Jun 2020 01:39:31 -0000"},"content":"Decouple the number of buffers to allocate for the ImgU from the number\nof buffers allocated for the CIO2. Instead of blindly following the CIO2\npick the maximum number of buffers requested for any stream facing\napplications.\n\nThis is potentially wasteful, as each stream could allocate just as many\nbuffers as requested by the application instead of the maximum from the\nset. But this is not more wasteful then whats already used by the\npipeline and should be fixed on top after the decoupling of the two\nprocessing units.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 0e7555c716b36749..f4759715c6ae7572 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -729,14 +729,16 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n \tIPU3CameraData *data = cameraData(camera);\n \tCIO2Device *cio2 = &data->cio2_;\n \tImgUDevice *imgu = data->imgu_;\n-\tunsigned int bufferCount;\n+\tunsigned int bufferCount = 0;\n \tint ret;\n \n \tret = cio2->allocateBuffers();\n \tif (ret < 0)\n \t\treturn ret;\n \n-\tbufferCount = ret;\n+\tbufferCount = std::max<unsigned int>(data->outStream_.configuration().bufferCount, bufferCount);\n+\tbufferCount = std::max<unsigned int>(data->vfStream_.configuration().bufferCount, bufferCount);\n+\tbufferCount = std::max<unsigned int>(data->rawStream_.configuration().bufferCount, bufferCount);\n \n \tret = imgu->allocateBuffers(data, bufferCount);\n \tif (ret < 0) {\n","prefixes":["libcamera-devel","05/10"]}