diff options
author | Subv <subv2112@gmail.com> | 2018-02-12 05:44:12 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-02-12 05:44:12 +0100 |
commit | 6cddf9d88e7fc49919fda92bcd4235797c56f07f (patch) | |
tree | 3f7da3795b5561b2d325325b72610996e2857742 /src/core/hle/service/nvdrv/devices | |
parent | GPU: Added a command processor to decode the GPU pushbuffers and forward the commands to their respective engines. (diff) | |
download | yuzu-6cddf9d88e7fc49919fda92bcd4235797c56f07f.tar yuzu-6cddf9d88e7fc49919fda92bcd4235797c56f07f.tar.gz yuzu-6cddf9d88e7fc49919fda92bcd4235797c56f07f.tar.bz2 yuzu-6cddf9d88e7fc49919fda92bcd4235797c56f07f.tar.lz yuzu-6cddf9d88e7fc49919fda92bcd4235797c56f07f.tar.xz yuzu-6cddf9d88e7fc49919fda92bcd4235797c56f07f.tar.zst yuzu-6cddf9d88e7fc49919fda92bcd4235797c56f07f.zip |
Diffstat (limited to 'src/core/hle/service/nvdrv/devices')
4 files changed, 13 insertions, 16 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 cf3601f02..9832e1899 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp @@ -4,6 +4,7 @@ #include "common/assert.h" #include "common/logging/log.h" +#include "core/core.h" #include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h" #include "core/hle/service/nvdrv/devices/nvmap.h" @@ -44,11 +45,12 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& LOG_DEBUG(Service_NVDRV, "called, pages=%x, page_size=%x, flags=%x", params.pages, params.page_size, params.flags); + auto& gpu = Core::System::GetInstance().GPU(); const u64 size{static_cast<u64>(params.pages) * static_cast<u64>(params.page_size)}; if (params.flags & 1) { - params.offset = memory_manager->AllocateSpace(params.offset, size, 1); + params.offset = gpu.memory_manager->AllocateSpace(params.offset, size, 1); } else { - params.offset = memory_manager->AllocateSpace(size, params.align); + params.offset = gpu.memory_manager->AllocateSpace(size, params.align); } std::memcpy(output.data(), ¶ms, output.size()); @@ -71,10 +73,12 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& ou auto object = nvmap_dev->GetObject(params.nvmap_handle); ASSERT(object); + auto& gpu = Core::System::GetInstance().GPU(); + if (params.flags & 1) { - params.offset = memory_manager->MapBufferEx(object->addr, params.offset, object->size); + params.offset = gpu.memory_manager->MapBufferEx(object->addr, params.offset, object->size); } else { - params.offset = memory_manager->MapBufferEx(object->addr, object->size); + params.offset = gpu.memory_manager->MapBufferEx(object->addr, object->size); } std::memcpy(output.data(), ¶ms, output.size()); 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 301a8a79f..f8a60cce7 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h @@ -10,7 +10,6 @@ #include "common/common_types.h" #include "common/swap.h" #include "core/hle/service/nvdrv/devices/nvdevice.h" -#include "core/hle/service/nvdrv/memory_manager.h" namespace Service { namespace Nvidia { @@ -20,8 +19,7 @@ class nvmap; class nvhost_as_gpu final : public nvdevice { public: - nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev, std::shared_ptr<MemoryManager> memory_manager) - : nvmap_dev(std::move(nvmap_dev)), memory_manager(std::move(memory_manager)) {} + nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} ~nvhost_as_gpu() override = default; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; @@ -100,7 +98,6 @@ private: u32 GetVARegions(const std::vector<u8>& input, std::vector<u8>& output); std::shared_ptr<nvmap> nvmap_dev; - std::shared_ptr<MemoryManager> memory_manager; }; } // namespace Devices diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 1c3079889..0b2ebd466 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -5,8 +5,8 @@ #include <map> #include "common/assert.h" #include "common/logging/log.h" +#include "core/core.h" #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" -#include "video_core/command_processor.h" namespace Service { namespace Nvidia { @@ -131,9 +131,8 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp std::memcpy(&entries[0], &input.data()[sizeof(IoctlSubmitGpfifo)], params.num_entries * sizeof(IoctlGpfifoEntry)); for (auto entry : entries) { - VAddr va_addr = memory_manager->PhysicalToVirtualAddress(entry.Address()); - Tegra::CommandProcessor::ProcessCommandList(va_addr, entry.sz); - // TODO(ogniK): Process these + VAddr va_addr = entry.Address(); + Core::System::GetInstance().GPU().ProcessCommandList(va_addr, entry.sz); } params.fence_out.id = 0; params.fence_out.value = 0; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 6f9b90b05..e7e9a0088 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h @@ -9,7 +9,6 @@ #include "common/common_types.h" #include "common/swap.h" #include "core/hle/service/nvdrv/devices/nvdevice.h" -#include "core/hle/service/nvdrv/memory_manager.h" namespace Service { namespace Nvidia { @@ -21,8 +20,7 @@ constexpr u32 NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO(0x8); class nvhost_gpu final : public nvdevice { public: - nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev, std::shared_ptr<MemoryManager> memory_manager) - : nvmap_dev(std::move(nvmap_dev)), memory_manager(std::move(memory_manager)) {} + nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} ~nvhost_gpu() override = default; u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; @@ -139,7 +137,6 @@ private: u32 SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& output); std::shared_ptr<nvmap> nvmap_dev; - std::shared_ptr<MemoryManager> memory_manager; }; } // namespace Devices |