lib/igt_hdr: switch to libdisplay-info for EDID parsing
Subsystems (2)
PATCH v2 1/2 lib/igt_hdr: switch to libdisplay-info for EDID parsing
Replace manual EDID/CTA parsing with libdisplay-info [1].
libdisplay-info is an EDID and DisplayID library. It's widely used across Wayland compositors. It exposes both a high-level API (with information collected across EDID/DisplayID/CTA blocks) and a low-level API (exposing individual parsed fields from the specifications).
Using libdisplay-info will allow IGT to drop all of its custom parsing code. libdisplay-info takes care of the bitshifting and value decoding. libdisplay-info has documentation, a test suite, fuzzing, and a clone of edid-decode which can serve as an example to figure out how to use the low-level API.
IGT has already quite a bit of hand-rolled parsing code, and we need to start somewhere, so here is a patch leveraging libdisplay-info for igt_hdr.
As a bonus, igt_hdr now extracts HDR static metadata from CTA DisplayID blocks for free, because the high-level libdisplay-info helper does this already (since version 0.4.0).
v2: drop unnecessary igt_edid.h includes, adjust doc comment (Gil)
[1]: https://gitlab.freedesktop.org/emersion/libdisplay-info
--- Dockerfile.build-debian-arm64 | 1 + Dockerfile.build-debian-armhf | 1 + Dockerfile.build-debian-minimal | 1 + Dockerfile.build-fedora | 1 + lib/igt_hdr.c | 71 +++++++-------------------------- lib/igt_hdr.h | 1 - lib/meson.build | 1 + meson.build | 1 + 8 files changed, 21 insertions(+), 57 deletions(-)
Dockerfile.build-debian-arm64 +1 -0
@@ -26,6 +26,7 @@ RUN apt-get install -y \ libpci-dev:arm64 \ libpixman-1-dev:arm64 \ libudev-dev:arm64 \ + libdisplay-info-dev:arm64 \ libgsl-dev:arm64 \ libasound2-dev:arm64 \ libjansson-dev:arm64 \
Dockerfile.build-debian-armhf +1 -0
@@ -26,6 +26,7 @@ RUN apt-get install -y \ libpci-dev:armhf \ libpixman-1-dev:armhf \ libudev-dev:armhf \ + libdisplay-info-dev:armhf \ libgsl-dev:armhf \ libasound2-dev:armhf \ libjansson-dev:armhf \
Dockerfile.build-debian-minimal +1 -0
@@ -17,6 +17,7 @@ RUN apt-get install -y \ libpci-dev \ libpixman-1-dev \ libudev-dev \ + libdisplay-info-dev \ libxrandr-dev \ libxv-dev \ x11proto-dri2-dev \
Dockerfile.build-fedora +1 -0
@@ -14,6 +14,7 @@ RUN dnf install -y \ 'pkgconfig(cairo)' \ 'pkgconfig(libpci)' \ 'pkgconfig(libudev)' \ + 'pkgconfig(libdisplay-info)' \ 'pkgconfig(glib-2.0)' \ 'pkgconfig(gsl)' \ 'pkgconfig(alsa)' \
lib/igt_hdr.c +15 -56
112 lines not on this page · raw message
lib/igt_hdr.h +0 -1
@@ -1,7 +1,6 @@#ifndef IGT_HDR_H #define IGT_HDR_H -#include "igt_edid.h" #include "igt_kms.h" enum hdmi_eotf {
lib/meson.build +1 -0
@@ -156,6 +156,7 @@ lib_deps = [ libkmod, libpci, libudev, + libdisplay_info, math, pciaccess, pixman,
meson.build +1 -0
@@ -151,6 +151,7 @@ build_info += 'Valgrind annotations: @0@'.format(valgrind.found()) cairo = dependency('cairo', version : '>1.12.0', required : true) libpci = dependency('libpci', required : true) libudev = dependency('libudev', required : true) +libdisplay_info = dependency('libdisplay-info', required : true) glib = dependency('glib-2.0', required : true) libtsi = cc.find_library('TSI', required : false)
Signature · 1 line
2.56.1
PATCH v2 2/2 meson: require libdisplay-info v0.4.0
This version looks up CTA extension blocks nested inside a DisplayID extension block. This is required for upcoming tests leveraging igt_hdr helpers.
On systems not shipping a new enough libdisplay-info, a wrap file [1] is provided so that Meson can automatically download and link to an up-to-date subproject [2]. This eases developer setup when IGT is built on distributions such as Debian. This behavior is typically disabled when packaging software via the wrap_mode=nodownload option (see e.g. the arch-meson wrapper [3] used for Arch Linux packaging).
A slightly newer commit is pulled in by the wrap to avoid compiling a bunch of unnecessary v4l-utils code when libdisplay-info is used as a subproject [4].
v2: new commit (Gil)
[1]: https://mesonbuild.com/Wrap-dependency-system-manual.html
[2]: https://mesonbuild.com/Subprojects.html
[3]: https://gitlab.archlinux.org/archlinux/packaging/packages/meson/-/blob/9fe4433580978cc020c813019b77238ce65ab38d/arch-meson#L19
[4]: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/merge_requests/219
--- meson.build | 2 +- subprojects/libdisplay-info.wrap | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 subprojects/libdisplay-info.wrap
meson.build +1 -1
@@ -151,7 +151,7 @@ build_info += 'Valgrind annotations: @0@'.format(valgrind.found()) cairo = dependency('cairo', version : '>1.12.0', required : true) libpci = dependency('libpci', required : true) libudev = dependency('libudev', required : true) -libdisplay_info = dependency('libdisplay-info', required : true) +libdisplay_info = dependency('libdisplay-info', version : '>=0.4.0', required : true) glib = dependency('glib-2.0', required : true) libtsi = cc.find_library('TSI', required : false)
subprojects/libdisplay-info.wrap new file +3 -0
@@ -0,0 +1,3 @@ +[wrap-git] +url = https://gitlab.freedesktop.org/emersion/libdisplay-info.git +revision = 548330bca9bd3c6518cf4c6b38c954cfaabe782d
Signature · 1 line
2.56.1