tree: d166152d9cc3c3f00bf1e832a87b8c4b17f953a2 [path history] [tgz]
  1. meta/
  2. test/
  3. app.cc
  4. app.h
  5. BUILD.gn
  6. goldfish_device.cc
  7. goldfish_device.h
  8. gpu_device.h
  9. icd_component.cc
  10. icd_component.h
  11. icd_list.cc
  12. icd_list.h
  13. icd_runner.cc
  14. icd_runner.h
  15. magma_device.cc
  16. magma_device.h
  17. main.cc
  18. README.md
src/graphics/bin/vulkan_loader/README.md

The Vulkan Loader service

This service is responsible for providing Vulkan ICDs to applications that use vulkan.

ICD identification

The vulkan loader waits for GPU devices to appear, then queries them for the URLs of ICD components that can be used with them. The exact query depends on the type of GPU device:

More types of GPU hardware devices may be supported in the future.

ICD<->loader interface

ICD are made available to the loader as CFv2 components. An ICD component must expose a contents directory containing an arbitrary directory tree containing a shared library, as well as a metadata directory containing a single metadata.json file.

An ICD is generally contained in its own package. In that case, the contents directory would be the root of the package, and the metadata directory would be the data/ directory in the package. The loader doesn't enforce this layout, however.

ICD shared libraries

ICD shared libraries should match the Vulkan ICD ABI. ICDs are executable shared libraries so they must be in the lib directory of a package, since other directories are not allow to serve executable VMOs.

Component manifest

The Vulkan loader supplies an icd_runner runner to simplify the creation of an ICD component from a package. The ICD package must contain a component manifest .cml file similar to the following:

{
    include: [ "sdk/lib/diagnostics/syslog/client.shard.cml" ],
    program: {
        runner: "icd_runner",
    },
    capabilities: [
        {
            directory: "contents",
            rights: [ "rx*" ],
            path: "/pkg",
        },
    ],
    expose: [
        {
            directory: "contents",
            from: "self",
            rights: [ "rx*" ],
        },
        {
            directory: "contents",
            from: "self",
            as: "metadata",
            rights: [ "r*" ],
            subdir: "data",
        },
    ],
}

The “icd_runner” runner automatically exports the directories from the package. This CML assumes the metadata is at data/metadata.json in the package. That can be changed by modifying the subdir property of the metadata entry.

The ICD component may also use the elf runner, but the only service available to it is fuchsia.logger.LogSink.

metadata.json

metadata.json is a single JSON file that describes the ICD to the loader. Example:

{
    "file_path": "lib/libvulkan_example.so",
    "library_path": "libvulkan_example.so",
    "version": 1
}
  • version must be 1 for this metadata version.
  • file_path is the location of the ICD shared library relative the exposed contents directory.
  • library_path matches to value of library_path in the Khronos ICD manifest json.

library_path can be an arbitrary string, but must be unique between all ICDs on the system. It is only temporary and will be removed once libvulkan.so has been converted to use a newer mechanism to identify ICDs.