mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:35:12 +01:00
Various accuracy improvements in services
* 'Fix' memory accounting to not measure reserved regions * Fix some copy bugs introduced by switch to span * Correct remap the behaviour of Modify so it actually works
This commit is contained in:
parent
c7e5202042
commit
c161ef0cac
@ -199,7 +199,7 @@ namespace skyline::kernel {
|
||||
std::shared_lock lock(mutex);
|
||||
size_t size{};
|
||||
for (const auto &chunk : chunks)
|
||||
if (chunk.state != memory::states::Unmapped)
|
||||
if (chunk.state != memory::states::Unmapped && chunk.state != memory::states::Reserved)
|
||||
size += chunk.size;
|
||||
return size;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace skyline::service::am {
|
||||
return result::OutOfBounds;
|
||||
|
||||
if (size)
|
||||
span(parent->content).copy_from(request.outputBuf.at(0), size);
|
||||
span(parent->content).copy_from(request.inputBuf.at(0), size);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace skyline::service::hid {
|
||||
|
||||
Result IHidServer::AcquireNpadStyleSetUpdateEventHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto id{request.Pop<NpadId>()};
|
||||
request.copyHandles.push_back(state.process->InsertItem(state.input->npad.at(id).updateEvent));
|
||||
response.copyHandles.push_back(state.process->InsertItem(state.input->npad.at(id).updateEvent));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -79,19 +79,13 @@ namespace skyline::service::nvdrv::device {
|
||||
} &data = buffer.as<Data>();
|
||||
|
||||
try {
|
||||
auto driver{nvdrv::driver.lock()};
|
||||
auto nvmap{driver->nvMap.lock()};
|
||||
auto mapping{nvmap->GetObject(data.nvmapHandle)};
|
||||
|
||||
if (data.flags.remap) {
|
||||
auto region{regionMap.upper_bound(data.offset)};
|
||||
if ((region == regionMap.begin()) || (region == regionMap.end())) {
|
||||
auto region{regionMap.lower_bound(data.offset)};
|
||||
if (region == regionMap.end()) {
|
||||
state.logger->Warn("Cannot remap an unmapped GPU address space region: 0x{:X}", data.offset);
|
||||
return NvStatus::BadParameter;
|
||||
}
|
||||
|
||||
region--; // Upper bound gives us the region after the one we want
|
||||
|
||||
if (region->second.size < data.mappingSize) {
|
||||
state.logger->Warn("Cannot remap an partially mapped GPU address space region: 0x{:X}", data.offset);
|
||||
return NvStatus::BadParameter;
|
||||
@ -100,7 +94,7 @@ namespace skyline::service::nvdrv::device {
|
||||
u64 gpuAddress{data.offset + data.bufferOffset};
|
||||
u8 *cpuPtr{region->second.ptr + data.bufferOffset};
|
||||
|
||||
if (state.gpu->memoryManager.MapFixed(gpuAddress, cpuPtr, data.mappingSize)) {
|
||||
if (!state.gpu->memoryManager.MapFixed(gpuAddress, cpuPtr, data.mappingSize)) {
|
||||
state.logger->Warn("Failed to remap GPU address space region: 0x{:X}", gpuAddress);
|
||||
return NvStatus::BadParameter;
|
||||
}
|
||||
@ -108,6 +102,10 @@ namespace skyline::service::nvdrv::device {
|
||||
return NvStatus::Success;
|
||||
}
|
||||
|
||||
auto driver{nvdrv::driver.lock()};
|
||||
auto nvmap{driver->nvMap.lock()};
|
||||
auto mapping{nvmap->GetObject(data.nvmapHandle)};
|
||||
|
||||
u8 *cpuPtr{data.bufferOffset + mapping->ptr};
|
||||
u64 size{data.mappingSize ? data.mappingSize : mapping->size};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user