Bug 111054 - Vulkan overlay doesn't work with X4: Foundations
Summary: Vulkan overlay doesn't work with X4: Foundations
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/Common (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-04 01:40 UTC by Shmerl
Modified: 2019-07-04 09:47 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Shmerl 2019-07-04 01:40:22 UTC
For some reason when used with X4: Foundations, the overlay doesn't show up.

Mesa master (git-75d8b4e795)
Driver: radv
GPU: Sapphire Pulse AMD Vega 56.
X4: Foundations 2.50 Hotfix 1 (GOG version).
Comment 1 Shmerl 2019-07-04 01:41:18 UTC
Just for the reference, the game is using Vulkan.
Comment 2 Lionel Landwerlin 2019-07-04 05:01:35 UTC
Any other information?
I don't have the game, but I was able to use the overlay with games like Dota 2.
Comment 3 Shmerl 2019-07-04 05:04:04 UTC
It works fine in other cases for me (like when using with Wine+dxvk in Witcher 3). So something strange is going with X4 specifically. Is there some way to narrow down why it's not loading?
Comment 4 Shmerl 2019-07-04 05:13:20 UTC
Interesting, I just analyzed loaded shared libraries for case when the layer is showing up (vkcube), and I see libVkLayer_MESA_overlay.so listed. While in case of X4 it's not present. So something does prevent it from loading.
Comment 5 Lionel Landwerlin 2019-07-04 06:54:51 UTC
Running with VK_LOADER_DEBUG=all might help figuring out what's going wrong.
Comment 6 Shmerl 2019-07-04 07:25:22 UTC
I see a strange difference. I placed my built layer in /opt/mesa-master. For vkcube when it works, I run it like this:

VK_LOADER_DEBUG=all VK_LAYER_PATH=/opt/mesa-master/share/vulkan/explicit_layer.d VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay vkcube

Result (it finds it):

...
DEBUG: ReadDataFilesInSearchPaths: Searching the following paths for manifest files: /etc/xdg/vulkan/implicit_layer.d:/etc/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:/usr/local/share/vulkan/implicit_layer.d:/home/user/.local/share/vulkan/implicit_layer.d

DEBUG: ReadDataFilesInSearchPaths: Searching the following paths for manifest files: /etc/xdg/vulkan/implicit_layer.d:/etc/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:/usr/local/share/vulkan/implicit_layer.d:/home/user/.local/share/vulkan/implicit_layer.d

DEBUG: ReadDataFilesInSearchPaths: Searching the following paths for manifest files: /opt/mesa-master/share/vulkan/explicit_layer.d
...


For X4, when it doesn't work:

VK_LOADER_DEBUG=all VK_LAYER_PATH=/opt/mesa-master/share/vulkan/explicit_layer.d VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay ./X4

Result:

...
DEBUG: ReadDataFilesInSearchPaths: Searching the following paths for manifest files: /etc/xdg/vulkan/implicit_layer.d:/etc/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:/usr/local/share/vulkan/implicit_layer.d:/home/user/.local/share/vulkan/implicit_layer.d

DEBUG: ReadDataFilesInSearchPaths: Searching the following paths for manifest files: /etc/xdg/vulkan/implicit_layer.d:/etc/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:/usr/local/share/vulkan/implicit_layer.d:/home/user/.local/share/vulkan/implicit_layer.d

DEBUG: ReadDataFilesInSearchPaths: Searching the following paths for manifest files: vulkan/linux

DEBUG: ReadDataFilesInSearchPaths: Searching the following paths for manifest files: /etc/xdg/vulkan/icd.d:/etc/vulkan/icd.d:/usr/share/vulkan/icd.d:/usr/share/vulkan/icd.d:/usr/local/share/vulkan/icd.d:/home/user/.local/share/vulkan/icd.d
...
WARNING: loaderAddLayerNameToList: Failed to find layer name VK_LAYER_MESA_overlay to activate
WARNING: loaderAddLayerNameToList: Failed to find layer name VK_LAYER_MESA_overlay to activate
...

Somehow search resolution is different so it doesn't find it.
Comment 7 Shmerl 2019-07-04 07:27:17 UTC
This part looks weird (i.e. vulkan/linux there)

DEBUG: ReadDataFilesInSearchPaths: Searching the following paths for manifest files: vulkan/linux
Comment 8 Eero Tamminen 2019-07-04 07:58:58 UTC
Have you checked it's not 32-bit vs. 64-bit issue?

("file" command tells you which arch given library/binary is using, and you can see where the game binary / libraries are from /proc/PID/maps file.)
Comment 9 Shmerl 2019-07-04 08:04:19 UTC
The game and layer are both 64-bit.
Comment 10 Lionel Landwerlin 2019-07-04 08:24:18 UTC
Are you using the %command% trick in steam or some other mean?
It looks like something is stripping your VK_LAYER_PATH environment variable.
Comment 11 Shmerl 2019-07-04 08:25:54 UTC
I'm using GOG version, and actually launch the binary directly with those env variables prefixed for a test (X4 is a binary).

I.e.

VK_LOADER_DEBUG=all VK_LAYER_PATH=/opt/mesa-master/share/vulkan/explicit_layer.d VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay ./X4
Comment 12 Lionel Landwerlin 2019-07-04 08:29:51 UTC
(In reply to Shmerl from comment #11)
> I'm using GOG version, and actually launch the binary directly with those
> env variables prefixed for a test (X4 is a binary).
> 
> I.e.
> 
> VK_LOADER_DEBUG=all
> VK_LAYER_PATH=/opt/mesa-master/share/vulkan/explicit_layer.d
> VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay ./X4

Can you look at a strace dump or once the game is loaded cat /proc/<game_pid>/maps to check whether the game might be using its own version of the loader?
Comment 13 Shmerl 2019-07-04 08:44:11 UTC
OK, I run it now also to match mesa-master Vulkan driver with the loader. I.e. using not the system ICD, but the one built with mesa-master (though that doesn't change the outcome, but at least reduces potential mismatches).

Here is the result of /proc/<pid>/maps: https://pastebin.com/raw/vPwn0xTd
Comment 14 Shmerl 2019-07-04 08:46:21 UTC
May be something is statically compiled into it?
Comment 15 Lionel Landwerlin 2019-07-04 08:50:26 UTC
(In reply to Shmerl from comment #13)
> OK, I run it now also to match mesa-master Vulkan driver with the loader.
> I.e. using not the system ICD, but the one built with mesa-master (though
> that doesn't change the outcome, but at least reduces potential mismatches).
> 
> Here is the result of /proc/<pid>/maps: https://pastebin.com/raw/vPwn0xTd

Thanks it seems to be using the system loader.
At this point I have no idea apart from the game manually calling setenv() to drop the VK_LAYER_PATH variable.
Comment 16 Shmerl 2019-07-04 08:54:48 UTC
OK, I'll try to strace it to get some details and will also ping developers of the game with this question.
Comment 17 Shmerl 2019-07-04 09:01:24 UTC
Oh, this is something already:

strings X4 | grep 'vulkan/linux'
VK_LAYER_PATH=vulkan/linux

The game is doing something fishy, that's why above you can also see it looking for that weird "vulkan/linux" location.
Comment 18 Lionel Landwerlin 2019-07-04 09:14:05 UTC
(In reply to Shmerl from comment #17)
> Oh, this is something already:
> 
> strings X4 | grep 'vulkan/linux'
> VK_LAYER_PATH=vulkan/linux
> 
> The game is doing something fishy, that's why above you can also see it
> looking for that weird "vulkan/linux" location.

Heh, you can always try to create that directory and link to the layer's file there.

Anyway it doesn't seem like a layer bug so I'm closing this.
Thanks
Comment 19 Eero Tamminen 2019-07-04 09:47:56 UTC
(In reply to Lionel Landwerlin from comment #15)
> Thanks it seems to be using the system loader.
> At this point I have no idea apart from the game manually calling setenv()
> to drop the VK_LAYER_PATH variable.

Environment can be easily checked for a running program:
  tr '\0' '\n' < /proc/PID/environ | grep VK


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.