Framebuffer use - notro/fbtft GitHub Wiki

This page list some ways to use the framebuffer drivers. All commands are issued from a SSH session.

X server

Install framebuffer driver

sudo apt-get install xserver-xorg-video-fbdev

Create file: /usr/share/X11/xorg.conf.d/99-fbdev.conf

Section "Device"  
  Identifier "myfb"
  Driver "fbdev"
  Option "fbdev" "/dev/fb1"
EndSection

Start X server

startx

Source: blogpost

Alternative method

FRAMEBUFFER=/dev/fb1 startx

mplayer

WIDTH is the display width.
scale is used because the movie is larger than most small displays. -3 means keep aspect ratio and calculate height.

apt-get install -y mplayer
wget http://fredrik.hubbe.net/plugger/test.mpg

mplayer -nolirc -vo fbdev2:/dev/fb1 -vf scale=WIDTH:-3 test.mpg

This does not work for jessie anymore. mplayer was replaced with mplayer2 missing fbdev support. Workaround for this is using SDL

sudo SDL_VIDEODRIVER=fbcon SDL_FBDEV=/dev/fb1 mplayer -vo sdl -framedrop test.mpg

Image viewer

apt-get -y install fbi
wget http://art110.wikispaces.com/file/view/Mystery-100x100.jpg/30649064/Mystery-100x100.jpg

fbi -d /dev/fb1 -T 1 -noverbose -a Mystery-100x100.jpg

Console

Use display as the primary console.
If a keyboard is plugged in after power on, a reboot may be necessary.

# Map console 1 to framebuffer 1, login screen will show up on the display
con2fbmap 1 1

con2fbmap 1
console 1 is mapped to framebuffer 1

# Revert
con2fbmap 1 0

Framebuffer mirroring

By mirroring /dev/fb0 onto /dev/fb1, we can take advantage of the GPU for hardware accelerated video playback.
fbcp takes a snapshot of /dev/fb0, copies it to /dev/fb1 and waits 25ms before repeating.
Snapshotting takes ~10ms and with a 25ms delay it gives roughly 1000/(10+25) = 28fps
CPU usage: ~2%
Note: Snapshot and /dev/fb1 driver refresh is not synchronized.

Install fbcp

sudo apt-get install cmake
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp/
mkdir build
cd build/
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp

Load drivers and fbcp

sudo modprobe fbtft dma
sudo modprobe fbtft_device name=tinylcd35 rotate=90 speed=48000000 fps=50

# Start fb copying process in the background
fbcp &

Play video on /dev/fb0, which will also show up on /dev/fb1

omxplayer test_480_320.mpg

Stop framebuffer copy

killall fbcp

syslog output

$ tail /var/log/messages
Dec 15 17:38:07 raspberrypi fbcp[4836]: Primary display is 720 x 480
Dec 15 17:38:07 raspberrypi fbcp[4836]: Second display is 480 x 320 16bps

Links:
http://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html

Watch Youtube

Using fbcp

Install

sudo apt-get install youtube-dl
# Do this twice
sudo youtube-dl -U
sudo youtube-dl -U

sudo apt-get install python-setuptools
sudo easy_install whitey

Play

yt --player omxplayer

Refs:

piwik