[{"id":30881,"web_url":"https://patchwork.libcamera.org/comment/30881/","msgid":"<d96068e3-eb50-4c7c-91fc-eaec1d430a58@redhat.com>","date":"2024-08-21T09:57:02","subject":"Re: [PATCH 1/5] pipeline_handler: Fix unlocking media devices too\n\tearly when there are multiple cameras","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/people/102/","name":"Hans de Goede","email":"hdegoede@redhat.com"},"content":"Hi,\n\nOn 8/20/24 9:50 PM, Hans de Goede wrote:\n> PipelineHandler::acquire() only locks the media devices when the first\n> camera is acquired. If a second camera of a pipeline is acquired only\n> useCount_ is increased and nothing else is done.\n> \n> When releasing cameras PipelineHandler::release() should only unlock\n> the media devices when the last camera is released. But the old code\n> unlocked on every release().\n> \n> Fix PipelineHandler::release() to only release the media devices when\n> the last camera is released.\n> \n> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n\nNote this is a resend of the standalone fix which I send out earlier\nsince the rest of the series depends on this.\n\nThe standalone posting already has a:\n\nReviewed-by: Harvey Yang <chenghaoyang@chromium.org>\n\nwhich I forgot to add here.\n\nRegards,\n\nHans\n\n\n> ---\n>  src/libcamera/pipeline_handler.cpp | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index 5a6de685..a20cd27d 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -205,7 +205,8 @@ void PipelineHandler::release(Camera *camera)\n>  \n>  \tASSERT(useCount_);\n>  \n> -\tunlockMediaDevices();\n> +\tif (useCount_ == 1)\n> +\t\tunlockMediaDevices();\n>  \n>  \treleaseDevice(camera);\n>","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 34448BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Aug 2024 09:57:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2439063393;\n\tWed, 21 Aug 2024 11:57:14 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5DE5763393\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Aug 2024 11:57:11 +0200 (CEST)","from mail-lj1-f199.google.com (mail-lj1-f199.google.com\n\t[209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-331-nScj1Y4BMp6BYW207vIHBg-1; Wed, 21 Aug 2024 05:57:07 -0400","by mail-lj1-f199.google.com with SMTP id\n\t38308e7fff4ca-2f3f6d581fbso9358651fa.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Aug 2024 02:57:07 -0700 (PDT)","from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec?\n\t(2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl.\n\t[2001:1c00:c32:7800:5bfa:a036:83f0:f9ec])\n\tby smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-a8383935641sm883767066b.127.2024.08.21.02.57.02\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 21 Aug 2024 02:57:03 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"GU12W/8z\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1724234230;\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=fobCpohc0OXDBeipjOQQ90SR+0z21spKYQ8y6JT2T4Y=;\n\tb=GU12W/8z9PZA/tc/Y1R55Ww9ZCo+zlqdAYKtXpSemQYTXjIEV5+kSIGRl5ysVb6E4kF9Cg\n\tSIfdUIXpzExmGGl4TIAvHgPPGqteTEd4WBqPLJ84dU/CwspVp37TUkg1y4Nd9oD3GlZafn\n\t6FL4OMKDTY+j1AgYXbUPwNn+p532Ykg=","X-MC-Unique":"nScj1Y4BMp6BYW207vIHBg-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1724234225; x=1724839025;\n\th=content-transfer-encoding:in-reply-to:from:content-language\n\t:references:cc:to:subject:user-agent:mime-version:date:message-id\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n\tbh=fobCpohc0OXDBeipjOQQ90SR+0z21spKYQ8y6JT2T4Y=;\n\tb=UZc40HOS/KgO0Sz/8blRtpJraQ4GuHKpzAqExK2BbOSZsgXbYVZen21YFt30mqatkn\n\tLWTFFwgIfNT1fMsrIkKSXtOt/IrAdCOk12x1uDFtnxcf3m7GEYzR/e3CnEN9qSpA+jBI\n\t0OmZXD/YyIjEC0E8n8YaopcjcCC26nxBofkef4b+OWB5VHrFFqpg4CJbytTursDp62tf\n\tTO1PPuGuytRPKKrftpwfy2ktgVIYaSsbYqH4T2CQSj96/UYi5UegyQUTlTPFEIWz4VLC\n\tJeDT0aCxChH8YDRDCjfT/G5OiL9qQqgpEto76Mn0zwcRzOtZc9GJ7RVomKH0wPwrZIrQ\n\tX5BA==","X-Gm-Message-State":"AOJu0Yy3sXGMxK6ZWs2zWIkhCBncYYqag8r+VLdOUzjVzvYqJtgXJNh/\n\tuDlFo0ipWRCMEjGrNNTIhxIRhApJcO9vGFqmXGQQIZOKl2zJB+UhUzQHlQDk0i7G+xHHMABI3VK\n\t9bWFK3ahynEP9t35LAb1fq2W5TGDxmqcfqffch+QdWiFp9h0j9yNqrtJPJUMXPuCEGdPaJIkFlo\n\tPP2mEKU7CJflLUv36lznegFdKnP7J5rDS6P1/qaRsllD6Zykvp2sm46Eg=","X-Received":["by 2002:a2e:e01:0:b0:2ef:2ba5:d214 with SMTP id\n\t38308e7fff4ca-2f3f87ee2damr11694181fa.4.1724234224575; \n\tWed, 21 Aug 2024 02:57:04 -0700 (PDT)","by 2002:a2e:e01:0:b0:2ef:2ba5:d214 with SMTP id\n\t38308e7fff4ca-2f3f87ee2damr11693851fa.4.1724234223838; \n\tWed, 21 Aug 2024 02:57:03 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IES/YA1yPnnWc3Wr/z3Z/s9D0jgRk6b3r0ci3hncihx1JBDY61AYi1lb77rcoBFzvyZMZ3sJQ==","Message-ID":"<d96068e3-eb50-4c7c-91fc-eaec1d430a58@redhat.com>","Date":"Wed, 21 Aug 2024 11:57:02 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/5] pipeline_handler: Fix unlocking media devices too\n\tearly when there are multiple cameras","To":"libcamera-devel@lists.libcamera.org","Cc":"Maxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>","References":"<20240820195016.16028-1-hdegoede@redhat.com>\n\t<20240820195016.16028-2-hdegoede@redhat.com>","From":"Hans de Goede <hdegoede@redhat.com>","In-Reply-To":"<20240820195016.16028-2-hdegoede@redhat.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Language":"en-US, nl","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","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>"}}]