From patchwork Wed Nov 9 10:16:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17758 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 49C25BE08B for ; Wed, 9 Nov 2022 10:16:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C159F63083; Wed, 9 Nov 2022 11:16:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1667989006; bh=z1Z5io615YRYWQWeVspZkTZJQI410jfx735aiyCrjH8=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=BAw7cpnjqJan+CHdGGHK7lOg5xGlQoIJPZ+g4mLSIX61LnCjXWfRa6SK4hYDFmmVg ogLvB+r4BQCv5ZpaayYowsz8RNnw99qzgIw8YyXzfaTRnQBJ6pDsUSa0IY7aTBUoFo YRqmUpHwIcx1YD0CPjqYgb/abGNGoRDlR+948LU3JGG7NzjSC4ben/tRVQKyaiEDuA u5xMtrTk3wOEZ4mL/hH9tpSKvcC3EFOuEyQJ+1bWIvLfzgMnYOByonl5RinJZE5fik iXfvDb6yEwOWi2W4MILtPcTtEUBe/dp2LB6bJWEunKxZYvuiBS6AEM7N68oPxHcvfR mny6xbU+B+rjA== Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A2F6961F3F for ; Wed, 9 Nov 2022 11:16:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="hzxLQjyg"; dkim-atps=neutral Received: by mail-wm1-x330.google.com with SMTP id ay14-20020a05600c1e0e00b003cf6ab34b61so927373wmb.2 for ; Wed, 09 Nov 2022 02:16:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8/lGsJPM+rQyGj39ufKctNpqauf4oKAT22Cs1IQdmWY=; b=hzxLQjygVbUZpmCQgLJBBnhii1t9LXiam4dm30RsX/+ONQaLrmTqmqmUQ3H3qvDOp3 c5zU3yKy4XxEH2t70+QqnQ9MElzRV2z+0rMhUmz5WqLY/2BbioLWboN4HcaEbqUNUAGw gBKEzsj227P4RMq3P4BfbOyFtS/UxvdsDYp6d9nknBGGwFZnIEHzhx0DLtTA6pxRIDlB kubS7fmrxZpB8EVF0P48SEY4tcwwJS53eOBraf9iCCmAQdUGMK4CmrBMGrqG3qmU7Knf 8CJoCplKP+iGXj/UpwoiTIzoL53F5U6jWExDkEOumBHRkwvxhPKckTv4lFOZwFrhetex 3p+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8/lGsJPM+rQyGj39ufKctNpqauf4oKAT22Cs1IQdmWY=; b=X9K3Y55lW7WGUe9TD1k0OxQuUrX1DYE7Tbkc2ljGPD+uTO1Ao23VBrC2FNnl0EdhE8 1AySqD0B7QUU4dD3P4c5tWB0+s4SoYFWbdi59EajboTE3GLbWYqvuTYkXZvIkZtgk9G3 lNG59RFLXsWBXM/eGwa9sbyxXebeBCq0NJngDhe8pREA7iTbfN3x4Nnzqk6R+c4slIgy OLNRMe7IaDHCefNKiL+Xib3oG56fricGthvJFYIw08AA0Z/n2IxioAZDkkzDQf8Dkflk 1qjqr4Cp5h845fLighraFGkqS65fZKHaD7isCCFxACkUcccQpo59O7Q3vJbE/KBAq5jV fzZw== X-Gm-Message-State: ACrzQf0UlaDICtB7w/XAp5iMuy+gY2rpZPUNogB0k2bgx4VxfXNfz98H vBrQIOngwxzguhtsWSdkr0RG512RbUbrdw== X-Google-Smtp-Source: AMsMyM4n4fltMCfi2t6QhlwbAs4wnvLHP4hfXyt/GHekMbP4t3SbugOCznc/ow/uoORoeLRbrkZBsQ== X-Received: by 2002:a05:600c:2194:b0:3cf:7065:99e5 with SMTP id e20-20020a05600c219400b003cf706599e5mr34001421wme.174.1667989004919; Wed, 09 Nov 2022 02:16:44 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id l15-20020a1c790f000000b003c6c5a5a651sm1028690wme.28.2022.11.09.02.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 02:16:44 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Wed, 9 Nov 2022 10:16:42 +0000 Message-Id: <20221109101642.4957-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] Revert "pipeline: raspberrypi: Do not unconditionally free buffers on close" X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This reverts commit 30d704732badc675f72fe73d14749669cb645c23. It turns out that this commit causes some regressions and is in fact unnecessary because the related commit "libcamera: v4l2_videodevice: Guard against releasing unallocated buffers" (a2bdff6d0b67475492ac7cf9318866b6d89a28fd) fixes the problem completely (if the buffers were never allocated, the video device avoids trying to free them even if the pipeline handler asks). The reason for the regressions is that in this new (broken) scheme we would never call clearBuffers() on all the streams if the internal buffers were never allocated (i.e. buffersAllocated_ is never set). This causes the stream's bufferMap_ list to get longer and longer if there are multiple back-to-back calls to configure, and dev_->importBuffers() will ultimately to fail. So either we need to think more carefully about how to stop the pipeline handler from freeing buffers that it doesn't own, or we just leave it as the other commit resolves the problem on its own. In the interim, simply reverting this commit certainly seems like the best solution. Signed-off-by: David Plowman Reviewed-by: Naushir Patuck --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 1b599fcc..343f8cb2 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1506,9 +1506,6 @@ void PipelineHandlerRPi::mapBuffers(Camera *camera, const RPi::BufferMap &buffer void RPiCameraData::freeBuffers() { - if (!buffersAllocated_) - return; - if (ipa_) { /* * Copy the buffer ids from the unordered_set to a vector to