aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-02-19 21:35:14 +0100
committerJames Cameron <quozl@laptop.org>2020-03-12 14:17:55 +1100
commitd3dfc784523ed2d590262518586416de59efa26d (patch)
tree497d015e90058a1c7234b4671f2785c4efaf218f
parent4b4957222635465127437cca7e2f98d74e66baf7 (diff)
downloadopenfirmware-d3dfc784523ed2d590262518586416de59efa26d.tar.gz
geode/display: add /chosen/framebuffer simple-framebuffer node
Hand the framebuffer set up by OFW over to the operating system. This enables Linux to draw on the screen if the native driver is not (yet) available. Follows the display/simple-framebuffer.txt bindings.
-rw-r--r--dev/geode/display/gp.fth29
-rw-r--r--dev/geode/display/gxfb.fth2
2 files changed, 29 insertions, 2 deletions
diff --git a/dev/geode/display/gp.fth b/dev/geode/display/gp.fth
index 65d66ac5..673e1c30 100644
--- a/dev/geode/display/gp.fth
+++ b/dev/geode/display/gp.fth
@@ -94,15 +94,44 @@ alias depth+ wa+
['] fbgeode-delete-lines is delete-lines
;
+: add-simple-framebuffer ( -- )
+ height width frame-buffer-adr ( height width fba )
+ " /chosen" find-device
+ new-device
+ " framebuffer" device-name
+ " simple-framebuffer" +compatible
+
+ >physical encode-int ( height width adr len )
+ 2over * 2 * encode-int encode+ ( height width adr len adr len)
+ " reg" property
+
+ dup 2 * " stride" integer-property ( height width )
+ " width" integer-property ( height )
+ " height" integer-property ( )
+ " r5g6b5" " format" string-property
+ " /display" encode-phandle " display" property
+ finish-device
+ device-end
+;
+
+: remove-simple-framebuffer ( -- )
+ " /chosen/framebuffer" find-package if delete-package then
+;
+
: display-install ( -- )
init-all
default-font set-font
width height ( width height )
over char-width / over char-height / ( width height rows cols )
/scanline depth fb-install gp-install ( )
+ add-simple-framebuffer
init-hook
;
+: display-remove ( -- )
+ remove-simple-framebuffer
+;
+
: display-selftest ( -- failed? ) false ;
' display-install is-install
diff --git a/dev/geode/display/gxfb.fth b/dev/geode/display/gxfb.fth
index 63dfe4ea..bf19050c 100644
--- a/dev/geode/display/gxfb.fth
+++ b/dev/geode/display/gxfb.fth
@@ -521,8 +521,6 @@ headers
frame-buffer-adr /fb + to graphmem
;
-: display-remove ( -- ) ;
-
" display" device-type
" ISO8859-1" encode-string " character-set" property
0 0 encode-bytes " iso6429-1983-colors" property