[{"id":25758,"web_url":"https://patchwork.libcamera.org/comment/25758/","msgid":"<166800454437.1595469.12704577676409248114@Monstersaurus>","date":"2022-11-09T14:35:44","subject":"Re: [libcamera-devel] [PATCH v2] Revert \"pipeline: raspberrypi: Do\n\tnot unconditionally free buffers on close\"","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting David Plowman via libcamera-devel (2022-11-09 10:49:40)\n> This reverts commit 30d704732badc675f72fe73d14749669cb645c23.\n> \n> It turns out that this commit causes some regressions and is in fact\n> unnecessary because the related commit \"libcamera: v4l2_videodevice:\n> Guard against releasing unallocated buffers\"\n> (a2bdff6d0b67475492ac7cf9318866b6d89a28fd) fixes the problem\n> completely (if the buffers were never allocated, the video device\n> avoids trying to free them even if the pipeline handler asks).\n> \n> The reason for the regressions is that in this new (broken) scheme we\n> would never call clearBuffers() on all the streams if the internal\n> buffers were never allocated (i.e. buffersAllocated_ is never\n> set). This causes the stream's bufferMap_ list to get longer and\n> longer if there are multiple back-to-back calls to configure, and\n> dev_->importBuffers() will ultimately to fail.\n> \n> So either we need to think more carefully about how to stop the\n> pipeline handler from freeing buffers that it doesn't own, or we just\n> leave it as the other commit resolves the problem on its own. In the\n> interim, simply reverting this commit certainly seems like the best\n> solution.\n> \n> Fixes: 30d704732bad (\"pipeline: raspberrypi: Do not unconditionally free buffers on close\")\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\nNo harm with a revert if it's not right.\n\nAcked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ---\n>  1 file changed, 3 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 1b599fcc..343f8cb2 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -1506,9 +1506,6 @@ void PipelineHandlerRPi::mapBuffers(Camera *camera, const RPi::BufferMap &buffer\n>  \n>  void RPiCameraData::freeBuffers()\n>  {\n> -       if (!buffersAllocated_)\n> -               return;\n> -\n>         if (ipa_) {\n>                 /*\n>                  * Copy the buffer ids from the unordered_set to a vector to\n> -- \n> 2.30.2\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 AAFD8BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Nov 2022 14:35:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0A55163083;\n\tWed,  9 Nov 2022 15:35:49 +0100 (CET)","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 A18556305E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Nov 2022 15:35:47 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 127C9896;\n\tWed,  9 Nov 2022 15:35:47 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668004549;\n\tbh=i1vdQLo2/vfxDVEojwYhTWnKHaRTrsK1hibU5Hcz07E=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=JybbSewfnbhLDme/ExJMj1bgwwxtwIw17Xj2Cju/6x1vzpZaH+snMFjdyUrPrPoTj\n\t9AhPa9qhhyvseEhsPjxsfyCfx5475GXrHdXTiEx9qSBB93JoSJcpJvZg3kpNTJNX2n\n\tEw0dwYR0NfVwnkeA+PbQq3TQsFRMsuZ7TvB97FUhfw85LBDEopYWgRHwSV1Z9Svl6V\n\tGmMNlC1c2uwkOnmEH1B7ioY04Yf8DrgufhqRuoap3pDQ8hSvUqjwvH/v/0rCbta5nd\n\tUHzAj2KOn883b6TrIlQEyglzjoyXheDBU0AvfpH4FyZgkIVhUsemH3gGmP22nc57we\n\ttd7TZPC9O1JqA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1668004547;\n\tbh=i1vdQLo2/vfxDVEojwYhTWnKHaRTrsK1hibU5Hcz07E=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=Q2JUZpRqjr4Sh0lhIpWBxwN/NEm+ZKf/LSPl/9Bpv5hJNzIQbL6/lOyg3krNg1jem\n\tJi4ibWTwsn58gqkWomXRb8uMlqb2KLNGEeVok+2h1vfUKMoshqTcNMpfy20CrGrsID\n\tt6l2N3MLpPLeh2F5AkcX4MP8VyhjfFI3GpPqN7oc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Q2JUZpRq\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20221109104940.5799-1-david.plowman@raspberrypi.com>","References":"<20221109104940.5799-1-david.plowman@raspberrypi.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 09 Nov 2022 14:35:44 +0000","Message-ID":"<166800454437.1595469.12704577676409248114@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2] Revert \"pipeline: raspberrypi: Do\n\tnot unconditionally free buffers on close\"","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]