mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-03-06 13:33:57 +01:00
enforce gnm driver loading, fix syncing flexible memory with gpu
This commit is contained in:
parent
0ce879d966
commit
5b3bc0e97a
|
|
@ -261,8 +261,10 @@ static void release(orbis::Process *process, decltype(g_vmInstance)::type *vmem,
|
||||||
|
|
||||||
auto blockRange = range.intersection(it.range());
|
auto blockRange = range.intersection(it.range());
|
||||||
|
|
||||||
|
auto gpuProt = orbis::vmem::toGpuProtection(it->prot);
|
||||||
if (it->flags & orbis::vmem::BlockFlags::FlexibleMemory) {
|
if (it->flags & orbis::vmem::BlockFlags::FlexibleMemory) {
|
||||||
if (it->device == nullptr) {
|
if (it->device == nullptr && gpuProt) {
|
||||||
|
amdgpu::unmapMemory(process->pid, blockRange);
|
||||||
orbis::fmem::deallocate(blockRange);
|
orbis::fmem::deallocate(blockRange);
|
||||||
}
|
}
|
||||||
budget->release(orbis::BudgetResource::Fmem, blockRange.size());
|
budget->release(orbis::BudgetResource::Fmem, blockRange.size());
|
||||||
|
|
@ -281,9 +283,8 @@ static void release(orbis::Process *process, decltype(g_vmInstance)::type *vmem,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orbis::vmem::toGpuProtection(it->prot) &&
|
if (gpuProt && (it->flags & orbis::vmem::BlockFlags::DirectMemory |
|
||||||
(it->flags & orbis::vmem::BlockFlags::DirectMemory |
|
orbis::vmem::BlockFlags::PooledMemory)) {
|
||||||
orbis::vmem::BlockFlags::PooledMemory)) {
|
|
||||||
amdgpu::unmapMemory(process->pid, blockRange);
|
amdgpu::unmapMemory(process->pid, blockRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -566,7 +567,8 @@ std::pair<rx::AddressRange, orbis::ErrorCode> orbis::vmem::mapFile(
|
||||||
blockpool::releaseControlBlock();
|
blockpool::releaseControlBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
rx::println(stderr, "map: device allocation failure, blockFlags {}", blockFlags);
|
rx::println(stderr, "map: device allocation failure, blockFlags {}",
|
||||||
|
blockFlags);
|
||||||
return {{}, error};
|
return {{}, error};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -823,7 +825,13 @@ std::pair<rx::AddressRange, orbis::ErrorCode> orbis::vmem::mapFlex(
|
||||||
AllocationFlags::Fixed | (allocFlags & AllocationFlags::NoMerge),
|
AllocationFlags::Fixed | (allocFlags & AllocationFlags::NoMerge),
|
||||||
alignment);
|
alignment);
|
||||||
|
|
||||||
// vmemDump(process, rx::format("mapFlex {:x}-{:x}", vmemRange.beginAddress(),
|
if (prot) {
|
||||||
|
amdgpu::mapMemory(process->pid, vmemRange, MemoryType::WbOnion, prot,
|
||||||
|
allocationInfo.deviceOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vmemDump(process, rx::format("mapFlex {:x}-{:x}",
|
||||||
|
// vmemRange.beginAddress(),
|
||||||
// vmemRange.endAddress()));
|
// vmemRange.endAddress()));
|
||||||
fmemResource.commit();
|
fmemResource.commit();
|
||||||
return {vmemRange, {}};
|
return {vmemRange, {}};
|
||||||
|
|
@ -1139,6 +1147,9 @@ orbis::ErrorCode orbis::vmem::protect(Process *process, rx::AddressRange range,
|
||||||
toCpuProtection(blockProt));
|
toCpuProtection(blockProt));
|
||||||
|
|
||||||
rx::dieIf(errc != ErrorCode{}, "failed to map flexible memory");
|
rx::dieIf(errc != ErrorCode{}, "failed to map flexible memory");
|
||||||
|
|
||||||
|
amdgpu::mapMemory(process->pid, range, MemoryType::WbOnion,
|
||||||
|
prot, pmemRange.beginAddress());
|
||||||
} else if (!blockProt && alloc.prot) {
|
} else if (!blockProt && alloc.prot) {
|
||||||
auto errc = fmem::deallocate(rx::AddressRange::fromBeginSize(
|
auto errc = fmem::deallocate(rx::AddressRange::fromBeginSize(
|
||||||
alloc.deviceOffset, range.size()));
|
alloc.deviceOffset, range.size()));
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ orbis::SysResult dynlib_load_prx(orbis::Thread *thread,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it->second == resultModule) {
|
if (it->second == resultModule) {
|
||||||
wasNeeded = true;
|
// wasNeeded = true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue