From patchwork Mon Aug 19 11:45:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 820505 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 838D315DBAB for ; Mon, 19 Aug 2024 11:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724068072; cv=none; b=bctMrCTdPmXBKa4auAkLRUYIYLg6poYkMy/N6WKZjTm/KWF6Y3cAfu/bR/FVv+SLfM9vEuiHfxdjW50wop1f8+HpOL/rBKkxowsErRG7dDr2QJgkVgOjjIjNMQPMEDlsIXQ+x28Ya6yvlUHvNxkEwNWw4n0xhvvTYB2thxMxabo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724068072; c=relaxed/simple; bh=21DfWFG1OLpDMw0d4jBnDJoi9K+S7qg8y9KMO7zwhdE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eylGpaay4jc7BfXp7K0/lWXNl+3dgsJsksCgmDSFDOM45ZJQyPY8/8HnwAApSOyJsTQxsXiHGa3NDYBgqgL0wAp/QJQlI1jv47UtbOlGHt5QfUvAK707bNbr1JKuJmJE/eC1GQSaEuWwDiLfl/iNACWahOLsGIKKYdJhYVKush4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25B9EC4AF0C; Mon, 19 Aug 2024 11:47:50 +0000 (UTC) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Erling Ljunggren , Hans Verkuil Subject: [PATCH 1/3] videodev2.h: add CAP_EDID (DO NOT COMMIT) Date: Mon, 19 Aug 2024 13:45:42 +0200 Message-ID: <26dd745a0b3c99b92da21eb767272928fa4a6742.1724067944.git.hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add capability flag to indicate that the device is an EDID-only device. Signed-off-by: Hans Verkuil --- include/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index f18a40d4..dab68c8d 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -475,6 +475,7 @@ struct v4l2_capability { #define V4L2_CAP_META_CAPTURE 0x00800000 /* Is a metadata capture device */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ +#define V4L2_CAP_EDID 0x02000000 /* Is an EDID-only device */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ #define V4L2_CAP_META_OUTPUT 0x08000000 /* Is a metadata output device */ From patchwork Mon Aug 19 11:45:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 820807 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA20C166F34 for ; Mon, 19 Aug 2024 11:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724068073; cv=none; b=W/HgbhUcYNKFTjfEWdiR/bhqRj9pGB9xxy+DoAZIttmwOoeJXekjxTk9c5zo7+fsHjiEhjtH533KCRdvrDzF5Xs63Ch+WVEsgfKExLiupIekJlkVNT8FI4Ijb9SJ3wgf9LBkdEfbj0FdNYSeYEBjBd8F1YEUCOp9iiEmlFBLayg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724068073; c=relaxed/simple; bh=1rzj8VVU1+eaSlRo+NK16kiH3KaAQI3wIKo1fGui3zw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uMh1JfX7Ve1ydToB1hCN5iiEOIiAtM9r7eDQu6ZlrKZG3nBET2VP/z9PhF9UStuDBGZok3U2YFsWv6eqeHhQe9RBE/VEt7lF2GAaD7/+TRko3D1SqGxZixl6zqvT7FKJsvKkgRNUQIAvDjkf0rnz+Furea+xMW1nOJtMkwdjIZc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F76AC32782; Mon, 19 Aug 2024 11:47:52 +0000 (UTC) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Erling Ljunggren , Hans Verkuil Subject: [PATCH 2/3] utils/common: add V4L2_CAP_EDID support Date: Mon, 19 Aug 2024 13:45:43 +0200 Message-ID: <7ab24b375c3d23ffbf2836de16834d94ee8fd88a.1724067944.git.hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Understand V4L2_CAP_EDID and log it. Signed-off-by: Hans Verkuil --- utils/common/v4l2-info.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp index aaf7b0b5..7dd7e708 100644 --- a/utils/common/v4l2-info.cpp +++ b/utils/common/v4l2-info.cpp @@ -91,6 +91,8 @@ static std::string cap2s(unsigned cap) s += "\t\tI/O MC\n"; if (cap & V4L2_CAP_READWRITE) s += "\t\tRead/Write\n"; + if (cap & V4L2_CAP_EDID) + s += "\t\tEDID Only\n"; if (cap & V4L2_CAP_STREAMING) s += "\t\tStreaming\n"; if (cap & V4L2_CAP_EXT_PIX_FORMAT) From patchwork Mon Aug 19 11:45:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 820504 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3F5716A95B for ; Mon, 19 Aug 2024 11:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724068074; cv=none; b=MvdxYGdMQSXkO4jXLCoUT0xzWJqgEYyCc4D8bmxfoO4mSbcLspShpsZWTXSCtaxEkvAiqiRSm/IjiVVllU4/x3PUiy+4qL1CGQ7HS3C/Y9bN04yqBjPm9iH6GzX/i+8EPsMahK7uJ0yrXumSgRS/5mw5lAXf2XAWZ3Tm61SdSPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724068074; c=relaxed/simple; bh=19gBCHVY74JSGZLM3S0kA4tTI+cdT8MVIWwK/UfBhQA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BIC42Hv/2sTg587t6utZUqyI8fcdwwllKjOhSAUkFC+VsK6y2Ac7ei7Gj1OjhPfO3gNoVtLG0bvF7aAlcLsIkDmlaH/uWS6cLLkCaC+sThaiqSqBPiMGc2vQ+4WMbOwuQ36bjEXCBWHnckQEtQ0W9ahkY9i9vHuyeSpcE3SMJG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D91F7C4AF09; Mon, 19 Aug 2024 11:47:53 +0000 (UTC) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Erling Ljunggren , Hans Verkuil Subject: [PATCH 3/3] v4l2-compliance: add support for V4L2_CAP_EDID Date: Mon, 19 Aug 2024 13:45:44 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add tests for devices that only support G/S_EDID and ENUM/G/S_INPUT or OUTPUT. Co-developed-by: Erling Ljunggren Signed-off-by: Erling Ljunggren Signed-off-by: Hans Verkuil --- utils/v4l2-compliance/v4l2-compliance.cpp | 17 ++++++++++++++--- utils/v4l2-compliance/v4l2-test-io-config.cpp | 4 +++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 144f9618..c2832401 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -645,6 +645,7 @@ static int testCap(struct node *node) V4L2_CAP_VIDEO_M2M_MPLANE; const __u32 splane_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_M2M; + const __u32 edid_caps = V4L2_CAP_EDID; memset(&vcap, 0xff, sizeof(vcap)); fail_on_test(doioctl(node, VIDIOC_QUERYCAP, &vcap)); @@ -663,6 +664,7 @@ static int testCap(struct node *node) memcmp(vcap.bus_info, "platform:", 9) && memcmp(vcap.bus_info, "rmi4:", 5) && memcmp(vcap.bus_info, "libcamera:", 10) && + memcmp(vcap.bus_info, "serio:", 6) && memcmp(vcap.bus_info, "gadget.", 7)) return fail("missing bus_info prefix ('%s')\n", vcap.bus_info); if (!node->media_bus_info.empty() && @@ -685,7 +687,7 @@ static int testCap(struct node *node) // for a modern driver for both caps and dcaps fail_on_test(!(caps & V4L2_CAP_EXT_PIX_FORMAT)); //fail_on_test(!(dcaps & V4L2_CAP_EXT_PIX_FORMAT)); - fail_on_test(node->is_video && !(dcaps & video_caps)); + fail_on_test(node->is_video && !(dcaps & video_caps || dcaps & edid_caps)); fail_on_test(node->is_radio && !(dcaps & radio_caps)); // V4L2_CAP_AUDIO is invalid for radio and sdr fail_on_test(node->is_radio && (dcaps & V4L2_CAP_AUDIO)); @@ -1034,6 +1036,14 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_ V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_META_OUTPUT)) node.has_outputs = true; + if (node.g_caps() & V4L2_CAP_EDID) { + int tmp; + + if (!ioctl(node.g_fd(), VIDIOC_G_INPUT, &tmp)) + node.has_inputs = true; + else if (!ioctl(node.g_fd(), VIDIOC_G_OUTPUT, &tmp)) + node.has_outputs = true; + } if (node.g_caps() & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_CAP_SLICED_VBI_CAPTURE | @@ -1400,20 +1410,21 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_ node.valid_buftypes = 0; node.valid_memorytype = 0; node.buf_caps = 0; + node.cur_io_caps = 0; for (auto &buftype_pixfmt : node.buftype_pixfmts) buftype_pixfmt.clear(); if (max_io) { sprintf(suffix, " (%s %u)", node.can_capture ? "Input" : "Output", io); - if (node.can_capture) { + if (node.has_inputs) { struct v4l2_input descr; doioctl(&node, VIDIOC_S_INPUT, &io); descr.index = io; doioctl(&node, VIDIOC_ENUMINPUT, &descr); node.cur_io_caps = descr.capabilities; - } else { + } else if (node.has_outputs) { struct v4l2_output descr; doioctl(&node, VIDIOC_S_OUTPUT, &io); diff --git a/utils/v4l2-compliance/v4l2-test-io-config.cpp b/utils/v4l2-compliance/v4l2-test-io-config.cpp index dcab40b8..48eabe04 100644 --- a/utils/v4l2-compliance/v4l2-test-io-config.cpp +++ b/utils/v4l2-compliance/v4l2-test-io-config.cpp @@ -513,8 +513,10 @@ static int checkEdid(struct node *node, unsigned pad, bool is_input) fail_on_test(doioctl(node, VIDIOC_S_EDID, &edid) != ENOTTY); return ENOTTY; } + if (!is_input && ret == ENODATA) + return 0; has_edid = ret == 0; - fail_on_test(ret && ret != EINVAL); + fail_on_test_val(ret && ret != EINVAL, ret); fail_on_test(!ret && check_0(edid.reserved, sizeof(edid.reserved))); fail_on_test(edid.start_block); fail_on_test(edid.blocks > 256);