| 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 | 3b654a0 | 2017-07-15 22:27:14 +0200 | [diff] [blame] | 48 | By default most debug messages won't be compiled into the binary. To |
| 49 | include them into the build, set `DEBUG=1` on the command line or in |
| 50 | your `.config`. |
| 51 | |
| Nico Huber | fda2d6e | 2017-07-09 16:47:52 +0200 | [diff] [blame] | 52 | Let's install *libhwbase*. We'll need `configs/linux` to build regular |
| Nico Huber | fb4f8ce | 2017-03-13 13:37:56 +0100 | [diff] [blame] | 53 | Linux executables: |
| 54 | |
| 55 | $ cd libhwbase |
| Nico Huber | 3b654a0 | 2017-07-15 22:27:14 +0200 | [diff] [blame] | 56 | $ make DEBUG=1 cnf=configs/linux install |
| Nico Huber | fb4f8ce | 2017-03-13 13:37:56 +0100 | [diff] [blame] | 57 | |
| 58 | By default this installs into a new subdirectory `dest`. You can however |
| 59 | overwrite this decision by specifying `DESTDIR=`. |
| 60 | |
| 61 | Build libgfxinit/`gfx_test` |
| 62 | --------------------------- |
| 63 | |
| 64 | *libgfxinit* is configured and installed in the same manner as de- |
| 65 | scribed above. You will have to select a configuration matching your |
| 66 | hardware. |
| 67 | |
| 68 | The makefile knows an additional target `gfx_test` to build a small |
| 69 | Linux test application: |
| 70 | |
| 71 | $ cd ../libgfxinit |
| Nico Huber | 3b654a0 | 2017-07-15 22:27:14 +0200 | [diff] [blame] | 72 | $ make DEBUG=1 cnf=configs/sandybridge gfx_test |
| Nico Huber | fb4f8ce | 2017-03-13 13:37:56 +0100 | [diff] [blame] | 73 | |
| 74 | The resulting binary is `build/gfx_test`. |
| 75 | |
| 76 | |
| 77 | Testing libgfxinit on Linux |
| 78 | =========================== |
| 79 | |
| Nico Huber | 3b654a0 | 2017-07-15 22:27:14 +0200 | [diff] [blame] | 80 | `gfx_test` sets up its own framebuffer in the *stolen memory*. It |
| 81 | backs any current framebuffer mapping and contents up first and re- |
| 82 | stores it before exiting. This works somehow even while the *i915* |
| 83 | driver is running. A wrapper script `gfxtest/gfx_test.sh` is pro- |
| 84 | vided to help with the setup. It switches to a text console first |
| 85 | and tries to unload the *i915* driver. But ignores failures to do |
| 86 | so (it won't work if you still have any application running that |
| 87 | uses the gfx driver, e.g. an X server). |
| Nico Huber | fb4f8ce | 2017-03-13 13:37:56 +0100 | [diff] [blame] | 88 | |
| Nico Huber | 3b654a0 | 2017-07-15 22:27:14 +0200 | [diff] [blame] | 89 | # gfxtest/gfx_test.sh |
| Nico Huber | fb4f8ce | 2017-03-13 13:37:56 +0100 | [diff] [blame] | 90 | |
| 91 | If you chose the right config above, you should be presented with a |
| Nico Huber | 3b654a0 | 2017-07-15 22:27:14 +0200 | [diff] [blame] | 92 | nice test image. But please be prepared that your console might be |
| 93 | stuck in that state afterwards. You can try to run it with *i915* |
| 94 | deactivated then (e.g. when booting with `nomodeset` in the kernel |
| 95 | command line or with *i915* blacklisted) and loading it afterwards. |