From patchwork Fri Nov 11 13:30:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17788 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 59BCBC3285 for ; Fri, 11 Nov 2022 13:30:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D190963087; Fri, 11 Nov 2022 14:30:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668173432; bh=ezy0mYD0YxRPxt1lRUUw8BL2nEP7GeoH4VvjV61NBdE=; 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=l9PM3Dhp8IMju35vrYXBTwYAjZewMHYqSR0MspCPdTeyNHNzRFUhHtZZn01qM906O ooWj61uebOZpfcn9mkw0tI/d/bbMKaUHVHqYzFnqeSAiPAJWX9tT4T2cr1Li0NXIxd fsAaWNK+k2CSpbCR6BaA0BNJRRo9hfrdChnFqnsw5RpdLjTkMSvoNZ0b3aMOhLEV4z jzM3IQz+SVoJzlwJ0YWPISYo/RTXIShCsXkcVkS5SqcN5v3KhGDzvqB5fNYdshaCTR +iQgqg9ovIvLxq0SPlpZ7T6f379i3U1/vwFyxP6eVLXdHZSoqmQkYEmg34dF4dpNG0 HQwp4OdGxsi8Q== Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4FA216307E for ; Fri, 11 Nov 2022 14:30:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="sOPY69Tp"; dkim-atps=neutral Received: by mail-wm1-x331.google.com with SMTP id r203-20020a1c44d4000000b003cfa97c05cdso3868250wma.4 for ; Fri, 11 Nov 2022 05:30:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IhibtisHB+sjCPzG5P0lOz5qlZRGGKdQlitZDDgL3Zo=; b=sOPY69TpQIM7/ZSGESGo9Jybfd5IpauOrEOlgQsHAaUzm5/v3SuTxanwuBBr/T77/V EOuSJls+kUNSzMiBdFsE2iF5qaHo1kkWFtt8Z4wkGFoA4gTByUG9Z+EneI3z2GV6+qgP nHgaKd0m5fHTCdN8Wzh28sPQmVVUaL2bS+ZtxZrRG2DVQgYrDmSN3bB93K2ws1ULKXit qzbOskFQD658pUysiU3Fv7bJHadb0TsQ18Y4xv++fL1N5j9iFLLnr4iIp8znD+Q40T8+ E9qndmjzFyRT82gDdq6R2z5w+UxWYNZNNB7EYtAO30oI+Wg8TM3dHrlZvxm8d+O2blhW kOLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IhibtisHB+sjCPzG5P0lOz5qlZRGGKdQlitZDDgL3Zo=; b=l3vgn7oh76bI9SQFQeWfPA15PypDFY/gVn75MZjusRNEOuv987asrnz1v3oFYoEk0F JBiscNbIaF4nqFDJE80gIbaagK5Nlqs6/o4aEKXHKjkC3vkiamYTFLC8R0nOIK4Z3hCq 6bn8szR9tabd4hw/nT9ucV1fR2CxwbwMOFtGnR5AFjWZlJkzMy6eJmnJI1L7yfs40yd0 5Xs3JPK9R2IzqJsu6rztYh2hNRSB+FOTL/jnhBVO9PyiKeuWT02TgWIyHYCq5JOrvTUz 2fHNT7D3545+LS3uHUfuM54ZufHaI/imew4dxZMKs5sXblfBByR7OFIhz8HTbiqUJFHs TNtg== X-Gm-Message-State: ANoB5plYFJwlloHmH+vstab/R2Bg1EzjfDK4BjN98/n60Y/76RDzPucX jYljRB+Lx5fvt6haCt9mNKTCPA456j3x1A== X-Google-Smtp-Source: AA0mqf5GjGNTb6OFBubTsANLZT2/FNs/oIf4BCYx0ONN/cH7O/rV2VFONPBG2WW/GtNyfyLcCl5i3A== X-Received: by 2002:a05:600c:3b03:b0:3cf:b49e:1638 with SMTP id m3-20020a05600c3b0300b003cfb49e1638mr1262382wms.50.1668173430639; Fri, 11 Nov 2022 05:30:30 -0800 (PST) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id bk11-20020a0560001d8b00b002416f0f1e96sm1511487wrb.43.2022.11.11.05.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 05:30:29 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 11 Nov 2022 13:30:25 +0000 Message-Id: <20221111133025.3102-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221111133025.3102-1-david.plowman@raspberrypi.com> References: <20221111133025.3102-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: pipeline: raspberrypi: Free buffers when a camera is released 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" Implement the PipelineHandlerRPi::releaseDevice method which allows us to free any allocated buffers when a camera is released. Signed-off-by: David Plowman Reviewed-by: Kieran Bingham Reviewed-by: Naushir Patuck --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index f15fa28b..785eddf9 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -337,6 +337,8 @@ public: bool match(DeviceEnumerator *enumerator) override; + void releaseDevice(Camera *camera) override; + private: RPiCameraData *cameraData(Camera *camera) { @@ -1193,6 +1195,12 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) return !!numCameras; } +void PipelineHandlerRPi::releaseDevice(Camera *camera) +{ + RPiCameraData *data = cameraData(camera); + data->freeBuffers(); +} + int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, MediaEntity *sensorEntity) { std::unique_ptr data = std::make_unique(this);