From patchwork Wed Jul 3 15:09:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 20538 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2B22EBEFBE for ; Wed, 3 Jul 2024 15:09:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7EF4862E22; Wed, 3 Jul 2024 17:09:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="Ml51xu/m"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2EC9A62C95 for ; Wed, 3 Jul 2024 17:09:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720019373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6IIJ6+YRXSxMtGTY4tSyPRyWXgNyuHopPUjEwCA/CQE=; b=Ml51xu/mXiH5ODG8sy6HCqUbAgdCINHFhVJfbvK33TY6joqlXPeg2SL4m8ca2epxEtacAX sy42rmQ7TSbkHrt8a3lu6zu+8/bFIEzbiJLpQypH+KCJw2StBaXpwA0W6l0xueZW0KCZz9 E6bvk9S4bWjDu72ZjhqRlJN1ic8ORGc= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-41-AxhyP-mDNT68L34H9PRrYg-1; Wed, 03 Jul 2024 11:09:31 -0400 X-MC-Unique: AxhyP-mDNT68L34H9PRrYg-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F12531954207 for ; Wed, 3 Jul 2024 15:09:30 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.67]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 911281955F21; Wed, 3 Jul 2024 15:09:29 +0000 (UTC) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Maxime Ripard , Hans de Goede Subject: [PATCH resend 1/2] libcamera: v4l2_videodevice: Fix devices which set both V4L2_CAP_VIDEO and V4L2_CAP_META Date: Wed, 3 Jul 2024 17:09:22 +0200 Message-ID: <20240703150923.25994-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE and V4L2_CAP_META_CAPTURE. This was resulting in V4L2VideoDevice::getFormat() / tryFormat() / setFormat() calling the metadata related ioctls instead of the videocap ioctls causing things to not work. Fix this by making V4L2Capability::isMeta() return false when the device also has one of the video capabilities. Signed-off-by: Hans de Goede --- include/libcamera/internal/v4l2_videodevice.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index 9057be08..fdd877c8 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability { } bool isMeta() const { + /* Treat devs which combine video and meta as video not meta */ + if (isVideo()) + return false; + return device_caps() & (V4L2_CAP_META_CAPTURE | V4L2_CAP_META_OUTPUT); }