How to get and set the HDMI output pixel in drm mode?

For example, My screen is 4k, I want to set the HDMI to be 1080P. And How to get the current time sequence of HDMI(width height fps)

Hi,
You can get the the modes by running:

sudo cat /sys/class/graphics/fb0/modes

And change the mode by executing

sudo echo 4 > /sys/class/graphics/fb0/blank
sudo echo "U:3840x2160p-60" > /sys/class/graphics/fb0/mode
sudo echo 0 > /sys/class/graphcis/fb0/blank

HA! I see.
What does the “U” means in “U:3840x2160p-60”? I can see “D” “V” “S” too.
And is there any API to do it?

I follow your command I can get the modes but can noe set the mode

Hi,
It should work by simply put the string in "" like "U:3840x2160p-30"

We have these TV modes:

nvidia@tegra-ubuntu:~$ sudo cat /sys/class/graphics/fb0/modes
D:1920x1080p-60
D:1280x720p-60
V:640x480p-60
V:800x600p-60
V:1024x768p-60
S:1280x1024p-60
S:1600x900p-60
S:1152x864p-75
S:1680x1050p-60
U:3840x2160p-24
U:3840x2160p-25
U:3840x2160p-30
U:4096x2160p-24
U:1920x1080p-50

1.That means there is no api to set the mode?
2.What does the “U” means in “U:3840x2160p-60”? I can see “D” “V” “S” too.

Hi,
We don’t have specific api for switching the mode. In Ubunut desktop, there is option in System SettingsDisplay and can switch the mode. It should be certain X functions for this. It would need other users to share experience.

The mode flag is checked in
fbsysfs.c - drivers/video/fbdev/core/fbsysfs.c - Linux source code (v4.10-rc8) - Bootlin
"U" means unknown.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.