Bug 107977 - Commit 90819abb56f6b1a0cd4946b13b6caf24fb46e500 crashes dolphin-emu with "Failed to create Vulkan command buffers"
Summary: Commit 90819abb56f6b1a0cd4946b13b6caf24fb46e500 crashes dolphin-emu with "Fai...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-18 12:49 UTC by Kyle De'Vir
Modified: 2018-09-19 06:06 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
test (574 bytes, patch)
2018-09-18 13:33 UTC, Samuel Pitoiset
Details | Splinter Review
possible fix (521 bytes, patch)
2018-09-18 13:57 UTC, Samuel Pitoiset
Details | Splinter Review

Description Kyle De'Vir 2018-09-18 12:49:33 UTC
Using the Vulkan backend on dolphin-emu, I suddenly noticed that it was complaining that it couldn't initialize the Vulkan backend.

I bisected to 6521d4a659b911bb86d979564de03665616a671e, which is the cause.
Comment 1 Kyle De'Vir 2018-09-18 13:11:30 UTC
Actually, 90819abb56f6b1a0cd4946b13b6caf24fb46e500 ~ `radv: fix descriptor pool allocation size` is where the fun starts.

It crashes dolphin-emu with "Failed to create Vulkan command buffers"

It is 6521d4a659b911bb86d979564de03665616a671e that cause problems with dolphin-emu initializing Vulkan in the first place.
Comment 2 Kyle De'Vir 2018-09-18 13:15:52 UTC
> It is 6521d4a659b911bb86d979564de03665616a671e that cause problems with dolphin-emu initializing Vulkan in the first place.

Actually, no, ignore this...
Comment 3 Samuel Pitoiset 2018-09-18 13:16:40 UTC
So, when does the problem start exactly?
Comment 4 Kyle De'Vir 2018-09-18 13:22:48 UTC
As soon as I click play for any of the games in dolphin-emu's game list, which is when it starts the renderer.

I can provide a backtrace from dolphin-emu, if it helps any.
Comment 5 Samuel Pitoiset 2018-09-18 13:25:24 UTC
I meant what commit. Are you sure it's 90819abb56f6b1a0cd4946b13b6caf24fb46e500 ? That seems quite weird.

Yes, please attach a backtrace.
Comment 6 Kyle De'Vir 2018-09-18 13:28:15 UTC
Backtrace: https://paste.kde.org/pnt3dlvpx
Comment 7 Samuel Pitoiset 2018-09-18 13:33:01 UTC
Created attachment 141639 [details] [review]
test

Please try this patch. Does it abort?
Comment 8 Gustaw Smolarczyk 2018-09-18 13:39:57 UTC
Hi, I am just passing by.

I have found the following piece of code in Dolphin source code [1]:

    VkDescriptorPoolCreateInfo pool_create_info = {VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
                                                   nullptr,
                                                   0,
                                                   100000,  // tweak this
                                                   static_cast<u32>(ArraySize(pool_sizes)),
                                                   pool_sizes};


maxSets is being set to 100000, which might be the source of this problem. I like the comment next to it :)

[1] https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp#L97
Comment 9 Kyle De'Vir 2018-09-18 13:40:51 UTC
No change... :/
Comment 10 Kyle De'Vir 2018-09-18 13:44:06 UTC
Is this potentially a dolphin-emu bug, then?
Comment 11 Kyle De'Vir 2018-09-18 13:49:10 UTC
I ran dolphin-emu, and decided to log any errors (why didn't I think of this previously...):

43:00:797 VideoBackends/Vulkan/VulkanLoader.cpp:314 E[Video]: (CreateCommandBuffers) vkCreateDescriptorPool failed:  (-1: VK_ERROR_OUT_OF_HOST_MEMORY)
43:00:797 Common/MsgHandler.cpp:92 E[MASTER]: Warning: Failed to create Vulkan command buffers
Comment 12 Samuel Pitoiset 2018-09-18 13:57:48 UTC
Created attachment 141640 [details] [review]
possible fix

Well, dolphin tries to allocate a TON of memory for one descriptor pool. It allocates 16262320 bytes for one set... And they are 100000. That explains the OOM error.

The attached patch might help but this should be reported to the Dolphin guys because it's definitely too bad.

Let me know if that helps.
Comment 13 Kyle De'Vir 2018-09-18 14:07:05 UTC
Your patch doesn't help, unfortunately.

Probably best if I report this bug to dolphin-emu, then.
Comment 14 Samuel Pitoiset 2018-09-18 14:18:05 UTC
Yeah, dolphin allocates too much memory. Anyway we should use a 64-bit unsigned integer. Closing.
Comment 15 Gustaw Smolarczyk 2018-09-18 18:37:57 UTC
It turns out it really was a problem on mesa side. I think we should change the resolution of the bug.
Comment 16 Bas Nieuwenhuizen 2018-09-18 22:57:21 UTC
You are right, a revert of 90819abb56f6b1a0cd4946b13b6caf24fb46e500 has been pushed.
Comment 17 Kyle De'Vir 2018-09-19 06:06:28 UTC
Can you explain why it was a bug in Mesa? Just trying to understand why the change broke things.


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.