blob: 998b8cce909c42ddc3dfd21e13355ad8dda80a29 [file] [log] [blame] [view]
Nico Huberfb4f8ce2017-03-13 13:37:56 +01001libgfxinit
2==========
3
4*libgfxinit* is a graphics initialization (aka modesetting) library
5for embedded environments. It currently supports only Intel hardware,
6more specifically the Intel Core processor line.
7
8It can query and set up most kinds of displays based on their EDID
9information. You can, however, also specify particular mode lines.
10
11*libgfxinit* is written in SPARK, an Ada subset with formal verifica-
12tion aspects. Absence of runtime errors can be proved automatically
13with SPARK GPL 2016.
14
15
16Building on Linux
17=================
18
19Prerequisites
20-------------
21
22For compilation, the GNAT Ada compiler is required. Usual package
23names in Linux distributions are `gcc-ada` and `gnat`.
24
25Grab the Sources
26----------------
27
28You'll need *libhwbase* and *libgfxinit*. Best is to clone the reposi-
29tories into a common parent directory (this way *libgfxinit* will know
30where to find *libhwbase*).
31
32 $ mkdir gfxfun && cd gfxfun
33 $ git clone https://review.coreboot.org/p/libhwbase.git
34 $ git clone https://review.coreboot.org/p/libgfxinit.git
35
36Configure and Install libhwbase
37-------------------------------
38
39Both libraries are currently configured by hand-written config files.
40You can either write your own `.config`, link one of the shipped files
41in `configs/`, e.g.:
42
43 $ ln -s configs/posix libhwbase/.config
44
45or overwrite the config filename by specifying `cnf=<configfile>` on
46the make command line.
47
48Let's install *libhwbase*. We'll need `configs/posix` to build regular
49Linux executables:
50
51 $ cd libhwbase
52 $ make cnf=configs/posix install
53
54By default this installs into a new subdirectory `dest`. You can however
55overwrite this decision by specifying `DESTDIR=`.
56
57Build libgfxinit/`gfx_test`
58---------------------------
59
60*libgfxinit* is configured and installed in the same manner as de-
61scribed above. You will have to select a configuration matching your
62hardware.
63
64The makefile knows an additional target `gfx_test` to build a small
65Linux test application:
66
67 $ cd ../libgfxinit
68 $ make cnf=configs/sandybridge gfx_test
69
70The resulting binary is `build/gfx_test`.
71
72
73Testing libgfxinit on Linux
74===========================
75
76In its current state `gfx_test` doesn't know how to set up a frame-
77buffer. It just assumes that enough memory is mapped. This is known
78to work well, after running the VBIOS but before the Linux driver
79*i915* took over (e.g. when booting with `nomodeset` in the kernel
80command line or with *i915* blacklisted). After running *i915* it
81only works by chance.
82
83When running `gfx_test` (as root), it will ask for a single argument:
84The path to a sysfs PCI-device node, where it will find the graphics
85hardware. Usually this is PCI device 00:02.0:
86
87 $ sudo build/gfx_test /sys/devices/pci0000:00/0000:00:02.0/
88
89If you chose the right config above, you should be presented with a
90nice test image. However, `gfx_test` is one-way only: The graphics
91hardware will stay in this state, until another driver takes over.