From patchwork Mon Mar 7 12:46:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15427 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 1520ABF415 for ; Mon, 7 Mar 2022 12:46:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F1DAB6118F; Mon, 7 Mar 2022 13:46:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1646657203; bh=FyyHGeWhlB5LY2jQX1WYbJUW6Xuvj0MggkhDKWIoB/4=; 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=KcpoggUDAC6RUHKsC42UXx4atXB6guIh/GHf/FEwBX2aBDZQ3GFJtEQjscnRRLpTx LyAzNtUzkRnLXFMhHRiukruU4ntmjiprQdwemS/WGRewSe4vCW2MkW63QZlLVQ29ot m2G5h3w6+aaBYDYI53ZEw4NZupdTG9vyiAJd3nV9sx9kbrBgAJYXeJOcJyqExDPp4i l6LYS4hft5XxR8+GcP7zwLRpWfeyMWOru9YsL+98IRJfCz2ZeUfmeU1k3DHrYpHJvZ zRWv14B4cMOtwdU2ltDTwIm1i8KVmid8QSEzhknRqIbsMnxFFeHDDRB+4Z5IyZGakP d5SmBi3+hwsUw== Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9303561184 for ; Mon, 7 Mar 2022 13:46:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="UwPGii3N"; dkim-atps=neutral Received: by mail-wm1-x334.google.com with SMTP id o18-20020a05600c4fd200b003826701f847so10674901wmq.4 for ; Mon, 07 Mar 2022 04:46:40 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=wi8Ibf1/9HKLHB0vE2sv4ocKlb9cP2TxaZ7cUSBfnZw=; b=UwPGii3NnV5tIrttOPYx+AEtOzGE77qpv25+yKHBmsXQ1CjwoOCTW5B7rTeZugbX9k S6mthUZHSjTBLTM/hqER6kwvZX9MUNBtOZ21PAhUTw3ar9blBp1W+YLjQ5ic1k/axWBi ad6qp2Igi3SsldVhvOpWUpLiuTejcTxOMVqRZzy4VR4DA3mGrfuQIS3EVEeDWDmT5ZOQ LOHjsi6fsQAVD3uEJm5BXOWLIXyGC45Zn15T1DO3EAD+spLueY1oBSIranD8oL2keHdC SZGy5fDe/8CcazZeiOvqWW85iXNSza1zrEl6stQDWo5amOVy73tiETfN7DwErmM4qj5d C1/w== 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=wi8Ibf1/9HKLHB0vE2sv4ocKlb9cP2TxaZ7cUSBfnZw=; b=0LFzA5XVa6bOCMn/9EDyahhIotErm5VkH2OW1W/mucGnbO0RZjP1acgkQ6PDslf7nt kDi2KT8HDDsh6sZqOPNp8eez6t4If+iPCqinf2EGTks6sgGJ5FZi2JyicPaXm6nIrzzh frxStKLyEai0Urw8P8sgLk81yUT0JvnUsswjfBj006oiWMcHgOaGnhhe+jd1lj136R2b BjjWmGk2IoY19R6NDM7cbGpGla+92IiTrruuP5PW0HuQv0fJubAHCZBf9fuwThH2Ez7J WQ0bfx2r9VEGsQszOoiAXtbxT4DLn+NNrmZHgXAh/OptVSLLcCgt8qB47QBWOqki2346 SuOg== X-Gm-Message-State: AOAM532BBthX5wDaO6iStkWAusI1fMDkATptWd8Y2V00n4v1N5OnHi/0 2yFJMu2hR67vsd05XaN1jhqaSVSonkF9aQ== X-Google-Smtp-Source: ABdhPJw0GUBTMoWa6Yb1gGqo5NQ/JHcK1KojjzJd7sW4APXGdPexncv0HerYDqXQzbXgbqv7E8HUoQ== X-Received: by 2002:a7b:cc8f:0:b0:389:844e:9e28 with SMTP id p15-20020a7bcc8f000000b00389844e9e28mr8769874wma.67.1646657200025; Mon, 07 Mar 2022 04:46:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 04:46:39 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Mon, 7 Mar 2022 12:46:29 +0000 Message-Id: <20220307124633.115452-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307124633.115452-1-naush@raspberrypi.com> References: <20220307124633.115452-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 2/6] 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 d604c473c26c..3781e4e0e3c4 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); @@ -329,7 +330,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); }; @@ -1049,7 +1049,7 @@ void PipelineHandlerRPi::stopDevice(Camera *camera) /* Stop the IPA. */ data->ipa_->stop(); - freeBuffers(camera); + data->freeBuffers(); } int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request) @@ -1445,16 +1445,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(); }