From patchwork Mon Mar 21 10:26:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15485 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 44063BD80A for ; Mon, 21 Mar 2022 10:27:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F3ACA610F8; Mon, 21 Mar 2022 11:27:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647858430; bh=kXB2y+u+v0J4lOfnEEEK0fEHQi8UCDN+opF1eo2OslI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kJsblsTAxBB4+Dpvioxq+ZF0WT63iF1RM4T+Kiroj57zfmPzYjju4zQTZXcjU/mHV vu03g579cVgz+/+jMCCQKjYwZk/wjvEC1IhnO675y4z6rSyBHfLDs6B74qV3s2goed PvXN5jqmb4vKSPVuywBBczdxxnDRLAJ4K/5rkHbBwp9lwr+T6qL3eXvw7Z0HmaIwsP KcsLPcixBRzCecouyoRF8t0rjHha2VPjkclSaSkhOhqGHzIG5xkmGSzgBhTSOkqim2 r/rB7/jVrWAUU/vYi045NbnG/W3ZVo11EoN6FxLl52D9W2lzI3p5Kwc7WS4fABQCEr 3YJTgXSdKVqog== Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 37CAB604DA for ; Mon, 21 Mar 2022 11:27:07 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="nHwK4o1v"; dkim-atps=neutral Received: by mail-wr1-x436.google.com with SMTP id u16so18995344wru.4 for ; Mon, 21 Mar 2022 03:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gxKs37xBf6jAcWLRbf5L/O2SlW/iZaDg6COx8v6by6c=; b=nHwK4o1vdq2MCd3EBqqdMyh0j+agzust9QwR/K/3MDg4EzFw8XV9rEDY4a8lKxf0D8 tSIJVYJr4MbOVr2VDe1odf94V7jLJsV94QL0GIiXlXbizv7MawG78TIPehyHXqTJKDto 60y+Ay5HykE1cIdgZNcWaJFjVE0tPRwTkH4Px8GAZWBmPnhRRu9cftwe3pQn08fMIw17 MzhVVpJhyaWfnCtZneUn/hoo+gHazrx8yUcuVEsw3IHzYiMaIuvqwTHVZu7AqqOLeMrr r72cXw9OzOcmKvKk2+t21KyyZ3q0X6a+q9GreGYEIQOEUoN5tiE3j3UNbvVF6lASPpDv 5dLw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=gxKs37xBf6jAcWLRbf5L/O2SlW/iZaDg6COx8v6by6c=; b=iZr1SeIjMn4vImFr+8eXP1h1xKHPmRnhmF3ec7mnJ5fIXMPu49naS0CUX/YFpbzHhM jG8thPLRb/uJshbkAxQzbMl3IIAAIkXr3BqhcCVIh+PWZt1jK0OxH3OB4TwFfnGVJCxg 6O7xlp9Ma29XJAKA9WS9GtjwWHXGgWqTyiZzvBrFjti/817CRr7C5Gbm17WiJ6Eqq6nc QA4zht7Q7lLmT3BTmPFMNZJqmK1eI7G7ECa3MCSQeMPVzJUnwsG31QDW9UqAfrOSksPX 5vjXkHnW7RVb4SWLyWyh+Wi0vS01NN7jRwkOhJqPqwVWkpXpEv0Ewl+9h/oDji20ILmV ojoQ== X-Gm-Message-State: AOAM531Y1lu5bpGhNIlgSPQk8vRYVRAv+a4mZejiuFvLUjxQXOLbiOv8 4jc1DPcMFICsTVZ5gYnA6uwH97Bk+iZAOw== X-Google-Smtp-Source: ABdhPJw1VEUs7CTcaV4qKo1Q0PwmjDQS8BVN0czaQhn0qQuk4As06fWlW4dIooQkr4BWoh3qYwbLxg== X-Received: by 2002:a5d:6208:0:b0:203:dde4:c76e with SMTP id y8-20020a5d6208000000b00203dde4c76emr17785921wru.273.1647858426567; Mon, 21 Mar 2022 03:27:06 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:77bd:7c6c:a8b9:8855]) by smtp.gmail.com with ESMTPSA id v10-20020a056000144a00b00203df06cf9bsm13530115wrx.106.2022.03.21.03.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 03:27:06 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 21 Mar 2022 10:26:59 +0000 Message-Id: <20220321102702.1753800-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220321102702.1753800-1-naush@raspberrypi.com> References: <20220321102702.1753800-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/5] pipeline: raspberrypi: Move freeBuffers() to the RPiCameraData class 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: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This function used to clear the camera buffers does not belong in the PipelineHandlerRPi class as it only access members of the RPiCameraData, so move it. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Tested-by: David Plowman Reviewed-by: Laurent Pinchart --- .../pipeline/raspberrypi/raspberrypi.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 43e87a406036..2281b43fc3ac 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -189,6 +189,7 @@ public: { } + void freeBuffers(); void frameStarted(uint32_t sequence); int loadIPA(ipa::RPi::SensorConfig *sensorConfig); @@ -330,7 +331,6 @@ private: int registerCamera(MediaDevice *unicam, MediaDevice *isp, MediaEntity *sensorEntity); int queueAllBuffers(Camera *camera); int prepareBuffers(Camera *camera); - void freeBuffers(Camera *camera); void mapBuffers(Camera *camera, const RPi::BufferMap &buffers, unsigned int mask); }; @@ -1056,7 +1056,7 @@ void PipelineHandlerRPi::stopDevice(Camera *camera) /* Stop the IPA. */ data->ipa_->stop(); - freeBuffers(camera); + data->freeBuffers(); } int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request) @@ -1452,16 +1452,14 @@ void PipelineHandlerRPi::mapBuffers(Camera *camera, const RPi::BufferMap &buffer data->ipa_->mapBuffers(ipaBuffers); } -void PipelineHandlerRPi::freeBuffers(Camera *camera) +void RPiCameraData::freeBuffers() { - RPiCameraData *data = cameraData(camera); - /* Copy the buffer ids from the unordered_set to a vector to pass to the IPA. */ - std::vector ipaBuffers(data->ipaBuffers_.begin(), data->ipaBuffers_.end()); - data->ipa_->unmapBuffers(ipaBuffers); - data->ipaBuffers_.clear(); + std::vector ipaBuffers(ipaBuffers_.begin(), ipaBuffers_.end()); + ipa_->unmapBuffers(ipaBuffers); + ipaBuffers_.clear(); - for (auto const stream : data->streams_) + for (auto const stream : streams_) stream->releaseBuffers(); }