From patchwork Thu Aug 8 17:39:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 20848 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 7779EC323E for ; Thu, 8 Aug 2024 17:39:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 29AB963382; Thu, 8 Aug 2024 19:39:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mSqi5QiW"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CE6E16337F for ; Thu, 8 Aug 2024 19:39:24 +0200 (CEST) Received: from Monstersaurus.tail69b4.ts.net (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E9048C8E; Thu, 8 Aug 2024 19:38:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1723138711; bh=l4hjMp0+x9x77pS0m7uX5MOyVl1PnogMgw8D/SO5su8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mSqi5QiWBbLEhIA5Dl8G/lHArcayEWiZV+wZgQeLfr9C8WTn4FqM3RCC44tTBhYFG lbk6u0SXSx3vnmf8CCelodll6aKnIrx1GcvRnxWjelQ49017rs+4+euARC/x+k5+VU a1RpKDUWP17SbgZTyWFk0J5fMnzYdGUvYn9DtDbo= From: Kieran Bingham To: libcamera devel Cc: Paul Elder , Kieran Bingham Subject: [PATCH 1/2] pipeline: simple: Remove media member variable Date: Thu, 8 Aug 2024 18:39:20 +0100 Message-Id: <20240808173921.2519957-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808173921.2519957-1-kieran.bingham@ideasonboard.com> References: <20240808173921.2519957-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Paul Elder There is no need for the simple pipeline handler to save the media device. Remove it. Signed-off-by: Paul Elder Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/simple/simple.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 9910900e0e5e..222052ce02f8 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -363,13 +363,12 @@ private: return static_cast(camera->_d()); } - std::vector locateSensors(); + std::vector locateSensors(MediaDevice *media); static int resetRoutingTable(V4L2Subdevice *subdev); const MediaPad *acquirePipeline(SimpleCameraData *data); void releasePipeline(SimpleCameraData *data); - MediaDevice *media_; std::map entities_; MediaDevice *converter_; @@ -1424,7 +1423,8 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request) * Match and Setup */ -std::vector SimplePipelineHandler::locateSensors() +std::vector +SimplePipelineHandler::locateSensors(MediaDevice *media) { std::vector entities; @@ -1432,7 +1432,7 @@ std::vector SimplePipelineHandler::locateSensors() * Gather all the camera sensor entities based on the function they * expose. */ - for (MediaEntity *entity : media_->entities()) { + for (MediaEntity *entity : media->entities()) { if (entity->function() == MEDIA_ENT_F_CAM_SENSOR) entities.push_back(entity); } @@ -1520,17 +1520,18 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) { const SimplePipelineInfo *info = nullptr; unsigned int numStreams = 1; + MediaDevice *media; for (const SimplePipelineInfo &inf : supportedDevices) { DeviceMatch dm(inf.driver); - media_ = acquireMediaDevice(enumerator, dm); - if (media_) { + media = acquireMediaDevice(enumerator, dm); + if (media) { info = &inf; break; } } - if (!media_) + if (!media) return false; for (const auto &[name, streams] : info->converters) { @@ -1545,13 +1546,13 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) swIspEnabled_ = info->swIspEnabled; /* Locate the sensors. */ - std::vector sensors = locateSensors(); + std::vector sensors = locateSensors(media); if (sensors.empty()) { - LOG(SimplePipeline, Info) << "No sensor found for " << media_->deviceNode(); + LOG(SimplePipeline, Info) << "No sensor found for " << media->deviceNode(); return false; } - LOG(SimplePipeline, Debug) << "Sensor found for " << media_->deviceNode(); + LOG(SimplePipeline, Debug) << "Sensor found for " << media->deviceNode(); /* * Create one camera data instance for each sensor and gather all