Close

Announcing Odroid C1 Support(!), Plus Hardware Acceleration

A project log for VGA Graphics Over SPI and Serial - VGATonic

640x480 (and 848x480!) Color VGA Video Card for Microcontrollers and Single Board Computers

pkPK 07/13/2015 at 07:050 Comments

I know you expected an update on the microcontroller with all the serial work I've been doing, but today I've got something even more interesting. Here's VGATonic announcing Odroid C1 support (link to drivers on Github) by surfing to the Odroid C1 product page on an Odroid C1:


For those who haven't used one of these boards, it's my go-to for this project, and I haven't had any problem with it corrupting disk images.

That said, this driver supports the Raspberry Pi 2 Model B as well.

Okay, let's discuss the exciting features! Today we've got hardware acceleration through color depth and resolution changes, as well as some interesting color depth macros you can borrow.

Release Notes

To change the resolution with these drivers, do this once VGATonic is loaded:

fbset -fb /dev/fb# -xres XXX -yres YYY -depth ZZ

Resolutions: 640x480, 320x240, 160x120, 80x60

Color Depth: 8 bpp, 4 bpp, 2 bpp, 1 bpp, 16bpp (virtual - you may need this to launch X)

Other:

VGATonic will multiply your framerate automatically, up to 60, depending on how you scale down your mode:

Say you have a board that does 15 frame per second at 640*480*8bpp, and you scale it down to 320*240*8bpp. VGATonic's driver will automatically adjust your refresh rate to 60Hz - maxing out the refresh rate for the 640x480 mode we chose.

VGATonic automatically does color conversions. They could use some adjustment, but here are bit shifting macros to convert from 5-6-5 RGB to our 4 color modes:

#define RGB565toRGB332(c) ( ((c&0xE000)>>8) | ((c&0x0700)>>6) | ((c&0x0018)>>3) )

#define   RGB565toRGBI(c) ( ((c&0x8000)>>12) | ((c&0x4000)>>14) | ((c&0x0400)>>8) | ((c&0x0200)>>9) | ((c&0x0018)>>3) )

#define     RGB565to4G(c) ( ((c&0xC000)>>14) | ((c&0x0600)>>9) | ((c&0x0018)>>3) )

#define     RGB565toBW(c) ( ((c&0x8000)>>15) | ((c&0x0400)>>10) | ((c&0x0010)>>4) )
Installation

Raspberry Pi:

Install all of the normal build tools and a recent gcc/g++. You may need an updated kernel - I'm using some 3.18 flavor (no device tree); you can match me like so:

sudo rpi-update 07179c0ab486d8362af38c6fc99643ded953b99d
rpi-source

cd into Driver directory

sudo make clean ; sudo make

sudo modprobe sysfillrect; sudo modprobe syscopyarea; sudo modprobe sysimgblt; sudo modprobe fb_sys_fops; sudo insmod vgatonic.ko; sudo insmod rpi_vgatonic_spi.ko

(You should see activity. Or just do a 'cat /dev/urandom > /dev/fbX' to see writes!)

Odroid C1:

I'm on this kernel: Linux odroid 3.10.80-94

sudo -i

Install all of the normal build tools. cd into VGATonic directory.

make clean ; make

sudo modprobe spicc; sudo modprobe spidev; sudo modprobe sysfillrect; sudo modprobe syscopyarea; sudo modprobe sysimgblt; sudo modprobe fb_sys_fops; sudo insmod vgatonic.ko; sudo insmod odroid_vgatonic_spi.ko

(You should see activity. Or just do a 'cat /dev/urandom > /dev/fbX' to see writes, just ike our Raspberry Pi bretheren!)

Discussions