framebuffer
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| framebuffer [2026-11-21 23:48 UTC (6 days ago)] – link to alsa page jazzy | framebuffer [2026-11-23 00:26 UTC (5 days ago)] (current) – add note about touchscreen interfaces, ffmpeg static build to run on device, framebuffer driver, brightness control, and obtaining copies of what is on framebuffer qkb | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Framebuffer ====== | ====== Framebuffer ====== | ||
| - | Graphics | + | Graphics |
| + | stride and B, G, R, X byte order. | ||
| + | controller: | ||
| - | The framebuffer driver implements some special ''ioctl''s, [[https://github.com/ | + | ^ device ^ name ^ mode ^ virtual ^ stride ^ |
| + | | '' | ||
| + | | '' | ||
| - | | + | '' |
| - | * '' | + | reports '' |
| + | virtual size is three 320-line pages. nx does not open it. | ||
| + | '' | ||
| + | V4L2 output nodes, not extra framebuffers. | ||
| + | |||
| + | There is no touchscreen. '' | ||
| + | and nx opens only '' | ||
| + | NFC taps, barcode scans, and the power button. | ||
| + | |||
| + | ===== Driver ===== | ||
| + | |||
| + | The framebuffer driver is '' | ||
| + | LCD. The device tree node is '' | ||
| + | '' | ||
| + | '' | ||
| + | memory is padding. Source: | ||
| + | [[https:// | ||
| + | (the unit runs 4.9; this is the current NXP tree, and the ioctl interface is the | ||
| + | same). | ||
| + | |||
| + | The kernel command line sets '' | ||
| + | DTB's '' | ||
| + | |||
| + | Two private ioctls are worth knowing: | ||
| + | |||
| + | | ||
| + | * '' | ||
| + | |||
| + | ===== Backlight ===== | ||
| + | |||
| + | There is no '' | ||
| + | The PIC32 owns the backlight. It reads the ambient sensor and maps the reading | ||
| + | onto a min/max range: | ||
| + | |||
| + | ^ key ^ meaning ^ | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | LCD brightness is 0..10000. A max above 10000 reaches full brightness before the | ||
| + | ambient reading hits 10000. Equal values hold a fixed brightness. Max above min | ||
| + | follows the light. Writes take effect immediately. | ||
| + | |||
| + | Power-on values are 200/12000. nx sets 100/15000 at startup via | ||
| + | '' | ||
| + | values. The script' | ||
| + | 10000/ | ||
| + | |||
| + | Write max first, then min: | ||
| + | |||
| + | < | ||
| + | stty -F / | ||
| + | |||
| + | # fixed half | ||
| + | printf ' | ||
| + | printf ' | ||
| + | |||
| + | # back to auto | ||
| + | printf ' | ||
| + | printf ' | ||
| + | </ | ||
| + | |||
| + | Each frame is a PIC32 ValueWrite: message type '' | ||
| + | both big-endian. See [[pic32]] for the frame layout. | ||
| + | |||
| + | Read the values and the sensor with ValueRead, type '' | ||
| + | |||
| + | < | ||
| + | exec 3<>/ | ||
| + | printf ' | ||
| + | timeout -t 1 dd if=/ | ||
| + | </ | ||
| + | |||
| + | The reply is '' | ||
| + | a flashlight pointed at the sensor reaches about 3300. | ||
| + | |||
| + | ===== Blanking ===== | ||
| + | |||
| + | The kernel command line includes '' | ||
| + | blanks on its own. To clear the screen, write zeros and stop the fbcon cursor | ||
| + | from repainting: | ||
| + | |||
| + | < | ||
| + | echo 0 > / | ||
| + | dd if=/ | ||
| + | </ | ||
| + | |||
| + | Those two commands are the whole blanking operation. The cursor setting matters: | ||
| + | with the cursor blinking, | ||
| + | |||
| + | If nx is running, it owns the same buffer and will draw over the black frame on | ||
| + | its next update. Stop it first. | ||
| + | |||
| + | ===== Capturing the screen ===== | ||
| + | |||
| + | < | ||
| + | ssh root@< | ||
| + | </ | ||
| + | |||
| + | Read '' | ||
| + | 1,536,000 bytes. | ||
| ===== Video output ===== | ===== Video output ===== | ||
| - | People have made simple animations | + | Animations work by writing |
| + | ffmpeg: | ||
| < | < | ||
| - | ffmpeg -i .\input.mp4 -map 0:v -vf " | + | ffmpeg -i input.mp4 -map 0:v -vf " |
| + | | ||
| </ | </ | ||
| - | Beware that these files get very large, to the point that reading them out can max out USB bandwidth. | + | The crop centres a taller input and throws away the rest. Raw frames are |
| - | And then on the pm3, the animation can be played back with a fairly simple: | + | 1.5 MB each, so a minute at 30 fps is well over 2 GB. Short clips are the |
| + | practical limit. | ||
| + | |||
| + | Play them on the unit: | ||
| < | < | ||
| - | for file in *.raw; do cat $file > /dev/fb0; usleep 30000; done | + | for file in *.raw; do cat "$file" |
| </ | </ | ||
| - | Alternatively, you can get a statically compiled [[https:// | + | A static armhf ffmpeg can play the video directly, no frame dump: |
| < | < | ||
| - | # video only | + | / |
| - | / | + | -f fbdev /dev/fb0 |
| - | # video + audio (janky) | + | |
| - | / | + | |
| </ | </ | ||
| - | This assumes your input video is already cropped to exactly | + | A prebuilt 6.1 armhf build is at |
| + | [[https:// | ||
| + | |||
| + | Video plus audio needs the input already cropped to 800x480 | ||
| + | speaker amp has to be enabled first; see [[alsa]]. | ||
| + | |||
| + | < | ||
| + | / | ||
| + | -f fbdev /dev/fb0 -map 0:a -ac 1 -c:a pcm_s16le -f s16le - \ | ||
| + | | aplay -c 1 -f S16_LE -r 44100 - | ||
| + | </ | ||
| + | |||
| + | The audio side is mono 44.1 kHz. Drop '' | ||
| + | decodes them. '' | ||
| + | offers. | ||
framebuffer.1795304901.txt.gz · Last modified: by jazzy
