From patchwork Sun Jun 28 09:52:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8471 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 AFE2CC2E66 for ; Sun, 28 Jun 2020 09:52:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0C1F4609DB; Sun, 28 Jun 2020 11:52:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="r9YdJPWZ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A115C603B2 for ; Sun, 28 Jun 2020 11:52:14 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 134344FB; Sun, 28 Jun 2020 11:52:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593337934; bh=kAoLCUBMUhtmdOqfUwCGVqXVpkghn1FXxql1KKzlbIM=; h=From:To:Cc:Subject:Date:From; b=r9YdJPWZAyKaCMBfU8LnNIcnzr1LODUvKGRnzqyoPkQa6F6KC+6HELa5JLfQ1oosC 6QMRZQoYUfXgVjnkOsd9nGuUDmtECoDp46chuinI4s0mmpOhL8rx6KYuC85wm4NA6w YSTpZx3l6RJQLVljjLCUhxTW6K0KL7Tj9ONGy/8o= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sun, 28 Jun 2020 12:52:04 +0300 Message-Id: <20200628095204.23527-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: pipeline: simple: Setup links outside for format try loop 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" The SimpleCameraData::init() function needs to setup links along the pipeline, but doesn't need to repeat that operation for each media bus code it tries. Move the link setup before the loop. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/pipeline/simple/simple.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 1ec8d0f7de03..9274e61462fc 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -250,6 +250,14 @@ int SimpleCameraData::init() SimpleConverter *converter = pipe->converter(); int ret; + /* + * Setup links first as some subdev drivers take active links into + * account to propagate TRY formats. Such is life :-( + */ + ret = setupLinks(); + if (ret < 0) + return ret; + /* * Enumerate the possible pipeline configurations. For each media bus * format supported by the sensor, propagate the formats through the @@ -259,14 +267,6 @@ int SimpleCameraData::init() for (unsigned int code : sensor_->mbusCodes()) { V4L2SubdeviceFormat format{ code, sensor_->resolution() }; - /* - * Setup links first as some subdev drivers take active links - * into account to propagate TRY formats. Such is life :-( - */ - ret = setupLinks(); - if (ret < 0) - return ret; - ret = setupFormats(&format, V4L2Subdevice::TryFormat); if (ret < 0) { LOG(SimplePipeline, Error)