diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | 3 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_vic.h | 3 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 9 |
5 files changed, 27 insertions, 17 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index 8e2a16d86..8314d1ec2 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp | |||
| @@ -20,8 +20,12 @@ NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 20 | switch (command.group) { | 20 | switch (command.group) { |
| 21 | case 0x0: | 21 | case 0x0: |
| 22 | switch (command.cmd) { | 22 | switch (command.cmd) { |
| 23 | case 0x1: | 23 | case 0x1: { |
| 24 | if (!fd_to_id.contains(fd)) { | ||
| 25 | fd_to_id[fd] = next_id++; | ||
| 26 | } | ||
| 24 | return Submit(fd, input, output); | 27 | return Submit(fd, input, output); |
| 28 | } | ||
| 25 | case 0x2: | 29 | case 0x2: |
| 26 | return GetSyncpoint(input, output); | 30 | return GetSyncpoint(input, output); |
| 27 | case 0x3: | 31 | case 0x3: |
| @@ -62,15 +66,13 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 62 | return NvResult::NotImplemented; | 66 | return NvResult::NotImplemented; |
| 63 | } | 67 | } |
| 64 | 68 | ||
| 65 | void nvhost_nvdec::OnOpen(DeviceFD fd) { | 69 | void nvhost_nvdec::OnOpen(DeviceFD fd) {} |
| 66 | static u32 next_id{}; | ||
| 67 | fd_to_id[fd] = next_id++; | ||
| 68 | } | ||
| 69 | 70 | ||
| 70 | void nvhost_nvdec::OnClose(DeviceFD fd) { | 71 | void nvhost_nvdec::OnClose(DeviceFD fd) { |
| 71 | LOG_INFO(Service_NVDRV, "NVDEC video stream ended"); | 72 | LOG_INFO(Service_NVDRV, "NVDEC video stream ended"); |
| 72 | if (fd_to_id.find(fd) != fd_to_id.end()) { | 73 | const auto iter = fd_to_id.find(fd); |
| 73 | system.GPU().ClearCdmaInstance(fd_to_id[fd]); | 74 | if (iter != fd_to_id.end()) { |
| 75 | system.GPU().ClearCdmaInstance(iter->second); | ||
| 74 | } | 76 | } |
| 75 | } | 77 | } |
| 76 | 78 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index 523d96e3a..a507c4d0a 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | |||
| @@ -24,6 +24,9 @@ public: | |||
| 24 | 24 | ||
| 25 | void OnOpen(DeviceFD fd) override; | 25 | void OnOpen(DeviceFD fd) override; |
| 26 | void OnClose(DeviceFD fd) override; | 26 | void OnClose(DeviceFD fd) override; |
| 27 | |||
| 28 | private: | ||
| 29 | u32 next_id{}; | ||
| 27 | }; | 30 | }; |
| 28 | 31 | ||
| 29 | } // namespace Service::Nvidia::Devices | 32 | } // 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 index 420fe21c8..76b39806f 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | |||
| @@ -21,6 +21,9 @@ NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& i | |||
| 21 | case 0x0: | 21 | case 0x0: |
| 22 | switch (command.cmd) { | 22 | switch (command.cmd) { |
| 23 | case 0x1: | 23 | case 0x1: |
| 24 | if (!fd_to_id.contains(fd)) { | ||
| 25 | fd_to_id[fd] = next_id++; | ||
| 26 | } | ||
| 24 | return Submit(fd, input, output); | 27 | return Submit(fd, input, output); |
| 25 | case 0x2: | 28 | case 0x2: |
| 26 | return GetSyncpoint(input, output); | 29 | return GetSyncpoint(input, output); |
| @@ -62,14 +65,12 @@ NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& i | |||
| 62 | return NvResult::NotImplemented; | 65 | return NvResult::NotImplemented; |
| 63 | } | 66 | } |
| 64 | 67 | ||
| 65 | void nvhost_vic::OnOpen(DeviceFD fd) { | 68 | void nvhost_vic::OnOpen(DeviceFD fd) {} |
| 66 | static u32 next_id{}; | ||
| 67 | fd_to_id[fd] = next_id++; | ||
| 68 | } | ||
| 69 | 69 | ||
| 70 | void nvhost_vic::OnClose(DeviceFD fd) { | 70 | void nvhost_vic::OnClose(DeviceFD fd) { |
| 71 | if (fd_to_id.find(fd) != fd_to_id.end()) { | 71 | const auto iter = fd_to_id.find(fd); |
| 72 | system.GPU().ClearCdmaInstance(fd_to_id[fd]); | 72 | if (iter != fd_to_id.end()) { |
| 73 | system.GPU().ClearCdmaInstance(iter->second); | ||
| 73 | } | 74 | } |
| 74 | } | 75 | } |
| 75 | 76 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h index 6d7fda9d1..c9732c037 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h | |||
| @@ -23,5 +23,8 @@ public: | |||
| 23 | 23 | ||
| 24 | void OnOpen(DeviceFD fd) override; | 24 | void OnOpen(DeviceFD fd) override; |
| 25 | void OnClose(DeviceFD fd) override; | 25 | void OnClose(DeviceFD fd) override; |
| 26 | |||
| 27 | private: | ||
| 28 | u32 next_id{}; | ||
| 26 | }; | 29 | }; |
| 27 | } // namespace Service::Nvidia::Devices | 30 | } // namespace Service::Nvidia::Devices |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 27a47954d..8788f5148 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -333,8 +333,8 @@ struct GPU::Impl { | |||
| 333 | return; | 333 | return; |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | if (cdma_pushers.find(id) == cdma_pushers.end()) { | 336 | if (!cdma_pushers.contains(id)) { |
| 337 | cdma_pushers[id] = std::make_unique<Tegra::CDmaPusher>(gpu); | 337 | cdma_pushers.insert_or_assign(id, std::make_unique<Tegra::CDmaPusher>(gpu)); |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | // SubmitCommandBuffer would make the nvdec operations async, this is not currently working | 340 | // SubmitCommandBuffer would make the nvdec operations async, this is not currently working |
| @@ -345,8 +345,9 @@ struct GPU::Impl { | |||
| 345 | 345 | ||
| 346 | /// Frees the CDMAPusher instance to free up resources | 346 | /// Frees the CDMAPusher instance to free up resources |
| 347 | void ClearCdmaInstance(u32 id) { | 347 | void ClearCdmaInstance(u32 id) { |
| 348 | if (cdma_pushers.find(id) != cdma_pushers.end()) { | 348 | const auto iter = cdma_pushers.find(id); |
| 349 | cdma_pushers.erase(id); | 349 | if (iter != cdma_pushers.end()) { |
| 350 | cdma_pushers.erase(iter); | ||
| 350 | } | 351 | } |
| 351 | } | 352 | } |
| 352 | 353 | ||