Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: Workaround slow vkCmdCopyImageToBuffer on QCom #11084

Merged
merged 1 commit into from Sep 30, 2022

Conversation

K0bin
Copy link
Contributor

@K0bin K0bin commented Sep 23, 2022

After profiling Mario Galaxy on my Snapdragon 865 phone, I realized that the video thread spends a ridiculous amount of time in vkCmdCopyImageToBuffer.

Turns out the driver allocates a temporary image every single time. After playing around for a bit, I've noticed that it doesn't do that when copying from a linear tiled image. So we can just do that blit ourselves and reuse the image.

image

EDIT: I should clarify, this is mostly a problem when "Store EFB copies to texture only" is disabled.

@JMC47
Copy link
Contributor

JMC47 commented Sep 24, 2022

Greatly improves performance on Vulkan. NES VC games run ~100% faster (EFB2RAM ones)

A lot of the 3D games are still slower in Vulkan than OpenGL though. Wind Waker island overview during the opening is full speed on OpenGL and is ~25 FPS on Vulkan (Pixel 3a)

So, while Vulkan performance is better and greatly improved in some cases, it's still not great for most Adrenos.

@iwubcode
Copy link
Contributor

Some questions from me: is there a reason users would prefer Vulkan over OGL? Does it make sense to add additional code complexity for a single platform if it doesn't push Vulkan perf over OGL which users can already use?

@K0bin
Copy link
Contributor Author

K0bin commented Sep 24, 2022

Wind Waker runs at ~45FPS on my phone with both Vulkan and OpenGL. (with the PR)
OpenGL is a lot faster in Mario Galaxy but that's probably because their flushing logic is a lot smarter.

Does it make sense to add additional code complexity for a single platform if it doesn't push Vulkan perf over OGL which users can already use?

I think it's not that much code and it's fairly contained.

@K0bin K0bin force-pushed the qcom-workaround branch 2 times, most recently from 78cdea6 to 182de5e Compare September 24, 2022 15:47
@K0bin K0bin changed the title VideoBackends:Vulkan: Workaround slow vkCmdCopyImageToBuffer on QCom Vulkan: Workaround slow vkCmdCopyImageToBuffer on QCom Sep 24, 2022
@K0bin K0bin force-pushed the qcom-workaround branch 2 times, most recently from 5b67941 to 459c4eb Compare September 25, 2022 00:11
@brujo5
Copy link

brujo5 commented Sep 25, 2022

Screenshot_20220925-000713_Dolphin Emulator
Screenshot_20220925-000726_Dolphin Emulator

Very nice
Sd860 with v615 driver

@golivax
Copy link

golivax commented Sep 25, 2022

In my non scientific tests, I also noticed a massive improvement with Vulkan on a SD855 (stock Galaxy S10). Windwaker and several other games run much better. Indeed, this PR brought Vulkan very close to OpenGL, which is wonderful! I am very curious to see if PR + #11090 will make things even (e.g., in games like Mario Galaxy and Skyward Sword). Tks a lot for your work, @K0bin. I am sure the community will really appreciate it.

Source/Core/VideoBackends/Vulkan/VKTexture.cpp Outdated Show resolved Hide resolved
Source/Core/VideoBackends/Vulkan/VKTexture.cpp Outdated Show resolved Hide resolved
Source/Core/VideoBackends/Vulkan/VKTexture.cpp Outdated Show resolved Hide resolved
Source/Core/VideoBackends/Vulkan/VKTexture.cpp Outdated Show resolved Hide resolved
@K0bin K0bin force-pushed the qcom-workaround branch 2 times, most recently from d7552e2 to 21e0505 Compare September 30, 2022 17:54
Copy link
Contributor

@Pokechu22 Pokechu22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I haven't tested it directly though.

@JMC47
Copy link
Contributor

JMC47 commented Sep 30, 2022

I can test the latest version to make sure it works, but without other optimizations I won't see the full effect.

Seems to still run, so let's start getting the optimizations merged.

@JMC47 JMC47 merged commit 68eda7f into dolphin-emu:master Sep 30, 2022
11 checks passed
@K0bin K0bin deleted the qcom-workaround branch September 30, 2022 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants