| commit | ac2a141ee3abd5c6cdbd3a7ce4162f1614e53368 | [log] [tgz] |
|---|---|---|
| author | Nico Huber <nico.huber@secunet.com> | Thu Jul 02 10:41:59 2026 +0200 |
| committer | Nico Huber <nico.h@gmx.de> | Mon Jul 13 12:27:58 2026 +0000 |
| tree | 4d0003fefa316cfd2f8c33ef13833765c136a12b | |
| parent | ba84df26cb4ef8a37a94d976bad5fd272a525610 [diff] |
Fix style issues and enable style checks The enabled checks `3abdefhiklnprSx` are what we already live by but didn't enforce so far. One check that we use internally, yet omit here is `t`, token spacing. It's too aggressive and doesn't allow for manual alignment of tables. The set of checks seems to to fit our code base rather well, otherwise. So following checks will be performed: `3` Specify indentation level: 3 spaces. `a` Check attribute casing: Attributes should appear in mixed case `b` Blanks not allowed at statement end `d` Check no DOS line terminators present: No CR/LF `e` Check end/exit labels `f` No form feeds or vertical tabs `h` No horizontal tabs: We always use spaces `i` Check if-then layout `k` Check keyword casing: Keywords should appear in lower case `l` Check layout: Follow layout recommendation of the Ada RM `n` Check casing of entities in Standard: Should follow the Ada RM `p` Check pragma casing: Should appear in mixed case `r` Check reference: Identifiers should appear as in the declaration `S` Check no statements after then/else `x` Check extra parentheses: No C-syle parents arounds conditions Change-Id: Ia07c571c3e3e4e49d8559099511b217ade86f33f Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/533 Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: Nico Huber <nico.h@gmx.de>
libgfxinit is a graphics initialization (aka modesetting) library for embedded environments. It currently supports only Intel hardware, more specifically the Intel Core processor line.
It can query and set up most kinds of displays based on their EDID information. You can, however, also specify particular mode lines.
libgfxinit is written in SPARK, an Ada subset with formal verification aspects. Absence of runtime errors can be proved automatically with SPARK GPL 2016.
For compilation, the GNAT Ada compiler is required. Usual package names in Linux distributions are gcc-ada and gnat.
You'll need libhwbase and libgfxinit. Best is to clone the repositories into a common parent directory (this way libgfxinit will know where to find libhwbase).
$ mkdir gfxfun && cd gfxfun $ git clone https://review.coreboot.org/p/libhwbase.git $ git clone https://review.coreboot.org/p/libgfxinit.git
Both libraries are currently configured by hand-written config files. You can either write your own .config, link one of the shipped files in configs/, e.g.:
$ ln -s configs/linux libhwbase/.config
or overwrite the config filename by specifying cnf=<configfile> on the make command line.
By default most debug messages won't be compiled into the binary. To include them into the build, set DEBUG=1 on the command line or in your .config.
Let's install libhwbase. We'll need configs/linux to build regular Linux executables:
$ cd libhwbase $ make DEBUG=1 cnf=configs/linux install
By default this installs into a new subdirectory dest. You can however overwrite this decision by specifying DESTDIR=.
gfx_testlibgfxinit is configured and installed in the same manner as described above. You will have to select a configuration matching your hardware.
The makefile knows an additional target gfx_test to build a small Linux test application:
$ cd ../libgfxinit $ make DEBUG=1 cnf=configs/sandybridge gfx_test
The resulting binary is build/gfx_test.
gfx_test sets up its own framebuffer in the stolen memory. It backs any current framebuffer mapping and contents up first and restores it before exiting. This works somehow even while the i915 driver is running. A wrapper script gfxtest/gfx_test.sh is provided to help with the setup. It switches to a text console first and tries to unload the i915 driver. But ignores failures to do so (it won't work if you still have any application running that uses the gfx driver, e.g. an X server).
# gfxtest/gfx_test.sh
If you chose the right config above, you should be presented with a nice test image. But please be prepared that your console might be stuck in that state afterwards. You can try to run it with i915 deactivated then (e.g. when booting with nomodeset in the kernel command line or with i915 blacklisted) and loading it afterwards.