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