summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ameerj2021-04-24 19:22:09 -0400
committerGravatar ameerj2021-04-24 19:22:09 -0400
commit75e0d16caa994f0765f78268fb5a94496914d23b (patch)
tree378eab8a370a1f95ad04d9828e1e6e74d3e8fbac /src
parentMerge pull request #6234 from Morph1984/stub-am (diff)
downloadyuzu-75e0d16caa994f0765f78268fb5a94496914d23b.tar.gz
yuzu-75e0d16caa994f0765f78268fb5a94496914d23b.tar.xz
yuzu-75e0d16caa994f0765f78268fb5a94496914d23b.zip
nvhost_vic: Fix device closure
Implements the OnClose method of the nvhost_vic device, and removes the remnants of an older implementation. Also cleans up some of the surrounding code.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp6
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_vic.cpp12
-rw-r--r--src/video_core/gpu.cpp4
-rw-r--r--src/video_core/gpu.h4
4 files changed, 11 insertions, 15 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
index 4e58b9b80..e2f671d8e 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
@@ -31,9 +31,8 @@ NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>&
31 return SetSubmitTimeout(input, output); 31 return SetSubmitTimeout(input, output);
32 case 0x9: 32 case 0x9:
33 return MapBuffer(input, output); 33 return MapBuffer(input, output);
34 case 0xa: { 34 case 0xa:
35 return UnmapBuffer(input, output); 35 return UnmapBuffer(input, output);
36 }
37 default: 36 default:
38 break; 37 break;
39 } 38 }
@@ -67,7 +66,8 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>&
67void nvhost_nvdec::OnOpen(DeviceFD fd) {} 66void nvhost_nvdec::OnOpen(DeviceFD fd) {}
68 67
69void nvhost_nvdec::OnClose(DeviceFD fd) { 68void nvhost_nvdec::OnClose(DeviceFD fd) {
70 system.GPU().ClearCommandBuffer(); 69 LOG_INFO(Service_NVDRV, "NVDEC video stream ended");
70 system.GPU().ClearCdmaInstance();
71} 71}
72 72
73} // namespace Service::Nvidia::Devices 73} // 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 0421fb956..301efe8a1 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
@@ -29,13 +29,8 @@ NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& i
29 return GetWaitbase(input, output); 29 return GetWaitbase(input, output);
30 case 0x9: 30 case 0x9:
31 return MapBuffer(input, output); 31 return MapBuffer(input, output);
32 case 0xa: { 32 case 0xa:
33 if (command.length == 0x1c) {
34 Tegra::ChCommandHeaderList cmdlist{{0xDEADB33F}};
35 system.GPU().PushCommandBuffer(cmdlist);
36 }
37 return UnmapBuffer(input, output); 33 return UnmapBuffer(input, output);
38 }
39 default: 34 default:
40 break; 35 break;
41 } 36 }
@@ -69,6 +64,9 @@ NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& i
69} 64}
70 65
71void nvhost_vic::OnOpen(DeviceFD fd) {} 66void nvhost_vic::OnOpen(DeviceFD fd) {}
72void nvhost_vic::OnClose(DeviceFD fd) {} 67
68void nvhost_vic::OnClose(DeviceFD fd) {
69 system.GPU().ClearCdmaInstance();
70}
73 71
74} // namespace Service::Nvidia::Devices 72} // namespace Service::Nvidia::Devices
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 7c42f1177..a38024242 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -492,10 +492,8 @@ void GPU::PushCommandBuffer(Tegra::ChCommandHeaderList& entries) {
492 cdma_pusher->ProcessEntries(std::move(entries)); 492 cdma_pusher->ProcessEntries(std::move(entries));
493} 493}
494 494
495void GPU::ClearCommandBuffer() { 495void GPU::ClearCdmaInstance() {
496 // This condition fires when a video stream ends, clear all intermediary data
497 cdma_pusher.reset(); 496 cdma_pusher.reset();
498 LOG_INFO(Service_NVDRV, "NVDEC video stream ended");
499} 497}
500 498
501void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { 499void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index b1960ea86..8669e9940 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -324,8 +324,8 @@ 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 327 /// Frees the CDMAPusher instance to free up resources
328 void ClearCommandBuffer(); 328 void ClearCdmaInstance();
329 329
330 /// Swap buffers (render frame) 330 /// Swap buffers (render frame)
331 void SwapBuffers(const Tegra::FramebufferConfig* framebuffer); 331 void SwapBuffers(const Tegra::FramebufferConfig* framebuffer);