Unstable framerate of SPI camera with ondemand governor since 5.4

Open
#3,944 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c, linux, raspberry-pi

Research direction

Start by reproducing the unstable SPI camera framerate on a Raspberry Pi 3B+ with kernel 5.4 or 5.9 while using the ondemand governor, then compare it with powersave, performance, and conservative. Use the reported vcgencmd arm and core clock measurements to investigate; done means the camera remains synchronized with ondemand frequency scaling.

Written by the indexing model from the issue text.

Description

We have Raspberry Pi 3B+ with a camera connected via SPI interface.

kernel 4.19: When "ondemand" governor is enabled, CPU switches between 2 steps: 600 MHz and 1400 MHz. This can influence SPI clock, so the core clock is fixed at 400 MHz in /boot/config.txt (core_freq=400). Everything works correctly.

kernel 5.x: With "ondemand" governor, CPU frequency change is more smooth. It is changed in 100 MHz steps. But even with fixed core clock, the SPI camera frame rate is unstable and desynchronization occurs very often. It can be minimized a bit with "conservative" governor, but it does not fix it. The problem appears in 5.4 and 5.9 kernels.

When governor is set to "powersave" or "performance", so the CPU frequency is fixed, the problem does not appear. But this way is not effective (fixed 600 MHz is too low for our application...)

"vcgencmd measure_clock arm" shows that the CPU frequency is scaled as expected.
"vcgencmd measure_clock core" shows "frequency(1)=400000000" all the time.

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.