We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

5 posts • Page 1 of 1
koseungjin
Posts: 4
Joined: Thu Aug 28, 2025 8:50 am

why raspberrypi 4 + kmssink slow?

Mon Sep 01, 2025 10:20 am

"Why does Raspberry Pi 4 + v4l2 + kmssink take so long to load, about 5 seconds? Has anyone solved this issue?"

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 18476
Joined: Wed Dec 04, 2013 11:27 am

Re: why raspberrypi 4 + kmssink slow?

Mon Sep 01, 2025 11:22 am

I suspect that it's just the normal GStreamer format negotiation that takes a few moments - it all looks to be in going from PAUSED to PREROLLING.

What format are you using from V4L2? Complete pipeline command please. Is GStreamer having to insert format conversions?
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

koseungjin
Posts: 4
Joined: Thu Aug 28, 2025 8:50 am

Re: why raspberrypi 4 + kmssink slow?

Tue Sep 02, 2025 9:57 am

GST_DEBUG="kmssink:7" gst-launch-1.0 videotestsrc ! kmssink
Setting pipeline to PAUSED ...
0:00:03.096814035 41772 0x55b1b52460 INFO kmssink gstkmssink.c:671:log_drm_version:<kmssink0> DRM v0.0.0 [vc4 — Broadcom VC4 graphics — 0]
0:00:03.096943220 41772 0x55b1b52460 INFO kmssink gstkmssink.c:716:get_drm_caps:<kmssink0> prime import (✓) / prime export (✓) / async page flip (✓)
0:00:03.251720403 41772 0x55b1b52460 INFO kmssink gstkmssink.c:849:ensure_allowed_ca

itis about 3~ 5seconds then start view on camera

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 18476
Joined: Wed Dec 04, 2013 11:27 am

Re: why raspberrypi 4 + kmssink slow?

Thu Sep 11, 2025 6:14 pm

I've only just had a chance to look further.

kmssink goes and tries opening /dev/dri/card0 all the way up to /dev/dri/card63, poking each one 50 times with a 20usec delay between each attempt, and then does that multiple times.
Using "strace gst-launch-1.0 videotestsrc ! kmssink 2> log.txt" and then "less log.txt | grep "AT_FDCWD, ./dev/dri/card" | wc -l" lists 39638 different attempts to open a directory a /dev/dri/cardN, and each also appears to check for /dev/dri existing first.

That would appear to be libdrm at https://gitlab.freedesktop.org/mesa/lib ... heads#L892
50 attempts with a 20usec delay between attempts for each.

Gstreamer is calling drmOpen with a sequence of driver names at https://gitlab.freedesktop.org/gstreame ... heads#L478
So we've got 13 other driver name attempts before we try "vc4", each one generating 50 retries for each of 62 directories that don't exist (card0 and card1 will), each with a 20usec delay. 13 * 50 * 62 = 40300 attempts.

Specify the DRM driver to use with

Code: Select all

gst-launch-1.0 videotestsrc ! kmssink driver-name=vc4
it avoids all that searching, and starting almost immediately.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

koseungjin
Posts: 4
Joined: Thu Aug 28, 2025 8:50 am

5 posts • Page 1 of 1

Return to "OpenGLES"

AltStyle によって変換されたページ (->オリジナル) /