summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv/devices
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-12-30 23:08:55 +0100
committerLiam <byteslice@airmail.cc>2024-01-19 03:12:30 +0100
commitb0bca0f8b04de630f9dec47cff14a640d40f65db (patch)
treec1723cc631a573340e1393aa81939fa1ce5dfad0 /src/core/hle/service/nvdrv/devices
parentSMMU: Add continuity tracking optimization. (diff)
downloadyuzu-b0bca0f8b04de630f9dec47cff14a640d40f65db.tar
yuzu-b0bca0f8b04de630f9dec47cff14a640d40f65db.tar.gz
yuzu-b0bca0f8b04de630f9dec47cff14a640d40f65db.tar.bz2
yuzu-b0bca0f8b04de630f9dec47cff14a640d40f65db.tar.lz
yuzu-b0bca0f8b04de630f9dec47cff14a640d40f65db.tar.xz
yuzu-b0bca0f8b04de630f9dec47cff14a640d40f65db.tar.zst
yuzu-b0bca0f8b04de630f9dec47cff14a640d40f65db.zip
Diffstat (limited to 'src/core/hle/service/nvdrv/devices')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp29
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h7
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.cpp2
4 files changed, 16 insertions, 24 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
index 8bc10eac2..936b93bd9 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -40,15 +40,15 @@ NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> i
case 0x3:
return WrapFixed(this, &nvhost_as_gpu::FreeSpace, input, output);
case 0x5:
- return WrapFixed(this, &nvhost_as_gpu::UnmapBuffer, input, output, fd);
+ return WrapFixed(this, &nvhost_as_gpu::UnmapBuffer, input, output);
case 0x6:
- return WrapFixed(this, &nvhost_as_gpu::MapBufferEx, input, output, fd);
+ return WrapFixed(this, &nvhost_as_gpu::MapBufferEx, input, output);
case 0x8:
return WrapFixed(this, &nvhost_as_gpu::GetVARegions1, input, output);
case 0x9:
return WrapFixed(this, &nvhost_as_gpu::AllocAsEx, input, output);
case 0x14:
- return WrapVariable(this, &nvhost_as_gpu::Remap, input, output, fd);
+ return WrapVariable(this, &nvhost_as_gpu::Remap, input, output);
default:
break;
}
@@ -86,15 +86,8 @@ NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> i
return NvResult::NotImplemented;
}
-void nvhost_as_gpu::OnOpen(size_t session_id, DeviceFD fd) {
- sessions[fd] = session_id;
-}
-void nvhost_as_gpu::OnClose(DeviceFD fd) {
- auto it = sessions.find(fd);
- if (it != sessions.end()) {
- sessions.erase(it);
- }
-}
+void nvhost_as_gpu::OnOpen(size_t session_id, DeviceFD fd) {}
+void nvhost_as_gpu::OnClose(DeviceFD fd) {}
NvResult nvhost_as_gpu::AllocAsEx(IoctlAllocAsEx& params) {
LOG_DEBUG(Service_NVDRV, "called, big_page_size=0x{:X}", params.big_page_size);
@@ -268,7 +261,7 @@ NvResult nvhost_as_gpu::FreeSpace(IoctlFreeSpace& params) {
return NvResult::Success;
}
-NvResult nvhost_as_gpu::Remap(std::span<IoctlRemapEntry> entries, DeviceFD fd) {
+NvResult nvhost_as_gpu::Remap(std::span<IoctlRemapEntry> entries) {
LOG_DEBUG(Service_NVDRV, "called, num_entries=0x{:X}", entries.size());
if (!vm.initialised) {
@@ -302,7 +295,7 @@ NvResult nvhost_as_gpu::Remap(std::span<IoctlRemapEntry> entries, DeviceFD fd) {
return NvResult::BadValue;
}
- DAddr base = nvmap.PinHandle(entry.handle, sessions[fd], false);
+ DAddr base = nvmap.PinHandle(entry.handle, false);
DAddr device_address{static_cast<DAddr>(
base + (static_cast<u64>(entry.handle_offset_big_pages) << vm.big_page_size_bits))};
@@ -314,7 +307,7 @@ NvResult nvhost_as_gpu::Remap(std::span<IoctlRemapEntry> entries, DeviceFD fd) {
return NvResult::Success;
}
-NvResult nvhost_as_gpu::MapBufferEx(IoctlMapBufferEx& params, DeviceFD fd) {
+NvResult nvhost_as_gpu::MapBufferEx(IoctlMapBufferEx& params) {
LOG_DEBUG(Service_NVDRV,
"called, flags={:X}, nvmap_handle={:X}, buffer_offset={}, mapping_size={}"
", offset={}",
@@ -358,8 +351,8 @@ NvResult nvhost_as_gpu::MapBufferEx(IoctlMapBufferEx& params, DeviceFD fd) {
return NvResult::BadValue;
}
- DAddr device_address{static_cast<DAddr>(nvmap.PinHandle(params.handle, sessions[fd], false) +
- params.buffer_offset)};
+ DAddr device_address{
+ static_cast<DAddr>(nvmap.PinHandle(params.handle, false) + params.buffer_offset)};
u64 size{params.mapping_size ? params.mapping_size : handle->orig_size};
bool big_page{[&]() {
@@ -414,7 +407,7 @@ NvResult nvhost_as_gpu::MapBufferEx(IoctlMapBufferEx& params, DeviceFD fd) {
return NvResult::Success;
}
-NvResult nvhost_as_gpu::UnmapBuffer(IoctlUnmapBuffer& params, DeviceFD fd) {
+NvResult nvhost_as_gpu::UnmapBuffer(IoctlUnmapBuffer& params) {
LOG_DEBUG(Service_NVDRV, "called, offset=0x{:X}", params.offset);
std::scoped_lock lock(mutex);
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
index 4b28f5078..7fd704bce 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
@@ -141,9 +141,9 @@ private:
NvResult AllocAsEx(IoctlAllocAsEx& params);
NvResult AllocateSpace(IoctlAllocSpace& params);
- NvResult Remap(std::span<IoctlRemapEntry> params, DeviceFD fd);
- NvResult MapBufferEx(IoctlMapBufferEx& params, DeviceFD fd);
- NvResult UnmapBuffer(IoctlUnmapBuffer& params, DeviceFD fd);
+ NvResult Remap(std::span<IoctlRemapEntry> params);
+ NvResult MapBufferEx(IoctlMapBufferEx& params);
+ NvResult UnmapBuffer(IoctlUnmapBuffer& params);
NvResult FreeSpace(IoctlFreeSpace& params);
NvResult BindChannel(IoctlBindChannel& params);
@@ -214,7 +214,6 @@ private:
bool initialised{};
} vm;
std::shared_ptr<Tegra::MemoryManager> gmmu;
- std::unordered_map<DeviceFD, size_t> sessions;
};
} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
index a50577c75..a0a7bfa40 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
@@ -140,7 +140,7 @@ NvResult nvhost_nvdec_common::MapBuffer(IoctlMapBuffer& params, std::span<MapBuf
DeviceFD fd) {
const size_t num_entries = std::min(params.num_entries, static_cast<u32>(entries.size()));
for (size_t i = 0; i < num_entries; i++) {
- DAddr pin_address = nvmap.PinHandle(entries[i].map_handle, sessions[fd], true);
+ DAddr pin_address = nvmap.PinHandle(entries[i].map_handle, true);
entries[i].map_address = static_cast<u32>(pin_address);
}
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp
index 7765ca1be..24f49ddcd 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp
@@ -124,7 +124,7 @@ NvResult nvmap::IocAlloc(IocAllocParams& params, DeviceFD fd) {
}
const auto result =
- handle_description->Alloc(params.flags, params.align, params.kind, params.address);
+ handle_description->Alloc(params.flags, params.align, params.kind, params.address, sessions[fd]);
if (result != NvResult::Success) {
LOG_CRITICAL(Service_NVDRV, "Object failed to allocate, handle={:08X}", params.handle);
return result;