{"id":20980,"url":"https://patchwork.libcamera.org/api/patches/20980/?format=json","web_url":"https://patchwork.libcamera.org/patch/20980/","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":"<20240820195016.16028-5-hdegoede@redhat.com>","date":"2024-08-20T19:50:15","name":"[4/5] camera: Use invokeMethod() for pipe_->acquire() and pipe_->release()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"99857ba41d21426d1737b7e227870e9bc20b44a9","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/people/102/?format=json","name":"Hans de Goede","email":"hdegoede@redhat.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20980/mbox/","series":[{"id":4530,"url":"https://patchwork.libcamera.org/api/series/4530/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4530","date":"2024-08-20T19:50:11","name":"Fix uvcvideo pipelinehandler keeping /dev/video# open","version":1,"mbox":"https://patchwork.libcamera.org/series/4530/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20980/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20980/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 A8182C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Aug 2024 19:50:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3155E633D9;\n\tTue, 20 Aug 2024 21:50:36 +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 2EACE633CC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Aug 2024 21:50:33 +0200 (CEST)","from mx-prod-mc-04.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-550-QxV4OrWmN-aELMxH12-raA-1;\n\tTue, 20 Aug 2024 15:50:30 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.12])\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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS\n\tid D4B871955F42 for <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Aug 2024 19:50:29 +0000 (UTC)","from x1.localdomain.com (unknown [10.39.192.41])\n\tby mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id F074B19560AA; Tue, 20 Aug 2024 19:50:27 +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=\"ObgX6cG8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1724183432;\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\tin-reply-to:in-reply-to:references:references;\n\tbh=WGiYb64KQE89QK7XoYdi0Qqg9cde4U+1zFPMIxPGT08=;\n\tb=ObgX6cG87K/FW/nhsHzM7Dc7z7ht24+/raiOC9NZwrqm8/3Z7b0ToEd8gbrnEHtTM+l4Pe\n\tXdop8r24MZb84bveLlYhwUFzI2guBPxx4Xf71EOsNC/nu0L3yg0xlQfTKxYn8FNURc/O1M\n\tzg8gHH9nFKOGdKI1PJ8j9caMdf9QlPQ=","X-MC-Unique":"QxV4OrWmN-aELMxH12-raA-1","From":"Hans de Goede <hdegoede@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Maxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>, \n\tHans de Goede <hdegoede@redhat.com>","Subject":"[PATCH 4/5] camera: Use invokeMethod() for pipe_->acquire() and\n\tpipe_->release()","Date":"Tue, 20 Aug 2024 21:50:15 +0200","Message-ID":"<20240820195016.16028-5-hdegoede@redhat.com>","In-Reply-To":"<20240820195016.16028-1-hdegoede@redhat.com>","References":"<20240820195016.16028-1-hdegoede@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12","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":"Some pipeline handlers may want to open / close /dev/video# nodes\nfrom pipe_->acquireDevices() / pipe_->releaseDevices().\n\nV4L2VideoDevice::open() creates an EventNotifier, this notifier needs\nto be created from the CameraManager thread.\n\nUse invokeMethod() for pipe_->acquire() and pipe_->release() so that\nany EventNotifiers created are created from the CameraManager thread\ncontext.\n\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\n src/libcamera/camera.cpp | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 4e393f89..61925e83 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -995,7 +995,8 @@ int Camera::acquire()\n \tif (ret < 0)\n \t\treturn ret == -EACCES ? -EBUSY : ret;\n \n-\tif (!d->pipe_->acquire(this)) {\n+\tif (!d->pipe_->invokeMethod(&PipelineHandler::acquire,\n+\t\t\t\t    ConnectionTypeBlocking, this)) {\n \t\tLOG(Camera, Info)\n \t\t\t<< \"Pipeline handler in use by another process\";\n \t\treturn -EBUSY;\n@@ -1030,7 +1031,8 @@ int Camera::release()\n \t\treturn ret == -EACCES ? -EBUSY : ret;\n \n \tif (d->isAcquired())\n-\t\td->pipe_->release(this);\n+\t\td->pipe_->invokeMethod(&PipelineHandler::release,\n+\t\t\t\t       ConnectionTypeBlocking, this);\n \n \td->setState(Private::CameraAvailable);\n \n","prefixes":["4/5"]}