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?
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.
I have a two part answer which works wonders on Raspberry Pi.
First, the Pi has the concept of overscan, which is a black border added around the whole screen to make it fall within the "tube" of older TVs. And yes, it's also needed on some modern flat-screen TVs that emulate that function. If your black border is around all the screen resolutions, then change this. The easiest way is through sudo raspi-config
. The options and layout vary in different versions of raspi-config
but you might start by looking in the Advanced Options
menu for Overscan
. If overscan is your issue, but you want finer control over the size of the black border - then there is a way to fine tune it in /boot/config.txt. I won't go into that here, and it's easy to search for how to tweak that file.
If this is not your problem, and you are looking for a better resolution you can set for your TV/monitor, then you can also use raspi-config
to select from among all the valid screen resolutions. They are in the same Advanced Options
menu as was overscan.
If you need to check and set the resolution programmatically, then the go-to tool for that is tvservice
. There is no man page for the program, but running it with no arguments provides some help. There are very interesting capabilities that go well beyond what fbset
can do.
Some brief examples:
$ sudo tvservice --status
state 0x120009 [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
$
$ sudo tvservice --modes=CEA
Group CEA has 11 modes:
mode 1: 640x480 @ 60Hz 4:3, clock:25MHz progressive
mode 2: 720x480 @ 60Hz 4:3, clock:27MHz progressive
mode 3: 720x480 @ 60Hz 16:9, clock:27MHz progressive
mode 4: 1280x720 @ 60Hz 16:9, clock:74MHz progressive
(prefer) mode 16: 1920x1080 @ 60Hz 16:9, clock:148MHz progressive
mode 17: 720x576 @ 50Hz 4:3, clock:27MHz progressive
mode 18: 720x576 @ 50Hz 16:9, clock:27MHz progressive
mode 19: 1280x720 @ 50Hz 16:9, clock:74MHz progressive
mode 31: 1920x1080 @ 50Hz 16:9, clock:148MHz progressive
mode 32: 1920x1080 @ 24Hz 16:9, clock:74MHz progressive
mode 34: 1920x1080 @ 30Hz 16:9, clock:74MHz progressive
You can see what modes the TV supports, and to be complete you should scan both for DMT and CEA groups to catch everything. DMT modes are more attuned to computer monitors rather than TVs.
Then your program can select from that list and use tvservice -e
to set one of these modes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With