Skip to content

Commit 6a28b88

Browse files
committed
firmware/coreboot: Subtree merge libgfxinit
Signed-off-by: David Hendricks <dhendricks@fb.com>
2 parents 6f4bd2f + 865f1fa commit 6a28b88

149 files changed

Lines changed: 20302 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/proof-allconfigs/
2+
/build/
3+
/dest/
4+
/*.gpr
5+
/.config

firmware/coreboot/3rdparty/libgfxinit/COPYING

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name := gfxinit
2+
3+
ifeq ($(MAKECMDGOALS),gfx_test)
4+
prefixed-name := gfx_test
5+
link-type := program
6+
GFXINIT_TEST := y
7+
endif
8+
9+
gfxinit-deplibs := libhw
10+
11+
libhw-dir ?= ../libhwbase/dest
12+
include $(libhw-dir)/Makefile
13+
14+
gfx_test: $(binary)
15+
16+
.PHONY: gfx_test
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
subdirs-y += common
2+
3+
subdirs-$(GFXINIT_TEST) += gfxtest
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
43+
$ ln -s configs/linux libhwbase/.config
44+
45+
or overwrite the config filename by specifying `cnf=<configfile>` on
46+
the make command line.
47+
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+
52+
Let's install *libhwbase*. We'll need `configs/linux` to build regular
53+
Linux executables:
54+
55+
$ cd libhwbase
56+
$ make DEBUG=1 cnf=configs/linux install
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
72+
$ make DEBUG=1 cnf=configs/sandybridge gfx_test
73+
74+
The resulting binary is `build/gfx_test`.
75+
76+
77+
Testing libgfxinit on Linux
78+
===========================
79+
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).
88+
89+
# gfxtest/gfx_test.sh
90+
91+
If you chose the right config above, you should be presented with a
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.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
medium DP re-read status if updated bit isn't set
2+
medium DP honor adjust requests also if training succeeded?
3+
unknown DP honor SINK_STATUS after training
4+
5+
low LVDS 8bit colors, data format???
6+
7+
medium gfxtest take care of our own framebuffer mapping
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
gfxinit-y += hw-gfx-dp_aux_ch.adb
2+
gfxinit-y += hw-gfx-dp_aux_ch.ads
3+
gfxinit-y += hw-gfx-dp_defs.ads
4+
gfxinit-y += hw-gfx-dp_info.adb
5+
gfxinit-y += hw-gfx-dp_info.ads
6+
gfxinit-y += hw-gfx-dp_training.adb
7+
gfxinit-y += hw-gfx-dp_training.ads
8+
gfxinit-y += hw-gfx-edid.adb
9+
gfxinit-y += hw-gfx-edid.ads
10+
gfxinit-y += hw-gfx-gma-config_helpers.adb
11+
gfxinit-y += hw-gfx-gma-config_helpers.ads
12+
gfxinit-y += hw-gfx-gma-connector_info.adb
13+
gfxinit-y += hw-gfx-gma-connector_info.ads
14+
gfxinit-y += hw-gfx-gma-connectors.ads
15+
gfxinit-y += hw-gfx-gma-display_probing.adb
16+
gfxinit-y += hw-gfx-gma-display_probing.ads
17+
gfxinit-y += hw-gfx-gma-dp_aux_ch.ads
18+
gfxinit-y += hw-gfx-gma-dp_aux_request.adb
19+
gfxinit-y += hw-gfx-gma-dp_aux_request.ads
20+
gfxinit-y += hw-gfx-gma-dp_info.ads
21+
gfxinit-y += hw-gfx-gma-i2c.adb
22+
gfxinit-y += hw-gfx-gma-i2c.ads
23+
gfxinit-y += hw-gfx-gma-panel.adb
24+
gfxinit-y += hw-gfx-gma-panel.ads
25+
gfxinit-y += hw-gfx-gma-pch-fdi.adb
26+
gfxinit-y += hw-gfx-gma-pch-fdi.ads
27+
gfxinit-y += hw-gfx-gma-pch-sideband.adb
28+
gfxinit-y += hw-gfx-gma-pch-sideband.ads
29+
gfxinit-y += hw-gfx-gma-pch-transcoder.adb
30+
gfxinit-y += hw-gfx-gma-pch-transcoder.ads
31+
gfxinit-y += hw-gfx-gma-pch-vga.adb
32+
gfxinit-y += hw-gfx-gma-pch-vga.ads
33+
gfxinit-y += hw-gfx-gma-pch.ads
34+
gfxinit-y += hw-gfx-gma-pipe_setup.adb
35+
gfxinit-y += hw-gfx-gma-pipe_setup.ads
36+
gfxinit-y += hw-gfx-gma-port_detect.ads
37+
gfxinit-y += hw-gfx-gma-registers.adb
38+
gfxinit-y += hw-gfx-gma-registers.ads
39+
gfxinit-y += hw-gfx-gma-transcoder.adb
40+
gfxinit-y += hw-gfx-gma-transcoder.ads
41+
gfxinit-y += hw-gfx-gma.adb
42+
gfxinit-y += hw-gfx-gma.ads
43+
gfxinit-y += hw-gfx-i2c.ads
44+
gfxinit-y += hw-gfx.ads
45+
gfxinit-y += hw-gfx-framebuffer_filler.adb
46+
gfxinit-y += hw-gfx-framebuffer_filler.ads
47+
48+
CONFIG_GFX_GMA_CPU := $(call strip_quotes,$(CONFIG_GFX_GMA_CPU))
49+
CONFIG_GFX_GMA_CPU_VARIANT := $(call strip_quotes,$(CONFIG_GFX_GMA_CPU_VARIANT))
50+
CONFIG_GFX_GMA_INTERNAL_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_INTERNAL_PORT))
51+
CONFIG_GFX_GMA_ANALOG_I2C_PORT := $(call strip_quotes,$(CONFIG_GFX_GMA_ANALOG_I2C_PORT))
52+
53+
hw-gfx-gma-config-ads := $(subst //,/,$(call src-to-obj,,$(dir)/hw-gfx-gma-config).ads)
54+
55+
$(hw-gfx-gma-config-ads): $(dir)/hw-gfx-gma-config.ads.template $(cnf)
56+
printf " GENERATE $(patsubst /%,%,$(subst $(obj)/,,$@))\n"
57+
sed -e's/<<CPU>>/$(CONFIG_GFX_GMA_CPU)/' \
58+
-e's/<<CPU_VARIANT>>/$(CONFIG_GFX_GMA_CPU_VARIANT)/' \
59+
-e's/<<INTERNAL_PORT>>/$(CONFIG_GFX_GMA_INTERNAL_PORT)/' \
60+
-e's/<<ANALOG_I2C_PORT>>/$(CONFIG_GFX_GMA_ANALOG_I2C_PORT)/' \
61+
-e's/<<DEFAULT_MMIO_BASE>>/$(CONFIG_GFX_GMA_DEFAULT_MMIO)/' \
62+
$< >$@
63+
gfxinit-gen-y += $(hw-gfx-gma-config-ads)
64+
65+
ifneq ($(filter G45,$(CONFIG_GFX_GMA_CPU)),)
66+
subdirs-y += g45
67+
else ifneq ($(filter Ironlake Sandybridge Ivybridge,$(CONFIG_GFX_GMA_CPU)),)
68+
subdirs-y += ironlake
69+
else ifneq ($(filter Haswell Broadwell,$(CONFIG_GFX_GMA_CPU)),)
70+
subdirs-y += haswell_shared haswell
71+
else ifneq ($(filter Broxton,$(CONFIG_GFX_GMA_CPU)),)
72+
subdirs-y += haswell_shared broxton
73+
else ifneq ($(filter Skylake,$(CONFIG_GFX_GMA_CPU)),)
74+
subdirs-y += haswell_shared skylake
75+
endif
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
gfxinit-y += hw-gfx-gma-connectors-ddi-buffers.ads
2+
gfxinit-y += hw-gfx-gma-ddi_phy.adb
3+
gfxinit-y += hw-gfx-gma-ddi_phy.ads
4+
gfxinit-y += hw-gfx-gma-plls.adb
5+
gfxinit-y += hw-gfx-gma-plls.ads
6+
gfxinit-y += hw-gfx-gma-power_and_clocks.adb
7+
gfxinit-y += hw-gfx-gma-power_and_clocks.ads
8+
gfxinit-y += hw-gfx-gma-spll.ads
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--
2+
-- Copyright (C) 2017 secunet Security Networks AG
3+
--
4+
-- This program is free software; you can redistribute it and/or modify
5+
-- it under the terms of the GNU General Public License as published by
6+
-- the Free Software Foundation; either version 2 of the License, or
7+
-- (at your option) any later version.
8+
--
9+
-- This program is distributed in the hope that it will be useful,
10+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
-- GNU General Public License for more details.
13+
--
14+
15+
private package HW.GFX.GMA.Connectors.DDI.Buffers
16+
is
17+
18+
procedure Translations (Trans : out Buf_Trans_Array; Port : Digital_Port)
19+
is null;
20+
21+
end HW.GFX.GMA.Connectors.DDI.Buffers;

0 commit comments

Comments
 (0)