193.14. vulkan-tools-1.4.363
Khronos Vulkan tools — vkcube, vkcubepp and vulkaninfo, Wayland and KMS display WSI
| Version | 1.4.363, release 1 |
| Shelf | gpu — The GPU stack: Mesa, DRM, GL and Vulkan loaders and headers, shader compilers, VA-API, OpenCL |
| Phase | 42_graphics (Graphics Stack), 111 of 189 in build order |
| Licence | Apache-2.0 |
| Homepage | https://github.com/KhronosGroup/Vulkan-Tools |
| Build time | 2.3 SBU |
| Installed size | 2.5 MiB in 6 files |
| Recipe | ports/core/gpu/vulkan-tools/kpkgbuild |
About
Vulkan-Tools is Khronos’s pair of Vulkan diagnostics: vulkaninfo, which lists every device the vulkan-loader finds with its properties, extensions, formats and surfaces, and vkcube (with its C++ twin vkcubepp), a spinning textured cube drawn through a real swapchain. vulkaninfo --summary is what says whether a machine has a Vulkan driver at all, and which, since a Vulkan program falls back to lavapipe on the CPU without saying so. How the tools are used together with glmark2 and mesa-demos is in Which tool answers which question.
Why it is in KDOS
The comment above the 3 ports from mesa-demos to vulkan-tools in script/phases/42_graphics/packages.d/gpu.txt:
THE GRAPHICS TOOLS ARE THE WAYLAND AND EGL ONES: es2gears_wayland and eglinfo from mesa-demos, glmark2-es2-wayland, and vkcube/vulkaninfo from vulkan-tools, which are also what says whether the machine has a Vulkan driver at all. mesa is built with GLX and its X11 platform for the X11 programs that run under Xwayland, but mesa-demos is built -Dx11=disabled, so glxgears and glxinfo are not among its programs.
Sources
vulkan-tools-1.4.363.tar.gz(802.5 KiB)
sha256a41172b681c2b9d40e154b0e3acd56b10e12eb910c4dbe60a1d90db0b73e01b2
upstream: https://github.com/KhronosGroup/Vulkan-Tools/archive/v1.4.363/vulkan-tools-1.4.363.tar.gz
archive copy: sources-2/gpu--vulkan-tools-1.4.363.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, vulkan-headers, vulkan-loader, wayland, wayland-protocols.
Required by (1): kinfocenter.
Patches
build.sh applies these; kpkg applies nothing by itself.
app-id.patch— Set the Wayland app id of the cube's window to the program namevkcube and vkcubepp set a title on their xdg_toplevel and no app id, so a compositor can match the window to no desktop entry. Set the app id to APP_SHORT_NAME, the program's name, beside the title.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install vulkan-tools'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/gpu/vulkan-tools.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/gpu/vulkan-tools
echo 'a41172b681c2b9d40e154b0e3acd56b10e12eb910c4dbe60a1d90db0b73e01b2 vulkan-tools-1.4.363.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/vulkan-tools
SRC=$SRC_ROOT/vulkan-tools-1.4.363
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf vulkan-tools-1.4.363.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/app-id.patch"
cmake -GNinja -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_DATADIR=/usr/share \
-DCMAKE_PREFIX_PATH=/usr \
-DVULKAN_HEADERS_INSTALL_DIR=/usr \
-DBUILD_CUBE=ON \
-DBUILD_VULKANINFO=ON \
-DBUILD_ICD=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_WSI_WAYLAND_SUPPORT=ON \
-DBUILD_WSI_DISPLAY_SUPPORT=ON \
-DBUILD_WSI_XCB_SUPPORT=OFF \
-DBUILD_WSI_XLIB_SUPPORT=OFF \
-DBUILD_WSI_DIRECTFB_SUPPORT=OFF
cmake --build build
DESTDIR=$PKG cmake --install build
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/vkcube.desktop" <<'KDOS_EOF'
[Desktop Entry]
Type=Application
Name=Vulkan Cube
GenericName=Vulkan Test
Comment=Spinning textured cube on the Vulkan driver this machine picked
Exec=vkcube
Icon=video-display
Terminal=false
StartupWMClass=vkcube
Categories=Development;Graphics;
Keywords=vulkan;gpu;driver;3d;benchmark;vkcube;
KDOS_EOF
chmod 644 "$PKG/usr/share/applications/vkcube.desktop"
The switches, and why each is set:
-DVULKAN_HEADERS_INSTALL_DIR=/usr,-DCMAKE_PREFIX_PATH=/usr— Where the build looks for vulkan-headers and the loader:CMAKE_PREFIX_PATHfor their CMake package files, andVULKAN_HEADERS_INSTALL_DIRfor the registry, which only the code-generation target reads. The build requires headers of at least its own version; this port, the headers and the loader carry the same version.-DBUILD_CUBE=ON,-DBUILD_VULKANINFO=ON— The two tools, upstream’s defaults.-DBUILD_ICD=OFF— Builds no mock ICD, the fake Vulkan driver upstream builds by default for its own tests. Upstream installs it only whenINSTALL_ICDis also set, so leaving it out changes no installed file and saves its compile.-DBUILD_WSI_WAYLAND_SUPPORT=ON— Presents to a Wayland window, the platformvkcubepicks on its own here.-DBUILD_WSI_DISPLAY_SUPPORT=ON— Presents straight to a display throughVK_KHR_display, from a text console while no compositor holds the screen (vkcube --wsi display).-DBUILD_WSI_XCB_SUPPORT=OFF,-DBUILD_WSI_XLIB_SUPPORT=OFF,-DBUILD_WSI_DIRECTFB_SUPPORT=OFF— No X11 or DirectFB presentation. The graphics tools on the host are the Wayland ones; what an X11 client sees through Xwayland is tested from inside a box.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/vulkan-tools, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf vulkan-tools-1.4.363-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/vulkan-tools, and runs the triggers its paths call for.
Contents
Installed programs: vkcube, vkcubepp, vulkaninfo.
Installed directories: /usr/share/licenses/vulkan-tools.
Notes
app-id.patch sets the Wayland app id of the vkcube and vkcubepp windows to the program’s name. Upstream sets only a title, so KWin matches the window to no entry and draws the generic icon on it.
build.sh writes a desktop entry for vkcube, so the driver check is one click from the launcher; its file name is the window’s app id, vkcube, which is where KWin looks for the window’s icon. vulkaninfo has none: it is a terminal program.