[{"id":36063,"web_url":"https://patchwork.libcamera.org/comment/36063/","msgid":"<162ea9d8-8b4b-461e-9e4a-6d2709705e8c@ideasonboard.com>","date":"2025-10-01T08:10:35","subject":"Re: [PATCH v3 1/2] pipeline: simple: Allow buffer counts from 1 to\n\t32","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 09. 30. 14:42 keltezéssel, Robert Mader írta:\n> While a default value of 4 buffers appears to be a good default that is\n> used by other pipelines as well, allowing both higher and lower values\n> can be desirable, notably for:\n> 1. Video encoding, e.g. encoding multiple buffers in parallel.\n> 2. Clients requesting a single buffer - e.g. in multi-stream scenarios.\n> \n> Thus allow buffer counts between 1 and 32 buffers - following the default\n> maximum from vb2 core - while keeping the default to the previous 4.\n> \n> While on it mark the config as adjusted when appropriate.\n> \n> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n> \n> ---\n> \n> Changes in v3:\n> 1. Adopeted code cleanup suggestion - no change in behavior.\n> 2. Split out change of kNumInternalBuffers.\n> 3. Minor commit message changes.\n> \n> Changes since v1 with title \"pipeline: simple: Allow buffer counts from 1 to 16 for swISP\"\n> 1: Cover all cases, not just the swISP one.\n> 2: Increase maximum to 32 to match vb2 core.\n> 3: Change constant naming to better match similar ones.\n> 4: Bump kNumInternalBuffers to 4.\n> ---\n>   src/libcamera/pipeline/simple/simple.cpp | 18 ++++++++++++++++--\n>   1 file changed, 16 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index c816cffc9..2dcba04ec 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -378,6 +378,9 @@ public:\n>   \tconst Transform &combinedTransform() const { return combinedTransform_; }\n>   \n>   private:\n> +\tstatic constexpr unsigned int kNumBuffersDefault = 4;\n> +\tstatic constexpr unsigned int kNumBuffersMax = 32;\n\nI was testing this with `cam`, and it brought up an issue. Specifically,\n`ipa::soft::kMaxFrameContexts` is just 16, which is less than 32. So `cam`,\nwhich creates requests based on the number of buffers, may run into the\nfollowing problem with more than 16 buffers:\n\n   [0:04:25.186460320] [3298] FATAL FCQueue fc_queue.h:85 Frame context for 0 has been overwritten by 16\n   Backtrace:\n   libcamera::ipa::FCQueue<libcamera::ipa::soft::IPAFrameContext>::get(unsigned int)+0x5ef (../src/ipa/libipa/fc_queue.h:85)\n   libcamera::ipa::soft::IPASoftSimple::computeParams(unsigned int)+0x165 (../src/ipa/simple/soft_simple.cpp:294)\n   libcamera::ipa::soft::IPAProxySoftThreaded::ThreadProxy::computeParams(unsigned int)+0x637 (include/libcamera/ipa/soft_ipa_proxy.h:125)\n   ...\n   \nSo I think it would be nice to fix this as well. I believe we should pass\n16 to the `PipelineHandler` base constructor as `maxQueuedRequestsDevice`.\nBut it would be nice to be able to access that 16 constant somehow so that\nthey don't go out of sync.\n   \n`cam` patch for testing:\n\ndiff --git a/src/apps/common/stream_options.cpp b/src/apps/common/stream_options.cpp\nindex 288f86530..b8e1a6d2e 100644\n--- a/src/apps/common/stream_options.cpp\n+++ b/src/apps/common/stream_options.cpp\n@@ -25,6 +25,8 @@ StreamKeyValueParser::StreamKeyValueParser()\n                   ArgumentRequired);\n         addOption(\"colorspace\", OptionString, \"Color space\",\n                   ArgumentRequired);\n+       addOption(\"buffers\", OptionInteger, \"Number of buffers\",\n+                 ArgumentRequired);\n  }\n  \n  KeyValueParser::Options StreamKeyValueParser::parse(const char *arguments)\n@@ -95,6 +97,9 @@ int StreamKeyValueParser::updateConfiguration(CameraConfiguration *config,\n  \n                 if (opts.isSet(\"colorspace\"))\n                         cfg.colorSpace = ColorSpace::fromString(opts[\"colorspace\"].toString());\n+\n+               if (opts.isSet(\"buffers\"))\n+                       cfg.bufferCount = opts[\"buffers\"];\n         }\n  \n         return 0;\n\n\nRegards,\nBarnabás Pőcze\n\n> +\n>   \t/*\n>   \t * The SimpleCameraData instance is guaranteed to be valid as long as\n>   \t * the corresponding Camera instance is valid. In order to borrow a\n> @@ -1239,7 +1242,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n>   \t\t    cfg.size != pipeConfig_->captureSize)\n>   \t\t\tneedConversion_ = true;\n>   \n> -\t\t/* Set the stride, frameSize and bufferCount. */\n> +\t\t/* Set the stride and frameSize. */\n>   \t\tif (needConversion_) {\n>   \t\t\tstd::tie(cfg.stride, cfg.frameSize) =\n>   \t\t\t\tdata_->converter_\n> @@ -1262,7 +1265,18 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n>   \t\t\tcfg.frameSize = format.planes[0].size;\n>   \t\t}\n>   \n> -\t\tcfg.bufferCount = 4;\n> +\t\tconst auto bufferCount = cfg.bufferCount;\n> +\t\tif (bufferCount <= 0)\n> +\t\t\tcfg.bufferCount = kNumBuffersDefault;\n> +\t\telse if (bufferCount > kNumBuffersMax)\n> +\t\t\tcfg.bufferCount = kNumBuffersMax;\n> +\n> +\t\tif (cfg.bufferCount != bufferCount) {\n> +\t\t\tLOG(SimplePipeline, Debug)\n> +\t\t\t\t<< \"Adjusting bufferCount from \" << bufferCount\n> +\t\t\t\t<< \" to \" << cfg.bufferCount;\n> +\t\t\tstatus = Adjusted;\n> +\t\t}\n>   \t}\n>   \n>   \treturn status;","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 BCFE3C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Oct 2025 08:10:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 887786B5F0;\n\tWed,  1 Oct 2025 10:10:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 178B869318\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Oct 2025 10:10:40 +0200 (CEST)","from [192.168.33.13] (185.221.142.146.nat.pool.zt.hu\n\t[185.221.142.146])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0F154F6;\n\tWed,  1 Oct 2025 10:09:10 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"bjzox6jq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759306151;\n\tbh=n2/yKfL6/hxfhefCsLRPvLw+dpz1xWr/7uXyH5Yfyxo=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=bjzox6jqqcUJA08oc31y+9Y11Rr02wRZAXt49RilbKSXCw5obRf6xBTRf97rfZPLm\n\tXA7LUbqMKsxVlm48elr8vEjZv0tvnj41owgZo9p7mKkl9zlVGr1B73koZY9bbyMkj7\n\tA+x+jRqthNdL8SA3QaHvV5pLk18qrPawA6PJ8Ibg=","Message-ID":"<162ea9d8-8b4b-461e-9e4a-6d2709705e8c@ideasonboard.com>","Date":"Wed, 1 Oct 2025 10:10:35 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 1/2] pipeline: simple: Allow buffer counts from 1 to\n\t32","To":"Robert Mader <robert.mader@collabora.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>","References":"<20250930124208.14391-1-robert.mader@collabora.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250930124208.14391-1-robert.mader@collabora.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36124,"web_url":"https://patchwork.libcamera.org/comment/36124/","msgid":"<7c1905bb-b0cc-4ded-86ed-14723de2832f@collabora.com>","date":"2025-10-04T12:33:51","subject":"Re: [PATCH v3 1/2] pipeline: simple: Allow buffer counts from 1 to\n\t32","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"Hi,\n\nOn 10/1/25 10:10, Barnabás Pőcze wrote:\n> Hi\n>\n> 2025. 09. 30. 14:42 keltezéssel, Robert Mader írta:\n>> While a default value of 4 buffers appears to be a good default that is\n>> used by other pipelines as well, allowing both higher and lower values\n>> can be desirable, notably for:\n>> 1. Video encoding, e.g. encoding multiple buffers in parallel.\n>> 2. Clients requesting a single buffer - e.g. in multi-stream scenarios.\n>>\n>> Thus allow buffer counts between 1 and 32 buffers - following the \n>> default\n>> maximum from vb2 core - while keeping the default to the previous 4.\n>>\n>> While on it mark the config as adjusted when appropriate.\n>>\n>> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n>> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n>>\n>> ---\n>>\n>> Changes in v3:\n>> 1. Adopeted code cleanup suggestion - no change in behavior.\n>> 2. Split out change of kNumInternalBuffers.\n>> 3. Minor commit message changes.\n>>\n>> Changes since v1 with title \"pipeline: simple: Allow buffer counts \n>> from 1 to 16 for swISP\"\n>> 1: Cover all cases, not just the swISP one.\n>> 2: Increase maximum to 32 to match vb2 core.\n>> 3: Change constant naming to better match similar ones.\n>> 4: Bump kNumInternalBuffers to 4.\n>> ---\n>>   src/libcamera/pipeline/simple/simple.cpp | 18 ++++++++++++++++--\n>>   1 file changed, 16 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/src/libcamera/pipeline/simple/simple.cpp \n>> b/src/libcamera/pipeline/simple/simple.cpp\n>> index c816cffc9..2dcba04ec 100644\n>> --- a/src/libcamera/pipeline/simple/simple.cpp\n>> +++ b/src/libcamera/pipeline/simple/simple.cpp\n>> @@ -378,6 +378,9 @@ public:\n>>       const Transform &combinedTransform() const { return \n>> combinedTransform_; }\n>>     private:\n>> +    static constexpr unsigned int kNumBuffersDefault = 4;\n>> +    static constexpr unsigned int kNumBuffersMax = 32;\n>\n> I was testing this with `cam`, and it brought up an issue. Specifically,\n> `ipa::soft::kMaxFrameContexts` is just 16, which is less than 32. So \n> `cam`,\n> which creates requests based on the number of buffers, may run into the\n> following problem with more than 16 buffers:\n>\n>   [0:04:25.186460320] [3298] FATAL FCQueue fc_queue.h:85 Frame context \n> for 0 has been overwritten by 16\n>   Backtrace:\n> libcamera::ipa::FCQueue<libcamera::ipa::soft::IPAFrameContext>::get(unsigned \n> int)+0x5ef (../src/ipa/libipa/fc_queue.h:85)\n>   libcamera::ipa::soft::IPASoftSimple::computeParams(unsigned \n> int)+0x165 (../src/ipa/simple/soft_simple.cpp:294)\n> libcamera::ipa::soft::IPAProxySoftThreaded::ThreadProxy::computeParams(unsigned \n> int)+0x637 (include/libcamera/ipa/soft_ipa_proxy.h:125)\n>   ...\n>   So I think it would be nice to fix this as well. I believe we should \n> pass\n> 16 to the `PipelineHandler` base constructor as \n> `maxQueuedRequestsDevice`.\n> But it would be nice to be able to access that 16 constant somehow so \n> that\n> they don't go out of sync.\n>   `cam` patch for testing:\n\nNice catch, thanks for testing!\n\nI haven't got around to test that solution yet, however assuming it'll \nwork I wonder: should we maybe be even more conservative and set \nmaxQueuedRequestsDevice to something like 4, in order to avoid \nregressions? I.e. could there be valid reasons why drivers don't \nactually handle that many queued requests?\n\n>\n> diff --git a/src/apps/common/stream_options.cpp \n> b/src/apps/common/stream_options.cpp\n> index 288f86530..b8e1a6d2e 100644\n> --- a/src/apps/common/stream_options.cpp\n> +++ b/src/apps/common/stream_options.cpp\n> @@ -25,6 +25,8 @@ StreamKeyValueParser::StreamKeyValueParser()\n>                   ArgumentRequired);\n>         addOption(\"colorspace\", OptionString, \"Color space\",\n>                   ArgumentRequired);\n> +       addOption(\"buffers\", OptionInteger, \"Number of buffers\",\n> +                 ArgumentRequired);\n>  }\n>\n>  KeyValueParser::Options StreamKeyValueParser::parse(const char \n> *arguments)\n> @@ -95,6 +97,9 @@ int \n> StreamKeyValueParser::updateConfiguration(CameraConfiguration *config,\n>\n>                 if (opts.isSet(\"colorspace\"))\n>                         cfg.colorSpace = \n> ColorSpace::fromString(opts[\"colorspace\"].toString());\n> +\n> +               if (opts.isSet(\"buffers\"))\n> +                       cfg.bufferCount = opts[\"buffers\"];\n>         }\n>\n>         return 0;\n>\n>\n> Regards,\n> Barnabás Pőcze\n>\n>> +\n>>       /*\n>>        * The SimpleCameraData instance is guaranteed to be valid as \n>> long as\n>>        * the corresponding Camera instance is valid. In order to \n>> borrow a\n>> @@ -1239,7 +1242,7 @@ CameraConfiguration::Status \n>> SimpleCameraConfiguration::validate()\n>>               cfg.size != pipeConfig_->captureSize)\n>>               needConversion_ = true;\n>>   -        /* Set the stride, frameSize and bufferCount. */\n>> +        /* Set the stride and frameSize. */\n>>           if (needConversion_) {\n>>               std::tie(cfg.stride, cfg.frameSize) =\n>>                   data_->converter_\n>> @@ -1262,7 +1265,18 @@ CameraConfiguration::Status \n>> SimpleCameraConfiguration::validate()\n>>               cfg.frameSize = format.planes[0].size;\n>>           }\n>>   -        cfg.bufferCount = 4;\n>> +        const auto bufferCount = cfg.bufferCount;\n>> +        if (bufferCount <= 0)\n>> +            cfg.bufferCount = kNumBuffersDefault;\n>> +        else if (bufferCount > kNumBuffersMax)\n>> +            cfg.bufferCount = kNumBuffersMax;\n>> +\n>> +        if (cfg.bufferCount != bufferCount) {\n>> +            LOG(SimplePipeline, Debug)\n>> +                << \"Adjusting bufferCount from \" << bufferCount\n>> +                << \" to \" << cfg.bufferCount;\n>> +            status = Adjusted;\n>> +        }\n>>       }\n>>         return status;\n>","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 9C501BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  4 Oct 2025 12:34:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 50FCD6B5F3;\n\tSat,  4 Oct 2025 14:34:09 +0200 (CEST)","from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com\n\t[136.143.188.15])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 677E0613AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Oct 2025 14:34:07 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1759581234120606.3791134541453;\n\tSat, 4 Oct 2025 05:33:54 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"OBSLE2+2\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1759581238; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=LIwyy/Pr48sEQ5Gs62lR2vMA7PlY7k0S/sBKszU1ax8azLciUIYBUZOfbUl9RAOTG1KFbOD30e4eKDCQ693/697qi/EkkSUNVl3b0h1A6kzMStsHxBtU2wZP9F+oR793L1btwofJl9LpME2y6lC+zXSLKyxj+2wfXoe6vm8FfDE=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1759581238;\n\th=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=rKW7tBzqLNk5/GERfLsGt6r9K5IxfgJCTBMnIJulZaI=; \n\tb=c2u9qrV0lyaxY8sS9fZuBAQjeT85In9sAItir/B7VM4KJIDRjFZzkxUejF4KwQRRRRJC0OLujSQVP9ibGiD8afwotQKCNrNo2PJIJyUHcyeoC3xlLuiR9Vq1g389uxlL/BJYrnFUgFGsPl0QcLnEBucA4bKCAcy0HgIcDVWn3FU=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1759581238;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:Cc:Cc:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=rKW7tBzqLNk5/GERfLsGt6r9K5IxfgJCTBMnIJulZaI=;\n\tb=OBSLE2+2XVvzLYyCT4XJ8ZUSOo9m4/6HWLu34US9fC59Cjv/D70JdkyAS6whWr0x\n\tXWXkCw6mq8VDgz+4jwjfaf2B1cr4blc/ArTzFkV/KevjkAVk3LjedAQz94JzYIt5liW\n\t85CbjPfC4J0E4oUH7zWPBJhiLiM30uAYApDpiGRw=","Message-ID":"<7c1905bb-b0cc-4ded-86ed-14723de2832f@collabora.com>","Date":"Sat, 4 Oct 2025 14:33:51 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 1/2] pipeline: simple: Allow buffer counts from 1 to\n\t32","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>","References":"<20250930124208.14391-1-robert.mader@collabora.com>\n\t<162ea9d8-8b4b-461e-9e4a-6d2709705e8c@ideasonboard.com>","Content-Language":"en-US, de-DE, en-GB","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<162ea9d8-8b4b-461e-9e4a-6d2709705e8c@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":36182,"web_url":"https://patchwork.libcamera.org/comment/36182/","msgid":"<383c90c7-6eba-4713-a411-4e961e27db79@collabora.com>","date":"2025-10-10T09:27:01","subject":"Re: [PATCH v3 1/2] pipeline: simple: Allow buffer counts from 1 to\n\t32","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"On 10/4/25 14:33, Robert Mader wrote:\n> Hi,\n>\n> On 10/1/25 10:10, Barnabás Pőcze wrote:\n>> Hi\n>>\n>> 2025. 09. 30. 14:42 keltezéssel, Robert Mader írta:\n>>\n>> I was testing this with `cam`, and it brought up an issue. Specifically,\n>> `ipa::soft::kMaxFrameContexts` is just 16, which is less than 32. So \n>> `cam`,\n>> which creates requests based on the number of buffers, may run into the\n>> following problem with more than 16 buffers:\n>>\n>>   [0:04:25.186460320] [3298] FATAL FCQueue fc_queue.h:85 Frame \n>> context for 0 has been overwritten by 16\n>>   Backtrace:\n>> libcamera::ipa::FCQueue<libcamera::ipa::soft::IPAFrameContext>::get(unsigned \n>> int)+0x5ef (../src/ipa/libipa/fc_queue.h:85)\n>>   libcamera::ipa::soft::IPASoftSimple::computeParams(unsigned \n>> int)+0x165 (../src/ipa/simple/soft_simple.cpp:294)\n>> libcamera::ipa::soft::IPAProxySoftThreaded::ThreadProxy::computeParams(unsigned \n>> int)+0x637 (include/libcamera/ipa/soft_ipa_proxy.h:125)\n>>   ...\n>>   So I think it would be nice to fix this as well. I believe we \n>> should pass\n>> 16 to the `PipelineHandler` base constructor as \n>> `maxQueuedRequestsDevice`.\n>> But it would be nice to be able to access that 16 constant somehow so \n>> that\n>> they don't go out of sync.\n>>   `cam` patch for testing:\n>\n> Nice catch, thanks for testing!\n>\n> I haven't got around to test that solution yet, however assuming it'll \n> work I wonder: should we maybe be even more conservative and set \n> maxQueuedRequestsDevice to something like 4, in order to avoid \n> regressions? I.e. could there be valid reasons why drivers don't \n> actually handle that many queued requests?\n\nWent with a limit of 4 in v4 now.\n\nBarnabás: unfortunately I still didn't get around to reproduce your test \ncase and 0.6 is close - do you think you could give it another test run \nto check if the issue is fixed?","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 0FA7FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Oct 2025 09:27:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 570696B60E;\n\tFri, 10 Oct 2025 11:27:11 +0200 (CEST)","from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com\n\t[136.143.188.12])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 42979613AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Oct 2025 11:27:09 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1760088423589374.10083730291444; \n\tFri, 10 Oct 2025 02:27:03 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"UFusV3ii\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1760088426; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=RnQ3SWBwdt01xcd2UwNmSAkkePCJ6hbo9k2J0T9VzN8Tu3eRzDyLDASmgQEemwyyTKSKXcxv6mWkXUvYFdC5CyK1fLdfR1H8ZwMGsUG7hCQCcFl2VNJ61OLWkU+daGindKSKPSXrDPv+a95jMQr5sAwDc+AdV4jCu/qLXs0XxhE=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1760088426;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=yuFDZswOKRyax7Kej3WldqlHZInWgq1xIiNyRxWPzyw=; \n\tb=PPNRPWdFtzfwutoA0J7CYQsRUomKbRJmrQjqSFjbN9O1x/nVK8hm2XX7C2Peu9JXoq57SVjeb0Go2m7/i7hB3/OawpJ/P+DARQMFsYUpF8hnuoiYhuUT97b1Qxo56qvlZTPBjRq6biuokQ2kGKTJJBHMk/Yj0mbvwwbl+WFYKlw=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1760088426;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=yuFDZswOKRyax7Kej3WldqlHZInWgq1xIiNyRxWPzyw=;\n\tb=UFusV3iiGKXK4VvSRUvwLn8EGqLdrPD9edbKcS6pSDTWKg/5jatJq4Hq+tugKeaP\n\tFbc+7XXbzMKCF4rQvA3GRmlLNB76TNCl/tCxSrRW1pa0JsPXM23CUmkcw1iFLNUpQit\n\tj4PsMIDyX039OTIAzHtIFmAr/Ysjh603NuBEltyU=","Message-ID":"<383c90c7-6eba-4713-a411-4e961e27db79@collabora.com>","Date":"Fri, 10 Oct 2025 11:27:01 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 1/2] pipeline: simple: Allow buffer counts from 1 to\n\t32","To":"libcamera-devel@lists.libcamera.org","References":"<20250930124208.14391-1-robert.mader@collabora.com>\n\t<162ea9d8-8b4b-461e-9e4a-6d2709705e8c@ideasonboard.com>\n\t<7c1905bb-b0cc-4ded-86ed-14723de2832f@collabora.com>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<7c1905bb-b0cc-4ded-86ed-14723de2832f@collabora.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]