mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-25 15:56:00 +03:00
[PR #2819] [MERGED] video_core: Implement DMA. #3006
Labels
No labels
Bloodborne
bug
contributor wanted
documentation
enhancement
frontend
good first issue
help wanted
linux
pull-request
question
release
verification progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shadPS4#3006
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/shadps4-emu/shadPS4/pull/2819
Author: @LNDF
Created: 4/20/2025
Status: ✅ Merged
Merged: 5/22/2025
Merged by: @georgemoralis
Base:
main← Head:hybrid📝 Commits (10+)
52253b4Import memoryd5e45fb64K pages and fix memory mapping83255eeQueue coverage94a0782Buffer syncing, faulted readback adn BDA in Bufferc077fb9Base DMA implementation9356779Preparations for implementing SPV DMA access68a33cdBase impl (pending 16K pages and getbuffersize)31df79516K pages and stack overflow fixd89d937clang-format20aacecclang-format but for real this time📊 Changes
40 files changed (+1641 additions, -311 deletions)
View changed files
📝
CMakeLists.txt(+3 -0)📝
externals/sirit(+1 -1)➕
src/common/recursive_lock.cpp(+37 -0)➕
src/common/recursive_lock.h(+67 -0)📝
src/common/slot_vector.h(+109 -1)📝
src/shader_recompiler/backend/spirv/emit_spirv.cpp(+9 -2)📝
src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp(+3 -3)📝
src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp(+40 -41)📝
src/shader_recompiler/backend/spirv/emit_spirv_instructions.h(+1 -1)📝
src/shader_recompiler/backend/spirv/spirv_emit_context.cpp(+185 -13)📝
src/shader_recompiler/backend/spirv/spirv_emit_context.h(+106 -11)📝
src/shader_recompiler/frontend/translate/scalar_memory.cpp(+7 -6)📝
src/shader_recompiler/info.h(+12 -2)➕
src/shader_recompiler/ir/abstract_syntax_list.cpp(+44 -0)📝
src/shader_recompiler/ir/abstract_syntax_list.h(+5 -0)📝
src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp(+27 -4)📝
src/shader_recompiler/ir/program.cpp(+30 -4)📝
src/shader_recompiler/ir/program.h(+1 -1)📝
src/shader_recompiler/recompiler.cpp(+2 -0)📝
src/video_core/amdgpu/liverpool.cpp(+1 -0)...and 20 more files
📄 Description
This implements arbitrary memory access from the GPU to CPU memory.
When mapping memory, tries to import host memory with VK_KHR_external_memory. When a buffer is created in the same address range of an improted region, device local memory is used.
Buffer Device Addresses are used to get pointers to the data in shaders. A BDA pagetable buffer is created on the GPU that holds the BDA for every 16K page.
Additionaly a "fault" buffer is also created which holds a bitfield that tells the CPU if a non GPU local address has been accessed from a shader. This is done by embedding in the LSB of the BDA if a page is cached by the buffer cache. If a page has been accessed by the GPU and is not cached by the buffer cache it will be cached before the next frame.
It may happen that the host memory import fails. (on AMD GPUs on Linux sometimes), in those cases, a fallback value is used and the page bit is set in the "fault" buffer.
Problems:
scheduler.Finish();every time I download the "fault" buffer. inBufferCache::CreateFaultBuffers, If there is a better way to sync I can implement it.This is currently used for ReadConst, and work like this:
This can also potentialy be used in GetBufferSize.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.