From patchwork Mon Mar 7 12:46:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne via libcamera-devel X-Patchwork-Id: 15425 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 CCC4EBF415 for ; Mon, 7 Mar 2022 12:46:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DC75461184; Mon, 7 Mar 2022 13:46:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1646657200; bh=DIxj7vDQgXJhCCF3SLV3uFzSAmSyMX6a3IZYcc0k7/Y=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=W6QHZzizchC7KtUgsKVtGmVJS0x7R2GqtlP7vWQ0Vsz+1WuRR9+sNJDgYvxCSiz1F m9+g1+a3ksGpbM2UbWNTCslSu2Bs+BbjUiXBk50nvq0dJk3aUCC+B6PA0pYdMoswa6 cjxpzwH6xJjKUsEK+t+qRLjFmQ+/FWsbZWVWxqIJxOl/ed1d2UYKtJOCoT9C6xWpeg iVVDZxAPbz15y/PeRlSVp1pqUP4FK6KRKDowCuUFgwxGEZkXNUDx8n+BYAIzmfqMjC JfWhktI4iEfk9NMZxjAq3mTwY/Op9MftnIkhEIF7pl6Yx4a1AJcqkJ4D9mkoo1Qs1G DIbRplNIWzCCA== Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1CA6A604EC for ; Mon, 7 Mar 2022 13:46:39 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="pppQzGrW"; dkim-atps=neutral Received: by mail-wr1-x42c.google.com with SMTP id n15so8963340wra.6 for ; Mon, 07 Mar 2022 04:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=x06lppAe8bn8ybLWGoDpeRZWE4Da/fK/9NEXnE0bgzs=; b=pppQzGrWPygOWcTD4rkWBiYJlgXWn/todkwuJf2VdGafBdVtwrIupAZAeMnOtrXHm9 A4l+orUL4c8tPrNFr7PCi4wju46SFkcqw6DV5V6LKLyVpoNibdh+/az+KkVHjy/0WZET fghO8bJevQtHU6XfIo2tHuHIY9fJsXbN0y4xnVo73/7Uf4GgFTAyquG1lzVhJ9GTwSRP 1PMnjolzAU0fK7yz92FpR6re/UQJuizxKMLh9W8SIaIpxVL4iJMWyl1co8Igg+AbGSfF l87j+RNxmWUUu9Bv8Qazrtf7RQ+yqJjwJZnr6GhFb5xL+7BsHkr0+gBYbvTbBT7TqyXH gdZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=x06lppAe8bn8ybLWGoDpeRZWE4Da/fK/9NEXnE0bgzs=; b=AWll1OdenhptVHVGMVRWAzj2livPC+QojlILumUMlTMeunqlBRtPP/nizoZImL7MNJ mA4KrF+94TTGa0CIvoG0wkE5neTT+qdneEFM6c/ve5ljaak1CJPo95ywqApmthR6CYHp Lo9PaPKX3iR7pymgqcEHa2K+lb5Goz6p/Ck5LhMnEJIUf+0ZWzc3XGvEutlbU7cSXLH4 bEltPKgBL5f0vAeztPrCi6rG5/5ofiXSvjA1kluLcOmOXcbAw5KmSA7wmaZ1q2riYIJF KJPYU70UEvQzD59raY+Sr4i+Ex7H1gOLCKrUWbAGlMeXajUP4g/6oqvfSy5r05TZEwfW 0nOw== X-Gm-Message-State: AOAM530ijAE8osw6vCl+MLO7dHmI8e+XCAs2viqXclILJXXcDQABKVJR H6ACoLmeuQXnyvv0wnW5bHnnDRBV6NT8RQ== X-Google-Smtp-Source: ABdhPJy0PoSxJytGG6QyyMHEjWIb+xX0QQf5T9nVAQm5CscnXjTmP4EGKSK80OvCVNztGQdE2krt6w== X-Received: by 2002:adf:f1c1:0:b0:1e3:1381:7bd5 with SMTP id z1-20020adff1c1000000b001e313817bd5mr8270582wro.450.1646657198409; Mon, 07 Mar 2022 04:46:38 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:c644:e9b3:de0b:54c5]) by smtp.gmail.com with ESMTPSA id z6-20020a1cf406000000b0037c4e2d3baesm19759582wma.19.2022.03.07.04.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 04:46:37 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Mon, 7 Mar 2022 12:46:27 +0000 Message-Id: <20220307124633.115452-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 0/6] Raspberry Pi: Efficient start/stop/start sequences 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: Naushir Patuck via libcamera-devel From: Nicolas Dufresne via libcamera-devel Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi, This series addresses a problem with the existing Raspberry Pi pipeline handler, were we do not efficiently handle a camera start/stop/restart sequence. This is because we de-allocate and re-allocate buffers on stop and start respectively. However, since no camera configure has occurred, the re-allocation is unnecessary. This series attempts to fix this by not de-allocating buffers on a stop, and only re-allocating on start if a configure has been called in-between. We also fix a small bug in the V4L2 buffer cache, which does not clear state on a stop in all circumstances. Thanks, Naush Naushir Patuck (6): pipeline: raspberrypi: Avoid over-allocation for ISP Output 1 pipeline: raspberrypi: Move freeBuffers() to the RPiCameraData class pipeline: raspberrypi: Free buffers in the RPiCamera destructor and re-configure pipeline: raspberrypi: Add a reconfigured flag pipeline: raspberrypi: Repurpose RPi::Stream::reset() libcamera: v4l2_videodevice: Empty the V4L2 buffer cache on streamOff() include/libcamera/internal/v4l2_videodevice.h | 1 + .../pipeline/raspberrypi/raspberrypi.cpp | 54 ++++++++++++------- .../pipeline/raspberrypi/rpi_stream.cpp | 11 ++-- src/libcamera/v4l2_videodevice.cpp | 16 ++++++ 4 files changed, 56 insertions(+), 26 deletions(-)