Linux Framebuffer set resolution correctly

user3696412 picture user3696412 · Jan 20, 2016 · Viewed 27.2k times · Source

I have a RaspberryPi and want to display an image fullscreen without xserver - so write it directly to the framebuffer. No problem here.

But setting it fullscreen doesn't work.

cat /sys/class/graphics/fb0/modes

yields:

U:1024x768p-0
U:1920x1200p-0
U:1920x1080p-0
U:608x684p-0

So I use

fbset -xres 1920 -yres 1200 -match

resulting in

>>fbset
mode "1920x1200"
geometry 1920 1200 1920 1200 16
timings 0 0 0 0 0 0 0
rgba 5/11,6/5,5/0,0/16
endmode

If I now use fbi to display an image, or just fill the framebuffer /dev/urandom >> /dev/fb0, just part of the screen is filled. The aspect etc. of the displayed part is correct, there is just a big black boundary around.

If I use other resolutions, everything works as expected, for example the stats-line in fbi gets bigger etc.

What do I do wrong?

Answer

Jeff DeCola picture Jeff DeCola · Jan 26, 2016

Try this format for fbset:

fbset -fb /dev/fb0 -g 1920 1200 1920 1200 16 

And check you're really looking at fb0 and not fb1:

fbset -fb /dev/fb0

Double check what was actually set:

cat /sys/class/graphics/fb0/mode

Also try to run fbi with (again, to make sure you're using fb0):

fbi -d /dev/fb0 image.png

You could also force your settings into the fb0 by doing:

echo U:1920x1200p-0 > /sys/class/graphics/fb0/mode

Technically, that is what fbset is doing anyway. Just making sure fb1 isn't screwing things up.

Last, make sure your console is using fb0. I'm sure it is.

con2fbmap 1

You may also want to reboot, so check what your setting is:

cat /proc/cmdline

If its not 1920x1200, update to 1920x200. I think it located in /boot/cmdline.txt for raspberry pi. For me its /boot/uEnv.txt.