summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp17
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h13
2 files changed, 9 insertions, 21 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
index 845de724d..e61261f98 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
@@ -69,8 +69,7 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
69 std::vector<Reloc> relocs(params.relocation_count); 69 std::vector<Reloc> relocs(params.relocation_count);
70 std::vector<u32> reloc_shifts(params.relocation_count); 70 std::vector<u32> reloc_shifts(params.relocation_count);
71 std::vector<SyncptIncr> syncpt_increments(params.syncpoint_count); 71 std::vector<SyncptIncr> syncpt_increments(params.syncpoint_count);
72 std::vector<SyncptIncr> wait_checks(params.syncpoint_count); 72 std::vector<u32> fence_thresholds(params.fence_count);
73 std::vector<Fence> fences(params.fence_count);
74 73
75 // Slice input into their respective buffers 74 // Slice input into their respective buffers
76 std::size_t offset = sizeof(IoctlSubmit); 75 std::size_t offset = sizeof(IoctlSubmit);
@@ -78,15 +77,13 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
78 offset += SliceVectors(input, relocs, params.relocation_count, offset); 77 offset += SliceVectors(input, relocs, params.relocation_count, offset);
79 offset += SliceVectors(input, reloc_shifts, params.relocation_count, offset); 78 offset += SliceVectors(input, reloc_shifts, params.relocation_count, offset);
80 offset += SliceVectors(input, syncpt_increments, params.syncpoint_count, offset); 79 offset += SliceVectors(input, syncpt_increments, params.syncpoint_count, offset);
81 offset += SliceVectors(input, wait_checks, params.syncpoint_count, offset); 80 offset += SliceVectors(input, fence_thresholds, params.fence_count, offset);
82 offset += SliceVectors(input, fences, params.fence_count, offset);
83 81
84 auto& gpu = system.GPU(); 82 auto& gpu = system.GPU();
85 if (gpu.UseNvdec()) { 83 if (gpu.UseNvdec()) {
86 for (std::size_t i = 0; i < syncpt_increments.size(); i++) { 84 for (std::size_t i = 0; i < syncpt_increments.size(); i++) {
87 const SyncptIncr& syncpt_incr = syncpt_increments[i]; 85 const SyncptIncr& syncpt_incr = syncpt_increments[i];
88 fences[i].id = syncpt_incr.id; 86 fence_thresholds[i] =
89 fences[i].value =
90 syncpoint_manager.IncreaseSyncpoint(syncpt_incr.id, syncpt_incr.increments); 87 syncpoint_manager.IncreaseSyncpoint(syncpt_incr.id, syncpt_incr.increments);
91 } 88 }
92 } 89 }
@@ -98,11 +95,6 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
98 cmdlist.size() * sizeof(u32)); 95 cmdlist.size() * sizeof(u32));
99 gpu.PushCommandBuffer(cmdlist); 96 gpu.PushCommandBuffer(cmdlist);
100 } 97 }
101 if (gpu.UseNvdec()) {
102 fences[0].value = syncpoint_manager.IncreaseSyncpoint(fences[0].id, 1);
103 Tegra::ChCommandHeaderList cmdlist{{(4 << 28) | fences[0].id}};
104 gpu.PushCommandBuffer(cmdlist);
105 }
106 std::memcpy(output.data(), &params, sizeof(IoctlSubmit)); 98 std::memcpy(output.data(), &params, sizeof(IoctlSubmit));
107 // Some games expect command_buffers to be written back 99 // Some games expect command_buffers to be written back
108 offset = sizeof(IoctlSubmit); 100 offset = sizeof(IoctlSubmit);
@@ -110,8 +102,7 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
110 offset += WriteVectors(output, relocs, offset); 102 offset += WriteVectors(output, relocs, offset);
111 offset += WriteVectors(output, reloc_shifts, offset); 103 offset += WriteVectors(output, reloc_shifts, offset);
112 offset += WriteVectors(output, syncpt_increments, offset); 104 offset += WriteVectors(output, syncpt_increments, offset);
113 offset += WriteVectors(output, wait_checks, offset); 105 offset += WriteVectors(output, fence_thresholds, offset);
114 offset += WriteVectors(output, fences, offset);
115 106
116 return NvResult::Success; 107 return NvResult::Success;
117} 108}
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
index af59f00d2..ae4199b79 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
@@ -56,19 +56,16 @@ protected:
56 s32 target{}; 56 s32 target{};
57 s32 target_offset{}; 57 s32 target_offset{};
58 }; 58 };
59 static_assert(sizeof(Reloc) == 0x10, "CommandBuffer has incorrect size"); 59 static_assert(sizeof(Reloc) == 0x10, "Reloc has incorrect size");
60 60
61 struct SyncptIncr { 61 struct SyncptIncr {
62 u32 id{}; 62 u32 id{};
63 u32 increments{}; 63 u32 increments{};
64 u32 unk0{};
65 u32 unk1{};
66 u32 unk2{};
64 }; 67 };
65 static_assert(sizeof(SyncptIncr) == 0x8, "CommandBuffer has incorrect size"); 68 static_assert(sizeof(SyncptIncr) == 0x14, "SyncptIncr has incorrect size");
66
67 struct Fence {
68 u32 id{};
69 u32 value{};
70 };
71 static_assert(sizeof(Fence) == 0x8, "CommandBuffer has incorrect size");
72 69
73 struct IoctlGetSyncpoint { 70 struct IoctlGetSyncpoint {
74 // Input 71 // Input