Skip to content

[Bug]: Vulkan not working in any Flatpak. #5131

Closed

Description

@gegoxaren

Checklist

Flatpak version

1.12.7

What Linux distribution are you using?

Ubuntu

Linux distribution version

22.04.1 LTS

What architecture are you using?

x86_64

How to reproduce

I can not get Vulkan to work under flatpak. This affects Steam, and the VulkanInfo tool.

This is obviously a problem with how flatpak handles system files, and does not expose them to the sandbox environment.

$ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json flatpak run org.freedesktop.Platform.VulkanInfo  
ERROR: [Loader Message] Code 0 : loader_get_json: Failed to open JSON file /usr/share/vulkan/icd.d/radeon_icd.i686.json
ERROR: [Loader Message] Code 0 : loader_get_json: Failed to open JSON file /usr/share/vulkan/icd.d/radeon_icd.x86_64.json
ERROR: [Loader Message] Code 0 : vkCreateInstance: Found no drivers!
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /buildstream/freedesktop-sdk/extensions/vulkaninfo/vulkan-tools.bst/vulkaninfo/vulkaninfo.h:672:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVE

Even trying to expose the host files does not work.

$ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json flatpak run --filesystem=host org.freedesktop.Platform.VulkanInfo  
ERROR: [Loader Message] Code 0 : loader_get_json: Failed to open JSON file /usr/share/vulkan/icd.d/radeon_icd.x86_64.json
ERROR: [Loader Message] Code 0 : vkCreateInstance: Found no drivers!
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /buildstream/freedesktop-sdk/extensions/vulkaninfo/vulkan-tools.bst/vulkaninfo/vulkaninfo.h:672:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER
$ cat /usr/share/vulkan/icd.d/radeon_icd.x86_64.json
{
    "ICD": {
        "api_version": "1.3.204",
        "library_path": "/usr/lib/x86_64-linux-gnu/libvulkan_radeon.so"
    },
    "file_format_version": "1.0.0"

}
$ ls -las /usr/lib/x86_64-linux-gnu/libvulkan_radeon.so
6764 -rw-r--r-- 1 root root 6924848 jul  6 08:37 /usr/lib/x86_64-linux-gnu/libvulkan_radeon.so

Expected Behavior

Having VulkanInfo actually work, showing something like this:

$ vulkaninfo
==========
VULKANINFO
==========

Vulkan Instance Version: 1.3.204


Instance Extensions: count = 19
===============================
	VK_EXT_acquire_drm_display             : extension revision 1
	VK_EXT_acquire_xlib_display            : extension revision 1
	VK_EXT_debug_report                    : extension revision 10
	VK_EXT_debug_utils                     : extension revision 2
	VK_EXT_direct_mode_display             : extension revision 1
	VK_EXT_display_surface_counter         : extension revision 1
	VK_KHR_device_group_creation           : extension revision 1
	VK_KHR_display                         : extension revision 23
	VK_KHR_external_fence_capabilities     : extension revision 1
	VK_KHR_external_memory_capabilities    : extension revision 1
	VK_KHR_external_semaphore_capabilities : extension revision 1

\/\/\/\/\/\/\/\/\/\/\/\/\/\

	vulkanMemoryModel                             = true
	vulkanMemoryModelDeviceScope                  = true
	vulkanMemoryModelAvailabilityVisibilityChains = false

VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR:
---------------------------------------------------------
	workgroupMemoryExplicitLayout                  = true
	workgroupMemoryExplicitLayoutScalarBlockLayout = true
	workgroupMemoryExplicitLayout8BitAccess        = true
	workgroupMemoryExplicitLayout16BitAccess       = true

VkPhysicalDeviceYcbcrImageArraysFeaturesEXT:
--------------------------------------------
	ycbcrImageArrays = true

VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures:
------------------------------------------------------
	shaderZeroInitializeWorkgroupMemory = true

Actual Behavior

VulkanInfo does not work.

Additional Information

I have even tried to unset the VK_ICD_FILENAMES variable, and then running VulkanInfo, but to the same result.

Any help would be appreciated, Workarounds or otherwise.

Activity

  1. okseb commented on Oct 7, 2022

    @okseb

    It seems like this issue is affecting the Unreal Engine install within the Epic Asset Manager Flatpak it was telling me it couldn't find Vulkan drivers on my system even though it worked before.

  2. gegoxaren commented on Oct 7, 2022

    @gegoxaren
    Author

    Seems a reboot and unset:ing the VK_ICD_FILENAMES now works. Don't know why.

    I'm sorry for making you read all that.

    Sincerely,
    Gustav.

  3. ninja- commented on Feb 15, 2024

    @ninja-

    Maybe we can reopen? Looks like FlatPak, or the freedesktop SDK is not compliant in some way with the default Vulkan loader, for example shipped by Chrome.

    LAYER:             Searching for implicit layer manifest files
    LAYER:                In following locations:
    LAYER:                   /home/user2/.var/app/com.google.ChromeDev/config/vulkan/implicit_layer.d
    LAYER:                   /app/etc/xdg/vulkan/implicit_layer.d
    LAYER:                   /etc/xdg/vulkan/implicit_layer.d
    LAYER:                   /etc/vulkan/implicit_layer.d
    LAYER:                   /home/user2/.var/app/com.google.ChromeDev/data/vulkan/implicit_layer.d
    LAYER:                   /app/share/vulkan/implicit_layer.d
    LAYER:                   /usr/share/vulkan/implicit_layer.d
    LAYER:                   /usr/share/runtime/share/vulkan/implicit_layer.d
    LAYER:                   /run/host/user-share/vulkan/implicit_layer.d
    LAYER:                   /run/host/share/vulkan/implicit_layer.d
    

    None of these directories are valid, however /usr/lib/x86_64-linux-gnu/GL/vulkan/implicit_layer.d is...

    VK_ICD_FILENAMES=/usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/radeon_icd.x86_64.json MESA_DEBUG=1 VK_LOADER_DEBUG=error,warn,layer,info chrome
    

    Allows Chrome to see vulkan (within it's capability, which is limited for now to X11 without Wayland)

  4. smcv commented on Feb 15, 2024

    @smcv
    Collaborator

    Looks like FlatPak, or the freedesktop SDK is not compliant in some way with the default Vulkan loader, for example shipped by Chrome

    This is a Chrome issue or a freedesktop SDK issue, depending how you look at it. Either way, it is not a Flatpak bug.

    Flatpak doesn't know anything about Vulkan: all it knows are runtimes and extensions. The structure of the specific extensions used for Vulkan is a freedesktop SDK thing.

    The freedesktop SDK assumes that the Vulkan-Loader has had https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/master/patches/vulkan/vulkan-libdir-path.patch?ref_type=heads applied to it. This is true for the Vulkan-Loader shipped in the freedesktop SDK itself.

    If Chrome is shipping its own vendored copy of Vulkan-Loader that does not have that patch, then there are four possible resolutions:

    • in the Flatpak packaging of Chrome, remove the vendored copy and use the one from the freedesktop SDK
    • in the Flatpak packaging of Chrome, apply a similar patch to the vendored Vulkan-Loader
    • in the Flatpak packaging of Chrome, set VK_DRIVER_FILES (the replacement for the deprecated VK_ICD_FILENAMES) to point to /usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d so that files in that directory will be found
    • in the freedesktop.org SDK, set VK_DRIVER_FILES or XDG_DATA_HOME so that files in that directory will be found

    None of these are Flatpak changes. If Flatpak made similar changes, it would break runtimes that do not have the same structure as the freedesktop SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions