Patch Detail
Show a patch.
GET /api/1.1/patches/22374/?format=api
{ "id": 22374, "url": "https://patchwork.libcamera.org/api/1.1/patches/22374/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22374/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20241217105206.357495-1-stanislaw.gruszka@linux.intel.com>", "date": "2024-12-17T10:52:06", "name": "pipeline: simple: Use proper device for frame start events", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2b2b4d52ab326c88c4d7331ead453f43f9f7c976", "submitter": { "id": 211, "url": "https://patchwork.libcamera.org/api/1.1/people/211/?format=api", "name": "Stanislaw Gruszka", "email": "stanislaw.gruszka@linux.intel.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22374/mbox/", "series": [ { "id": 4901, "url": "https://patchwork.libcamera.org/api/1.1/series/4901/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4901", "date": "2024-12-17T10:52:06", "name": "pipeline: simple: Use proper device for frame start events", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4901/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22374/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22374/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 53CA0BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 10:52:16 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8830867FC6;\n\tTue, 17 Dec 2024 11:52:15 +0100 (CET)", "from mgamail.intel.com (mgamail.intel.com [192.198.163.18])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D739567FC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 11:52:12 +0100 (CET)", "from orviesa001.jf.intel.com ([10.64.159.141])\n\tby fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n\t17 Dec 2024 02:52:11 -0800", "from sgruszka-mobl.ger.corp.intel.com (HELO localhost)\n\t([10.246.8.237])\n\tby smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n\t17 Dec 2024 02:52:09 -0800" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"N+xz73mr\"; 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=1734432733; x=1765968733;\n\th=from:to:cc:subject:date:message-id:mime-version:\n\tcontent-transfer-encoding;\n\tbh=aS0bQ3IsO0Pfeh6bs94LVmWsbiHUe8SEPHRfLYV1k6w=;\n\tb=N+xz73mr/RWRiHcDnR0YPyI52u4M+p6tpUWMNES5IXVzQ480xg0wggxN\n\tlcRnq5YORmDIL6oUtqGhf6N23ho2yIdZPjRB+OkIl/1wQGhK+tOuzngi/\n\tWFShTRgEiMr9bH+lV9yOF/iK+P9lcbBJZkaccS5CSBUBkui/QEApp5EvQ\n\t234nFVAlBX5R3aVph9M8dfTIMp6zre1ojN9Hh6fWNjWHpCTtyPmdvpL75\n\t5zE+2MoBDZWEFQqriVZdPsmv1TEJ7vvaZ194iSInVTNwZfSDQUgZJ8wLD\n\tZixUt1TJZBLSHzUf7tinG9hQhynn7P8Rmjhe0X9Br3YWGwwrLnzJQyTCG A==;", "X-CSE-ConnectionGUID": [ "oOWFAxMgQjexwHxt7+F5gw==", "2ecHtOTlThSKV20kiwRFwQ==" ], "X-CSE-MsgGUID": [ "ottT8RuMQ8e3+uQ7tLCBIA==", "rxhL1ep3RLWzPWwgQFYxrg==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6700,10204,11288\"; a=\"34173626\"", "E=Sophos;i=\"6.12,241,1728975600\"; d=\"scan'208\";a=\"34173626\"", "E=Sophos;i=\"6.12,224,1728975600\"; d=\"scan'208\";a=\"134832065\"" ], "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>", "Subject": "[PATCH] pipeline: simple: Use proper device for frame start events", "Date": "Tue, 17 Dec 2024 11:52:06 +0100", "Message-Id": "<20241217105206.357495-1-stanislaw.gruszka@linux.intel.com>", "X-Mailer": "git-send-email 2.34.1", "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\nWithout DelayedConntrols:applyControls() is possible that we can get\ncall to DelayedControls::get() with frame number that exceed number\nof saved entries and get below assertion failure:\n\n../src/libcamera/delayed_controls.cpp:227:\nlibcamera::ControlList libcamera::DelayedControls::get(uint32_t):\nAssertion `info.type() != ControlTypeNone' failed\n\nAssertion failure can happen at the beginning of streaming when\nControlRingBuffer is not yet filled and there are errors on CSI-2.\n\nTo fix, loop over devices in the pipeline (starting from the last one),\nfind one that emits start frame events and connect applyControls()\nto it.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=241\nSigned-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 26 ++++++++++++++++++++++--\n 1 file changed, 24 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 8ac24e6e..52f3d520 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -382,6 +382,7 @@ private:\n \tstd::map<const MediaEntity *, EntityData> entities_;\n \n \tMediaDevice *converter_;\n+\tV4L2Subdevice *eventEmitter_;\n \tbool swIspEnabled_;\n };\n \n@@ -1299,8 +1300,6 @@ 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 \n \tStreamConfiguration inputCfg;\n \tinputCfg.pixelFormat = pipeConfig->captureFormat;\n@@ -1368,6 +1367,23 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] const ControlL\n \n \tvideo->bufferReady.connect(data, &SimpleCameraData::imageBufferReady);\n \n+\t/*\n+\t * Enable frame start event on last device in the pipeline\n+\t * that provides the events.\n+\t */\n+\tfor (auto it = data->entities_.rbegin(); it != data->entities_.rend(); ++it) {\n+\t\tV4L2Subdevice *sd = subdev(it->entity);\n+\t\tif (!sd)\n+\t\t\tcontinue;\n+\t\tif (sd->setFrameStartEnabled(true) < 0)\n+\t\t\tcontinue;\n+\n+\t\tsd->frameStart.connect(data->delayedCtrls_.get(),\n+\t\t\t\t &DelayedControls::applyControls);\n+\t\teventEmitter_ = sd;\n+\t\tbreak;\n+\t}\n+\n \tret = video->streamOn();\n \tif (ret < 0) {\n \t\tstop(camera);\n@@ -1400,6 +1416,12 @@ void SimplePipelineHandler::stopDevice(Camera *camera)\n \tSimpleCameraData *data = cameraData(camera);\n \tV4L2VideoDevice *video = data->video_;\n \n+\tif (eventEmitter_) {\n+\t\teventEmitter_->setFrameStartEnabled(false);\n+\t\teventEmitter_->frameStart.disconnect(data->delayedCtrls_.get(),\n+\t\t\t\t\t\t &DelayedControls::applyControls);\n+\t}\n+\n \tif (data->useConversion_) {\n \t\tif (data->converter_)\n \t\t\tdata->converter_->stop();\n", "prefixes": [] }