Skip to content

runtime: Always use the driver basename

Ludovico de Nittis requested to merge wip/denittis/tasks213 into main
  • runtime: Refactor the ICD checks into a single if...else

    Group together the various checks to make the code easier to follow.

  • runtime: Move mkdir into setup_json_manifest()

    Move the creation of the directory in the same function that actually uses it. This will make it more clear what is happening and reduces the function implicit requirements.

    This is also a preparation step towards reusing the manifest basename, that will be added as a subsequent commit.

    The directories are only created when we have an ICD_KIND_ABSOLUTE because, in all the other cases, the eventual need to create the parent directories is automatically handled by pv_runtime_take_from_provider().

    With this commit we might end up with a slightly increased number of g_mkdir_with_parents() calls, but the overhead should be negligible, compared to the complexity of pressure-vessel.

  • runtime: Always use the drivers basename

    When creating the JSON manifests, we were simply naming them sequentially, as an easy way to avoid conflicts.

    However, since Vulkan Loader 1.3.234, it is possible to select which driver to use by listing their names in the environment variable VK_LOADER_DRIVERS_SELECT. This functionality would not work in pressure-vessel, unless we keep the original JSON manifest name.

    With this commit now we always reuse the JSON manifest basename. In the rare events where this could cause a conflict, we create unique sub directories to avoid issues.


Addresses: https://gitlab.steamos.cloud/steamrt/tasks/-/issues/223

I wanted to point out here that Vulkan's VK_LOADER_DRIVERS_SELECT tries to match the entire JSON manifest, including the file extension. This means that if you want to select the lvp driver, you should either do VK_LOADER_DRIVERS_SELECT=lvp* or VK_LOADER_DRIVERS_SELECT=lvp_icd.x86_64.json.

Using VK_LOADER_DRIVERS_SELECT=lvp will instead not work. I created a small patch for the Vulkan-Loader documentation to clarify this point https://github.com/KhronosGroup/Vulkan-Loader/pull/1130

For us, this means that we are forced to keep the JSON manifest name as-is. Our only option here is to use unique sub-directories, when needed.

I tried to add some automated tests for setup_each_json_manifest(), but it ended up being too complex. So instead I spun out the new logic that generates unique file paths into a separate function called pv_generate_unique_filepath() and added some tests for it. This is not what I had in mind but it's better than nothing.

Merge request reports

Loading