1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-12-26 08:52:26 +02:00
ben-blinkenlights/ubb-vga
Werner Almesberger a3cea3573c ubb-vga: send a line's last DMA transfer also if only partially filled
This caused 800x600 images to be cut off, because the line length is
not a multiple of 64 bytes.

- ubb-vga.c (session): make the allocation a multiple of the DMA
  transfer size
- ubb-vga.c (line): round number of transfers up instead of down
- ubb-vga.c (mode_db): line duration of 800x600/54 was a bit to short
2011-05-02 05:25:15 -03:00
..
ccube.c ubb-vga2: replaced threshold-based color mapping with color cube model 2011-04-28 01:18:03 -03:00
grabfb.c ubb-vga2: non-contiguous allocation of frame buffer memory 2011-04-29 13:04:02 -03:00
Makefile renamed ubb-vga.c to ubb-vga-old.c, ubb-vga2.c to ubb-vga.c; updated Makefile 2011-04-29 14:03:07 -03:00
mapping.fig renamed ubb-vga/res.fig to mapping.fig 2011-04-24 23:56:29 -03:00
physmem.c physmem.c: improved correctness and efficiency of alignment 2011-05-02 04:43:18 -03:00
ppm.c ubb-vga2: added support for showing a PPM image 2011-04-28 00:38:13 -03:00
ppm.h ubb-vga2: added support for showing a PPM image 2011-04-28 00:38:13 -03:00
ppmimg.c ubb-vga2: non-contiguous allocation of frame buffer memory 2011-04-29 13:04:02 -03:00
README ubb-vga/README: added to do list 2011-05-01 23:32:24 -03:00
regs4740.h regs4740.h: added DMAC registers; added virt to phys translation; cleanup 2011-04-29 22:09:42 -03:00
tstimg.c tstimg.c (tstimg): adjust size and position of parameters according to yres 2011-05-01 23:19:57 -03:00
ubb-vga-old.c renamed ubb-vga.c to ubb-vga-old.c, ubb-vga2.c to ubb-vga.c; updated Makefile 2011-04-29 14:03:07 -03:00
ubb-vga.c ubb-vga: send a line's last DMA transfer also if only partially filled 2011-05-02 05:25:15 -03:00
ubb-vga.h ubb-vga: test image now shows detailed horizontal and vertical timing 2011-05-01 21:50:20 -03:00
ubb-vga.pro ubb-vga.pro: commit pcbnew preferences (from local layout experiments) 2011-04-28 02:10:58 -03:00
ubb-vga.sch ubb-vga.sch: fixed typo in comment 2011-04-28 16:45:29 -03:00

UBB-VGA - VGA-like output via UBB
=================================

Sources
-------

Timing and the idea for the voltage divider is from:
http://faculty.lasierra.edu/~ehwang/public/mypublications/VGA Monitor Controller.pdf

More timing parameters:
http://tinyvga.com/vga-timing/640x480@60Hz


Signal	8:10	VGA
-------	-------	---
R	DAT2	1
VSYNC	DAT3	14
HSYNC	CMD	13
G	DAT0	2
B	DAT1	3
GND	GND	5

http://en.wikipedia.org/wiki/VGA_connector


Timing
------

Since the Ingenic CPUs take about 8.5 PCLK cycles for a GPIO set or clear,
and we can only set or clear a set of signals in GPIO operation, but not
set some and clear others, we cannot have a real 320 horizontal pixels.

Instead, set and clear operations alternate. This means that the best-case
resolution is equivalent to 320 pixels (if the original pixel boundaries
coincide with the set/clear phases), but it can be as low as 160 pixels if
the boundaries don't match.

Furthermore, timing is still a bit too tight. We therefore use a pixel
clock that's about 10% slower than the original. Luckily, most monitors
don't mind.


Single/double mode
------------------

In single mode, only one set/clear can be performed per pixel. They are
arranges such that the first pixel can only turn on channels, the
following pixel can only turn off channels, and so on.

In double mode, a set and a clear is performed per pixel. This changes
the timing such that it differs substantially from VGA, but some
monitors can still synchronize with this.

The resulting signals for various bit patterns are shown in mapping.fig
Each group shows the input pixels, and signal for single mode, and the
signal for double mode. "S" indicates a point where the channel can be
turned on, "C" indicates a point where it can be turned off.

Note that there are probably other mapping algorithms that would yield
better results. The mapping is not a very performance-critical part of
ubb-vga. Improvements are welcome.


Compatibility
-------------

ubb-vga in single mode has been tested with the following monitors:

Display			Monitor size	Quality
-----------------------	---------------	----------------------------------
Xenon XEN-1510T		15", 1024x768	good
Samsung 206NW		20", 1680x1050	poor (horizontal instability)
LG W2243C		22", 1920x1080	acceptable (slight instability)
LG W2243L		22", 1920x1080	acceptable (slight instability)

In double mode:

Display			Pixels missing	Quality
			left/right
-----------------------	---------------	------------------
Xenon XEN-1510T		5 / 25		good


To do
-----

- use timer half interrupt and WAIT to synchronize (less bus traffic and
  hopefully better granularity)
- recover from DMA lockup
- use color cube map (5x5x5 bits)
- read/write raw frame buffer
- consider prefetching first word of each line, to make DRAM controller
  open the row and reduce DMA startup latency