Commit 340b45b
committed
feat(graphics): compat.libdrm, compat.egl and compat.wayland — the KMS/DRM
stack closes
compat.libgbm on its own can allocate a buffer and do nothing with it. These
three are the rest of the stack, all on the binding shape libgbm validated:
compat.libdrm the layer underneath -- drmModeAddFB2 / drmModeSetCrtc turn
an allocated buffer into a scanout
compat.egl the layer that makes it renderable --
eglGetPlatformDisplay(EGL_PLATFORM_GBM_KHR, gbm_dev, NULL)
compat.wayland the other display path -- be a client of, or be, a compositor
WHY BINDINGS AND NOT SOURCE BUILDS. libdrm and wayland both PASS the
separable-unit test that libgbm fails -- independent freedesktop projects with
their own releases, and Conan carries libdrm as a real recipe. They are
bindings for the second criterion instead: the ecosystem already owns them,
Mesa's own payload has DT_NEEDED on both, and a second libdrm.so.2 or
libwayland-client.so.0 in a process that also loads Mesa means two handle
tables for one connection. EGL is the sharpest case: it is a spec, the thing
you link is glvnd's vendor-neutral dispatch library, and building a second one
would be the "one loader per process" mistake compat.vulkan-runtime already
documents.
Three things worth knowing, each found by making it work:
* libdrm needs TWO include roots. Public headers at the include root, the
uapi headers they include under libdrm/, and xf86drm.h line 40 is a bare
`#include <drm.h>`. Expose one root and nothing compiles -- measured while
writing compat.libgbm's own test, which hit exactly that.
* compat.egl ships ONLY EGL/, out of a payload that also carries GL/, GLES2/,
GLES3/ and KHR/. A third provider of GL/ would turn the two-provider race
compat.glx-headers documents into a three-way one; KHR/ comes from the
index's existing compat.khrplatform, and that edge is load-bearing rather
than tidy -- without it EGL/egl.h does not parse. X11 is deliberately not a
dependency: that include is USE_X11-gated, and forcing Xorg onto headless
GBM users would be exactly wrong.
* compat.wayland harvests four libraries and puts only -lwayland-client on
ldflags. A dependency's ldflags reach the consumer's link line with no way
to opt out, so forcing libwayland-server on every client would be
unfixable downstream. A compositor author adds it themselves and it
resolves out of the farm -- and the test member does exactly that, so the
documented escape hatch has a regression guarding it rather than a promise.
Verified: all three `mcpp test` green cold via the CN mirror. EGL's client
extension list includes EGL_KHR_platform_gbm / EGL_MESA_platform_gbm, which is
the seam with compat.libgbm; libdrm's DRM_FORMAT_XRGB8888 is asserted equal to
the 'XR24' fourcc compat.libgbm asserts, because those two values cross the
gbm_bo -> drmModeAddFB2 boundary and a mismatch shows wrong colours rather than
an error. Lint + xpkg parse clean across 139 descriptors. CN mirrors published
for all three and re-fetched byte-identical against GLOBAL.1 parent 1c08e2f commit 340b45b
12 files changed
Lines changed: 1032 additions & 2 deletions
File tree
- docs
- zh
- pkgs/c
- tests/examples
- egl
- tests
- libdrm
- tests
- wayland
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
0 commit comments