[GH-ISSUE #1584] Emulator crash if "Show Splash" is selected #539

Closed
opened 2026-02-27 21:06:47 +03:00 by kerem · 14 comments
Owner

Originally created by @ngoquang2708 on GitHub (Nov 23, 2024).
Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/1584

I am on Linux.
When I select "Show Splash" in Settings, the emulator crash when I start a game.

Log: shad_log.txt

In Visual Code, it crashes at this location:
Screenshot_20241123_143817

Originally created by @ngoquang2708 on GitHub (Nov 23, 2024). Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/1584 I am on Linux. When I select "Show Splash" in Settings, the emulator crash when I start a game. Log: [shad_log.txt](https://github.com/user-attachments/files/17879515/shad_log.txt) In Visual Code, it crashes at this location: ![Screenshot_20241123_143817](https://github.com/user-attachments/assets/dea078ec-3371-45b7-b07f-959585d5c871)
kerem 2026-02-27 21:06:47 +03:00
Author
Owner

@ngoquang2708 commented on GitHub (Nov 23, 2024):

It crashes when I ran my DE using the iGPU (my laptop is Intel/Nvidia Optimus).
It works if I use the dGPU to run my DE.
Emulator use the dGPU in both cases.

<!-- gh-comment-id:2495479048 --> @ngoquang2708 commented on GitHub (Nov 23, 2024): It crashes when I ran my DE using the iGPU (my laptop is Intel/Nvidia Optimus). It works if I use the dGPU to run my DE. Emulator use the dGPU in both cases.
Author
Owner

@kalaposfos13 commented on GitHub (Nov 23, 2024):

This is the same for me (Linux Mint 22), in fact, in previous versions, the splash screen did not even show up, so I just guessed it wasn't implemented yet.
Commenting out this line: stbi_image_free(img_mem); makes the splash appear (for the first time ever on my computer), but crashes further down the line: as soon as the game tries to write to the screen.

<!-- gh-comment-id:2495512410 --> @kalaposfos13 commented on GitHub (Nov 23, 2024): This is the same for me (Linux Mint 22), in fact, in previous versions, the splash screen did not even show up, so I just guessed it wasn't implemented yet. Commenting out this line: [stbi_image_free(img_mem);](https://github.com/shadps4-emu/shadPS4/blob/d7d28aa8da6b70d5f6641e52f1b087448ca27d4b/src/core/file_format/splash.cpp#L40) makes the splash appear (for the first time ever on my computer), but crashes further down the line: as soon as the game tries to write to the screen.
Author
Owner

@Hermiten commented on GitHub (Dec 20, 2024):

Can you test again ?
#1832 maybe fix it

<!-- gh-comment-id:2557568843 --> @Hermiten commented on GitHub (Dec 20, 2024): Can you test again ? #1832 maybe fix it
Author
Owner

@polybiusproxy commented on GitHub (Dec 20, 2024):

That won't fix it, I'm afraid @Hermiten

<!-- gh-comment-id:2557572803 --> @polybiusproxy commented on GitHub (Dec 20, 2024): That won't fix it, I'm afraid @Hermiten
Author
Owner

@Hermiten commented on GitHub (Dec 20, 2024):

Don't be afraid 👌

<!-- gh-comment-id:2557589578 --> @Hermiten commented on GitHub (Dec 20, 2024): Don't be afraid 👌
Author
Owner

@setepenre commented on GitHub (Dec 27, 2024):

this hacky patch solves the issue without appearing to cause any problem in menu and in game ; I will not pretend I have any idea why. MultiLevelPageTable doesn´t seem to expect high addresses like the one where splash image gets allocated to on linux? Removing the VideoCore::ImageFlagBits::GpuDirty from img_splash just skips going thru github.com/shadps4-emu/shadPS4@e40ede5db2/src/video_core/buffer_cache/buffer_cache.cpp (L356) which also expects the address to be lower than it is on linux.

diff --git a/src/video_core/buffer_cache/buffer_cache.cpp b/src/video_core/buffer_cache/buffer_cache.cpp
index 59c1e0bc..450faea8 100644
--- a/src/video_core/buffer_cache/buffer_cache.cpp
+++ b/src/video_core/buffer_cache/buffer_cache.cpp
@@ -341,7 +341,7 @@ std::pair<Buffer*, u32> BufferCache::ObtainBuffer(VAddr device_addr, u32 size, b
 
 std::pair<Buffer*, u32> BufferCache::ObtainViewBuffer(VAddr gpu_addr, u32 size, bool prefer_gpu) {
     // Check if any buffer contains the full requested range.
-    const u64 page = gpu_addr >> CACHING_PAGEBITS;
+    const u64 page = gpu_addr >> (64 - (Traits::AddressSpaceBits - Traits::PageBits));
     const BufferId buffer_id = page_table[page];
     if (buffer_id) {
         Buffer& buffer = slot_buffers[buffer_id];
diff --git a/src/video_core/renderer_vulkan/vk_presenter.cpp b/src/video_core/renderer_vulkan/vk_presenter.cpp
index bc55cde2..a57bd261 100644
--- a/src/video_core/renderer_vulkan/vk_presenter.cpp
+++ b/src/video_core/renderer_vulkan/vk_presenter.cpp
@@ -432,6 +432,7 @@ bool Presenter::ShowSplash(Frame* frame /*= nullptr*/) {
                                           splash->GetImageInfo().width,
                                           splash->GetImageInfo().height, 0);
             splash_img.emplace(instance, present_scheduler, info);
+            splash_img->flags ^= VideoCore::ImageFlagBits::GpuDirty;
             texture_cache.RefreshImage(*splash_img);
 
             splash_img->Transit(vk::ImageLayout::eTransferSrcOptimal,

EDIT: this is not a proposed solution, this is merely a hack to maybe help someone more knowledgeable find the proper solution

<!-- gh-comment-id:2563787814 --> @setepenre commented on GitHub (Dec 27, 2024): this hacky patch solves the issue without appearing to cause any problem in menu and in game ; I will not pretend I have any idea why. MultiLevelPageTable doesn´t seem to expect high addresses like the one where splash image gets allocated to on linux? Removing the VideoCore::ImageFlagBits::GpuDirty from img_splash just skips going thru https://github.com/shadps4-emu/shadPS4/blob/e40ede5db2aede2a51d481f5dc1df0baf8ea9c78/src/video_core/buffer_cache/buffer_cache.cpp#L356 which also expects the address to be lower than it is on linux. ```patch diff --git a/src/video_core/buffer_cache/buffer_cache.cpp b/src/video_core/buffer_cache/buffer_cache.cpp index 59c1e0bc..450faea8 100644 --- a/src/video_core/buffer_cache/buffer_cache.cpp +++ b/src/video_core/buffer_cache/buffer_cache.cpp @@ -341,7 +341,7 @@ std::pair<Buffer*, u32> BufferCache::ObtainBuffer(VAddr device_addr, u32 size, b std::pair<Buffer*, u32> BufferCache::ObtainViewBuffer(VAddr gpu_addr, u32 size, bool prefer_gpu) { // Check if any buffer contains the full requested range. - const u64 page = gpu_addr >> CACHING_PAGEBITS; + const u64 page = gpu_addr >> (64 - (Traits::AddressSpaceBits - Traits::PageBits)); const BufferId buffer_id = page_table[page]; if (buffer_id) { Buffer& buffer = slot_buffers[buffer_id]; diff --git a/src/video_core/renderer_vulkan/vk_presenter.cpp b/src/video_core/renderer_vulkan/vk_presenter.cpp index bc55cde2..a57bd261 100644 --- a/src/video_core/renderer_vulkan/vk_presenter.cpp +++ b/src/video_core/renderer_vulkan/vk_presenter.cpp @@ -432,6 +432,7 @@ bool Presenter::ShowSplash(Frame* frame /*= nullptr*/) { splash->GetImageInfo().width, splash->GetImageInfo().height, 0); splash_img.emplace(instance, present_scheduler, info); + splash_img->flags ^= VideoCore::ImageFlagBits::GpuDirty; texture_cache.RefreshImage(*splash_img); splash_img->Transit(vk::ImageLayout::eTransferSrcOptimal, ``` EDIT: this is not a proposed solution, this is merely a hack to maybe help someone more knowledgeable find the proper solution
Author
Owner

@Hermiten commented on GitHub (Feb 1, 2025):

Any update about this ?

<!-- gh-comment-id:2628882769 --> @Hermiten commented on GitHub (Feb 1, 2025): Any update about this ?
Author
Owner

@ngoquang2708 commented on GitHub (Feb 1, 2025):

Still crash on my SteamDeck.

shad_log.txt

<!-- gh-comment-id:2628887113 --> @ngoquang2708 commented on GitHub (Feb 1, 2025): Still crash on my SteamDeck. [shad_log.txt](https://github.com/user-attachments/files/18628245/shad_log.txt)
Author
Owner

@Hermiten commented on GitHub (Feb 1, 2025):

Can you try with the patch from @setepenre 2 messages above ?

<!-- gh-comment-id:2628888947 --> @Hermiten commented on GitHub (Feb 1, 2025): Can you try with the patch from @setepenre 2 messages above ?
Author
Owner

@ngoquang2708 commented on GitHub (Feb 1, 2025):

I don't have access to my PC for a week so I cannot try it now.

<!-- gh-comment-id:2628890128 --> @ngoquang2708 commented on GitHub (Feb 1, 2025): I don't have access to my PC for a week so I cannot try it now.
Author
Owner

@Hermiten commented on GitHub (Feb 24, 2025):

Is it still revelant and if so, can someone try to do a PR with the @setepenre suggestion ? Thanks you

<!-- gh-comment-id:2678212426 --> @Hermiten commented on GitHub (Feb 24, 2025): Is it still revelant and if so, can someone try to do a PR with the @setepenre suggestion ? Thanks you
Author
Owner

@ngoquang2708 commented on GitHub (Feb 24, 2025):

Still crash with latest main.

shad_log.txt

<!-- gh-comment-id:2678276050 --> @ngoquang2708 commented on GitHub (Feb 24, 2025): Still crash with latest main. [shad_log.txt](https://github.com/user-attachments/files/18942024/shad_log.txt)
Author
Owner

@CkNoSFeRaTU commented on GitHub (Mar 4, 2025):

First change from hack proposed by setepenre is indeed seems to work on latest main. Without it emulator has a big chance of crashing with black screen. BTW rarely if it was lucky it is able to show splash screen without hack but in this case half of the time game successfully boots and another half amdgpu driver crashes instead with [gfxhub] page fault.

<!-- gh-comment-id:2698800199 --> @CkNoSFeRaTU commented on GitHub (Mar 4, 2025): First change from hack proposed by [setepenre](https://github.com/setepenre) is indeed seems to work on latest main. Without it emulator has a big chance of crashing with black screen. BTW rarely if it was lucky it is able to show splash screen without hack but in this case half of the time game successfully boots and another half amdgpu driver crashes instead with [gfxhub] page fault.
Author
Owner

@viniciuslrangel commented on GitHub (Mar 13, 2025):

Fixed #2645

<!-- gh-comment-id:2721703277 --> @viniciuslrangel commented on GitHub (Mar 13, 2025): Fixed #2645
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#539
No description provided.