From patchwork Tue Feb 25 16:41:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 22866 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 433DFBDB1C for ; Tue, 25 Feb 2025 16:41:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EF9676872A; Tue, 25 Feb 2025 17:41:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="X0FqoEmv"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EE9016871E for ; Tue, 25 Feb 2025 17:41:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1740501700; x=1772037700; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e6Z2+Xw95ppyYevHMwKDI4aOyvzg2uhgO40wxVD/efM=; b=X0FqoEmv1BSlzN83EE8F5ezhUipw7OoluIZxXA6pu8yX60rIPNkeVKTD tcgqcI+uAh/KUeGycd2G9gO+6NCoD/AGQcTqp/3QZvYExgNOp1BaUMKU2 VdjQyyigIasoQSCxVC9eB2kvVmDm8QMhVzw1VAGeOpEt8/U0nf5zrJHiB QNzk/Un17FkplBWEyDNh9j1LsCc8IZrzvwT8Ps5L86ZHL3jsxvRVkBA8Q ieH+vKOwSspZi0CLAuFQPQ3cAhmaQZL6Z5kukHPr3WsKbZdPGu4FEPKrM Q/TZ99Dk9Ng/VRygHFvHtiCv0dt94Qmd+MDMRgENnFZn+WmNWJb87L1VB Q==; X-CSE-ConnectionGUID: 7QwR7bjORpmGA1g92mr5kg== X-CSE-MsgGUID: i88yItXDTPqwBsV41s8ClQ== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="52740852" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="52740852" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2025 08:41:39 -0800 X-CSE-ConnectionGUID: xIF2eVbPT2C64fnYUfQmZg== X-CSE-MsgGUID: QpFCfi4uToGi+BJPOD3zTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="121689794" Received: from sgruszka-mobl.ger.corp.intel.com (HELO localhost) ([10.245.115.185]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2025 08:41:37 -0800 From: Stanislaw Gruszka To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Laurent Pinchart , Kieran Bingham , Naushir Patuck , Sakari Ailus , Hans de Goede Subject: [PATCH v5 2/5] pipeline: simple: Use proper device for frame start events Date: Tue, 25 Feb 2025 17:41:13 +0100 Message-Id: <20250225164116.414301-3-stanislaw.gruszka@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250225164116.414301-1-stanislaw.gruszka@linux.intel.com> References: <20250225164116.414301-1-stanislaw.gruszka@linux.intel.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" Currently we use frame start event from video capture device to apply controls. But the capture device might not generate the events. Usually CSI-2 receiver is proper device to subscribe for start frame events. To fix, loop over devices in the pipeline to find the one that supports events and use it as start frame emitter. Co-developed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Stanislaw Gruszka Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/simple/simple.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 6e039bf3..063a098f 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -277,6 +277,7 @@ public: std::list entities_; std::unique_ptr sensor_; V4L2VideoDevice *video_; + V4L2Subdevice *frameStartEmitter_; std::vector configs_; std::map> formats_; @@ -579,6 +580,19 @@ int SimpleCameraData::init() properties_ = sensor_->properties(); + frameStartEmitter_ = nullptr; + for (const Entity &entity : entities_) { + V4L2Subdevice *sd = pipe->subdev(entity.entity); + if (!sd || !sd->supportsFrameStartEvent()) + continue; + + LOG(SimplePipeline, Debug) + << "Using " << entity.entity->name() << " frameStart signal"; + + frameStartEmitter_ = sd; + break; + } + return 0; } @@ -1215,6 +1229,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) static_cast(c); SimpleCameraData *data = cameraData(camera); V4L2VideoDevice *video = data->video_; + V4L2Subdevice *frameStartEmitter = data->frameStartEmitter_; int ret; /* @@ -1285,8 +1300,9 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) data->delayedCtrls_ = std::make_unique(data->sensor_->device(), params); - data->video_->frameStart.connect(data->delayedCtrls_.get(), - &DelayedControls::applyControls); + if (frameStartEmitter) + frameStartEmitter->frameStart.connect(data->delayedCtrls_.get(), + &DelayedControls::applyControls); StreamConfiguration inputCfg; inputCfg.pixelFormat = pipeConfig->captureFormat;