diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp | 34 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h | 36 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | 34 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_vic.h | 36 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.cpp | 4 |
6 files changed, 148 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index cceb1564b..0b0ae5ccc 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -249,6 +249,10 @@ add_library(core STATIC | |||
| 249 | hle/service/nvdrv/devices/nvhost_gpu.h | 249 | hle/service/nvdrv/devices/nvhost_gpu.h |
| 250 | hle/service/nvdrv/devices/nvhost_nvdec.cpp | 250 | hle/service/nvdrv/devices/nvhost_nvdec.cpp |
| 251 | hle/service/nvdrv/devices/nvhost_nvdec.h | 251 | hle/service/nvdrv/devices/nvhost_nvdec.h |
| 252 | hle/service/nvdrv/devices/nvhost_nvjpg.cpp | ||
| 253 | hle/service/nvdrv/devices/nvhost_nvjpg.h | ||
| 254 | hle/service/nvdrv/devices/nvhost_vic.cpp | ||
| 255 | hle/service/nvdrv/devices/nvhost_vic.h | ||
| 252 | hle/service/nvdrv/devices/nvmap.cpp | 256 | hle/service/nvdrv/devices/nvmap.cpp |
| 253 | hle/service/nvdrv/devices/nvmap.h | 257 | hle/service/nvdrv/devices/nvmap.h |
| 254 | hle/service/nvdrv/interface.cpp | 258 | hle/service/nvdrv/interface.cpp |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp new file mode 100644 index 000000000..51f01077b --- /dev/null +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <cstring> | ||
| 6 | |||
| 7 | #include "common/assert.h" | ||
| 8 | #include "common/logging/log.h" | ||
| 9 | #include "core/hle/service/nvdrv/devices/nvhost_nvjpg.h" | ||
| 10 | |||
| 11 | namespace Service::Nvidia::Devices { | ||
| 12 | |||
| 13 | u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | ||
| 14 | LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", | ||
| 15 | command.raw, input.size(), output.size()); | ||
| 16 | |||
| 17 | switch (static_cast<IoctlCommand>(command.raw)) { | ||
| 18 | case IoctlCommand::IocSetNVMAPfdCommand: | ||
| 19 | return SetNVMAPfd(input, output); | ||
| 20 | } | ||
| 21 | |||
| 22 | UNIMPLEMENTED_MSG("Unimplemented ioctl"); | ||
| 23 | return 0; | ||
| 24 | } | ||
| 25 | |||
| 26 | u32 nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { | ||
| 27 | IoctlSetNvmapFD params{}; | ||
| 28 | std::memcpy(¶ms, input.data(), input.size()); | ||
| 29 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); | ||
| 30 | nvmap_fd = params.nvmap_fd; | ||
| 31 | return 0; | ||
| 32 | } | ||
| 33 | |||
| 34 | } // namespace Service::Nvidia::Devices | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h new file mode 100644 index 000000000..2b0eb43ee --- /dev/null +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <vector> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | #include "common/swap.h" | ||
| 10 | #include "core/hle/service/nvdrv/devices/nvdevice.h" | ||
| 11 | |||
| 12 | namespace Service::Nvidia::Devices { | ||
| 13 | |||
| 14 | class nvhost_nvjpg final : public nvdevice { | ||
| 15 | public: | ||
| 16 | nvhost_nvjpg() = default; | ||
| 17 | ~nvhost_nvjpg() override = default; | ||
| 18 | |||
| 19 | u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | ||
| 20 | |||
| 21 | private: | ||
| 22 | enum class IoctlCommand : u32_le { | ||
| 23 | IocSetNVMAPfdCommand = 0x40044801, | ||
| 24 | }; | ||
| 25 | |||
| 26 | struct IoctlSetNvmapFD { | ||
| 27 | u32_le nvmap_fd; | ||
| 28 | }; | ||
| 29 | static_assert(sizeof(IoctlSetNvmapFD) == 4, "IoctlSetNvmapFD is incorrect size"); | ||
| 30 | |||
| 31 | u32_le nvmap_fd{}; | ||
| 32 | |||
| 33 | u32 SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output); | ||
| 34 | }; | ||
| 35 | |||
| 36 | } // namespace Service::Nvidia::Devices | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp new file mode 100644 index 000000000..fcb488d50 --- /dev/null +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <cstring> | ||
| 6 | |||
| 7 | #include "common/assert.h" | ||
| 8 | #include "common/logging/log.h" | ||
| 9 | #include "core/hle/service/nvdrv/devices/nvhost_vic.h" | ||
| 10 | |||
| 11 | namespace Service::Nvidia::Devices { | ||
| 12 | |||
| 13 | u32 nvhost_vic::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | ||
| 14 | LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}", | ||
| 15 | command.raw, input.size(), output.size()); | ||
| 16 | |||
| 17 | switch (static_cast<IoctlCommand>(command.raw)) { | ||
| 18 | case IoctlCommand::IocSetNVMAPfdCommand: | ||
| 19 | return SetNVMAPfd(input, output); | ||
| 20 | } | ||
| 21 | |||
| 22 | UNIMPLEMENTED_MSG("Unimplemented ioctl"); | ||
| 23 | return 0; | ||
| 24 | } | ||
| 25 | |||
| 26 | u32 nvhost_vic::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { | ||
| 27 | IoctlSetNvmapFD params{}; | ||
| 28 | std::memcpy(¶ms, input.data(), input.size()); | ||
| 29 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); | ||
| 30 | nvmap_fd = params.nvmap_fd; | ||
| 31 | return 0; | ||
| 32 | } | ||
| 33 | |||
| 34 | } // namespace Service::Nvidia::Devices | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h new file mode 100644 index 000000000..c7d681e52 --- /dev/null +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <vector> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | #include "common/swap.h" | ||
| 10 | #include "core/hle/service/nvdrv/devices/nvdevice.h" | ||
| 11 | |||
| 12 | namespace Service::Nvidia::Devices { | ||
| 13 | |||
| 14 | class nvhost_vic final : public nvdevice { | ||
| 15 | public: | ||
| 16 | nvhost_vic() = default; | ||
| 17 | ~nvhost_vic() override = default; | ||
| 18 | |||
| 19 | u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | ||
| 20 | |||
| 21 | private: | ||
| 22 | enum class IoctlCommand : u32_le { | ||
| 23 | IocSetNVMAPfdCommand = 0x40044801, | ||
| 24 | }; | ||
| 25 | |||
| 26 | struct IoctlSetNvmapFD { | ||
| 27 | u32_le nvmap_fd; | ||
| 28 | }; | ||
| 29 | static_assert(sizeof(IoctlSetNvmapFD) == 4, "IoctlSetNvmapFD is incorrect size"); | ||
| 30 | |||
| 31 | u32_le nvmap_fd{}; | ||
| 32 | |||
| 33 | u32 SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output); | ||
| 34 | }; | ||
| 35 | |||
| 36 | } // namespace Service::Nvidia::Devices | ||
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 427f4b574..2de39822f 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -12,6 +12,8 @@ | |||
| 12 | #include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" | 12 | #include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" |
| 13 | #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" | 13 | #include "core/hle/service/nvdrv/devices/nvhost_gpu.h" |
| 14 | #include "core/hle/service/nvdrv/devices/nvhost_nvdec.h" | 14 | #include "core/hle/service/nvdrv/devices/nvhost_nvdec.h" |
| 15 | #include "core/hle/service/nvdrv/devices/nvhost_nvjpg.h" | ||
| 16 | #include "core/hle/service/nvdrv/devices/nvhost_vic.h" | ||
| 15 | #include "core/hle/service/nvdrv/devices/nvmap.h" | 17 | #include "core/hle/service/nvdrv/devices/nvmap.h" |
| 16 | #include "core/hle/service/nvdrv/interface.h" | 18 | #include "core/hle/service/nvdrv/interface.h" |
| 17 | #include "core/hle/service/nvdrv/nvdrv.h" | 19 | #include "core/hle/service/nvdrv/nvdrv.h" |
| @@ -39,6 +41,8 @@ Module::Module() { | |||
| 39 | devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev); | 41 | devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev); |
| 40 | devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(); | 42 | devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(); |
| 41 | devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(); | 43 | devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(); |
| 44 | devices["/dev/nvhost-nvjpg"] = std::make_shared<Devices::nvhost_nvjpg>(); | ||
| 45 | devices["/dev/nvhost-vic"] = std::make_shared<Devices::nvhost_vic>(); | ||
| 42 | } | 46 | } |
| 43 | 47 | ||
| 44 | u32 Module::Open(const std::string& device_name) { | 48 | u32 Module::Open(const std::string& device_name) { |