{"id":21075,"url":"https://patchwork.libcamera.org/api/covers/21075/?format=json","web_url":"https://patchwork.libcamera.org/cover/21075/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20240830111207.46455-1-hdegoede@redhat.com>","date":"2024-08-30T11:12:04","name":"[v3,0/3] Fix uvcvideo pipelinehandler keeping /dev/video# open","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/people/102/?format=json","name":"Hans de Goede","email":"hdegoede@redhat.com"},"mbox":"https://patchwork.libcamera.org/cover/21075/mbox/","series":[{"id":4549,"url":"https://patchwork.libcamera.org/api/series/4549/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4549","date":"2024-08-30T11:12:04","name":"Fix uvcvideo pipelinehandler keeping /dev/video# open","version":3,"mbox":"https://patchwork.libcamera.org/series/4549/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/21075/comments/","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 13407C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 30 Aug 2024 11:12:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B6ED863466;\n\tFri, 30 Aug 2024 13:12:20 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1B8CC61E4A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 13:12:18 +0200 (CEST)","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-408-8oAO3IrbN36m_yIbvOvyDg-1;\n\tFri, 30 Aug 2024 07:12:16 -0400","from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.15])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS\n\tid 32C211954B07 for <libcamera-devel@lists.libcamera.org>;\n\tFri, 30 Aug 2024 11:12:15 +0000 (UTC)","from localhost.localdomain (unknown [10.39.193.217])\n\tby mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 99E8B1955F1B; Fri, 30 Aug 2024 11:12:13 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"MRWp0mIq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1725016337;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding;\n\tbh=4W7ZThR/dyiUIbE2HsTpMHCQFFk/uOGVEopPUEpRKPE=;\n\tb=MRWp0mIqOBwEft13vi9S2yh3GlATPlDNKG15IJgOm4t+siPRPUa26Dm/471bA8yiHeCLfZ\n\tSvQzakjtMfiKleh1Uh1BwvWSokNxzPpYAtLIoelx4bfl/MNqKAuK+vsKCaCAQjAOoRRS6W\n\t+4pbOZ6mJ1CboL3DAZH67f75VLt5Tvs=","X-MC-Unique":"8oAO3IrbN36m_yIbvOvyDg-1","From":"Hans de Goede <hdegoede@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>, Maxime Ripard <mripard@redhat.com>, \n\tHans de Goede <hdegoede@redhat.com>","Subject":"[PATCH v3 0/3] Fix uvcvideo pipelinehandler keeping /dev/video# open","Date":"Fri, 30 Aug 2024 13:12:04 +0200","Message-ID":"<20240830111207.46455-1-hdegoede@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.15","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain; charset=\"US-ASCII\"; x-default=true","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":"Hi all,\n\nThe uvcvideo pipeline handler always keeps the uvcvideo /dev/video# device\nfor a pipeline open after enumerating the camera.\n\nThis is a problem for uvcvideo, as keeping the /dev/video# node open stops\nthe underlying USB device and the USB bus controller from being able to\nenter runtime-suspend causing significant unnecessary power-usage.\n\nHere is v3 of my series making the uvcvideo pipeline handler open\n/dev/video# on acquire and close it on release to fix this.\n\nChanges in v3:\n- s/method/function/ in commit msg\n- Put MutexLocker locker(data_->openLock_); in a { } context\n  to reduce the time the lock is held to the minimum time necessary\n- Add Reviewed-by-s\n\nChanges in v2:\n- Drop the first 2 patches these have already been merged\n- Add a note to both the doxygen documentation as well as to the commit\n  messages that opening/closing /dev/video# from acquire()/release()\n  as done by the uvcvideo pipeline handler is an exception and that this\n  behavior should not be copied by other pipeline handlers\n- Other doxygen doc fixes / improvements\n- Only unlock media devices on acquireDevice() failure if useCount_ == 0\n- Drop PipelineHandler::lock_, update \"\\context\" in doxygen docs\n\nI've pushed this to the software-isp gitlab repo for CI:\nhttps://gitlab.freedesktop.org/camera/libcamera-softisp/-/commits/pipeline-acquireDevice-v2\n\nand it has passed CI.\n\nRegards,\n\nHans\n\n*** BLURB HERE ***\n\nHans de Goede (3):\n  pipeline_handler: Add acquireDevice() function to mirror existing\n    releaseDevice()\n  camera: Use invokeMethod() for pipe_->acquire() and pipe_->release()\n  uvcvideo: Implement acquireDevice() + releaseDevice()\n\n include/libcamera/internal/pipeline_handler.h |  8 +--\n src/libcamera/camera.cpp                      |  6 +-\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  | 54 ++++++++++++++++-\n src/libcamera/pipeline_handler.cpp            | 60 ++++++++++++++-----\n 4 files changed, 104 insertions(+), 24 deletions(-)"}