tree: aa2ab04f4bae972fbf2b116c073aba8cb6251059 [path history] [tgz]
  1. BUILD.gn
  2. README.md
  3. app.cc
  4. app.h
  5. goldfish_device.cc
  6. goldfish_device.h
  7. gpu_device.h
  8. icd_component.cc
  9. icd_component.h
  10. icd_list.cc
  11. icd_list.h
  12. icd_runner.cc
  13. icd_runner.h
  14. loader.cc
  15. loader.h
  16. magma_device.cc
  17. magma_device.h
  18. main.cc
  19. meta/
  20. test/
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 and can be placed in most subdirectories (not /bin) of the package.

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,
    "manifest_path": "data/icd.d/libvulkan_example.json"
}
  • version must be 1 for this metadata version.
  • file_path is the location of the ICD shared library relative to the exposed contents directory.
  • library_path matches to value of library_path in the Khronos ICD manifest json.
  • manifest_path is the location of the Khronos ICD manifest json file relative to the exposed contents directory.

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.