[openfirmware] r1680 - in dev: via/unichrome video/common
svn at openfirmware.info
svn at openfirmware.info
Thu Jan 21 23:59:34 CET 2010
Author: wmb
Date: 2010-01-21 23:59:33 +0100 (Thu, 21 Jan 2010)
New Revision: 1680
Modified:
dev/via/unichrome/loadpkg.fth
dev/via/unichrome/unichrome.fth
dev/video/common/defer.fth
dev/video/common/rectangle16.fth
Log:
Unichrome display driver - Added depth-dependent support for point and line drawing.
Modified: dev/via/unichrome/loadpkg.fth
===================================================================
--- dev/via/unichrome/loadpkg.fth 2010-01-21 06:17:12 UTC (rev 1679)
+++ dev/via/unichrome/loadpkg.fth 2010-01-21 22:59:33 UTC (rev 1680)
@@ -16,6 +16,9 @@
defer video-on
: color! ( r g b color# -- ) 2drop 2drop ;
: color@ ( color# -- r g b ) drop 0 0 0 ;
+defer pixel* ' noop is pixel*
+defer pixel+ ' + is pixel+
+defer pixel! ' c! is pixel!
fload ${BP}/dev/video/controlr/vga.fth \ Standard VGA interfaces
fload ${BP}/dev/via/unichrome/unichrome.fth \ Controller code
Modified: dev/via/unichrome/unichrome.fth
===================================================================
--- dev/via/unichrome/unichrome.fth 2010-01-21 06:17:12 UTC (rev 1679)
+++ dev/via/unichrome/unichrome.fth 2010-01-21 22:59:33 UTC (rev 1680)
@@ -21,8 +21,6 @@
: note-mode ( mode# -- ) video-mode-adr ! ;
: note-native-mode ( -- ) native-mode# note-mode ;
-: set-resolution ( width height depth -- ) to depth to height to width ;
-
: create-edid-property ( -- )
" edid" get-my-property if ( )
" edid" find-drop-in if ( adr len )
@@ -268,6 +266,23 @@
effective-depth * ( bits ) 3 >> ( bytes )
;
+: set-pitch ( -- ) width pixels>bytes to /scanline ;
+: set-depth ( depth -- )
+ to depth
+ \ The following is correct for framebuffers without extra padding
+ \ at the end of each scanline. Adjust /scanline for others.
+ set-pitch
+ depth case
+ d# 16 of ['] w! ['] /w* ['] wa+ endof
+ d# 24 of ['] l! ['] /l* ['] la+ endof
+ d# 32 of ['] l! ['] /l* ['] la+ endof
+ ( default ) >r ['] c! ['] noop ['] + r>
+ endcase
+ to pixel+ to pixel* to pixel!
+;
+
+: set-resolution ( width height depth -- ) set-depth to height to width ;
+
: lower-power ( -- )
7f 19 seq! \ clock gating
f0 1b seq! \ clock gating
@@ -553,7 +568,7 @@
\ 00 32 crt! \ HSYNC delay, SYNC drive, gamma, end blanking, etc Already set
c8 33 crt-clr \ Gamma, interlace, prefetch, HSYNC shift
- width pixels>bytes to /scanline
+ set-pitch
\ Offset
mode-3? mode-12? or if d# 320 else /scanline then hoffset1!
@@ -659,7 +674,7 @@
20 67 crt-clr \ Turn off interlace bit
\ Offset - distance from one scanline to the next in the memory array
- width pixels>bytes to /scanline
+ set-pitch
\ I'm unsure how the 808 is calculated for simultaneous mode 3, but the
\ value is what BIOS uses. It might not matter.
Modified: dev/video/common/defer.fth
===================================================================
--- dev/video/common/defer.fth 2010-01-21 06:17:12 UTC (rev 1679)
+++ dev/video/common/defer.fth 2010-01-21 22:59:33 UTC (rev 1680)
@@ -49,6 +49,9 @@
defer unmap-io-regs \ Unmapping of same
defer map-frame-buffer \ Frame buffer mapping
defer unmap-frame-buffer \ Unmapping of same
+defer pixel* ' noop is pixel*
+defer pixel+ ' + is pixel+
+defer pixel! ' c! is pixel!
false instance value 6-bit-primaries? \ Indicate if DAC only supports 6bpp
-1 value io-base \ Where pointer to io mapping is held
@@ -71,6 +74,13 @@
\ The following is correct for framebuffers without extra padding
\ at the end of each scanline. Adjust /scanline for others.
width depth * 8 / to /scanline
+ depth case
+ d# 16 of ['] w! ['] /w* ['] wa+ endof
+ d# 24 of ['] l! ['] /l* ['] la+ endof
+ d# 32 of ['] l! ['] /l* ['] la+ endof
+ ( default ) >r ['] c! ['] noop ['] + r>
+ endcase
+ to pixel+ to pixel* to pixel!
;
: (set-resolution) ( width height depth -- )
>r to height to width r> set-depth
Modified: dev/video/common/rectangle16.fth
===================================================================
--- dev/video/common/rectangle16.fth 2010-01-21 06:17:12 UTC (rev 1679)
+++ dev/video/common/rectangle16.fth 2010-01-21 22:59:33 UTC (rev 1680)
@@ -97,15 +97,15 @@
3drop
;
-defer pixel! ( color fbadr i -- )
+defer transparent-pixel! ( color fbadr i -- )
: 565-pixel! ( color fbadr i -- ) wa+ w! ;
: argb-pixel! ( color fbadr i -- ) rot 565>argb-pixel -rot la+ l! ;
: draw-transparent-rectangle ( adr x y w h -- )
depth d# 32 = if
- ['] argb-pixel! to pixel!
+ ['] argb-pixel! to transparent-pixel!
else
- ['] 565-pixel! to pixel!
+ ['] 565-pixel! to transparent-pixel!
then
565-rectangle-setup ( adr w fbadr h )
>r rot r> ( w fbadr adr h )
@@ -115,7 +115,7 @@
dup h# ffff = if ( w fbadr adr color )
drop ( w fbadr adr )
else ( w fbadr adr color )
- 2 pick i pixel! ( w fbadr adr )
+ 2 pick i transparent-pixel! ( w fbadr adr )
then ( w fbadr adr )
loop ( w fbadr adr )
swap /scanline + swap ( w fbadr' adr )
More information about the openfirmware
mailing list