diff options
| author | 2021-03-30 20:37:40 +1100 | |
|---|---|---|
| committer | 2021-03-30 20:37:40 +1100 | |
| commit | bf1c1788cab4740d8c46c30ad8a97021b2e858f9 (patch) | |
| tree | 3d3228a9369adcfe1db58c698b4ba84e86376300 /src | |
| parent | Merge pull request #6109 from german77/gestureID (diff) | |
| download | yuzu-bf1c1788cab4740d8c46c30ad8a97021b2e858f9.tar.gz yuzu-bf1c1788cab4740d8c46c30ad8a97021b2e858f9.tar.xz yuzu-bf1c1788cab4740d8c46c30ad8a97021b2e858f9.zip | |
nvdrv: Cleanup CDMA Processor on device closure
Brings us a step closer to unifying all channels to share a common interface.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 3 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index c8031970b..4e58b9b80 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp | |||
| @@ -32,11 +32,6 @@ NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 32 | case 0x9: | 32 | case 0x9: |
| 33 | return MapBuffer(input, output); | 33 | return MapBuffer(input, output); |
| 34 | case 0xa: { | 34 | case 0xa: { |
| 35 | if (command.length == 0x1c) { | ||
| 36 | LOG_INFO(Service_NVDRV, "NVDEC video stream ended"); | ||
| 37 | Tegra::ChCommandHeaderList cmdlist{{0xDEADB33F}}; | ||
| 38 | system.GPU().PushCommandBuffer(cmdlist); | ||
| 39 | } | ||
| 40 | return UnmapBuffer(input, output); | 35 | return UnmapBuffer(input, output); |
| 41 | } | 36 | } |
| 42 | default: | 37 | default: |
| @@ -70,6 +65,9 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 70 | } | 65 | } |
| 71 | 66 | ||
| 72 | void nvhost_nvdec::OnOpen(DeviceFD fd) {} | 67 | void nvhost_nvdec::OnOpen(DeviceFD fd) {} |
| 73 | void nvhost_nvdec::OnClose(DeviceFD fd) {} | 68 | |
| 69 | void nvhost_nvdec::OnClose(DeviceFD fd) { | ||
| 70 | system.GPU().ClearCommandBuffer(); | ||
| 71 | } | ||
| 74 | 72 | ||
| 75 | } // namespace Service::Nvidia::Devices | 73 | } // namespace Service::Nvidia::Devices |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index c61f44619..811e248a3 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -480,11 +480,7 @@ void GPU::PushCommandBuffer(Tegra::ChCommandHeaderList& entries) { | |||
| 480 | if (!use_nvdec) { | 480 | if (!use_nvdec) { |
| 481 | return; | 481 | return; |
| 482 | } | 482 | } |
| 483 | // This condition fires when a video stream ends, clear all intermediary data | 483 | |
| 484 | if (entries[0].raw == 0xDEADB33F) { | ||
| 485 | cdma_pusher.reset(); | ||
| 486 | return; | ||
| 487 | } | ||
| 488 | if (!cdma_pusher) { | 484 | if (!cdma_pusher) { |
| 489 | cdma_pusher = std::make_unique<Tegra::CDmaPusher>(*this); | 485 | cdma_pusher = std::make_unique<Tegra::CDmaPusher>(*this); |
| 490 | } | 486 | } |
| @@ -496,6 +492,13 @@ void GPU::PushCommandBuffer(Tegra::ChCommandHeaderList& entries) { | |||
| 496 | cdma_pusher->ProcessEntries(std::move(entries)); | 492 | cdma_pusher->ProcessEntries(std::move(entries)); |
| 497 | } | 493 | } |
| 498 | 494 | ||
| 495 | void GPU::ClearCommandBuffer() { | ||
| 496 | // This condition fires when a video stream ends, clear all intermediary data | ||
| 497 | if (cdma_pusher) { | ||
| 498 | cdma_pusher.reset(); | ||
| 499 | } | ||
| 500 | } | ||
| 501 | |||
| 499 | void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { | 502 | void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { |
| 500 | gpu_thread.SwapBuffers(framebuffer); | 503 | gpu_thread.SwapBuffers(framebuffer); |
| 501 | } | 504 | } |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index b2ee45496..d40982a54 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -324,6 +324,9 @@ public: | |||
| 324 | /// Push GPU command buffer entries to be processed | 324 | /// Push GPU command buffer entries to be processed |
| 325 | void PushCommandBuffer(Tegra::ChCommandHeaderList& entries); | 325 | void PushCommandBuffer(Tegra::ChCommandHeaderList& entries); |
| 326 | 326 | ||
| 327 | /// Frees the CDMAPusher to free up resources | ||
| 328 | void ClearCommandBuffer(); | ||
| 329 | |||
| 327 | /// Swap buffers (render frame) | 330 | /// Swap buffers (render frame) |
| 328 | void SwapBuffers(const Tegra::FramebufferConfig* framebuffer); | 331 | void SwapBuffers(const Tegra::FramebufferConfig* framebuffer); |
| 329 | 332 | ||