diff options
| author | 2021-03-29 12:53:55 -0700 | |
|---|---|---|
| committer | 2021-03-29 12:53:55 -0700 | |
| commit | fb7dcbf7af4fc718bccd3641dcdf997a4310da53 (patch) | |
| tree | c5a8bd45de1f318f36c0b876898d8b716f143679 | |
| parent | Merge pull request #6118 from MerryMage/dynarmic (diff) | |
| parent | nvdrv: Pass device fd and handle device create methods for device opening and... (diff) | |
| download | yuzu-fb7dcbf7af4fc718bccd3641dcdf997a4310da53.tar.gz yuzu-fb7dcbf7af4fc718bccd3641dcdf997a4310da53.tar.xz yuzu-fb7dcbf7af4fc718bccd3641dcdf997a4310da53.zip | |
Merge pull request #6102 from ogniK5377/fd-pass
nvdrv: Pass device fd and handle device create methods for device opening and closing
20 files changed, 161 insertions, 78 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h index 5681599ba..b37f023df 100644 --- a/src/core/hle/service/nvdrv/devices/nvdevice.h +++ b/src/core/hle/service/nvdrv/devices/nvdevice.h | |||
| @@ -31,7 +31,7 @@ public: | |||
| 31 | * @param output A buffer where the output data will be written to. | 31 | * @param output A buffer where the output data will be written to. |
| 32 | * @returns The result code of the ioctl. | 32 | * @returns The result code of the ioctl. |
| 33 | */ | 33 | */ |
| 34 | virtual NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, | 34 | virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 35 | std::vector<u8>& output) = 0; | 35 | std::vector<u8>& output) = 0; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| @@ -42,7 +42,7 @@ public: | |||
| 42 | * @param output A buffer where the output data will be written to. | 42 | * @param output A buffer where the output data will be written to. |
| 43 | * @returns The result code of the ioctl. | 43 | * @returns The result code of the ioctl. |
| 44 | */ | 44 | */ |
| 45 | virtual NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 45 | virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 46 | const std::vector<u8>& inline_input, std::vector<u8>& output) = 0; | 46 | const std::vector<u8>& inline_input, std::vector<u8>& output) = 0; |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| @@ -53,8 +53,20 @@ public: | |||
| 53 | * @param inline_output A buffer where the inlined output data will be written to. | 53 | * @param inline_output A buffer where the inlined output data will be written to. |
| 54 | * @returns The result code of the ioctl. | 54 | * @returns The result code of the ioctl. |
| 55 | */ | 55 | */ |
| 56 | virtual NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 56 | virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 57 | std::vector<u8>& inline_output) = 0; | 57 | std::vector<u8>& output, std::vector<u8>& inline_output) = 0; |
| 58 | |||
| 59 | /** | ||
| 60 | * Called once a device is openned | ||
| 61 | * @param fd The device fd | ||
| 62 | */ | ||
| 63 | virtual void OnOpen(DeviceFD fd) = 0; | ||
| 64 | |||
| 65 | /** | ||
| 66 | * Called once a device is closed | ||
| 67 | * @param fd The device fd | ||
| 68 | */ | ||
| 69 | virtual void OnClose(DeviceFD fd) = 0; | ||
| 58 | 70 | ||
| 59 | protected: | 71 | protected: |
| 60 | Core::System& system; | 72 | Core::System& system; |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index ce615c758..5ab7e39b0 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp | |||
| @@ -18,24 +18,27 @@ nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_de | |||
| 18 | : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} | 18 | : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} |
| 19 | nvdisp_disp0 ::~nvdisp_disp0() = default; | 19 | nvdisp_disp0 ::~nvdisp_disp0() = default; |
| 20 | 20 | ||
| 21 | NvResult nvdisp_disp0::Ioctl1(Ioctl command, const std::vector<u8>& input, | 21 | NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 22 | std::vector<u8>& output) { | 22 | std::vector<u8>& output) { |
| 23 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 23 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 24 | return NvResult::NotImplemented; | 24 | return NvResult::NotImplemented; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | NvResult nvdisp_disp0::Ioctl2(Ioctl command, const std::vector<u8>& input, | 27 | NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 28 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 28 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 29 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 29 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 30 | return NvResult::NotImplemented; | 30 | return NvResult::NotImplemented; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | NvResult nvdisp_disp0::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 33 | NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 34 | std::vector<u8>& inline_output) { | 34 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 35 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 35 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 36 | return NvResult::NotImplemented; | 36 | return NvResult::NotImplemented; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void nvdisp_disp0::OnOpen(DeviceFD fd) {} | ||
| 40 | void nvdisp_disp0::OnClose(DeviceFD fd) {} | ||
| 41 | |||
| 39 | void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, | 42 | void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, |
| 40 | u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, | 43 | u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, |
| 41 | const Common::Rectangle<int>& crop_rect) { | 44 | const Common::Rectangle<int>& crop_rect) { |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h index 55a33b7e4..59c9b6101 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h | |||
| @@ -20,11 +20,15 @@ public: | |||
| 20 | explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); | 20 | explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); |
| 21 | ~nvdisp_disp0() override; | 21 | ~nvdisp_disp0() override; |
| 22 | 22 | ||
| 23 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 23 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 24 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 24 | std::vector<u8>& output) override; |
| 25 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 25 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 26 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 26 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 27 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 27 | std::vector<u8>& inline_output) override; | 28 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 29 | |||
| 30 | void OnOpen(DeviceFD fd) override; | ||
| 31 | void OnClose(DeviceFD fd) override; | ||
| 28 | 32 | ||
| 29 | /// Performs a screen flip, drawing the buffer pointed to by the handle. | 33 | /// Performs a screen flip, drawing the buffer pointed to by the handle. |
| 30 | void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, | 34 | void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, |
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 485ac5f50..f7b3dc317 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | |||
| @@ -21,7 +21,7 @@ nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_ | |||
| 21 | : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} | 21 | : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} |
| 22 | nvhost_as_gpu::~nvhost_as_gpu() = default; | 22 | nvhost_as_gpu::~nvhost_as_gpu() = default; |
| 23 | 23 | ||
| 24 | NvResult nvhost_as_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | 24 | NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 25 | std::vector<u8>& output) { | 25 | std::vector<u8>& output) { |
| 26 | switch (command.group) { | 26 | switch (command.group) { |
| 27 | case 'A': | 27 | case 'A': |
| @@ -54,14 +54,14 @@ NvResult nvhost_as_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 54 | return NvResult::NotImplemented; | 54 | return NvResult::NotImplemented; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | NvResult nvhost_as_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, | 57 | NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 58 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 58 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 59 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 59 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 60 | return NvResult::NotImplemented; | 60 | return NvResult::NotImplemented; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | NvResult nvhost_as_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 63 | NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 64 | std::vector<u8>& inline_output) { | 64 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 65 | switch (command.group) { | 65 | switch (command.group) { |
| 66 | case 'A': | 66 | case 'A': |
| 67 | switch (command.cmd) { | 67 | switch (command.cmd) { |
| @@ -78,6 +78,9 @@ NvResult nvhost_as_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std: | |||
| 78 | return NvResult::NotImplemented; | 78 | return NvResult::NotImplemented; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void nvhost_as_gpu::OnOpen(DeviceFD fd) {} | ||
| 82 | void nvhost_as_gpu::OnClose(DeviceFD fd) {} | ||
| 83 | |||
| 81 | NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output) { | 84 | NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output) { |
| 82 | IoctlAllocAsEx params{}; | 85 | IoctlAllocAsEx params{}; |
| 83 | std::memcpy(¶ms, input.data(), input.size()); | 86 | std::memcpy(¶ms, input.data(), input.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 9ee60e060..d86a9cab6 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h | |||
| @@ -33,11 +33,15 @@ public: | |||
| 33 | explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); | 33 | explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); |
| 34 | ~nvhost_as_gpu() override; | 34 | ~nvhost_as_gpu() override; |
| 35 | 35 | ||
| 36 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 36 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 37 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 37 | std::vector<u8>& output) override; |
| 38 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 38 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 39 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 39 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 40 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 40 | std::vector<u8>& inline_output) override; | 41 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 42 | |||
| 43 | void OnOpen(DeviceFD fd) override; | ||
| 44 | void OnClose(DeviceFD fd) override; | ||
| 41 | 45 | ||
| 42 | private: | 46 | private: |
| 43 | class BufferMap final { | 47 | class BufferMap final { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index f6129ef10..9f00d5cb0 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | |||
| @@ -20,7 +20,8 @@ nvhost_ctrl::nvhost_ctrl(Core::System& system, EventInterface& events_interface, | |||
| 20 | : nvdevice(system), events_interface{events_interface}, syncpoint_manager{syncpoint_manager} {} | 20 | : nvdevice(system), events_interface{events_interface}, syncpoint_manager{syncpoint_manager} {} |
| 21 | nvhost_ctrl::~nvhost_ctrl() = default; | 21 | nvhost_ctrl::~nvhost_ctrl() = default; |
| 22 | 22 | ||
| 23 | NvResult nvhost_ctrl::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | 23 | NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 24 | std::vector<u8>& output) { | ||
| 24 | switch (command.group) { | 25 | switch (command.group) { |
| 25 | case 0x0: | 26 | case 0x0: |
| 26 | switch (command.cmd) { | 27 | switch (command.cmd) { |
| @@ -46,18 +47,21 @@ NvResult nvhost_ctrl::Ioctl1(Ioctl command, const std::vector<u8>& input, std::v | |||
| 46 | return NvResult::NotImplemented; | 47 | return NvResult::NotImplemented; |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | NvResult nvhost_ctrl::Ioctl2(Ioctl command, const std::vector<u8>& input, | 50 | NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 50 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 51 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 51 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 52 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 52 | return NvResult::NotImplemented; | 53 | return NvResult::NotImplemented; |
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | NvResult nvhost_ctrl::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 56 | NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 56 | std::vector<u8>& inline_outpu) { | 57 | std::vector<u8>& output, std::vector<u8>& inline_outpu) { |
| 57 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 58 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 58 | return NvResult::NotImplemented; | 59 | return NvResult::NotImplemented; |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 62 | void nvhost_ctrl::OnOpen(DeviceFD fd) {} | ||
| 63 | void nvhost_ctrl::OnClose(DeviceFD fd) {} | ||
| 64 | |||
| 61 | NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { | 65 | NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { |
| 62 | IocGetConfigParams params{}; | 66 | IocGetConfigParams params{}; |
| 63 | std::memcpy(¶ms, input.data(), sizeof(params)); | 67 | std::memcpy(¶ms, input.data(), sizeof(params)); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h index c5aa1362a..9178789c3 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | |||
| @@ -18,11 +18,15 @@ public: | |||
| 18 | SyncpointManager& syncpoint_manager); | 18 | SyncpointManager& syncpoint_manager); |
| 19 | ~nvhost_ctrl() override; | 19 | ~nvhost_ctrl() override; |
| 20 | 20 | ||
| 21 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 21 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 22 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 22 | std::vector<u8>& output) override; |
| 23 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 23 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 24 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 24 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 25 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 25 | std::vector<u8>& inline_output) override; | 26 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 27 | |||
| 28 | void OnOpen(DeviceFD fd) override; | ||
| 29 | void OnClose(DeviceFD fd) override; | ||
| 26 | 30 | ||
| 27 | private: | 31 | private: |
| 28 | struct IocSyncptReadParams { | 32 | struct IocSyncptReadParams { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index 0320d3ae2..933d42f3f 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp | |||
| @@ -15,7 +15,7 @@ namespace Service::Nvidia::Devices { | |||
| 15 | nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system) {} | 15 | nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system) {} |
| 16 | nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default; | 16 | nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default; |
| 17 | 17 | ||
| 18 | NvResult nvhost_ctrl_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | 18 | NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 19 | std::vector<u8>& output) { | 19 | std::vector<u8>& output) { |
| 20 | switch (command.group) { | 20 | switch (command.group) { |
| 21 | case 'G': | 21 | case 'G': |
| @@ -47,13 +47,13 @@ NvResult nvhost_ctrl_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 47 | return NvResult::NotImplemented; | 47 | return NvResult::NotImplemented; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | NvResult nvhost_ctrl_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, | 50 | NvResult nvhost_ctrl_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 51 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 51 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 52 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 52 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 53 | return NvResult::NotImplemented; | 53 | return NvResult::NotImplemented; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | NvResult nvhost_ctrl_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, | 56 | NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 57 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 57 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 58 | switch (command.group) { | 58 | switch (command.group) { |
| 59 | case 'G': | 59 | case 'G': |
| @@ -73,6 +73,9 @@ NvResult nvhost_ctrl_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, | |||
| 73 | return NvResult::NotImplemented; | 73 | return NvResult::NotImplemented; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void nvhost_ctrl_gpu::OnOpen(DeviceFD fd) {} | ||
| 77 | void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {} | ||
| 78 | |||
| 76 | NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, | 79 | NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, |
| 77 | std::vector<u8>& output) { | 80 | std::vector<u8>& output) { |
| 78 | LOG_DEBUG(Service_NVDRV, "called"); | 81 | LOG_DEBUG(Service_NVDRV, "called"); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h index 137b88238..f98aa841a 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h | |||
| @@ -16,11 +16,15 @@ public: | |||
| 16 | explicit nvhost_ctrl_gpu(Core::System& system); | 16 | explicit nvhost_ctrl_gpu(Core::System& system); |
| 17 | ~nvhost_ctrl_gpu() override; | 17 | ~nvhost_ctrl_gpu() override; |
| 18 | 18 | ||
| 19 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 19 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 20 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 20 | std::vector<u8>& output) override; |
| 21 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 21 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 22 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 22 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 23 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 23 | std::vector<u8>& inline_output) override; | 24 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 25 | |||
| 26 | void OnOpen(DeviceFD fd) override; | ||
| 27 | void OnClose(DeviceFD fd) override; | ||
| 24 | 28 | ||
| 25 | private: | 29 | private: |
| 26 | struct IoctlGpuCharacteristics { | 30 | struct IoctlGpuCharacteristics { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index af8b3d9f1..e83aaa798 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | |||
| @@ -23,7 +23,8 @@ nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev, | |||
| 23 | 23 | ||
| 24 | nvhost_gpu::~nvhost_gpu() = default; | 24 | nvhost_gpu::~nvhost_gpu() = default; |
| 25 | 25 | ||
| 26 | NvResult nvhost_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | 26 | NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 27 | std::vector<u8>& output) { | ||
| 27 | switch (command.group) { | 28 | switch (command.group) { |
| 28 | case 0x0: | 29 | case 0x0: |
| 29 | switch (command.cmd) { | 30 | switch (command.cmd) { |
| @@ -74,7 +75,7 @@ NvResult nvhost_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, std::ve | |||
| 74 | return NvResult::NotImplemented; | 75 | return NvResult::NotImplemented; |
| 75 | }; | 76 | }; |
| 76 | 77 | ||
| 77 | NvResult nvhost_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, | 78 | NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 78 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 79 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 79 | switch (command.group) { | 80 | switch (command.group) { |
| 80 | case 'H': | 81 | case 'H': |
| @@ -88,12 +89,15 @@ NvResult nvhost_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, | |||
| 88 | return NvResult::NotImplemented; | 89 | return NvResult::NotImplemented; |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | NvResult nvhost_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 92 | NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 92 | std::vector<u8>& inline_output) { | 93 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 93 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 94 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 94 | return NvResult::NotImplemented; | 95 | return NvResult::NotImplemented; |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 98 | void nvhost_gpu::OnOpen(DeviceFD fd) {} | ||
| 99 | void nvhost_gpu::OnClose(DeviceFD fd) {} | ||
| 100 | |||
| 97 | NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { | 101 | NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { |
| 98 | IoctlSetNvmapFD params{}; | 102 | IoctlSetNvmapFD params{}; |
| 99 | std::memcpy(¶ms, input.data(), input.size()); | 103 | std::memcpy(¶ms, input.data(), input.size()); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index e0298b4fe..12a1a1133 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h | |||
| @@ -26,11 +26,15 @@ public: | |||
| 26 | SyncpointManager& syncpoint_manager); | 26 | SyncpointManager& syncpoint_manager); |
| 27 | ~nvhost_gpu() override; | 27 | ~nvhost_gpu() override; |
| 28 | 28 | ||
| 29 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 29 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 30 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 30 | std::vector<u8>& output) override; |
| 31 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 31 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 32 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 32 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 33 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 33 | std::vector<u8>& inline_output) override; | 34 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 35 | |||
| 36 | void OnOpen(DeviceFD fd) override; | ||
| 37 | void OnClose(DeviceFD fd) override; | ||
| 34 | 38 | ||
| 35 | private: | 39 | private: |
| 36 | enum class CtxObjects : u32_le { | 40 | enum class CtxObjects : u32_le { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index ecba1dba1..c8031970b 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp | |||
| @@ -16,7 +16,7 @@ nvhost_nvdec::nvhost_nvdec(Core::System& system, std::shared_ptr<nvmap> nvmap_de | |||
| 16 | : nvhost_nvdec_common(system, std::move(nvmap_dev), syncpoint_manager) {} | 16 | : nvhost_nvdec_common(system, std::move(nvmap_dev), syncpoint_manager) {} |
| 17 | nvhost_nvdec::~nvhost_nvdec() = default; | 17 | nvhost_nvdec::~nvhost_nvdec() = default; |
| 18 | 18 | ||
| 19 | NvResult nvhost_nvdec::Ioctl1(Ioctl command, const std::vector<u8>& input, | 19 | NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 20 | std::vector<u8>& output) { | 20 | std::vector<u8>& output) { |
| 21 | switch (command.group) { | 21 | switch (command.group) { |
| 22 | case 0x0: | 22 | case 0x0: |
| @@ -57,16 +57,19 @@ NvResult nvhost_nvdec::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 57 | return NvResult::NotImplemented; | 57 | return NvResult::NotImplemented; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | NvResult nvhost_nvdec::Ioctl2(Ioctl command, const std::vector<u8>& input, | 60 | NvResult nvhost_nvdec::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 61 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 61 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 62 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 62 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 63 | return NvResult::NotImplemented; | 63 | return NvResult::NotImplemented; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | NvResult nvhost_nvdec::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 66 | NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 67 | std::vector<u8>& inline_output) { | 67 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 68 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 68 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 69 | return NvResult::NotImplemented; | 69 | return NvResult::NotImplemented; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | void nvhost_nvdec::OnOpen(DeviceFD fd) {} | ||
| 73 | void nvhost_nvdec::OnClose(DeviceFD fd) {} | ||
| 74 | |||
| 72 | } // namespace Service::Nvidia::Devices | 75 | } // 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 index 77ef53cdd..6c38a8c24 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | |||
| @@ -15,11 +15,15 @@ public: | |||
| 15 | SyncpointManager& syncpoint_manager); | 15 | SyncpointManager& syncpoint_manager); |
| 16 | ~nvhost_nvdec() override; | 16 | ~nvhost_nvdec() override; |
| 17 | 17 | ||
| 18 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 18 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 19 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 19 | std::vector<u8>& output) override; |
| 20 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 20 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 21 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 21 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 22 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 22 | std::vector<u8>& inline_output) override; | 23 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 24 | |||
| 25 | void OnOpen(DeviceFD fd) override; | ||
| 26 | void OnClose(DeviceFD fd) override; | ||
| 23 | }; | 27 | }; |
| 24 | 28 | ||
| 25 | } // namespace Service::Nvidia::Devices | 29 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp index 2d06955c0..0a9c35c01 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp | |||
| @@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices { | |||
| 13 | nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system) {} | 13 | nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system) {} |
| 14 | nvhost_nvjpg::~nvhost_nvjpg() = default; | 14 | nvhost_nvjpg::~nvhost_nvjpg() = default; |
| 15 | 15 | ||
| 16 | NvResult nvhost_nvjpg::Ioctl1(Ioctl command, const std::vector<u8>& input, | 16 | NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 17 | std::vector<u8>& output) { | 17 | std::vector<u8>& output) { |
| 18 | switch (command.group) { | 18 | switch (command.group) { |
| 19 | case 'H': | 19 | case 'H': |
| @@ -32,18 +32,21 @@ NvResult nvhost_nvjpg::Ioctl1(Ioctl command, const std::vector<u8>& input, | |||
| 32 | return NvResult::NotImplemented; | 32 | return NvResult::NotImplemented; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | NvResult nvhost_nvjpg::Ioctl2(Ioctl command, const std::vector<u8>& input, | 35 | NvResult nvhost_nvjpg::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 36 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 36 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 37 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 37 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 38 | return NvResult::NotImplemented; | 38 | return NvResult::NotImplemented; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | NvResult nvhost_nvjpg::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 41 | NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 42 | std::vector<u8>& inline_output) { | 42 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 43 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 43 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 44 | return NvResult::NotImplemented; | 44 | return NvResult::NotImplemented; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void nvhost_nvjpg::OnOpen(DeviceFD fd) {} | ||
| 48 | void nvhost_nvjpg::OnClose(DeviceFD fd) {} | ||
| 49 | |||
| 47 | NvResult nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { | 50 | NvResult nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { |
| 48 | IoctlSetNvmapFD params{}; | 51 | IoctlSetNvmapFD params{}; |
| 49 | std::memcpy(¶ms, input.data(), input.size()); | 52 | std::memcpy(¶ms, input.data(), input.size()); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h index 43948d18d..1f97b642f 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h | |||
| @@ -16,11 +16,15 @@ public: | |||
| 16 | explicit nvhost_nvjpg(Core::System& system); | 16 | explicit nvhost_nvjpg(Core::System& system); |
| 17 | ~nvhost_nvjpg() override; | 17 | ~nvhost_nvjpg() override; |
| 18 | 18 | ||
| 19 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 19 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 20 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 20 | std::vector<u8>& output) override; |
| 21 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 21 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 22 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 22 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 23 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 23 | std::vector<u8>& inline_output) override; | 24 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 25 | |||
| 26 | void OnOpen(DeviceFD fd) override; | ||
| 27 | void OnClose(DeviceFD fd) override; | ||
| 24 | 28 | ||
| 25 | private: | 29 | private: |
| 26 | struct IoctlSetNvmapFD { | 30 | struct IoctlSetNvmapFD { |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index 70849a9bd..0421fb956 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | |||
| @@ -16,7 +16,8 @@ nvhost_vic::nvhost_vic(Core::System& system, std::shared_ptr<nvmap> nvmap_dev, | |||
| 16 | 16 | ||
| 17 | nvhost_vic::~nvhost_vic() = default; | 17 | nvhost_vic::~nvhost_vic() = default; |
| 18 | 18 | ||
| 19 | NvResult nvhost_vic::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | 19 | NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 20 | std::vector<u8>& output) { | ||
| 20 | switch (command.group) { | 21 | switch (command.group) { |
| 21 | case 0x0: | 22 | case 0x0: |
| 22 | switch (command.cmd) { | 23 | switch (command.cmd) { |
| @@ -55,16 +56,19 @@ NvResult nvhost_vic::Ioctl1(Ioctl command, const std::vector<u8>& input, std::ve | |||
| 55 | return NvResult::NotImplemented; | 56 | return NvResult::NotImplemented; |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | NvResult nvhost_vic::Ioctl2(Ioctl command, const std::vector<u8>& input, | 59 | NvResult nvhost_vic::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 59 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 60 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 60 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 61 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 61 | return NvResult::NotImplemented; | 62 | return NvResult::NotImplemented; |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | NvResult nvhost_vic::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 65 | NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 65 | std::vector<u8>& inline_output) { | 66 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 66 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 67 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 67 | return NvResult::NotImplemented; | 68 | return NvResult::NotImplemented; |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 71 | void nvhost_vic::OnOpen(DeviceFD fd) {} | ||
| 72 | void nvhost_vic::OnClose(DeviceFD fd) {} | ||
| 73 | |||
| 70 | } // namespace Service::Nvidia::Devices | 74 | } // 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 index f401c61fa..cebefad71 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h | |||
| @@ -14,10 +14,14 @@ public: | |||
| 14 | SyncpointManager& syncpoint_manager); | 14 | SyncpointManager& syncpoint_manager); |
| 15 | ~nvhost_vic(); | 15 | ~nvhost_vic(); |
| 16 | 16 | ||
| 17 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 17 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 18 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 18 | std::vector<u8>& output) override; |
| 19 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 19 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 20 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 20 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 21 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 21 | std::vector<u8>& inline_output) override; | 22 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 23 | |||
| 24 | void OnOpen(DeviceFD fd) override; | ||
| 25 | void OnClose(DeviceFD fd) override; | ||
| 22 | }; | 26 | }; |
| 23 | } // namespace Service::Nvidia::Devices | 27 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 4015a2740..dd1355522 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp | |||
| @@ -19,7 +19,8 @@ nvmap::nvmap(Core::System& system) : nvdevice(system) { | |||
| 19 | 19 | ||
| 20 | nvmap::~nvmap() = default; | 20 | nvmap::~nvmap() = default; |
| 21 | 21 | ||
| 22 | NvResult nvmap::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { | 22 | NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 23 | std::vector<u8>& output) { | ||
| 23 | switch (command.group) { | 24 | switch (command.group) { |
| 24 | case 0x1: | 25 | case 0x1: |
| 25 | switch (command.cmd) { | 26 | switch (command.cmd) { |
| @@ -47,18 +48,21 @@ NvResult nvmap::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector< | |||
| 47 | return NvResult::NotImplemented; | 48 | return NvResult::NotImplemented; |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | NvResult nvmap::Ioctl2(Ioctl command, const std::vector<u8>& input, | 51 | NvResult nvmap::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 51 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 52 | const std::vector<u8>& inline_input, std::vector<u8>& output) { |
| 52 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 53 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 53 | return NvResult::NotImplemented; | 54 | return NvResult::NotImplemented; |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | NvResult nvmap::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 57 | NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 57 | std::vector<u8>& inline_output) { | 58 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 58 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 59 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 59 | return NvResult::NotImplemented; | 60 | return NvResult::NotImplemented; |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 63 | void nvmap::OnOpen(DeviceFD fd) {} | ||
| 64 | void nvmap::OnClose(DeviceFD fd) {} | ||
| 65 | |||
| 62 | VAddr nvmap::GetObjectAddress(u32 handle) const { | 66 | VAddr nvmap::GetObjectAddress(u32 handle) const { |
| 63 | auto object = GetObject(handle); | 67 | auto object = GetObject(handle); |
| 64 | ASSERT(object); | 68 | ASSERT(object); |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 4484bd79f..208875845 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h | |||
| @@ -19,11 +19,15 @@ public: | |||
| 19 | explicit nvmap(Core::System& system); | 19 | explicit nvmap(Core::System& system); |
| 20 | ~nvmap() override; | 20 | ~nvmap() override; |
| 21 | 21 | ||
| 22 | NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; | 22 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 23 | NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, | 23 | std::vector<u8>& output) override; |
| 24 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | ||
| 24 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 25 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; |
| 25 | NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, | 26 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 26 | std::vector<u8>& inline_output) override; | 27 | std::vector<u8>& output, std::vector<u8>& inline_output) override; |
| 28 | |||
| 29 | void OnOpen(DeviceFD fd) override; | ||
| 30 | void OnClose(DeviceFD fd) override; | ||
| 27 | 31 | ||
| 28 | /// Returns the allocated address of an nvmap object given its handle. | 32 | /// Returns the allocated address of an nvmap object given its handle. |
| 29 | VAddr GetObjectAddress(u32 handle) const; | 33 | VAddr GetObjectAddress(u32 handle) const; |
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index abba80112..ede77858a 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -89,6 +89,8 @@ DeviceFD Module::Open(const std::string& device_name) { | |||
| 89 | auto device = devices[device_name]; | 89 | auto device = devices[device_name]; |
| 90 | const DeviceFD fd = next_fd++; | 90 | const DeviceFD fd = next_fd++; |
| 91 | 91 | ||
| 92 | device->OnOpen(fd); | ||
| 93 | |||
| 92 | open_files[fd] = std::move(device); | 94 | open_files[fd] = std::move(device); |
| 93 | 95 | ||
| 94 | return fd; | 96 | return fd; |
| @@ -108,7 +110,7 @@ NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input | |||
| 108 | return NvResult::NotImplemented; | 110 | return NvResult::NotImplemented; |
| 109 | } | 111 | } |
| 110 | 112 | ||
| 111 | return itr->second->Ioctl1(command, input, output); | 113 | return itr->second->Ioctl1(fd, command, input, output); |
| 112 | } | 114 | } |
| 113 | 115 | ||
| 114 | NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 116 | NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| @@ -125,7 +127,7 @@ NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input | |||
| 125 | return NvResult::NotImplemented; | 127 | return NvResult::NotImplemented; |
| 126 | } | 128 | } |
| 127 | 129 | ||
| 128 | return itr->second->Ioctl2(command, input, inline_input, output); | 130 | return itr->second->Ioctl2(fd, command, input, inline_input, output); |
| 129 | } | 131 | } |
| 130 | 132 | ||
| 131 | NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 133 | NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| @@ -142,7 +144,7 @@ NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input | |||
| 142 | return NvResult::NotImplemented; | 144 | return NvResult::NotImplemented; |
| 143 | } | 145 | } |
| 144 | 146 | ||
| 145 | return itr->second->Ioctl3(command, input, output, inline_output); | 147 | return itr->second->Ioctl3(fd, command, input, output, inline_output); |
| 146 | } | 148 | } |
| 147 | 149 | ||
| 148 | NvResult Module::Close(DeviceFD fd) { | 150 | NvResult Module::Close(DeviceFD fd) { |
| @@ -158,6 +160,8 @@ NvResult Module::Close(DeviceFD fd) { | |||
| 158 | return NvResult::NotImplemented; | 160 | return NvResult::NotImplemented; |
| 159 | } | 161 | } |
| 160 | 162 | ||
| 163 | itr->second->OnClose(fd); | ||
| 164 | |||
| 161 | open_files.erase(itr); | 165 | open_files.erase(itr); |
| 162 | 166 | ||
| 163 | return NvResult::Success; | 167 | return NvResult::Success; |