Skip to contentSkip to conversation

Add vulkan validation and improvements for headless devices

PATCH In review Jordan Crouse 2 participants 5 messages Nov 11, 2022 – Nov 13, 2022

lore
Share & tools
lore
#0 lore raw

v2 cover Add vulkan validation and improvements for headless devices

This small patchset has a few small fixes and a new recipe for the official Vulkan validation layers from Khronos.

The first patch addresses a bug in the exported cmake packages from spriv-tools to make sure that the library path is correctly set. The second patch enables vulkan-loader for "headless" devices that don't have either X11 nor Wayland. The third patch adds the vulkan-validation for the same version level as the Vulkan headers and other packages.

Changes in v2:
- Don't change PR per Khem Raj
- Put DEPENDS all on one line
- Remove unused OEMAKE flags
- Force /usr/lib/*.so into ${PN} and remove INSANE_SKIP

Jordan Crouse (3):
spirv-tools: Correctly set the prefix in exported cmake packages
vulkan-loader: Allow headless targets to build the loader
vulkan-validation: Add the official Vulkan validation layers

 meta/conf/distro/include/maintainers.inc      |  1 +
 .../spir/spirv-tools_1.3.231.1.bb             |  5 ++-
 .../vulkan/vulkan-loader_1.3.231.1.bb         |  2 -
 .../vulkan/vulkan-validation_1.3.231.1.bb     | 39 +++++++++++++++++++
 4 files changed, 43 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-graphics/vulkan/vulkan-validation_1.3.231.1.bb
Signature · 1 line
2.37.1
#1 lore raw

PATCH v2 1/3 spirv-tools: Correctly set the prefix in exported cmake packages

spirv-tools exports Cmake packages. When they are installed the INTERFACE_LINK_LIBRARIES variable is not correctly updated to use _IMPORT_PREFIX like the other variables. This may have something to do with the path to the sysroot being different than the source path.

The existing recipe recognizes that the sysroot path made it through to the install and tries to get rid of it, but this just ends up with dependent tools looking in vain for /usr/lib/librt.so.

Replace the INTERFACE_LINK_LIBRARIES value in SPIRV-ToolsTarget.cmake with "${IMPORT_PREFIX}/lib".

---

Changes in v2:
- Don't change PR per Khem Raj

 meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb +3 -2
index ea47796543..e175cde145 100644
@@ -25,9 +25,10 @@ EXTRA_OECMAKE += "\
 "
 
 do_install:append:class-target() {
-    # reproducibility: remove build host path
+    # Properly set _IMPORT_PREFIX in INTERFACE_LINK_LIBRARIES so that dependent
+    # tools can find the right library
     sed -i ${D}${libdir}/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake \
-        -e 's:${STAGING_DIR_HOST}::g'
+        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}/lib":'
 }
 
 # all the libraries are unversioned, so don't pack it on PN-dev
Signature · 1 line
2.37.1
#2 lore raw

PATCH v2 2/3 vulkan-loader: Allow headless targets to build the loader

In reply to Jordan Crouse

vulkan-loader can build and work on headless targets without display engines so there isn't any need for the ANY_OF_DISTRO_FEATURES restriction.

---

(no changes since v1)

 meta/recipes-graphics/vulkan/vulkan-loader_1.3.231.1.bb | 2 --
 1 file changed, 2 deletions(-)
meta/recipes-graphics/vulkan/vulkan-loader_1.3.231.1.bb +0 -2
index 59c52c1db7..7aab7446f6 100644
@@ -17,7 +17,6 @@ S = "${WORKDIR}/git"
 REQUIRED_DISTRO_FEATURES = "vulkan"
 
 inherit cmake features_check pkgconfig
-ANY_OF_DISTRO_FEATURES = "x11 wayland"
 
 DEPENDS += "vulkan-headers"
 
@@ -29,7 +28,6 @@ EXTRA_OECMAKE = "\
                  -DVulkanRegistry_DIR=${RECIPE_SYSROOT}/${datadir} \
                  "
 
-# must choose x11 or wayland or both
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}"
 
 PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr"
Signature · 1 line
2.37.1
#3 lore raw

PATCH v2 3/3 vulkan-validation: Add the official Vulkan validation layers

In reply to Jordan Crouse

Add a recipe to build the Khronos official Vulkan validation layers that can assist developers in verifying that their applications correctly use the Vulkan APIs.

USE_ROBIN_HOOD_HASHING=OFF disables a third party dependency on [1] which is a performant reimplementation of std::unordered_map and std::unordered_set that gives better performance when using validation for extremely heavy workloads on a desktop. There isn't much benefit to enabling it on most embedded systems so force it off for now but no bias against making it optional if robin-hood-hashing is made available in the metadata.

[1] https://github.com/martinus/robin-hood-hashing

---

Changes in v2:
- Put DEPENDS all on one line
- Remove unused OEMAKE flags
- Force /usr/lib/*.so into ${PN} and remove INSANE_SKIP

 meta/conf/distro/include/maintainers.inc      |  1 +
 .../vulkan/vulkan-validation_1.3.231.1.bb     | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-graphics/vulkan/vulkan-validation_1.3.231.1.bb
meta/conf/distro/include/maintainers.inc +1 -0
index 5b7ce77c3c..8f319c63a7 100644
@@ -810,6 +810,7 @@ RECIPE_MAINTAINER:pn-vulkan-headers = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-loader = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-samples = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-tools = "Anuj Mittal <[email protected]>"
+RECIPE_MAINTAINER:pn-vulkan-validation = "Jordan Crouse <[email protected]>"
 RECIPE_MAINTAINER:pn-waffle = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-watchdog = "Alexander Kanavin <[email protected]>"
 RECIPE_MAINTAINER:pn-watchdog-config = "Alexander Kanavin <[email protected]>"
meta/recipes-graphics/vulkan/vulkan-validation_1.3.231.1.bb new file +39 -0
new file mode 100644
index 0000000000..37becb1d16
@@ -0,0 +1,39 @@
+SUMMARY = "Vulkan Validation layers"
+DESCRIPTION = "Khronos official Vulkan validation layers to assist developers \
+in verifying that their applications correctly use the Vulkan API"
+HOMEPAGE = "https://www.khronos.org/vulkan/"
+BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-ValidationLayers"
+SECTION = "libs"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8df9e8826734226d08cb412babfa599c"
+SRC_URI = "git://github.com/KhronosGroup/Vulkan-ValidationLayers.git;branch=sdk-1.3.231;protocol=https"
+
+SRCREV="f489610de566df6a5c20de1a3e54776e0ad852e1"
+
+S = "${WORKDIR}/git"
+
+REQUIRED_DISTRO_FEATURES = "vulkan"
+
+inherit cmake features_check pkgconfig
+
+DEPENDS += "vulkan-headers spirv-headers spirv-tools vulkan-loader glslang"
+
+EXTRA_OECMAKE = "\
+                 -DBUILD_TESTS=OFF \
+                 -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 \
+                 -DVULKAN_HEADERS_INSTALL_DIR=${STAGING_EXECPREFIXDIR} \
+                 -DGLSLANG_INSTALL_DIR=${STAGING_DATADIR} \
+                 -DSPIRV_HEADERS_INSTALL_DIR=${STAGING_EXECPREFIXDIR} \
+                 -DUSE_ROBIN_HOOD_HASHING=OFF \
+                 "
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}"
+
+PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr"
+PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland"
+
+FILES:${PN} = "${libdir}/*.so ${datadir}/vulkan"
+FILES:${PN}-dev = ""
+
+UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P<pver>\d+(\.\d+)+)"
Signature · 1 line
2.37.1
#4 lore raw

Re: [OE-core] [PATCH v2 3/3] vulkan-validation: Add the official Vulkan validation layers

Hello,

This was actually the version I tested and that failed on the autobuilders.

Quoted 97 lines · Jordan Crouse via lists.openembedded.org

Add a recipe to build the Khronos official Vulkan validation layers that can assist developers in verifying that their applications correctly use the Vulkan APIs.

USE_ROBIN_HOOD_HASHING=OFF disables a third party dependency on [1] which is a performant reimplementation of std::unordered_map and std::unordered_set that gives better performance when using validation for extremely heavy workloads on a desktop. There isn't much benefit to enabling it on most embedded systems so force it off for now but no bias against making it optional if robin-hood-hashing is made available in the metadata.

[1] https://github.com/martinus/robin-hood-hashing

---

Changes in v2:
- Put DEPENDS all on one line
- Remove unused OEMAKE flags
- Force /usr/lib/*.so into ${PN} and remove INSANE_SKIP

 meta/conf/distro/include/maintainers.inc      |  1 +
 .../vulkan/vulkan-validation_1.3.231.1.bb     | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-graphics/vulkan/vulkan-validation_1.3.231.1.bb
meta/conf/distro/include/maintainers.inc +1 -0
index 5b7ce77c3c..8f319c63a7 100644
@@ -810,6 +810,7 @@ RECIPE_MAINTAINER:pn-vulkan-headers = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-loader = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-samples = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-tools = "Anuj Mittal <[email protected]>"
+RECIPE_MAINTAINER:pn-vulkan-validation = "Jordan Crouse <[email protected]>"
 RECIPE_MAINTAINER:pn-waffle = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-watchdog = "Alexander Kanavin <[email protected]>"
 RECIPE_MAINTAINER:pn-watchdog-config = "Alexander Kanavin <[email protected]>"
meta/recipes-graphics/vulkan/vulkan-validation_1.3.231.1.bb new file +39 -0
new file mode 100644
index 0000000000..37becb1d16
@@ -0,0 +1,39 @@
+SUMMARY = "Vulkan Validation layers"
+DESCRIPTION = "Khronos official Vulkan validation layers to assist developers \
+in verifying that their applications correctly use the Vulkan API"
+HOMEPAGE = "https://www.khronos.org/vulkan/"
+BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-ValidationLayers"
+SECTION = "libs"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8df9e8826734226d08cb412babfa599c"
+SRC_URI = "git://github.com/KhronosGroup/Vulkan-ValidationLayers.git;branch=sdk-1.3.231;protocol=https"
+
+SRCREV="f489610de566df6a5c20de1a3e54776e0ad852e1"
+
+S = "${WORKDIR}/git"
+
+REQUIRED_DISTRO_FEATURES = "vulkan"
+
+inherit cmake features_check pkgconfig
+
+DEPENDS += "vulkan-headers spirv-headers spirv-tools vulkan-loader glslang"
+
+EXTRA_OECMAKE = "\
+                 -DBUILD_TESTS=OFF \
+                 -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 \
+                 -DVULKAN_HEADERS_INSTALL_DIR=${STAGING_EXECPREFIXDIR} \
+                 -DGLSLANG_INSTALL_DIR=${STAGING_DATADIR} \
+                 -DSPIRV_HEADERS_INSTALL_DIR=${STAGING_EXECPREFIXDIR} \
+                 -DUSE_ROBIN_HOOD_HASHING=OFF \
+                 "
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}"
+
+PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr"
+PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland"
+
+FILES:${PN} = "${libdir}/*.so ${datadir}/vulkan"
+FILES:${PN}-dev = ""
+
+UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P<pver>\d+(\.\d+)+)"
Signature · 11 lines
2.37.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173144): https://lists.openembedded.org/g/openembedded-core/message/173144
Mute This Topic: https://lists.openembedded.org/mt/94969329/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com