{"id":22866,"url":"https://patchwork.libcamera.org/api/1.1/patches/22866/?format=json","web_url":"https://patchwork.libcamera.org/patch/22866/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250225164116.414301-3-stanislaw.gruszka@linux.intel.com>","date":"2025-02-25T16:41:13","name":"[v5,2/5] pipeline: simple: Use proper device for frame start events","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6c5cf609c07a6c79cc6c70c30203e07143096248","submitter":{"id":211,"url":"https://patchwork.libcamera.org/api/1.1/people/211/?format=json","name":"Stanislaw Gruszka","email":"stanislaw.gruszka@linux.intel.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22866/mbox/","series":[{"id":5021,"url":"https://patchwork.libcamera.org/api/1.1/series/5021/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5021","date":"2025-02-25T16:41:11","name":"libcamera: start frame events changes","version":5,"mbox":"https://patchwork.libcamera.org/series/5021/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22866/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22866/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 433DFBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Feb 2025 16:41:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EF9676872A;\n\tTue, 25 Feb 2025 17:41:42 +0100 (CET)","from mgamail.intel.com (mgamail.intel.com [192.198.163.10])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE9016871E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Feb 2025 17:41:39 +0100 (CET)","from orviesa005.jf.intel.com ([10.64.159.145])\n\tby fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n\t25 Feb 2025 08:41:39 -0800","from sgruszka-mobl.ger.corp.intel.com (HELO localhost)\n\t([10.245.115.185]) by orviesa005-auth.jf.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2025 08:41:37 -0800"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"X0FqoEmv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1740501700; x=1772037700;\n\th=from:to:cc:subject:date:message-id:in-reply-to:\n\treferences:mime-version:content-transfer-encoding;\n\tbh=e6Z2+Xw95ppyYevHMwKDI4aOyvzg2uhgO40wxVD/efM=;\n\tb=X0FqoEmv1BSlzN83EE8F5ezhUipw7OoluIZxXA6pu8yX60rIPNkeVKTD\n\ttcgqcI+uAh/KUeGycd2G9gO+6NCoD/AGQcTqp/3QZvYExgNOp1BaUMKU2\n\tVdjQyyigIasoQSCxVC9eB2kvVmDm8QMhVzw1VAGeOpEt8/U0nf5zrJHiB\n\tQNzk/Un17FkplBWEyDNh9j1LsCc8IZrzvwT8Ps5L86ZHL3jsxvRVkBA8Q\n\tieH+vKOwSspZi0CLAuFQPQ3cAhmaQZL6Z5kukHPr3WsKbZdPGu4FEPKrM\n\tQ/TZ99Dk9Ng/VRygHFvHtiCv0dt94Qmd+MDMRgENnFZn+WmNWJb87L1VB Q==;","X-CSE-ConnectionGUID":["7QwR7bjORpmGA1g92mr5kg==","xIF2eVbPT2C64fnYUfQmZg=="],"X-CSE-MsgGUID":["i88yItXDTPqwBsV41s8ClQ==","QpFCfi4uToGi+BJPOD3zTA=="],"X-IronPort-AV":["E=McAfee;i=\"6700,10204,11314\"; a=\"52740852\"","E=Sophos;i=\"6.12,310,1728975600\"; d=\"scan'208\";a=\"52740852\"","E=Sophos;i=\"6.12,224,1728975600\"; d=\"scan'208\";a=\"121689794\""],"X-ExtLoop1":"1","From":"Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tNaushir Patuck <naush@raspberrypi.com>,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tHans de Goede <hdegoede@redhat.com>","Subject":"[PATCH v5 2/5] pipeline: simple: Use proper device for frame start\n\tevents","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","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Currently we use frame start event from video capture device to\napply controls. But the capture device might not generate the events.\nUsually CSI-2 receiver is proper device to subscribe for start\nframe events.\n\nTo fix, loop over devices in the pipeline to find the one that\nsupports events and use it as start frame emitter.\n\nCo-developed-by: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 20 ++++++++++++++++++--\n 1 file changed, 18 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 6e039bf3..063a098f 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -277,6 +277,7 @@ public:\n \tstd::list<Entity> entities_;\n \tstd::unique_ptr<CameraSensor> sensor_;\n \tV4L2VideoDevice *video_;\n+\tV4L2Subdevice *frameStartEmitter_;\n \n \tstd::vector<Configuration> configs_;\n \tstd::map<PixelFormat, std::vector<const Configuration *>> formats_;\n@@ -579,6 +580,19 @@ int SimpleCameraData::init()\n \n \tproperties_ = sensor_->properties();\n \n+\tframeStartEmitter_ = nullptr;\n+\tfor (const Entity &entity : entities_) {\n+\t\tV4L2Subdevice *sd = pipe->subdev(entity.entity);\n+\t\tif (!sd || !sd->supportsFrameStartEvent())\n+\t\t\tcontinue;\n+\n+\t\tLOG(SimplePipeline, Debug)\n+\t\t\t<< \"Using \" << entity.entity->name() << \" frameStart signal\";\n+\n+\t\tframeStartEmitter_ = sd;\n+\t\tbreak;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -1215,6 +1229,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \t\tstatic_cast<SimpleCameraConfiguration *>(c);\n \tSimpleCameraData *data = cameraData(camera);\n \tV4L2VideoDevice *video = data->video_;\n+\tV4L2Subdevice *frameStartEmitter = data->frameStartEmitter_;\n \tint ret;\n \n \t/*\n@@ -1285,8 +1300,9 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \tdata->delayedCtrls_ =\n \t\tstd::make_unique<DelayedControls>(data->sensor_->device(),\n \t\t\t\t\t\t  params);\n-\tdata->video_->frameStart.connect(data->delayedCtrls_.get(),\n-\t\t\t\t\t &DelayedControls::applyControls);\n+\tif (frameStartEmitter)\n+\t\tframeStartEmitter->frameStart.connect(data->delayedCtrls_.get(),\n+\t\t\t\t\t\t      &DelayedControls::applyControls);\n \n \tStreamConfiguration inputCfg;\n \tinputCfg.pixelFormat = pipeConfig->captureFormat;\n","prefixes":["v5","2/5"]}