summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-06-03 11:18:00 -0400
committerGravatar GitHub2018-06-03 11:18:00 -0400
commit41faeeeb037700dd66d124c9b45a55d4d7045759 (patch)
tree72bfc306c39d1f7ea8f490eafde772325dea2b00 /src
parentMerge pull request #496 from Subv/waitprocesswidekey_timeout (diff)
parentServices/nvdrv: add '/dev/nvhost-nvdec' device (diff)
downloadyuzu-41faeeeb037700dd66d124c9b45a55d4d7045759.tar.gz
yuzu-41faeeeb037700dd66d124c9b45a55d4d7045759.tar.xz
yuzu-41faeeeb037700dd66d124c9b45a55d4d7045759.zip
Merge pull request #484 from mailwl/nvhost-nvdec
Services/nvdrv: add '/dev/nvhost-nvdec' device
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp32
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec.h38
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp2
4 files changed, 74 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 7ab60c5bc..aff1d2180 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -175,6 +175,8 @@ add_library(core STATIC
175 hle/service/nvdrv/devices/nvhost_ctrl_gpu.h 175 hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
176 hle/service/nvdrv/devices/nvhost_gpu.cpp 176 hle/service/nvdrv/devices/nvhost_gpu.cpp
177 hle/service/nvdrv/devices/nvhost_gpu.h 177 hle/service/nvdrv/devices/nvhost_gpu.h
178 hle/service/nvdrv/devices/nvhost_nvdec.cpp
179 hle/service/nvdrv/devices/nvhost_nvdec.h
178 hle/service/nvdrv/devices/nvmap.cpp 180 hle/service/nvdrv/devices/nvmap.cpp
179 hle/service/nvdrv/devices/nvmap.h 181 hle/service/nvdrv/devices/nvmap.h
180 hle/service/nvdrv/interface.cpp 182 hle/service/nvdrv/interface.cpp
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
new file mode 100644
index 000000000..0b6c22898
--- /dev/null
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
@@ -0,0 +1,32 @@
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 "common/assert.h"
6#include "common/logging/log.h"
7#include "core/hle/service/nvdrv/devices/nvhost_nvdec.h"
8
9namespace Service::Nvidia::Devices {
10
11u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
12 NGLOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
13 command.raw, input.size(), output.size());
14
15 switch (static_cast<IoctlCommand>(command.raw)) {
16 case IoctlCommand::IocSetNVMAPfdCommand:
17 return SetNVMAPfd(input, output);
18 }
19
20 UNIMPLEMENTED_MSG("Unimplemented ioctl");
21 return 0;
22}
23
24u32 nvhost_nvdec::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
25 IoctlSetNvmapFD params{};
26 std::memcpy(&params, input.data(), input.size());
27 NGLOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
28 nvmap_fd = params.nvmap_fd;
29 return 0;
30}
31
32} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
new file mode 100644
index 000000000..0192aecdd
--- /dev/null
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
@@ -0,0 +1,38 @@
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 <array>
8#include <cstdlib>
9#include <cstring>
10#include <vector>
11#include "common/common_types.h"
12#include "core/hle/service/nvdrv/devices/nvdevice.h"
13
14namespace Service::Nvidia::Devices {
15
16class nvhost_nvdec final : public nvdevice {
17public:
18 nvhost_nvdec() = default;
19 ~nvhost_nvdec() override = default;
20
21 u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;
22
23private:
24 enum class IoctlCommand : u32_le {
25 IocSetNVMAPfdCommand = 0x40044801,
26 };
27
28 struct IoctlSetNvmapFD {
29 u32_le nvmap_fd;
30 };
31 static_assert(sizeof(IoctlSetNvmapFD) == 4, "IoctlSetNvmapFD is incorrect size");
32
33 u32_le nvmap_fd{};
34
35 u32 SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output);
36};
37
38} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index a6a4ab7d3..cc5cfe34e 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -9,6 +9,7 @@
9#include "core/hle/service/nvdrv/devices/nvhost_ctrl.h" 9#include "core/hle/service/nvdrv/devices/nvhost_ctrl.h"
10#include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h" 10#include "core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h"
11#include "core/hle/service/nvdrv/devices/nvhost_gpu.h" 11#include "core/hle/service/nvdrv/devices/nvhost_gpu.h"
12#include "core/hle/service/nvdrv/devices/nvhost_nvdec.h"
12#include "core/hle/service/nvdrv/devices/nvmap.h" 13#include "core/hle/service/nvdrv/devices/nvmap.h"
13#include "core/hle/service/nvdrv/interface.h" 14#include "core/hle/service/nvdrv/interface.h"
14#include "core/hle/service/nvdrv/nvdrv.h" 15#include "core/hle/service/nvdrv/nvdrv.h"
@@ -36,6 +37,7 @@ Module::Module() {
36 devices["/dev/nvmap"] = nvmap_dev; 37 devices["/dev/nvmap"] = nvmap_dev;
37 devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev); 38 devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev);
38 devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>(); 39 devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>();
40 devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>();
39} 41}
40 42
41u32 Module::Open(std::string device_name) { 43u32 Module::Open(std::string device_name) {