On 18/10/2023 11:52, Jack Zhu wrote: > > > On 2023/10/18 17:31, Hans Verkuil wrote: >> On 18/10/2023 11:25, Jack Zhu wrote: >>> >>> >>> On 2023/10/18 16:50, Hans Verkuil wrote: >>>> Hi Jack, >>>> >>>> On 18/10/2023 04:37, Jack Zhu wrote: >>>> >>>> <snip> >>>> >>>>>>> -------------------------------------------------------------------------------- >>>>>>> Compliance test for device /dev/v4l-subdev1: >>>>>>> >>>>>>> Driver Info: >>>>>>> Driver version : 6.6.0 >>>>>>> Capabilities : 0x00000000 >>>>>> >>>>>> But this does not appear for v4l-subdev1. >>>>>> >>>>>> I can't really tell why it doesn't show that. Can you debug a little bit? >>>>>> The code is in v4l2-compliance.cpp, line 1086: >>>>>> >>>>>> ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function); >>>>>> >>>>>> The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), >>>>>> and that fails for some reason. It could be that media_fd is invalid (would be weird). >>>>>> >>>>>> This could well be a v4l2-compliance bug that you hit with this driver. >>>>>> >>>>> >>>>> On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is >>>>> /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd >>>>> obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid. >>>>> >>>>> I don't know why media0 does not exist in /sys/dev/char/81:3/device? >>>>> >>>> >>>> Can you try again with this v4l2-compliance patch? >>>> >>>> I need to dig a bit deeper as to why media0 is missing, but for now try this. >>>> >>>> Regards, >>>> >>>> Hans >>>> >>>> diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp >>>> index 7169eefe..29475d6b 100644 >>>> --- a/utils/v4l2-compliance/v4l2-compliance.cpp >>>> +++ b/utils/v4l2-compliance/v4l2-compliance.cpp >>>> @@ -968,7 +968,7 @@ err: >>>> } >>>> >>>> void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type, >>>> - unsigned frame_count, unsigned all_fmt_frame_count) >>>> + unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd) >>>> { >>>> struct node node2; >>>> struct v4l2_capability vcap = {}; >>>> @@ -997,8 +997,12 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_ >>>> memset(&vcap, 0, sizeof(vcap)); >>>> } >>>> >>>> - if (!node.is_media()) >>>> - media_fd = mi_get_media_fd(node.g_fd(), node.bus_info); >>>> + if (!node.is_media()) { >>>> + if (parent_media_fd >= 0) >>>> + media_fd = parent_media_fd; >>>> + else >>>> + media_fd = mi_get_media_fd(node.g_fd(), node.bus_info); >>>> + } >>>> >>>> int fd = node.is_media() ? node.g_fd() : media_fd; >>>> if (fd >= 0) { >>>> diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h >>>> index 7caf254b..c47f25f5 100644 >>>> --- a/utils/v4l2-compliance/v4l2-compliance.h >>>> +++ b/utils/v4l2-compliance/v4l2-compliance.h >>>> @@ -308,7 +308,7 @@ int check_ustring(const __u8 *s, int len); >>>> int check_0(const void *p, int len); >>>> int restoreFormat(struct node *node); >>>> void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type, >>>> - unsigned frame_count, unsigned all_fmt_frame_count); >>>> + unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd = -1); >>>> std::string stream_from(const std::string &pixelformat, bool &use_hdr); >>>> >>>> // Media Controller ioctl tests >>>> >>> >>> From the log, there is no change. >> >> Oops, my mistake. Also apply this change: >> >> diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp >> index 0195ac58..52ab7fb8 100644 >> --- a/utils/v4l2-compliance/v4l2-test-media.cpp >> +++ b/utils/v4l2-compliance/v4l2-test-media.cpp >> @@ -612,7 +612,7 @@ void walkTopology(struct node &node, struct node &expbuf_node, >> } >> >> testNode(test_node, test_node, expbuf_node, type, >> - frame_count, all_fmt_frame_count); >> + frame_count, all_fmt_frame_count, node.g_fd()); >> test_node.close(); >> } >> } >> > > Can see relevant Info in the log. Great! Can you do one more thing? Please run 'v4l2-compliance -m /dev/media0 --verbose' and mail the output to me. It's pretty big, so just email it to me, without CCs. I want to take a closer look at the output to see why this patch is needed. Regards, Hans