[{"id":29367,"web_url":"https://patchwork.libcamera.org/comment/29367/","msgid":"<ZjFQ5CbSVpGKk-BM@kekkonen.localdomain>","date":"2024-04-30T20:13:24","subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Hans,\n\nThanks for the patch.\n\nOn Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:\n> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE\n> and V4L2_CAP_META_CAPTURE.\n> \n> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /\n> setFormat() calling the metadata related ioctls instead of the videocap\n> ioctls causing things to not work.\n> \n> Fix this by making V4L2Capability::isMeta() return false when the device\n> also has one of the video capabilities.\n> \n> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n> ---\n>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n>  1 file changed, 4 insertions(+)\n> \n> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> index d157a447..5816c18d 100644\n> --- a/include/libcamera/internal/v4l2_videodevice.h\n> +++ b/include/libcamera/internal/v4l2_videodevice.h\n> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {\n>  \t}\n>  \tbool isMeta() const\n>  \t{\n> +\t\t/* Treat devs which combine video and meta as video not meta */\n> +\t\tif (isVideo())\n> +\t\t\treturn false;\n> +\n>  \t\treturn device_caps() & (V4L2_CAP_META_CAPTURE |\n>  \t\t\t\t\tV4L2_CAP_META_OUTPUT);\n>  \t}\n\nIt looks like to me that some rework will be needed in determining the\nbuffer type for a video node. The current code assumes there is just one\nand that it's directly derived from device capabilities. Unicam might be\nthe only CSI-2 receiver with metadata support for which this applies.\n\nBut I guess this is ok for now.\n\nReviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>\n\nCc Stanislaw, too.","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 ACF1BC3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Apr 2024 20:13:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6F21E63418;\n\tTue, 30 Apr 2024 22:13:33 +0200 (CEST)","from mgamail.intel.com (mgamail.intel.com [192.198.163.11])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D9835633F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Apr 2024 22:13:30 +0200 (CEST)","from orviesa006.jf.intel.com ([10.64.159.146])\n\tby fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n\t30 Apr 2024 13:13:29 -0700","from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com)\n\t([10.237.72.44]) by orviesa006-auth.jf.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2024 13:13:27 -0700","from kekkonen.localdomain (localhost [127.0.0.1])\n\tby kekkonen.fi.intel.com (Postfix) with SMTP id 5BED311F832;\n\tTue, 30 Apr 2024 23:13:24 +0300 (EEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"C2xbrA1Z\"; 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=1714508011; x=1746044011;\n\th=date:from:to:cc:subject:message-id:references:\n\tmime-version:in-reply-to;\n\tbh=GBQQL7vmSLXrPrkonKJVesj5yhqihWpJ+9KAw9TvGsg=;\n\tb=C2xbrA1ZABO4hg/sERsG2Ahz3twoIUpB0MELzIFzPICHUqEw+VQOMdRP\n\tTYVo5u9+LCPMcG66MwV8aQojjmerXPjiJPjEGDtHto+kNvfsCnJx9xMnE\n\t3wTMQybdAXs8Rlg3jjPgxDV2UVjwD5JcN6WcXb817q7uSoqaf12kPc6cS\n\tKwiI7Af3x10qG7KfjwXKAdyzkGae9iovAxtX12Qtp+ckGprMvWuqXx3dt\n\tWnMxBysMSze1oURKch0nb4VtGF6EidpEcuUFAxdgFQATWpvrINp1RAsSl\n\tSA8A6YDhd/AvGvmL3jzvTxhMJPUMee1eyO/N9RIBXgO7w9wM8706rRmE+ w==;","X-CSE-ConnectionGUID":["rJ7pPwH0S0i6TOzBKiT2lA==","cCgwmECKQGaXxRQoGNMLjw=="],"X-CSE-MsgGUID":["HCBuOlxERRWWNppT1we2AQ==","mudtmHlxT/Cptw2IllvpRQ=="],"X-IronPort-AV":["E=McAfee;i=\"6600,9927,11060\"; a=\"20850095\"","E=Sophos;i=\"6.07,243,1708416000\"; d=\"scan'208\";a=\"20850095\"","E=Sophos;i=\"6.07,243,1708416000\"; d=\"scan'208\";a=\"26990344\""],"X-ExtLoop1":"1","Date":"Tue, 30 Apr 2024 20:13:24 +0000","From":"Sakari Ailus <sakari.ailus@linux.intel.com>","To":"Hans de Goede <hdegoede@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org, Maxime Ripard <mripard@redhat.com>, \n\tMilan Zamazal <mzamazal@redhat.com>, Dennis Bonke <admin@dennisbonke.com>,\n\tstanislaw.gruszka@linux.intel.com","Subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","Message-ID":"<ZjFQ5CbSVpGKk-BM@kekkonen.localdomain>","References":"<20240430171728.18073-1-hdegoede@redhat.com>\n\t<20240430171728.18073-2-hdegoede@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240430171728.18073-2-hdegoede@redhat.com>","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>"}},{"id":29368,"web_url":"https://patchwork.libcamera.org/comment/29368/","msgid":"<20240430221140.GC17852@pendragon.ideasonboard.com>","date":"2024-04-30T22:11:40","subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Hans,\n\nThank you for the patch.\n\nOn Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:\n> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE\n> and V4L2_CAP_META_CAPTURE.\n> \n> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /\n> setFormat() calling the metadata related ioctls instead of the videocap\n> ioctls causing things to not work.\n> \n> Fix this by making V4L2Capability::isMeta() return false when the device\n> also has one of the video capabilities.\n\nThis seems to be a quick hack. What would it take to solve the issue\ncorrectly ?\n\n> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n> ---\n>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n>  1 file changed, 4 insertions(+)\n> \n> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> index d157a447..5816c18d 100644\n> --- a/include/libcamera/internal/v4l2_videodevice.h\n> +++ b/include/libcamera/internal/v4l2_videodevice.h\n> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {\n>  \t}\n>  \tbool isMeta() const\n>  \t{\n> +\t\t/* Treat devs which combine video and meta as video not meta */\n\ns/devs/devices/\ns/meta/metadata/g\n\n> +\t\tif (isVideo())\n> +\t\t\treturn false;\n> +\n>  \t\treturn device_caps() & (V4L2_CAP_META_CAPTURE |\n>  \t\t\t\t\tV4L2_CAP_META_OUTPUT);\n>  \t}","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 7D039BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Apr 2024 22:11:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7AC0363418;\n\tWed,  1 May 2024 00:11:48 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7BF3C633F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 May 2024 00:11:46 +0200 (CEST)","from pendragon.ideasonboard.com (unknown [109.130.69.237])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CCBF7CE3;\n\tWed,  1 May 2024 00:10:49 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"siTFS92R\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1714515049;\n\tbh=YEBN1AStorpryzC8ZILuZfEPLSH1oJSUPEW6rwu0Xls=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=siTFS92Rv/7TnVD++XzghpUZDPDSHcUkK/1BJJlq2zEbBc2jKLjCuo0tZaQ8BFgBy\n\ta8f7Mlh6jppRjUcLtD+ycr/nj4AVNjWbFqDFHL+RRAa9ZSNUyI3JNHgevOEKkMer8Y\n\tUL4ZjA0JnhSoO8I2fB/dP/OeHlzPno7VqyyQ/ma8=","Date":"Wed, 1 May 2024 01:11:40 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hans de Goede <hdegoede@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMaxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>, \n\tDennis Bonke <admin@dennisbonke.com>","Subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","Message-ID":"<20240430221140.GC17852@pendragon.ideasonboard.com>","References":"<20240430171728.18073-1-hdegoede@redhat.com>\n\t<20240430171728.18073-2-hdegoede@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240430171728.18073-2-hdegoede@redhat.com>","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>"}},{"id":29371,"web_url":"https://patchwork.libcamera.org/comment/29371/","msgid":"<7abd4447-0070-4e6d-b784-b0c0028a866a@redhat.com>","date":"2024-05-01T11:57:59","subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/people/102/","name":"Hans de Goede","email":"hdegoede@redhat.com"},"content":"Hi Laurent,\n\nOn 5/1/24 12:11 AM, Laurent Pinchart wrote:\n> Hi Hans,\n> \n> Thank you for the patch.\n> \n> On Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:\n>> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE\n>> and V4L2_CAP_META_CAPTURE.\n>>\n>> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /\n>> setFormat() calling the metadata related ioctls instead of the videocap\n>> ioctls causing things to not work.\n>>\n>> Fix this by making V4L2Capability::isMeta() return false when the device\n>> also has one of the video capabilities.\n> \n> This seems to be a quick hack. What would it take to solve the issue\n> correctly ?\n\nI honestly don't know. Since the whole metadata stuff is all new\nand somewhat in flux I think properly fixing this is best\ndelayed until we actually figure out what we want to do here /\nhow this all is going to work.\n\nRegards,\n\nHans\n\n\n\n> \n>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n>> ---\n>>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n>>  1 file changed, 4 insertions(+)\n>>\n>> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n>> index d157a447..5816c18d 100644\n>> --- a/include/libcamera/internal/v4l2_videodevice.h\n>> +++ b/include/libcamera/internal/v4l2_videodevice.h\n>> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {\n>>  \t}\n>>  \tbool isMeta() const\n>>  \t{\n>> +\t\t/* Treat devs which combine video and meta as video not meta */\n> \n> s/devs/devices/\n> s/meta/metadata/g\n> \n>> +\t\tif (isVideo())\n>> +\t\t\treturn false;\n>> +\n>>  \t\treturn device_caps() & (V4L2_CAP_META_CAPTURE |\n>>  \t\t\t\t\tV4L2_CAP_META_OUTPUT);\n>>  \t}\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 D8097C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 May 2024 11:58:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F184C6340B;\n\tWed,  1 May 2024 13:58:10 +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 69148633ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 May 2024 13:58:08 +0200 (CEST)","from mail-ej1-f71.google.com (mail-ej1-f71.google.com\n\t[209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-678-98dhEmzdOvm8hxV6p9LmVQ-1; Wed, 01 May 2024 07:58:04 -0400","by mail-ej1-f71.google.com with SMTP id\n\ta640c23a62f3a-a59324b5fb3so99631066b.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 01 May 2024 04:58:03 -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\tf7-20020a170906c08700b00a51a80028e8sm16240065ejz.65.2024.05.01.04.57.59\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 01 May 2024 04:57:59 -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=\"Zb9SL4G4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1714564687;\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=YhIxj6gKARi4vg0ibO+Vp0lqb9txOP5psCA4xDeP3Fs=;\n\tb=Zb9SL4G4meeIaxe8UbxUoib6YFejAm5eTtCOGs8/l1RxYbpjorHPyvxdNIkZ0C+XrtPEUk\n\tT64HcltApAu2QJALKWxLGk58edtAqpilclCCXP5PuvfoCcASzBXobfOD1lciburBvN7W1E\n\ttFFnHHxIM2/fzlVPdcNXURpJSmLh7TI=","X-MC-Unique":"98dhEmzdOvm8hxV6p9LmVQ-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1714564683; x=1715169483;\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=YhIxj6gKARi4vg0ibO+Vp0lqb9txOP5psCA4xDeP3Fs=;\n\tb=DEFU+P+g4OZ5I4+Myc6yP+Z/4g1XXG5/8+Me+C8fIonlVyTbpnOWYmIsOzH+y2TpZu\n\t8+wznCzBdpN9Bl4TDI/5Z2Ml7An9evnwpvZZF0PRQHvAmkLvHiqrhVZdu+X67jcqGfa+\n\tQaFX3q/n8yOGHCQRU0Ra4I0OogBqi6bw3yl8/i84xhVs7v1lEXRqUiIPCPXup4tOvWs3\n\tPJvNM6ANrtppxAM+HMyWHq2UWqLOLv8ZtqCN88ztqLWz9K/fSUAiLYyzZhwGS+LtQ0zo\n\tNyKigNdZvPVrpZscHwowAy1ln4qddNrk2qs5I/rv3iWzFNAfiYA1uQrQXZP6u8zz3bMl\n\toMgw==","X-Gm-Message-State":"AOJu0Yw3ytC1AEjrRmQsnbwiKEp8fjRsI2jY/oNUHh2hHAwrmn56pkkt\n\tGvVThCKeHCyPLhwvPU4egeOLeOpCNHDZ02ca73P85LfkBDbhUbkM7vFHvHabo93SunKELBFPTcS\n\tcXhVYmD7jpmAlPUf5gjVdRetOc2ApHxBBEgPhrkFNlvWWG8EivqVIpX7w5EbiI42/l8aqG1g=","X-Received":["by 2002:a17:907:7e94:b0:a58:c0da:34a3 with SMTP id\n\tqb20-20020a1709077e9400b00a58c0da34a3mr847805ejc.33.1714564682843; \n\tWed, 01 May 2024 04:58:02 -0700 (PDT)","by 2002:a17:907:7e94:b0:a58:c0da:34a3 with SMTP id\n\tqb20-20020a1709077e9400b00a58c0da34a3mr847731ejc.33.1714564680407; \n\tWed, 01 May 2024 04:58:00 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IF3Pihp8XHOKB7gODw9Bl1Kp6Wxilx9Ig8c6zMzq/J096t0pW2A27hw5Sc7cMVe6J4sewdvwA==","Message-ID":"<7abd4447-0070-4e6d-b784-b0c0028a866a@redhat.com>","Date":"Wed, 1 May 2024 13:57:59 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMaxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>, \n\tDennis Bonke <admin@dennisbonke.com>","References":"<20240430171728.18073-1-hdegoede@redhat.com>\n\t<20240430171728.18073-2-hdegoede@redhat.com>\n\t<20240430221140.GC17852@pendragon.ideasonboard.com>","From":"Hans de Goede <hdegoede@redhat.com>","In-Reply-To":"<20240430221140.GC17852@pendragon.ideasonboard.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>"}},{"id":29372,"web_url":"https://patchwork.libcamera.org/comment/29372/","msgid":"<CAEmqJPokGH3_cRHE9gumNbXWUvUq1HEzgsW0_WM-dxH+eJEWQA@mail.gmail.com>","date":"2024-05-01T12:09:32","subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi all,\n\nOn Wed, 1 May 2024 at 12:58, Hans de Goede <hdegoede@redhat.com> wrote:\n>\n> Hi Laurent,\n>\n> On 5/1/24 12:11 AM, Laurent Pinchart wrote:\n> > Hi Hans,\n> >\n> > Thank you for the patch.\n> >\n> > On Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:\n> >> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE\n> >> and V4L2_CAP_META_CAPTURE.\n> >>\n> >> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /\n> >> setFormat() calling the metadata related ioctls instead of the videocap\n> >> ioctls causing things to not work.\n> >>\n> >> Fix this by making V4L2Capability::isMeta() return false when the device\n> >> also has one of the video capabilities.\n> >\n> > This seems to be a quick hack. What would it take to solve the issue\n> > correctly ?\n>\n> I honestly don't know. Since the whole metadata stuff is all new\n> and somewhat in flux I think properly fixing this is best\n> delayed until we actually figure out what we want to do here /\n> how this all is going to work.\n\nThe Pi 5 CFE driver also ran into this issue as we had a dev node that\nadvertised both meta and video caps.  I briefly looked into a fix, but\nquickly came to the conclusion that it might need a larger rework job\nthan I was able to do at the time.  Instead we fixed the dev node to\nonly advertise either meta or video cap type, not both.\n\nIIRC, a change would be needed to look at the pixel format set into\nthe V4L2VideoDevice object, decide if it is a meta or video format,\nand then make the appropriate IOCTL calls after that.\n\nRegards,\nNaush\n\n>\n> Regards,\n>\n> Hans\n>\n>\n>\n> >\n> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n> >> ---\n> >>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n> >>  1 file changed, 4 insertions(+)\n> >>\n> >> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> >> index d157a447..5816c18d 100644\n> >> --- a/include/libcamera/internal/v4l2_videodevice.h\n> >> +++ b/include/libcamera/internal/v4l2_videodevice.h\n> >> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {\n> >>      }\n> >>      bool isMeta() const\n> >>      {\n> >> +            /* Treat devs which combine video and meta as video not meta */\n> >\n> > s/devs/devices/\n> > s/meta/metadata/g\n> >\n> >> +            if (isVideo())\n> >> +                    return false;\n> >> +\n> >>              return device_caps() & (V4L2_CAP_META_CAPTURE |\n> >>                                      V4L2_CAP_META_OUTPUT);\n> >>      }\n> >\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 72F44BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 May 2024 12:10:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 994C46340B;\n\tWed,  1 May 2024 14:10:09 +0200 (CEST)","from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com\n\t[IPv6:2607:f8b0:4864:20::1132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AD621633ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 May 2024 14:10:07 +0200 (CEST)","by mail-yw1-x1132.google.com with SMTP id\n\t00721157ae682-6181d032bf9so64669007b3.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 01 May 2024 05:10:07 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"ae6fnoKj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1714565406; x=1715170206;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=YehgqynNIqNJm7Tt2PsuAF2bI6qmRmQLrzkL6gCxG+8=;\n\tb=ae6fnoKj0mfQqPJacUYtaJqrb55r4OGP2oGyaRACLsdwcCtzE/mNZXDWrBGeYK9zbs\n\tf5u/PN+G9IY95uj7/AAU3m0iQkxD+niiSI1mHnwMN+8ECoig1rSZXfztDrfd/6GwMR42\n\tkcRFH3/oRcaCbz1kIYfv1vuwxbQeDeOYnIb16fGg85n+jdGcfHmVsDQMXHabw/nSOoDF\n\tH54E9ZWXUw0REMNHN0ppfm4VF1xnJFc5JHukFWiX91RXX0aF4iegybHUU0NOhuP7UNOP\n\terMS2XuaqlapCoRAsW7LwecJwjet55gX2REA0yGq5rn0/0Se2dW6AdwuNK72iYfJUEka\n\tdF9A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1714565406; x=1715170206;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=YehgqynNIqNJm7Tt2PsuAF2bI6qmRmQLrzkL6gCxG+8=;\n\tb=ahOl1O+vOfs3TyExQKQXWrnL0sss0bLZTB2JdQ8CPA1DRn4WPFbK+jsmWDXKzGZg+N\n\trnkZy8EdUA/3tR6O/M+wybyYbQ2ItBMP4F1nrD1IZ/1oHOXd64Xv0dP4kN8d0qwsUPQs\n\tg/lFYoICqvRZo0lkbZZoJpDuGe5q77zAV57SN2RIfpVIiVYgZiS2YxsRv8clRLsnfvVn\n\tIDX01e9LAg1JDS32C/kCE14Z4o0HXbOZYdnEgMwzr4aOxZBEgBOpcgVR4Y6PqUikjUqx\n\tpXQOSYuhIUTGVT1UNvhrSFJmbS1iqb5CMzPMiVLJQDJgLODh+slSCIaHRfNpgqZUTW2U\n\tmAcg==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCXouDREtjYlZIm7dFsZFT1fvplkPILodJbDKl/HOhlJQ4aqAitFqzpGblbGC51mwmrxQ+w1b414KxFmpSkUW8vnpcXdKcJgkq8KmWxKJoVYa2Pncw==","X-Gm-Message-State":"AOJu0YyHeD93DUsd29apWY48I5yWL1gC7BvQE5HiWw8Bvlh7YJIQ17Uf\n\tuFPcIB1q+/NwI8pt7GkIpuwl/N9Jr0kerRykAQTLFQs4G3ib438Bl6IoiNrN+Z481SSGKUEPe3R\n\tujaAv254VnStIkrmuGR/AyYV6QW0zLa0FY8fcTg==","X-Google-Smtp-Source":"AGHT+IGdrTpth0Ua58Mf15ZtKbC2HxrHebiqO0W7D81RwcwUzg5ZlJKG3xjKhBm+Vb4q4O0qHPFnKwspcolxpw5MN5w=","X-Received":"by 2002:a05:690c:4d44:b0:61a:e4f3:555c with SMTP id\n\tiy4-20020a05690c4d4400b0061ae4f3555cmr2654446ywb.8.1714565406537;\n\tWed, 01 May 2024 05:10:06 -0700 (PDT)","MIME-Version":"1.0","References":"<20240430171728.18073-1-hdegoede@redhat.com>\n\t<20240430171728.18073-2-hdegoede@redhat.com>\n\t<20240430221140.GC17852@pendragon.ideasonboard.com>\n\t<7abd4447-0070-4e6d-b784-b0c0028a866a@redhat.com>","In-Reply-To":"<7abd4447-0070-4e6d-b784-b0c0028a866a@redhat.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Wed, 1 May 2024 13:09:32 +0100","Message-ID":"<CAEmqJPokGH3_cRHE9gumNbXWUvUq1HEzgsW0_WM-dxH+eJEWQA@mail.gmail.com>","Subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","To":"Hans de Goede <hdegoede@redhat.com>","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org, \n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMaxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>,\n\tDennis Bonke <admin@dennisbonke.com>","Content-Type":"text/plain; charset=\"UTF-8\"","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>"}},{"id":29373,"web_url":"https://patchwork.libcamera.org/comment/29373/","msgid":"<f1939b72-7c58-4aa5-a76b-1c9feee21f4f@redhat.com>","date":"2024-05-01T13:38:49","subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/people/102/","name":"Hans de Goede","email":"hdegoede@redhat.com"},"content":"Hi,\n\nOn 5/1/24 2:09 PM, Naushir Patuck wrote:\n> Hi all,\n> \n> On Wed, 1 May 2024 at 12:58, Hans de Goede <hdegoede@redhat.com> wrote:\n>>\n>> Hi Laurent,\n>>\n>> On 5/1/24 12:11 AM, Laurent Pinchart wrote:\n>>> Hi Hans,\n>>>\n>>> Thank you for the patch.\n>>>\n>>> On Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:\n>>>> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE\n>>>> and V4L2_CAP_META_CAPTURE.\n>>>>\n>>>> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /\n>>>> setFormat() calling the metadata related ioctls instead of the videocap\n>>>> ioctls causing things to not work.\n>>>>\n>>>> Fix this by making V4L2Capability::isMeta() return false when the device\n>>>> also has one of the video capabilities.\n>>>\n>>> This seems to be a quick hack. What would it take to solve the issue\n>>> correctly ?\n>>\n>> I honestly don't know. Since the whole metadata stuff is all new\n>> and somewhat in flux I think properly fixing this is best\n>> delayed until we actually figure out what we want to do here /\n>> how this all is going to work.\n> \n> The Pi 5 CFE driver also ran into this issue as we had a dev node that\n> advertised both meta and video caps.  I briefly looked into a fix, but\n> quickly came to the conclusion that it might need a larger rework job\n> than I was able to do at the time.  Instead we fixed the dev node to\n> only advertise either meta or video cap type, not both.\n> \n> IIRC, a change would be needed to look at the pixel format set into\n> the V4L2VideoDevice object, decide if it is a meta or video format,\n> and then make the appropriate IOCTL calls after that.\n\nInteresting. So if I understand things correctly then on the Pi 5\nyou no longer have nodes which advertise metadata + video support on\na single /dev/video# node, right ?  IOW this workaround patch should not\ncause any issues for the Pi 5?\n\nAssuming I have that right I still think just going with this workaround\npatch for now (so as a temporary solution, until things are more clear)\nis best.\n\nRegards,\n\nHans\n\n\n\n\n\n>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n>>>> ---\n>>>>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n>>>>  1 file changed, 4 insertions(+)\n>>>>\n>>>> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n>>>> index d157a447..5816c18d 100644\n>>>> --- a/include/libcamera/internal/v4l2_videodevice.h\n>>>> +++ b/include/libcamera/internal/v4l2_videodevice.h\n>>>> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {\n>>>>      }\n>>>>      bool isMeta() const\n>>>>      {\n>>>> +            /* Treat devs which combine video and meta as video not meta */\n>>>\n>>> s/devs/devices/\n>>> s/meta/metadata/g\n>>>\n>>>> +            if (isVideo())\n>>>> +                    return false;\n>>>> +\n>>>>              return device_caps() & (V4L2_CAP_META_CAPTURE |\n>>>>                                      V4L2_CAP_META_OUTPUT);\n>>>>      }\n>>>\n>>\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 AE801C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 May 2024 13:38:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C2C1063418;\n\tWed,  1 May 2024 15:38:58 +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 22FEA633ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 May 2024 15:38:57 +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-508-wHFAu9ilNsCD1cYs1PJi9Q-1; Wed, 01 May 2024 09:38:52 -0400","by mail-lj1-f199.google.com with SMTP id\n\t38308e7fff4ca-2d871086a09so60466711fa.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 01 May 2024 06:38:51 -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\ts19-20020a170906a19300b00a590f9c1f91sm2654899ejy.197.2024.05.01.06.38.49\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 01 May 2024 06:38:49 -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=\"H8V14MXf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1714570736;\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=kWmFJKXoRydALm4hvuBNsiYsaaA7phphBM1uF5/7FKg=;\n\tb=H8V14MXfPbE229ibqFXkImW1BJJ34t2ioz8Bj7bAWH3B/fjc70m9g/YHRz+9mrDpZy6+zb\n\tSvqnx0msix8psZnBlqUYA4Is741W1r9ylQQFIAWfH+mtS2PXEQyNTkM5XwDR5CDt2IPUMz\n\tAjFnYGwtqwtV8g34fVZo5x9n3Gvmx48=","X-MC-Unique":"wHFAu9ilNsCD1cYs1PJi9Q-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1714570731; x=1715175531;\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=kWmFJKXoRydALm4hvuBNsiYsaaA7phphBM1uF5/7FKg=;\n\tb=vTI4QJW1a7ay/htCCZr2LjUHpgPdqxtVIu+bc3foUG1544wooPO6xNf7CyqoaQT7iK\n\tCAXIyPSINU95RE748+vwohuBelEwYvvTCnsvxSRy9QA6xx4otqQ9CyhqWosZnIu4U207\n\t5q2tbIkITxX+MQ0/HA7C2Urvt2Zmo+TZad+x6QbbKmo9zVNjaTVy1Uj+HCwuEZWqUJzb\n\tNgnrnPiBJ9I5ZNnoxAFJYmGcwI6J/xIkerOzQccRNa1mhzls7dkgKazeTJS/Z9wRq4l3\n\tdtTarErapeCxe+CuQIi6Z/zTLRTETv6ia7GEhnn8WY07JcPD4p6+Baj4ftkrxjn9Fz5H\n\t39Vg==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCVFxxSpYX4f0kNaztULllYHOiPTq83Kymy6pOhV2aMguK3UcFAIPWyR5iJz38JRP9f37L1wZ/SE9E8+xEKEwbLCRfTV+qLqtnMvBuRZSNfsfoYEFQ==","X-Gm-Message-State":"AOJu0YxcGTUQqf4Vog50KG8zUKXkRs3jhdWeK4a0hkUXTgqYRNL1mNib\n\t8XVtQw0HmMnYjhj3dtA7J2q5NEH9GgqxuhW+vCwOn0WWcsPEWQNeNfssanvTB0zCGQihyGwHbGI\n\tpE7Fd++d8shZyI7mNUvJkSKpEZAuNPooXdE/wiQ/hyg2EJGGdkioJMoJ3NUQ+YGCcZ+Uqx4A=","X-Received":["by 2002:a05:6512:159e:b0:51b:79b7:8322 with SMTP id\n\tbp30-20020a056512159e00b0051b79b78322mr2076423lfb.52.1714570730677; \n\tWed, 01 May 2024 06:38:50 -0700 (PDT)","by 2002:a05:6512:159e:b0:51b:79b7:8322 with SMTP id\n\tbp30-20020a056512159e00b0051b79b78322mr2076403lfb.52.1714570730137; \n\tWed, 01 May 2024 06:38:50 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IGejNq/rqBChC01pf2REkrlkbHznIP4SE+n1fez8wS/ZJ5zlHvF8xE/SQq4I3kLdfHTq2UWXQ==","Message-ID":"<f1939b72-7c58-4aa5-a76b-1c9feee21f4f@redhat.com>","Date":"Wed, 1 May 2024 15:38:49 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMaxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>, \n\tDennis Bonke <admin@dennisbonke.com>","References":"<20240430171728.18073-1-hdegoede@redhat.com>\n\t<20240430171728.18073-2-hdegoede@redhat.com>\n\t<20240430221140.GC17852@pendragon.ideasonboard.com>\n\t<7abd4447-0070-4e6d-b784-b0c0028a866a@redhat.com>\n\t<CAEmqJPokGH3_cRHE9gumNbXWUvUq1HEzgsW0_WM-dxH+eJEWQA@mail.gmail.com>","From":"Hans de Goede <hdegoede@redhat.com>","In-Reply-To":"<CAEmqJPokGH3_cRHE9gumNbXWUvUq1HEzgsW0_WM-dxH+eJEWQA@mail.gmail.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>"}},{"id":29374,"web_url":"https://patchwork.libcamera.org/comment/29374/","msgid":"<CAEmqJPq5_QF51e0fJBYQmTV4_ZbvrVQjvfsd_LHCfhXWZEU5iQ@mail.gmail.com>","date":"2024-05-01T13:47:11","subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"On Wed, 1 May 2024 at 14:38, Hans de Goede <hdegoede@redhat.com> wrote:\n>\n> Hi,\n>\n> On 5/1/24 2:09 PM, Naushir Patuck wrote:\n> > Hi all,\n> >\n> > On Wed, 1 May 2024 at 12:58, Hans de Goede <hdegoede@redhat.com> wrote:\n> >>\n> >> Hi Laurent,\n> >>\n> >> On 5/1/24 12:11 AM, Laurent Pinchart wrote:\n> >>> Hi Hans,\n> >>>\n> >>> Thank you for the patch.\n> >>>\n> >>> On Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:\n> >>>> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE\n> >>>> and V4L2_CAP_META_CAPTURE.\n> >>>>\n> >>>> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /\n> >>>> setFormat() calling the metadata related ioctls instead of the videocap\n> >>>> ioctls causing things to not work.\n> >>>>\n> >>>> Fix this by making V4L2Capability::isMeta() return false when the device\n> >>>> also has one of the video capabilities.\n> >>>\n> >>> This seems to be a quick hack. What would it take to solve the issue\n> >>> correctly ?\n> >>\n> >> I honestly don't know. Since the whole metadata stuff is all new\n> >> and somewhat in flux I think properly fixing this is best\n> >> delayed until we actually figure out what we want to do here /\n> >> how this all is going to work.\n> >\n> > The Pi 5 CFE driver also ran into this issue as we had a dev node that\n> > advertised both meta and video caps.  I briefly looked into a fix, but\n> > quickly came to the conclusion that it might need a larger rework job\n> > than I was able to do at the time.  Instead we fixed the dev node to\n> > only advertise either meta or video cap type, not both.\n> >\n> > IIRC, a change would be needed to look at the pixel format set into\n> > the V4L2VideoDevice object, decide if it is a meta or video format,\n> > and then make the appropriate IOCTL calls after that.\n>\n> Interesting. So if I understand things correctly then on the Pi 5\n> you no longer have nodes which advertise metadata + video support on\n> a single /dev/video# node, right ?  IOW this workaround patch should not\n> cause any issues for the Pi 5?\n\nThat's correct, and this patch will not have a negative effect for Pi\n5.  But I'll leave it up to libcamera maintainers to decide if this\nworkaround can/should be merged.\n\n\n>\n> Assuming I have that right I still think just going with this workaround\n> patch for now (so as a temporary solution, until things are more clear)\n> is best.\n>\n> Regards,\n>\n> Hans\n>\n>\n>\n>\n>\n> >>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n> >>>> ---\n> >>>>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n> >>>>  1 file changed, 4 insertions(+)\n> >>>>\n> >>>> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> >>>> index d157a447..5816c18d 100644\n> >>>> --- a/include/libcamera/internal/v4l2_videodevice.h\n> >>>> +++ b/include/libcamera/internal/v4l2_videodevice.h\n> >>>> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {\n> >>>>      }\n> >>>>      bool isMeta() const\n> >>>>      {\n> >>>> +            /* Treat devs which combine video and meta as video not meta */\n> >>>\n> >>> s/devs/devices/\n> >>> s/meta/metadata/g\n> >>>\n> >>>> +            if (isVideo())\n> >>>> +                    return false;\n> >>>> +\n> >>>>              return device_caps() & (V4L2_CAP_META_CAPTURE |\n> >>>>                                      V4L2_CAP_META_OUTPUT);\n> >>>>      }\n> >>>\n> >>\n> >\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 30716BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 May 2024 13:47:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0A57863418;\n\tWed,  1 May 2024 15:47:49 +0200 (CEST)","from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com\n\t[IPv6:2607:f8b0:4864:20::1129])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 15E4B633ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 May 2024 15:47:47 +0200 (CEST)","by mail-yw1-x1129.google.com with SMTP id\n\t00721157ae682-61be4b986aaso30071507b3.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 01 May 2024 06:47:46 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"ldH0CHAS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1714571266; x=1715176066;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=xmOOKNWYHZqdiwiXUDb73ytAIPi6vqyigJgWrUIN2OA=;\n\tb=ldH0CHASeyqsiz/USin11C+dfhFwettQaqzwjMQPeIQoeRGCmWkcYec+ZZHJa05Y/n\n\tfnxX0QGywagQK2jxlcaWjrdNqFtXLhV78pnpMEBnC1eHNn5hA55yYbLQ60uLKohNgIwA\n\t9V13Vb6GMTOok8KTsbUN/alWR5rygvQvNDLLkNNT3dDcQ2ks4HhTPTpwBEBrMUoQqk+C\n\tWuxAPxpwXo4m4gAhH8ho+Wk9lnm6a3pV/Y6tWLIWluo7mvYye+fRJir2PV+58+4ICdea\n\t8ZPNbeKR+7Cs38TcFwmAVGROe5GCVSnV0y27H7ArCUm5Ks5uOcCrMzCpi6QUG9rJA2Ch\n\tHvpw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1714571266; x=1715176066;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=xmOOKNWYHZqdiwiXUDb73ytAIPi6vqyigJgWrUIN2OA=;\n\tb=rBaC1RaoKGG56foUnrj4fBNecmBPzizbRA0Q77222zC/g/ZyItMc244QOVw1qFxnbp\n\trvx0p93XUjVxPPS7rdSVMSzyl4rhrGWayPHcVseUW05T0R5+dFbhLvKZTZBCak9pFPLV\n\tTIvFl82GQ316ZmRL+Jf4FR89KJM2P1SGt6kijgY6VxRCEerAAaBtOASMyKu8dOJwixQi\n\tSgvJap5GDS3r0qUeHMPMjL0VpNjX4mk+xZYNeTGHq6DvP/S5APA8tNqzX0rTVEGfCAWu\n\tjvYchaudzv2Q/EX87N71fkRYig+RxlEo+cIx3le/Icu2/nAmwN5nFc2ss5bu59CGELDW\n\tqmdQ==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCVGUTacpZCI2LuZVVhh2kL/py5XElVr4/OOlOew11/y1r0k2k+t0b7ZJ39xS8YSBDQlW/rJQ/iojs3vK4QGmFZGlCglUSAkGTjE4sQ2hoOyO/ozuA==","X-Gm-Message-State":"AOJu0Yxwga/+Lnxu6Cp+l4YWWdTsRySPQbeppAYEvbvkwKQGNMOO5Fnz\n\tJ/yZyL4Mnf1kW2aMumXXzuap1RB5PQn9sNi0ZdA0C6cQid92WcZ3AjaQVu2v17mgHVynfOgHPZc\n\tSZaE2X0HvenWBqCnB247ejGqj2Dmkz5OAoopjjQ==","X-Google-Smtp-Source":"AGHT+IHmEgbmzoJxZ8E9iT5z5GZgHDB3cLndDkLfAou2qZqrGwZWahgPtl312ixbO9N5DzlF6F2b9NlAOymONHQkL6M=","X-Received":"by 2002:a05:690c:678a:b0:61a:b1a7:b300 with SMTP id\n\tib10-20020a05690c678a00b0061ab1a7b300mr2426600ywb.29.1714571265839;\n\tWed, 01 May 2024 06:47:45 -0700 (PDT)","MIME-Version":"1.0","References":"<20240430171728.18073-1-hdegoede@redhat.com>\n\t<20240430171728.18073-2-hdegoede@redhat.com>\n\t<20240430221140.GC17852@pendragon.ideasonboard.com>\n\t<7abd4447-0070-4e6d-b784-b0c0028a866a@redhat.com>\n\t<CAEmqJPokGH3_cRHE9gumNbXWUvUq1HEzgsW0_WM-dxH+eJEWQA@mail.gmail.com>\n\t<f1939b72-7c58-4aa5-a76b-1c9feee21f4f@redhat.com>","In-Reply-To":"<f1939b72-7c58-4aa5-a76b-1c9feee21f4f@redhat.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Wed, 1 May 2024 14:47:11 +0100","Message-ID":"<CAEmqJPq5_QF51e0fJBYQmTV4_ZbvrVQjvfsd_LHCfhXWZEU5iQ@mail.gmail.com>","Subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","To":"Hans de Goede <hdegoede@redhat.com>","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org, \n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMaxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>,\n\tDennis Bonke <admin@dennisbonke.com>","Content-Type":"text/plain; charset=\"UTF-8\"","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>"}},{"id":29375,"web_url":"https://patchwork.libcamera.org/comment/29375/","msgid":"<20240501154324.GC9891@pendragon.ideasonboard.com>","date":"2024-05-01T15:43:24","subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, May 01, 2024 at 02:47:11PM +0100, Naushir Patuck wrote:\n> On Wed, 1 May 2024 at 14:38, Hans de Goede wrote:\n> > On 5/1/24 2:09 PM, Naushir Patuck wrote:\n> > > On Wed, 1 May 2024 at 12:58, Hans de Goede wrote:\n> > >> On 5/1/24 12:11 AM, Laurent Pinchart wrote:\n> > >>> On Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:\n> > >>>> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE\n> > >>>> and V4L2_CAP_META_CAPTURE.\n> > >>>>\n> > >>>> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /\n> > >>>> setFormat() calling the metadata related ioctls instead of the videocap\n> > >>>> ioctls causing things to not work.\n> > >>>>\n> > >>>> Fix this by making V4L2Capability::isMeta() return false when the device\n> > >>>> also has one of the video capabilities.\n> > >>>\n> > >>> This seems to be a quick hack. What would it take to solve the issue\n> > >>> correctly ?\n> > >>\n> > >> I honestly don't know. Since the whole metadata stuff is all new\n> > >> and somewhat in flux I think properly fixing this is best\n> > >> delayed until we actually figure out what we want to do here /\n> > >> how this all is going to work.\n> > >\n> > > The Pi 5 CFE driver also ran into this issue as we had a dev node that\n> > > advertised both meta and video caps.  I briefly looked into a fix, but\n> > > quickly came to the conclusion that it might need a larger rework job\n> > > than I was able to do at the time.  Instead we fixed the dev node to\n> > > only advertise either meta or video cap type, not both.\n> > >\n> > > IIRC, a change would be needed to look at the pixel format set into\n> > > the V4L2VideoDevice object, decide if it is a meta or video format,\n> > > and then make the appropriate IOCTL calls after that.\n> >\n> > Interesting. So if I understand things correctly then on the Pi 5\n> > you no longer have nodes which advertise metadata + video support on\n> > a single /dev/video# node, right ?  IOW this workaround patch should not\n> > cause any issues for the Pi 5?\n> \n> That's correct, and this patch will not have a negative effect for Pi\n> 5.  But I'll leave it up to libcamera maintainers to decide if this\n> workaround can/should be merged.\n\nI don't think this patch will have a negative effect on any platform we\nsupport today, but I'm always a bit uncomfortable when we pile up\ntechnical debt. I'd like to see more volunteers to implement things\ncorrectly :-)\n\n> > Assuming I have that right I still think just going with this workaround\n> > patch for now (so as a temporary solution, until things are more clear)\n> > is best.\n> >\n> > >>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n> > >>>> ---\n> > >>>>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n> > >>>>  1 file changed, 4 insertions(+)\n> > >>>>\n> > >>>> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> > >>>> index d157a447..5816c18d 100644\n> > >>>> --- a/include/libcamera/internal/v4l2_videodevice.h\n> > >>>> +++ b/include/libcamera/internal/v4l2_videodevice.h\n> > >>>> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {\n> > >>>>      }\n> > >>>>      bool isMeta() const\n> > >>>>      {\n> > >>>> +            /* Treat devs which combine video and meta as video not meta */\n> > >>>\n> > >>> s/devs/devices/\n> > >>> s/meta/metadata/g\n> > >>>\n> > >>>> +            if (isVideo())\n> > >>>> +                    return false;\n> > >>>> +\n> > >>>>              return device_caps() & (V4L2_CAP_META_CAPTURE |\n> > >>>>                                      V4L2_CAP_META_OUTPUT);\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 6AA61C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 May 2024 15:43:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 61A8563418;\n\tWed,  1 May 2024 17:43:31 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DC6AF633ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 May 2024 17:43:29 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(233.56-78-194.adsl-static.isp.belgacom.be [194.78.56.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD669524;\n\tWed,  1 May 2024 17:42:32 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"m0Fr5YsJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1714578152;\n\tbh=os5IZooUsO3aNEj4WlLhi2Zp/LYJwKL4e+F5ual/OEU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=m0Fr5YsJCfdt8Qs36y96uXUax6aKcuWzd/yR8+8tAdv9gH7MSalMH53OEOAmbqcjU\n\tEUfGP4nXU2UMVZlffzBi28OwjxY+aBdPV4rbIwhWM+KMabHLD/6JIQFw4TUHZlQ4ix\n\tHCftp4JHWD3JDCGi1tM7dvBxz79pVrbN4IH6FoOI=","Date":"Wed, 1 May 2024 18:43:24 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"Hans de Goede <hdegoede@redhat.com>, libcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMaxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>, \n\tDennis Bonke <admin@dennisbonke.com>","Subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","Message-ID":"<20240501154324.GC9891@pendragon.ideasonboard.com>","References":"<20240430171728.18073-1-hdegoede@redhat.com>\n\t<20240430171728.18073-2-hdegoede@redhat.com>\n\t<20240430221140.GC17852@pendragon.ideasonboard.com>\n\t<7abd4447-0070-4e6d-b784-b0c0028a866a@redhat.com>\n\t<CAEmqJPokGH3_cRHE9gumNbXWUvUq1HEzgsW0_WM-dxH+eJEWQA@mail.gmail.com>\n\t<f1939b72-7c58-4aa5-a76b-1c9feee21f4f@redhat.com>\n\t<CAEmqJPq5_QF51e0fJBYQmTV4_ZbvrVQjvfsd_LHCfhXWZEU5iQ@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPq5_QF51e0fJBYQmTV4_ZbvrVQjvfsd_LHCfhXWZEU5iQ@mail.gmail.com>","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>"}},{"id":29378,"web_url":"https://patchwork.libcamera.org/comment/29378/","msgid":"<c755bc9d-cab2-46a5-b9b0-6c83e44eecbb@redhat.com>","date":"2024-05-01T16:15:57","subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/people/102/","name":"Hans de Goede","email":"hdegoede@redhat.com"},"content":"Hi,\n\nOn 5/1/24 5:43 PM, Laurent Pinchart wrote:\n> On Wed, May 01, 2024 at 02:47:11PM +0100, Naushir Patuck wrote:\n>> On Wed, 1 May 2024 at 14:38, Hans de Goede wrote:\n>>> On 5/1/24 2:09 PM, Naushir Patuck wrote:\n>>>> On Wed, 1 May 2024 at 12:58, Hans de Goede wrote:\n>>>>> On 5/1/24 12:11 AM, Laurent Pinchart wrote:\n>>>>>> On Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:\n>>>>>>> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE\n>>>>>>> and V4L2_CAP_META_CAPTURE.\n>>>>>>>\n>>>>>>> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /\n>>>>>>> setFormat() calling the metadata related ioctls instead of the videocap\n>>>>>>> ioctls causing things to not work.\n>>>>>>>\n>>>>>>> Fix this by making V4L2Capability::isMeta() return false when the device\n>>>>>>> also has one of the video capabilities.\n>>>>>>\n>>>>>> This seems to be a quick hack. What would it take to solve the issue\n>>>>>> correctly ?\n>>>>>\n>>>>> I honestly don't know. Since the whole metadata stuff is all new\n>>>>> and somewhat in flux I think properly fixing this is best\n>>>>> delayed until we actually figure out what we want to do here /\n>>>>> how this all is going to work.\n>>>>\n>>>> The Pi 5 CFE driver also ran into this issue as we had a dev node that\n>>>> advertised both meta and video caps.  I briefly looked into a fix, but\n>>>> quickly came to the conclusion that it might need a larger rework job\n>>>> than I was able to do at the time.  Instead we fixed the dev node to\n>>>> only advertise either meta or video cap type, not both.\n>>>>\n>>>> IIRC, a change would be needed to look at the pixel format set into\n>>>> the V4L2VideoDevice object, decide if it is a meta or video format,\n>>>> and then make the appropriate IOCTL calls after that.\n>>>\n>>> Interesting. So if I understand things correctly then on the Pi 5\n>>> you no longer have nodes which advertise metadata + video support on\n>>> a single /dev/video# node, right ?  IOW this workaround patch should not\n>>> cause any issues for the Pi 5?\n>>\n>> That's correct, and this patch will not have a negative effect for Pi\n>> 5.  But I'll leave it up to libcamera maintainers to decide if this\n>> workaround can/should be merged.\n> \n> I don't think this patch will have a negative effect on any platform we\n> support today, but I'm always a bit uncomfortable when we pile up\n> technical debt. I'd like to see more volunteers to implement things\n> correctly :-)\n\nThe way I see it the problem in this case is that we don't have a clear\npicture of what correctly looks like yet...\n\nRegards,\n\nHans\n\n\n\n\n\n> \n>>> Assuming I have that right I still think just going with this workaround\n>>> patch for now (so as a temporary solution, until things are more clear)\n>>> is best.\n>>>\n>>>>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>\n>>>>>>> ---\n>>>>>>>  include/libcamera/internal/v4l2_videodevice.h | 4 ++++\n>>>>>>>  1 file changed, 4 insertions(+)\n>>>>>>>\n>>>>>>> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n>>>>>>> index d157a447..5816c18d 100644\n>>>>>>> --- a/include/libcamera/internal/v4l2_videodevice.h\n>>>>>>> +++ b/include/libcamera/internal/v4l2_videodevice.h\n>>>>>>> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {\n>>>>>>>      }\n>>>>>>>      bool isMeta() const\n>>>>>>>      {\n>>>>>>> +            /* Treat devs which combine video and meta as video not meta */\n>>>>>>\n>>>>>> s/devs/devices/\n>>>>>> s/meta/metadata/g\n>>>>>>\n>>>>>>> +            if (isVideo())\n>>>>>>> +                    return false;\n>>>>>>> +\n>>>>>>>              return device_caps() & (V4L2_CAP_META_CAPTURE |\n>>>>>>>                                      V4L2_CAP_META_OUTPUT);\n>>>>>>>      }\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 A3BB4BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 May 2024 16:16:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E382D63418;\n\tWed,  1 May 2024 18:16:04 +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 0AA45633ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 May 2024 18:16:03 +0200 (CEST)","from mail-lf1-f72.google.com (mail-lf1-f72.google.com\n\t[209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-83-vMiuznQ5PIirWF57px9tLQ-1; Wed, 01 May 2024 12:16:01 -0400","by mail-lf1-f72.google.com with SMTP id\n\t2adb3069b0e04-516d2048ba1so6064786e87.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 01 May 2024 09:16:01 -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\tn4-20020a170906378400b00a522fb5587esm14525198ejc.144.2024.05.01.09.15.58\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 01 May 2024 09:15:58 -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=\"Bu4yLjQP\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1714580163;\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=tGYOnS5Olbh5A0VcAi0Cxpk7VgquamvmiFHnq+w5ppE=;\n\tb=Bu4yLjQPG9VSb3rn4NUxVu270dd5lWMlUilYwTp0aOaKD3fdk0E5qRHfQ77amNJvRVWZTr\n\ts+tgyKV3aHgmGnxIJtTIT+DlkfgL3/TI1lYQ5oN7L8b+TTus7zJT/GIUox7sMgoaLmDLAq\n\tieLXyRV0UxBZHoz7+mqP2Se2zMjI7FI=","X-MC-Unique":"vMiuznQ5PIirWF57px9tLQ-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1714580160; x=1715184960;\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=tGYOnS5Olbh5A0VcAi0Cxpk7VgquamvmiFHnq+w5ppE=;\n\tb=C+ojMwks4sO+VzllNpHa8Du2u+3vw8PfrdSpp6KvHoJlXPFFoTzyTqH1Zt4Ed28xce\n\teGzqX0fitZhqc/9zh7awdbe37x3zsRmAge+8G90sS321L9wtvJZcus7b3LK2nmuadznG\n\t3BR1ACvic0k8CVVnnZUrvnzmGryT40zYecvbY4UVY872Ykzc2vDCOTRr35AEpjqdiMq4\n\tVlSSpjEhO8C6Yf13556R4b0tbrnCv5NuxcRu436cIC6ja/0kWLBz5z11UoyBnR4stks/\n\tEKGRLnPvv8IyYsG3axvp0KjuQ1ROz3f2QtaqXQWsNmLDoOCnwMxu64+M3eMoTy6VmcPN\n\tkv8Q==","X-Gm-Message-State":"AOJu0Yzih51YnFl69rcWC2mgXDReSQfQ9QdwAtlY6aGozp9PIZLFe4L6\n\tcTb/iZRB37hlv7Z2QMP1Ml7ZTfLMI0oKvNhJehF38jokY81Bt7KAatMf5QAm+wNUv+5eNi1uyQa\n\txo0ILCrTorYtQKvKqSQG1BPzE+StoxXw2kJNqaEnrV5J67HMpcP2opiDUOefc5H4LrjgTnkw=","X-Received":["by 2002:ac2:5327:0:b0:513:1a9c:ae77 with SMTP id\n\tf7-20020ac25327000000b005131a9cae77mr1822800lfh.52.1714580159434; \n\tWed, 01 May 2024 09:15:59 -0700 (PDT)","by 2002:ac2:5327:0:b0:513:1a9c:ae77 with SMTP id\n\tf7-20020ac25327000000b005131a9cae77mr1822777lfh.52.1714580158959; \n\tWed, 01 May 2024 09:15:58 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IFDqiY96DPg7XBn2dQobK1v6BfxrU1NahjsvvVYGKSzMfzsMwgsTD+Zb6mu9fK2COLO9BgHVg==","Message-ID":"<c755bc9d-cab2-46a5-b9b0-6c83e44eecbb@redhat.com>","Date":"Wed, 1 May 2024 18:15:57 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set\n\tboth V4L2_CAP_VIDEO and V4L2_CAP_META","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tMaxime Ripard <mripard@redhat.com>, Milan Zamazal <mzamazal@redhat.com>, \n\tDennis Bonke <admin@dennisbonke.com>","References":"<20240430171728.18073-1-hdegoede@redhat.com>\n\t<20240430171728.18073-2-hdegoede@redhat.com>\n\t<20240430221140.GC17852@pendragon.ideasonboard.com>\n\t<7abd4447-0070-4e6d-b784-b0c0028a866a@redhat.com>\n\t<CAEmqJPokGH3_cRHE9gumNbXWUvUq1HEzgsW0_WM-dxH+eJEWQA@mail.gmail.com>\n\t<f1939b72-7c58-4aa5-a76b-1c9feee21f4f@redhat.com>\n\t<CAEmqJPq5_QF51e0fJBYQmTV4_ZbvrVQjvfsd_LHCfhXWZEU5iQ@mail.gmail.com>\n\t<20240501154324.GC9891@pendragon.ideasonboard.com>","From":"Hans de Goede <hdegoede@redhat.com>","In-Reply-To":"<20240501154324.GC9891@pendragon.ideasonboard.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>"}}]