From patchwork Tue Apr 30 17:17:27 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: 19966 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 0B1F9C32A2 for ; Tue, 30 Apr 2024 17:17:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A89AD633F3; Tue, 30 Apr 2024 19:17:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="GHo1F7ny"; 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 8B57D633F3 for ; Tue, 30 Apr 2024 19:17:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714497456; 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: in-reply-to:in-reply-to:references:references; bh=3rEzp/DtvvekktVDG8t1Ty/1n/7cZyy0N4cu5NFv/38=; b=GHo1F7nyCYdhtlosFEbplwRW/CNMTDT4wmxBV0rDDhCiQcwstzXcbYcmBpCXFvfTwhhgr+ mFXI8pWBdTPIGZrhg9NRC0GBN3mfRpwpSR9aAib06j5wKKi/J4UvkPyqY0HemSFtwI4vas W5G4jnPhAfnjge7kvx9MBWmg0p2VLQc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-oWWAt2mBPHO-hatcOVL_OQ-1; Tue, 30 Apr 2024 13:17:32 -0400 X-MC-Unique: oWWAt2mBPHO-hatcOVL_OQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E2BA1827143; Tue, 30 Apr 2024 17:17:32 +0000 (UTC) Received: from x1.localdomain.com (unknown [10.39.192.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20338477F80; Tue, 30 Apr 2024 17:17:31 +0000 (UTC) From: Hans de Goede To: libcamera-devel@lists.libcamera.org, Sakari Ailus Cc: Maxime Ripard , Milan Zamazal , Dennis Bonke , Hans de Goede Subject: [PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set both V4L2_CAP_VIDEO and V4L2_CAP_META Date: Tue, 30 Apr 2024 19:17:27 +0200 Message-ID: <20240430171728.18073-2-hdegoede@redhat.com> In-Reply-To: <20240430171728.18073-1-hdegoede@redhat.com> References: <20240430171728.18073-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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 Reviewed-by: Sakari Ailus --- 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 d157a447..5816c18d 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); }