Difference between revisions of "Framebuffer"

From ArmadeusWiki
Jump to: navigation, search
(Kernel configuration)
(Links)
(13 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
==Introduction==
 
==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.
 
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...
+
Some higher level librairies can be put on top of the Framebuffer for more portability: [[SDL]], [[Qt/Embedded]], GTK, DirectFB, etc...
  
 
==Kernel configuration==
 
==Kernel configuration==
{{Note | Framebuffer is already configured (for [[LQ043_Adapt|Sharp LQ043 LCD]]) in standard/default Armadeus kernel image.}}
+
{{Note | Framebuffer is already configured (for [[LQ043_Adapt|Sharp LQ043 LCD]] on [[APF9328]] and for Chimei LW700 on [[APF27]]/[[APF51]]) in standard/default Armadeus kernel image. [[APF28]] has a boot option to [[APF28Dev#Selecting_LCD|choose the LCD]].}}
Following instructions are only given as references or if you want to change the default LCD:
+
 
* launch Linux kernel configuration:
+
Instructions to configure Linux kernel were moved to [[Talk:FrameBuffer]] and are only given as references or if you want to change the default LCD.
<pre class="host">
+
[armadeus]$ make linux26-menuconfig
+
</pre>
+
* activates:
+
<pre class="config">
+
Device Drivers 
+
    ---> Character devices  --->
+
        [*] Virtual terminal
+
        [*]  Support for console on virtual terminal
+
</pre>
+
* '''on APF9328''' activates:
+
<pre class="config">
+
Device Drivers 
+
    ---> Graphics support 
+
        <*> Support for frame buffer devices  --->
+
            <*>  Motorola i.MX LCD support
+
</pre>
+
* '''on APF27''' activates:
+
<pre class="config">
+
Device Drivers 
+
    ---> Graphics support 
+
        <*> MXC Framebuffer support (Freescale driver)
+
</pre>
+
* and choose your LCD in:
+
<pre class="config">
+
Device Drivers 
+
    ---> Graphics support 
+
        ---> LCD Panel (xxxx)  --->
+
</pre>
+
* activates:
+
<pre class="config">
+
Device Drivers 
+
    ---> Graphics support 
+
        ---> Console display driver support
+
            <*> Framebuffer Console support
+
</pre>
+
* deactivates VGA stuff & add some fonts, then choose Armadeus boot logo:
+
<pre class="config">
+
Device Drivers  --->
+
    Graphics support  --->
+
        [*] Bootup logo
+
        [*]  224-color Armadeus Linux logo
+
</pre>
+
* recompiles the kernel:
+
<pre class="host">
+
[armadeus]$ make linux26
+
</pre>
+
* 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==
 
==Userland==
Line 68: Line 19:
 
<pre class="config">
 
<pre class="config">
 
  Package Selection for the target
 
  Package Selection for the target
...
+
    ...
     [ ] fbtest
+
     Graphic libraries and applications (graphic/text)  --->
...
+
    ...
    ---> Graphic libraries and applications (graphic/text)   
+
        [*] fbgrab
        ---> fbset/fbv/fbgrab
+
        [*] fbtest
 +
        [*] fbv
 +
    ...
 +
        ---> Graphic libraries and applications (graphic/text)   
 +
            ---> fbset/fbv/fbgrab
 
</pre>
 
</pre>
  
Line 80: Line 35:
 
<pre class="apf">
 
<pre class="apf">
 
# fbgrab /tmp/snapshot.png
 
# fbgrab /tmp/snapshot.png
 +
</pre>
 +
 +
* For example to display an image using standard image file formats PNG, GIF...:
 +
<pre class="apf">
 +
# fbv myimage.png
 
</pre>
 
</pre>
  
Line 87: Line 47:
 
<pre class="apf">
 
<pre class="apf">
 
  # echo 0 > /sys/class/graphics/fbcon/cursor_blink
 
  # echo 0 > /sys/class/graphics/fbcon/cursor_blink
 +
</pre>
 +
also possible at boot time (with 3.x recent kernels):
 +
<pre class="apf">
 +
BIOS> setenv extrabootargs vt.global_cursor_default=0
 
</pre>
 
</pre>
 
* To make it blinking again:
 
* To make it blinking again:
Line 101: Line 65:
 
  # echo 0 > /sys/class/graphics/fb0/blank
 
  # echo 0 > /sys/class/graphics/fb0/blank
 
</pre>
 
</pre>
* To set sleep mode entering time (where X is a time in minute; 0 = never):
+
* To set "sleep mode"/screensaver entering time (where X is a time in minute; 0 = never):
 
<pre class="apf">
 
<pre class="apf">
 
  # echo -e '\033[9;X]' > /dev/tty1    (from serial console)
 
  # echo -e '\033[9;X]' > /dev/tty1    (from serial console)
Line 130: Line 94:
 
<pre class="apf">
 
<pre class="apf">
 
  # echo -e '\033[?5l' > /dev/tty1
 
  # echo -e '\033[?5l' > /dev/tty1
 +
</pre>
 +
* To erase the screen
 +
<pre class="apf">
 +
echo -e '\033[2J' > /dev/tty1 (from serial console)
 
</pre>
 
</pre>
  
 
=Links=
 
=Links=
 
* [[Linux_Boot_Logo|How to change the Linux boot logo]]
 
* [[Linux_Boot_Logo|How to change the Linux boot logo]]
 +
* [[i.MX6 Framebuffer Overlay|How to play with Framebuffer overlay on APF6]]
 
* [http://lxr.linux.no/linux/Documentation/VGA-softcursor.txt How to configure soft cursor]
 
* [http://lxr.linux.no/linux/Documentation/VGA-softcursor.txt How to configure soft cursor]
 
* http://linux-fbdev.sourceforge.net/
 
* http://linux-fbdev.sourceforge.net/

Revision as of 11:47, 20 April 2017

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/Embedded, GTK, DirectFB, etc...

Kernel configuration

Note Note: Framebuffer is already configured (for Sharp LQ043 LCD on APF9328 and for Chimei LW700 on APF27/APF51) in standard/default Armadeus kernel image. APF28 has a boot option to choose the LCD.


Instructions to configure Linux kernel were moved to Talk:FrameBuffer and are only given as references or if you want to change the default LCD.

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
     ...
     Graphic libraries and applications (graphic/text)  ---> 
     ...
         [*] fbgrab
         [*] fbtest
         [*] fbv
     ...
        ---> Graphic libraries and applications (graphic/text)  
            ---> fbset/fbv/fbgrab
Note Note: As explain on LinuxInstall page, to compile fbtest, libnetpbm10-dev must be installed in your host system


  • For example to grab a snapshot of the framebuffer:
# fbgrab /tmp/snapshot.png
  • For example to display an image using standard image file formats PNG, GIF...:
# fbv myimage.png

Tips

  • To stop blinking cursor:
 # echo 0 > /sys/class/graphics/fbcon/cursor_blink

also possible at boot time (with 3.x recent kernels):

BIOS> setenv extrabootargs vt.global_cursor_default=0
  • 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"/screensaver 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
  • To erase the screen
echo -e '\033[2J' > /dev/tty1 (from serial console)

Links