blob: 7bfb504824921877a0f3bd1bcd55edfe586a5587 [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
Nico Huberfda2d6e2017-07-09 16:47:52 +020043 $ ln -s configs/linux libhwbase/.config
Nico Huberfb4f8ce2017-03-13 13:37:56 +010044
45or overwrite the config filename by specifying `cnf=<configfile>` on
46the make command line.
47
Nico Huberfda2d6e2017-07-09 16:47:52 +020048Let's install *libhwbase*. We'll need `configs/linux` to build regular
Nico Huberfb4f8ce2017-03-13 13:37:56 +010049Linux executables:
50
51 $ cd libhwbase
Nico Huberfda2d6e2017-07-09 16:47:52 +020052 $ make cnf=configs/linux install
Nico Huberfb4f8ce2017-03-13 13:37:56 +010053
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
Nico Huberfda2d6e2017-07-09 16:47:52 +020083When running `gfx_test` (as root), it will access the graphics hard-
84ware through the sysfs PCI interface. The path is
Nico Huberfb4f8ce2017-03-13 13:37:56 +010085
Nico Huberfda2d6e2017-07-09 16:47:52 +020086 /sys/devices/pci0000:00/0000:00:02.0/
87
88for all supported platforms.
Nico Huberfb4f8ce2017-03-13 13:37:56 +010089
90If you chose the right config above, you should be presented with a
91nice test image. However, `gfx_test` is one-way only: The graphics
92hardware will stay in this state, until another driver takes over.