Framerate falls to half of expected in subsequent captures
Closed this issue · 1 comments
After rebooting and loading the driver the first HDMI capture appears to perform as expected (e.g. 2160p30). But subsequent captures with the same GStreamer pipeline only achieve half the framerate (e.g. 15 FPS instead of 30).
Examples
GStreamer pipeline:
sudo modprobe tc358840
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, width=3840, height=2160, framerate=30/1, format=UYVY' ! nvvidconv ! 'video/x-raw(memory:NVMM), width=3840, height=2160, framerate=30/1, format=I420' ! nvoverlaysink sync=false
The problem can also be reproduced with v4l2-ctl
:
v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat=YUYV --stream-mmap --stream-count=400 --stream-to=/dev/null
Observed on
- https://github.com/InES-HPMM/linux-l4t/tree/hdmi2csi/l4t-r24-2.1
- https://github.com/InES-HPMM/linux-l4t/tree/hdmi2csi/l4t-r24-1-dev-4K
(previous versions not tested)
Workarounds
- The framerate can be increased by running the performance scripts
- The framerate can be increased by stressing all cpu cores:
stress -c 4
Solved in commit c2239a1
The source for the problem was that a WrAck syncpt was queued in the capture loop even though the loop was scheduled to end. Therefore the syncpt counter was incremented by the value of one too much as long as the driver was loaded. With our implementation of the video capture consisting of two individual captures (left and right half of the image), we must have always used one half of one frame and the other half of the next frame. Thus causing the resulting framerate to be half of what was expected.