[{"id":35307,"web_url":"https://patchwork.libcamera.org/comment/35307/","msgid":"<175464644002.560048.302595737552342684@ping.linuxembedded.co.uk>","date":"2025-08-08T09:47:20","subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Umang Jain (2025-08-08 05:04:53)\n> Explicitly clarify the usage of Request::ReuseBuffers flag in context\n> of buffer fences. Fences are user-supplied and are not re-cycled as\n> part of Request::reuse(), hence document this behaviour explicitly.\n> \n> Signed-off-by: Umang Jain <uajain@igalia.com>\n> ---\n>  src/libcamera/request.cpp | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index 7f1e11e8..86d849ac 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -326,7 +326,8 @@ void Request::Private::timeout()\n>   * \\var Request::Default\n>   * Don't reuse buffers\n>   * \\var Request::ReuseBuffers\n> - * Reuse the buffers that were previously added by addBuffer()\n> + * Reuse the buffers that were previously added by addBuffer().\n> + * Buffers meant to be queued with a Fence, should not use this flag.\n\nCan we codify this in some way during Request::reuse() and check at\nruntime too to print a warning? I would bet if someone hits this they\nhaven't read the documentation.\n\n--\nKieran\n\n>   */\n>  \n>  /**\n> -- \n> 2.50.0\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 E80F0BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Aug 2025 09:47:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0E6FF6921A;\n\tFri,  8 Aug 2025 11:47:25 +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 D9B7169215\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Aug 2025 11:47:22 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E375F16B8;\n\tFri,  8 Aug 2025 11:46:32 +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=\"rX10SPOE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1754646393;\n\tbh=rMGv6o9iOSbk2fcEaghTazobUWCtgziDI0IxX13glOA=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=rX10SPOEiPJl6B/6yR9hgjfdGdS6kA3+9hkczaOKiElWxwijPbXhq7lKtlaoS2quA\n\ttMNz1QSvi+O6Lgs+njYSO4/G/O/EUKKRD3aPCvHZmySmlYKneIPtk1oaOAg7rQw1sX\n\txeQw6qXkksGRb2dEp/pQ2u7ULdvq05++2BknW+wU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250808040453.9016-1-uajain@igalia.com>","References":"<20250808040453.9016-1-uajain@igalia.com>","Subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Umang Jain <uajain@igalia.com>","To":"Umang Jain <uajain@igalia.com>, libcamera-devel@lists.libcamera.org","Date":"Fri, 08 Aug 2025 10:47:20 +0100","Message-ID":"<175464644002.560048.302595737552342684@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":35308,"web_url":"https://patchwork.libcamera.org/comment/35308/","msgid":"<0ccaa00d4b4bdbf723e69c2457e55262@igalia.com>","date":"2025-08-08T10:47:54","subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/","name":"Umang Jain","email":"uajain@igalia.com"},"content":"On 2025-08-08 15:17, Kieran Bingham wrote:\n> Quoting Umang Jain (2025-08-08 05:04:53)\n>> Explicitly clarify the usage of Request::ReuseBuffers flag in context\n>> of buffer fences. Fences are user-supplied and are not re-cycled as\n>> part of Request::reuse(), hence document this behaviour explicitly.\n>> \n>> Signed-off-by: Umang Jain <uajain@igalia.com>\n>> ---\n>>  src/libcamera/request.cpp | 3 ++-\n>>  1 file changed, 2 insertions(+), 1 deletion(-)\n>> \n>> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n>> index 7f1e11e8..86d849ac 100644\n>> --- a/src/libcamera/request.cpp\n>> +++ b/src/libcamera/request.cpp\n>> @@ -326,7 +326,8 @@ void Request::Private::timeout()\n>>   * \\var Request::Default\n>>   * Don't reuse buffers\n>>   * \\var Request::ReuseBuffers\n>> - * Reuse the buffers that were previously added by addBuffer()\n>> + * Reuse the buffers that were previously added by addBuffer().\n>> + * Buffers meant to be queued with a Fence, should not use this flag.\n> \n> Can we codify this in some way during Request::reuse() and check at\n> runtime too to print a warning? I would bet if someone hits this they\n> haven't read the documentation.\n\nWe can codify yes, but it won't be as straight-forward. We will need to\ntrack\nthat the buffer had a fence set previously via a bool member and a\ngetter for the same,\nin the FrameBuffer::Private class. The existing fence() won't work I\nbelieve, as the fence\ncould have been released or signalled and fence_ will become nullptr.\n\nA second option would be to track at Request level and set a similar\nbool class member\nin Request::addBuffer() if the fence was passed in. This would fit\nbetter I think,\nif we decide to go to codify it.\n\n> \n> --\n> Kieran\n> \n>>   */\n>>  \n>>  /**\n>> -- \n>> 2.50.0\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 A6503BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Aug 2025 10:48:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 85E7A6921E;\n\tFri,  8 Aug 2025 12:48:00 +0200 (CEST)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EEBA56084D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Aug 2025 12:47:58 +0200 (CEST)","from maestria.local.igalia.com ([192.168.10.14]\n\thelo=mail.igalia.com) by fanzine2.igalia.com with esmtps \n\t(Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1ukKdh-00BUG5-13; Fri, 08 Aug 2025 12:47:57 +0200","from webmail.service.igalia.com ([192.168.21.45])\n\tby mail.igalia.com with esmtp (Exim)\n\tid 1ukKde-00E7WH-Uk; Fri, 08 Aug 2025 12:47:56 +0200","from localhost ([127.0.0.1] helo=webmail.igalia.com)\n\tby webmail with esmtp (Exim 4.96) (envelope-from <uajain@igalia.com>)\n\tid 1ukKde-001sDd-1E; Fri, 08 Aug 2025 12:47:54 +0200"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"Dcn+Yw8K\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=Content-Transfer-Encoding:Content-Type:Message-ID:References:\n\tIn-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=sY2m2w8HiOie3U7D0rCgC3FriRqJ/2urGy9m0TQiJIs=;\n\tb=Dcn+Yw8KeO0SKoZa9ZReOOdGJ2\n\tQfSx1E4kmAf7o4HkRJn2CM0jgI5DHbr0Yv9X04qZJSheX91x+XErP+5mC2avvi88M1/qAV0Nzo0cb\n\tfU/zQlq5DfztAYAo3hdjBzkqSNZoSBebyTzg08sVmiQZMeUC/LWU/FWi+LV41O8PB7klmE8b3M/Er\n\t1x33Yr7hlpUN9sIhj5/10JvzIVdoGodP8w+043foLB9T9zCridsiIFrbJOqZqGL39x6C82uSCLTA4\n\t0fUlxPKvzcorFxa7R1bk9Ji03ACiVXb6NU09MTtG7Qs5ZfDfWFNq/K7QIQCeHw6jipH+L66r7A0vT\n\txoN9P8lA==;","MIME-Version":"1.0","Date":"Fri, 08 Aug 2025 16:17:54 +0530","From":"uajain <uajain@igalia.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","In-Reply-To":"<175464644002.560048.302595737552342684@ping.linuxembedded.co.uk>","References":"<20250808040453.9016-1-uajain@igalia.com>\n\t<175464644002.560048.302595737552342684@ping.linuxembedded.co.uk>","Message-ID":"<0ccaa00d4b4bdbf723e69c2457e55262@igalia.com>","X-Sender":"uajain@igalia.com","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-Spam-Report":"NO, Score=-1.5, Tests=ALL_TRUSTED=-3,AWL=0.736,BAYES_50=0.8","X-Spam-Score":"-14","X-Spam-Bar":"-","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":35309,"web_url":"https://patchwork.libcamera.org/comment/35309/","msgid":"<175465060713.560048.18270648002334110272@ping.linuxembedded.co.uk>","date":"2025-08-08T10:56:47","subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting uajain (2025-08-08 11:47:54)\n> On 2025-08-08 15:17, Kieran Bingham wrote:\n> > Quoting Umang Jain (2025-08-08 05:04:53)\n> >> Explicitly clarify the usage of Request::ReuseBuffers flag in context\n> >> of buffer fences. Fences are user-supplied and are not re-cycled as\n> >> part of Request::reuse(), hence document this behaviour explicitly.\n> >> \n> >> Signed-off-by: Umang Jain <uajain@igalia.com>\n> >> ---\n> >>  src/libcamera/request.cpp | 3 ++-\n> >>  1 file changed, 2 insertions(+), 1 deletion(-)\n> >> \n> >> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> >> index 7f1e11e8..86d849ac 100644\n> >> --- a/src/libcamera/request.cpp\n> >> +++ b/src/libcamera/request.cpp\n> >> @@ -326,7 +326,8 @@ void Request::Private::timeout()\n> >>   * \\var Request::Default\n> >>   * Don't reuse buffers\n> >>   * \\var Request::ReuseBuffers\n> >> - * Reuse the buffers that were previously added by addBuffer()\n> >> + * Reuse the buffers that were previously added by addBuffer().\n> >> + * Buffers meant to be queued with a Fence, should not use this flag.\n> > \n> > Can we codify this in some way during Request::reuse() and check at\n> > runtime too to print a warning? I would bet if someone hits this they\n> > haven't read the documentation.\n> \n> We can codify yes, but it won't be as straight-forward. We will need to\n> track\n> that the buffer had a fence set previously via a bool member and a\n> getter for the same,\n> in the FrameBuffer::Private class. The existing fence() won't work I\n> believe, as the fence\n> could have been released or signalled and fence_ will become nullptr.\n\nAh - I was hoping it was going to be a simple flag check on the existing\nfence_ or such - but if it gets reset when the fence is consumed indeed\nwe won't know - and would have to store extra state which would possibly\nbe undesirable...\n\n> A second option would be to track at Request level and set a similar\n> bool class member\n> in Request::addBuffer() if the fence was passed in. This would fit\n> better I think,\n> if we decide to go to codify it.\n\nYes, if this is a path - knowing if a Request has 'needed' fences would\nbe the signal to not let reuse be automatic.\n\n--\nKieran\n\n> \n> > \n> > --\n> > Kieran\n> > \n> >>   */\n> >>  \n> >>  /**\n> >> -- \n> >> 2.50.0\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 096ADBEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Aug 2025 10:56:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 085B76921E;\n\tFri,  8 Aug 2025 12:56:51 +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 3C3116084D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Aug 2025 12:56:50 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C984185B;\n\tFri,  8 Aug 2025 12:56:00 +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=\"FBFS3ECU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1754650560;\n\tbh=iJFNBYNPfbNp4+seqi+dK7E0XiEGANmmEwKjixEQpHo=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=FBFS3ECUubsey/ZacJkDOvY0a89djB2ww355DW7lXtJCIEcM5YVhxTT0wOd1UEaiH\n\tcPpMnnt8zXdWrTvmZCKGld4z2yOkkieXhKMJWTc0uY/NocpY2/InqneDfSJoV3n2Kw\n\tN55tqjYEF6AFr9iJz0Mcxm13q5cNrkMRaiZT1Chg=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<0ccaa00d4b4bdbf723e69c2457e55262@igalia.com>","References":"<20250808040453.9016-1-uajain@igalia.com>\n\t<175464644002.560048.302595737552342684@ping.linuxembedded.co.uk>\n\t<0ccaa00d4b4bdbf723e69c2457e55262@igalia.com>","Subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","To":"uajain <uajain@igalia.com>","Date":"Fri, 08 Aug 2025 11:56:47 +0100","Message-ID":"<175465060713.560048.18270648002334110272@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":35310,"web_url":"https://patchwork.libcamera.org/comment/35310/","msgid":"<175465065266.560048.8473407051615864311@ping.linuxembedded.co.uk>","date":"2025-08-08T10:57:32","subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2025-08-08 11:56:47)\n> Quoting uajain (2025-08-08 11:47:54)\n> > On 2025-08-08 15:17, Kieran Bingham wrote:\n> > > Quoting Umang Jain (2025-08-08 05:04:53)\n> > >> Explicitly clarify the usage of Request::ReuseBuffers flag in context\n> > >> of buffer fences. Fences are user-supplied and are not re-cycled as\n> > >> part of Request::reuse(), hence document this behaviour explicitly.\n> > >> \n> > >> Signed-off-by: Umang Jain <uajain@igalia.com>\n> > >> ---\n> > >>  src/libcamera/request.cpp | 3 ++-\n> > >>  1 file changed, 2 insertions(+), 1 deletion(-)\n> > >> \n> > >> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> > >> index 7f1e11e8..86d849ac 100644\n> > >> --- a/src/libcamera/request.cpp\n> > >> +++ b/src/libcamera/request.cpp\n> > >> @@ -326,7 +326,8 @@ void Request::Private::timeout()\n> > >>   * \\var Request::Default\n> > >>   * Don't reuse buffers\n> > >>   * \\var Request::ReuseBuffers\n> > >> - * Reuse the buffers that were previously added by addBuffer()\n> > >> + * Reuse the buffers that were previously added by addBuffer().\n> > >> + * Buffers meant to be queued with a Fence, should not use this flag.\n> > > \n> > > Can we codify this in some way during Request::reuse() and check at\n> > > runtime too to print a warning? I would bet if someone hits this they\n> > > haven't read the documentation.\n> > \n> > We can codify yes, but it won't be as straight-forward. We will need to\n> > track\n> > that the buffer had a fence set previously via a bool member and a\n> > getter for the same,\n> > in the FrameBuffer::Private class. The existing fence() won't work I\n> > believe, as the fence\n> > could have been released or signalled and fence_ will become nullptr.\n> \n> Ah - I was hoping it was going to be a simple flag check on the existing\n> fence_ or such - but if it gets reset when the fence is consumed indeed\n> we won't know - and would have to store extra state which would possibly\n> be undesirable...\n> \n> > A second option would be to track at Request level and set a similar\n> > bool class member\n> > in Request::addBuffer() if the fence was passed in. This would fit\n> > better I think,\n> > if we decide to go to codify it.\n> \n> Yes, if this is a path - knowing if a Request has 'needed' fences would\n> be the signal to not let reuse be automatic.\n> \n\nAnyway, I think the clarification itself here still makes sense so far -\nbut Jacopo's the expert on Fences I think...\n\nand he just went on holiday...\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> --\n> Kieran\n> \n> > \n> > > \n> > > --\n> > > Kieran\n> > > \n> > >>   */\n> > >>  \n> > >>  /**\n> > >> -- \n> > >> 2.50.0\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 33E11BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Aug 2025 10:57:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B72466921E;\n\tFri,  8 Aug 2025 12:57:36 +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 6C9456084D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Aug 2025 12:57:35 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 97F8D185B;\n\tFri,  8 Aug 2025 12:56:45 +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=\"iEFiyimo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1754650605;\n\tbh=oOqyqyc3cWcrzlKSPIxXgS6K+QQLpfmQc336+Docteo=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=iEFiyimoCHxwe+UQBqCnB8uRlH+E3EqGbm6dFeuovaDam+clOdC/Wd6cyHcDhEskK\n\t+/2EAyhKf5i0LLXOQINjAFazK4FBYgmOuhJb7nRG9CH1ntxX3jIYhNWrykX8baPz6j\n\t6x4FRgT4kIwzgf4Wp8KDlsSL8IoJNyT6zajsudiM=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<175465060713.560048.18270648002334110272@ping.linuxembedded.co.uk>","References":"<20250808040453.9016-1-uajain@igalia.com>\n\t<175464644002.560048.302595737552342684@ping.linuxembedded.co.uk>\n\t<0ccaa00d4b4bdbf723e69c2457e55262@igalia.com>\n\t<175465060713.560048.18270648002334110272@ping.linuxembedded.co.uk>","Subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","To":"uajain <uajain@igalia.com>","Date":"Fri, 08 Aug 2025 11:57:32 +0100","Message-ID":"<175465065266.560048.8473407051615864311@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":35311,"web_url":"https://patchwork.libcamera.org/comment/35311/","msgid":"<6745494274cbd43fbb65dc1d981a9fed@igalia.com>","date":"2025-08-08T11:09:08","subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/","name":"Umang Jain","email":"uajain@igalia.com"},"content":"On 2025-08-08 16:27, Kieran Bingham wrote:\n> Quoting Kieran Bingham (2025-08-08 11:56:47)\n>> Quoting uajain (2025-08-08 11:47:54)\n>> > On 2025-08-08 15:17, Kieran Bingham wrote:\n>> > > Quoting Umang Jain (2025-08-08 05:04:53)\n>> > >> Explicitly clarify the usage of Request::ReuseBuffers flag in context\n>> > >> of buffer fences. Fences are user-supplied and are not re-cycled as\n>> > >> part of Request::reuse(), hence document this behaviour explicitly.\n>> > >> \n>> > >> Signed-off-by: Umang Jain <uajain@igalia.com>\n>> > >> ---\n>> > >>  src/libcamera/request.cpp | 3 ++-\n>> > >>  1 file changed, 2 insertions(+), 1 deletion(-)\n>> > >> \n>> > >> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n>> > >> index 7f1e11e8..86d849ac 100644\n>> > >> --- a/src/libcamera/request.cpp\n>> > >> +++ b/src/libcamera/request.cpp\n>> > >> @@ -326,7 +326,8 @@ void Request::Private::timeout()\n>> > >>   * \\var Request::Default\n>> > >>   * Don't reuse buffers\n>> > >>   * \\var Request::ReuseBuffers\n>> > >> - * Reuse the buffers that were previously added by addBuffer()\n>> > >> + * Reuse the buffers that were previously added by addBuffer().\n>> > >> + * Buffers meant to be queued with a Fence, should not use this flag.\n>> > > \n>> > > Can we codify this in some way during Request::reuse() and check at\n>> > > runtime too to print a warning? I would bet if someone hits this they\n>> > > haven't read the documentation.\n>> > \n>> > We can codify yes, but it won't be as straight-forward. We will need to\n>> > track\n>> > that the buffer had a fence set previously via a bool member and a\n>> > getter for the same,\n>> > in the FrameBuffer::Private class. The existing fence() won't work I\n>> > believe, as the fence\n>> > could have been released or signalled and fence_ will become nullptr.\n>> \n>> Ah - I was hoping it was going to be a simple flag check on the existing\n>> fence_ or such - but if it gets reset when the fence is consumed indeed\n>> we won't know - and would have to store extra state which would possibly\n>> be undesirable...\n>> \n>> > A second option would be to track at Request level and set a similar\n>> > bool class member\n>> > in Request::addBuffer() if the fence was passed in. This would fit\n>> > better I think,\n>> > if we decide to go to codify it.\n>> \n>> Yes, if this is a path - knowing if a Request has 'needed' fences would\n>> be the signal to not let reuse be automatic.\n>> \n> \n> Anyway, I think the clarification itself here still makes sense so far -\n> but Jacopo's the expert on Fences I think...\n\nYes, I wanted to check first if it is worth tracking the extra 'state'\nand checking it, specially when this can be a intended hot-path.\n\n> \n> and he just went on holiday...\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n>> --\n>> Kieran\n>> \n>> > \n>> > > \n>> > > --\n>> > > Kieran\n>> > > \n>> > >>   */\n>> > >>  \n>> > >>  /**\n>> > >> -- \n>> > >> 2.50.0\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 258BDBDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Aug 2025 11:09:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 685776921A;\n\tFri,  8 Aug 2025 13:09:13 +0200 (CEST)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A2D4B6084D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Aug 2025 13:09:11 +0200 (CEST)","from maestria.local.igalia.com ([192.168.10.14]\n\thelo=mail.igalia.com) by fanzine2.igalia.com with esmtps \n\t(Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1ukKyF-00BUfW-3M; Fri, 08 Aug 2025 13:09:11 +0200","from webmail.service.igalia.com ([192.168.21.45])\n\tby mail.igalia.com with esmtp (Exim)\n\tid 1ukKyC-00E8dG-VB; Fri, 08 Aug 2025 13:09:10 +0200","from localhost ([127.0.0.1] helo=webmail.igalia.com)\n\tby webmail with esmtp (Exim 4.96) (envelope-from <uajain@igalia.com>)\n\tid 1ukKyC-001sQU-1H; Fri, 08 Aug 2025 13:09:08 +0200"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"Oz7DeWCA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=Content-Transfer-Encoding:Content-Type:Message-ID:References:\n\tIn-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=R2CJTt6Z0I14RzGu/JDLxFxekOW/j1lUacsMEv0MSdo=;\n\tb=Oz7DeWCAYwd4ehmH0I3DKDuRbV\n\tVUD/opNaUwvX8qiCOOCC79dZZk5KOUMar6PQcZTzuOsq0/EKiCoS2uhwqco8AE2Ldrvda1gr4R4BK\n\tWT53XAYgX98kG9MJOf6hQ2KtKcUjZjBz0BeYc3HPmq+JIlk/1BHyiezDr8NxQ5A8SIii8TZSbXBKV\n\tb5lt/ZfztHds3e4cG9/oFg7wssf8yETO8Xd3gKOgQvYqqmHYin6JLMutRxqGorArtzIfjXuS/jCk1\n\tGJXCU7StOGk1806nzPO4vY2j3oD/j24x0j11pU+MXiguwwsSCFIMNmmNSU21DQQmvw+3v7CKytWWm\n\ty8nPiz+w==;","MIME-Version":"1.0","Date":"Fri, 08 Aug 2025 16:39:08 +0530","From":"uajain <uajain@igalia.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","In-Reply-To":"<175465065266.560048.8473407051615864311@ping.linuxembedded.co.uk>","References":"<20250808040453.9016-1-uajain@igalia.com>\n\t<175464644002.560048.302595737552342684@ping.linuxembedded.co.uk>\n\t<0ccaa00d4b4bdbf723e69c2457e55262@igalia.com>\n\t<175465060713.560048.18270648002334110272@ping.linuxembedded.co.uk>\n\t<175465065266.560048.8473407051615864311@ping.linuxembedded.co.uk>","Message-ID":"<6745494274cbd43fbb65dc1d981a9fed@igalia.com>","X-Sender":"uajain@igalia.com","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-Spam-Report":"NO, Score=-1.6, Tests=ALL_TRUSTED=-3, AWL=0.644, BAYES_50=0.8,\n\tURIBL_BLOCKED=0.001","X-Spam-Score":"-15","X-Spam-Bar":"-","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":35987,"web_url":"https://patchwork.libcamera.org/comment/35987/","msgid":"<861a798c-04a0-4bbe-b22c-c42d713700d6@ideasonboard.com>","date":"2025-09-25T14:39:28","subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","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. 08. 08. 6:04 keltezéssel, Umang Jain írta:\n> Explicitly clarify the usage of Request::ReuseBuffers flag in context\n> of buffer fences. Fences are user-supplied and are not re-cycled as\n> part of Request::reuse(), hence document this behaviour explicitly.\n> \n> Signed-off-by: Umang Jain <uajain@igalia.com>\n> ---\n>   src/libcamera/request.cpp | 3 ++-\n>   1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index 7f1e11e8..86d849ac 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -326,7 +326,8 @@ void Request::Private::timeout()\n>    * \\var Request::Default\n>    * Don't reuse buffers\n>    * \\var Request::ReuseBuffers\n> - * Reuse the buffers that were previously added by addBuffer()\n> + * Reuse the buffers that were previously added by addBuffer().\n> + * Buffers meant to be queued with a Fence, should not use this flag.\n\nI think it's useful to mention this behaviour (limitation?). But the description\nis a bit confusing to me. Maybe something like\n\n   \\note Fences associated with the buffers are not reused.\n         This flag should not be used if fences are used.\n\n?\n\n\nRegards,\nBarnabás Pőcze\n\n>    */\n>   \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 7940DC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Sep 2025 14:39:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 558036B5AA;\n\tThu, 25 Sep 2025 16:39:33 +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 62BC569318\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Sep 2025 16:39:31 +0200 (CEST)","from [192.168.33.22] (185.221.140.70.nat.pool.zt.hu\n\t[185.221.140.70])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 14FB01AC5;\n\tThu, 25 Sep 2025 16:38:05 +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=\"i9knO9V4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1758811086;\n\tbh=EXIj7lrrZpHpfk7b8VjMMi/DuLi8RcKLVzZef0OLSu0=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=i9knO9V4IfOZhgKaL0OlcikV+P7c7TWTFM/doGZor7CpgrZ6CDvEWpK9+PwnyAFnW\n\ttzlqakAIDkfUDZPhpE1/dscougE/WhVFzuq8Ko77Ah+r0wbPOnzl9d4VA9nx0Q/dAa\n\trOQK8e4cUtxs74nHrXDQwiGGKdDIFi2DeGYmnv2g=","Message-ID":"<861a798c-04a0-4bbe-b22c-c42d713700d6@ideasonboard.com>","Date":"Thu, 25 Sep 2025 16:39:28 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] libcamera: request: Clarify ReuseBuffers flag usage with\n\tfences","To":"Umang Jain <uajain@igalia.com>, libcamera-devel@lists.libcamera.org","References":"<20250808040453.9016-1-uajain@igalia.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250808040453.9016-1-uajain@igalia.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>"}}]