diff options
| author | 2018-09-10 18:02:47 -0400 | |
|---|---|---|
| committer | 2018-09-10 18:02:47 -0400 | |
| commit | ae0c95efccfb85c0456194d142f561cbd5f95df8 (patch) | |
| tree | 224018fc0aed7e56980e2bf9e063f3770b99539e /src/core | |
| parent | Merge pull request #1281 from bunnei/multi-rt (diff) | |
| parent | video_core: Refactor command_processor. (diff) | |
| download | yuzu-ae0c95efccfb85c0456194d142f561cbd5f95df8.tar.gz yuzu-ae0c95efccfb85c0456194d142f561cbd5f95df8.tar.xz yuzu-ae0c95efccfb85c0456194d142f561cbd5f95df8.zip | |
Merge pull request #1264 from degasus/optimizations
video_core: Optimize the command processor.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | 26 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_gpu.h | 17 |
2 files changed, 12 insertions, 31 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 4cdf7f613..8e0f9a9e5 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" | 9 | #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" |
| 10 | #include "core/memory.h" | 10 | #include "core/memory.h" |
| 11 | #include "video_core/command_processor.h" | ||
| 11 | #include "video_core/gpu.h" | 12 | #include "video_core/gpu.h" |
| 12 | #include "video_core/memory_manager.h" | 13 | #include "video_core/memory_manager.h" |
| 13 | 14 | ||
| @@ -134,17 +135,16 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp | |||
| 134 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}", | 135 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}", |
| 135 | params.address, params.num_entries, params.flags); | 136 | params.address, params.num_entries, params.flags); |
| 136 | 137 | ||
| 137 | ASSERT_MSG(input.size() == | 138 | ASSERT_MSG(input.size() == sizeof(IoctlSubmitGpfifo) + |
| 138 | sizeof(IoctlSubmitGpfifo) + params.num_entries * sizeof(IoctlGpfifoEntry), | 139 | params.num_entries * sizeof(Tegra::CommandListHeader), |
| 139 | "Incorrect input size"); | 140 | "Incorrect input size"); |
| 140 | 141 | ||
| 141 | std::vector<IoctlGpfifoEntry> entries(params.num_entries); | 142 | std::vector<Tegra::CommandListHeader> entries(params.num_entries); |
| 142 | std::memcpy(entries.data(), &input[sizeof(IoctlSubmitGpfifo)], | 143 | std::memcpy(entries.data(), &input[sizeof(IoctlSubmitGpfifo)], |
| 143 | params.num_entries * sizeof(IoctlGpfifoEntry)); | 144 | params.num_entries * sizeof(Tegra::CommandListHeader)); |
| 144 | for (auto entry : entries) { | 145 | |
| 145 | Tegra::GPUVAddr va_addr = entry.Address(); | 146 | Core::System::GetInstance().GPU().ProcessCommandLists(entries); |
| 146 | Core::System::GetInstance().GPU().ProcessCommandList(va_addr, entry.sz); | 147 | |
| 147 | } | ||
| 148 | params.fence_out.id = 0; | 148 | params.fence_out.id = 0; |
| 149 | params.fence_out.value = 0; | 149 | params.fence_out.value = 0; |
| 150 | std::memcpy(output.data(), ¶ms, sizeof(IoctlSubmitGpfifo)); | 150 | std::memcpy(output.data(), ¶ms, sizeof(IoctlSubmitGpfifo)); |
| @@ -160,14 +160,12 @@ u32 nvhost_gpu::KickoffPB(const std::vector<u8>& input, std::vector<u8>& output) | |||
| 160 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}", | 160 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, gpfifo={:X}, num_entries={:X}, flags={:X}", |
| 161 | params.address, params.num_entries, params.flags); | 161 | params.address, params.num_entries, params.flags); |
| 162 | 162 | ||
| 163 | std::vector<IoctlGpfifoEntry> entries(params.num_entries); | 163 | std::vector<Tegra::CommandListHeader> entries(params.num_entries); |
| 164 | Memory::ReadBlock(params.address, entries.data(), | 164 | Memory::ReadBlock(params.address, entries.data(), |
| 165 | params.num_entries * sizeof(IoctlGpfifoEntry)); | 165 | params.num_entries * sizeof(Tegra::CommandListHeader)); |
| 166 | |||
| 167 | Core::System::GetInstance().GPU().ProcessCommandLists(entries); | ||
| 166 | 168 | ||
| 167 | for (auto entry : entries) { | ||
| 168 | Tegra::GPUVAddr va_addr = entry.Address(); | ||
| 169 | Core::System::GetInstance().GPU().ProcessCommandList(va_addr, entry.sz); | ||
| 170 | } | ||
| 171 | params.fence_out.id = 0; | 169 | params.fence_out.id = 0; |
| 172 | params.fence_out.value = 0; | 170 | params.fence_out.value = 0; |
| 173 | std::memcpy(output.data(), ¶ms, output.size()); | 171 | std::memcpy(output.data(), ¶ms, output.size()); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 03b7356d0..baaefd79a 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/swap.h" | 11 | #include "common/swap.h" |
| 12 | #include "core/hle/service/nvdrv/devices/nvdevice.h" | 12 | #include "core/hle/service/nvdrv/devices/nvdevice.h" |
| 13 | #include "video_core/memory_manager.h" | ||
| 14 | 13 | ||
| 15 | namespace Service::Nvidia::Devices { | 14 | namespace Service::Nvidia::Devices { |
| 16 | 15 | ||
| @@ -151,22 +150,6 @@ private: | |||
| 151 | }; | 150 | }; |
| 152 | static_assert(sizeof(IoctlAllocObjCtx) == 16, "IoctlAllocObjCtx is incorrect size"); | 151 | static_assert(sizeof(IoctlAllocObjCtx) == 16, "IoctlAllocObjCtx is incorrect size"); |
| 153 | 152 | ||
| 154 | struct IoctlGpfifoEntry { | ||
| 155 | u32_le entry0; // gpu_va_lo | ||
| 156 | union { | ||
| 157 | u32_le entry1; // gpu_va_hi | (unk_0x02 << 0x08) | (size << 0x0A) | (unk_0x01 << 0x1F) | ||
| 158 | BitField<0, 8, u32_le> gpu_va_hi; | ||
| 159 | BitField<8, 2, u32_le> unk1; | ||
| 160 | BitField<10, 21, u32_le> sz; | ||
| 161 | BitField<31, 1, u32_le> unk2; | ||
| 162 | }; | ||
| 163 | |||
| 164 | Tegra::GPUVAddr Address() const { | ||
| 165 | return (static_cast<Tegra::GPUVAddr>(gpu_va_hi) << 32) | entry0; | ||
| 166 | } | ||
| 167 | }; | ||
| 168 | static_assert(sizeof(IoctlGpfifoEntry) == 8, "IoctlGpfifoEntry is incorrect size"); | ||
| 169 | |||
| 170 | struct IoctlSubmitGpfifo { | 153 | struct IoctlSubmitGpfifo { |
| 171 | u64_le address; // pointer to gpfifo entry structs | 154 | u64_le address; // pointer to gpfifo entry structs |
| 172 | u32_le num_entries; // number of fence objects being submitted | 155 | u32_le num_entries; // number of fence objects being submitted |