Framebuffer

From ArmadeusWiki
Revision as of 10:42, 24 June 2009 by JulienB (Talk | contribs) (Userland)

Jump to: navigation, search

On this page you will find usefull informations to have a working Linux Framebuffer on your board.

Introduction

Linux Framebuffer is the lowest level (standardized) API for userspace programs to access video capabilities of the system you're running on. It allows you to directly "draw" your graphics in the video memory. Some higher level librairies can be put on top of the Framebuffer for more portability: SDL, Qt, GTK, etc...

Kernel configuration

Note Note: Framebuffer is already configured (for Sharp LQ043 LCD) in standard/default Armadeus kernel image.

Following instructions are only given as references or if you want to change the default LCD:

  • launch Linux kernel configuration:
 [armadeus]$ make linux26-menuconfig
  • activates:
 Device Drivers  
    ---> Character devices  ---> 
        [*] Virtual terminal
        [*]   Support for console on virtual terminal
  • activates:
 Device Drivers  
    ---> Graphics support  
        <*> Support for frame buffer devices  
        <*>   Motorola i.MX LCD support
  • and choose your LCD in:
 LCD Panel (xxxx)  --->
  • activates:
 Device Drivers  
    ---> Graphics support  
        ---> Console display driver support
            <*> Framebuffer Console support
  • deactivates VGA stuff & add some fonts, then choose Armadeus boot logo
 Device Drivers  ---> 
    Graphics support  ---> 
        [*] Bootup logo
        [*]   224-color Armadeus Linux logo
  • recompiles the kernel:
 [armadeus]$ make linux26
  • now to have console on serial port, you will have to add "console=ttySMX0,115200n8" to your boot parameters
  • reflash kernel image on your board and enjoy ! (you should see Linux logo on screen at startup)

Userland

  • Framebuffer device can be accessed with /dev/fb0.
  • You can activate some tools from the Buildroot's menuconfig:
 $ make menuconfig
 Package Selection for the target
 ...
     [ ] fbtest
 ...
    ---> Graphic libraries and applications (graphic/text)  
        ---> fbset/fbv/fbgrab
  • For example to grab a snapshot of the framebuffer:
# fbgrab /tmp/snapshot.png

Tips

  • To stop blinking cursor:
 # echo 0 > /sys/class/graphics/fbcon/cursor_blink
  • To make it blinking again:
 # echo 1 > /sys/class/graphics/fbcon/cursor_blink
  • To grab a screenshot of a running Framebuffer application, use FBGrab
  • To enter in Framebuffer sleep mode:
 # echo 1 > /sys/class/graphics/fb0/blank
  • To leave Framebuffer sleep power mode:
 # echo 0 > /sys/class/graphics/fb0/blank
  • To set sleep mode entering time (where X is a time in minute; 0 = never):
 # echo -e '\033[9;X]' > /dev/tty1    (from serial console)

or

 # echo -e '\033[9;X]'    (from framebuffer console)

or to set it at each boot, use /etc/inittab:

 tty1::sysinit:echo -e '\033[9;X]'

Other usefull ESC sequences

  • To (definitly) hide cursor:
 # echo -e '\033[?17;0;0c' > /dev/tty1    (from serial console)

or

 # echo -e '\033[?17;0;0c'    (from framebuffer console)
  • inverse screen on:
 # echo -e '\033[?5h' > /dev/tty1
  • inverse screen off:
 # echo -e '\033[?5l' > /dev/tty1

Links