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

vk/dma: Initialize COW DMA block contents to avoid leaks #11541

Merged
merged 1 commit into from Feb 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions rpcs3/Emu/RSX/VK/VKDMA.cpp
Expand Up @@ -70,6 +70,14 @@ namespace vk
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, 0,
VMM_ALLOCATION_POOL_UNDEFINED);

// Initialize memory contents. This isn't something that happens often.
// Pre-loading the contents helps to avoid leakage when mixed types of allocations are in use (NVIDIA)
// TODO: Fix memory lost when old object goes out of use with in-flight data.
auto dst = allocated_memory->map(0, size);
auto src = vm::get_super_ptr(base_address);
std::memcpy(dst, src, size);
allocated_memory->unmap();

s_allocated_dma_pool_size += allocated_memory->size();
}

Expand Down