summaryrefslogtreecommitdiff
path: root/src/video_core/cdma_pusher.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2020-12-05 00:48:08 -0800
committerGravatar GitHub2020-12-05 00:48:08 -0800
commite6a896c4bdf9cc47c2002c115c9ff280e540fd1b (patch)
treee5cd397cb3a11f1529f38ed8fa0a0185d07becaa /src/video_core/cdma_pusher.cpp
parentMerge pull request #5127 from FearlessTobi/port-5617 (diff)
parentvideo_core: Resolve more variable shadowing scenarios (diff)
downloadyuzu-e6a896c4bdf9cc47c2002c115c9ff280e540fd1b.tar.gz
yuzu-e6a896c4bdf9cc47c2002c115c9ff280e540fd1b.tar.xz
yuzu-e6a896c4bdf9cc47c2002c115c9ff280e540fd1b.zip
Merge pull request #5124 from lioncash/video-shadow
video_core: Resolve more variable shadowing scenarios
Diffstat (limited to 'src/video_core/cdma_pusher.cpp')
-rw-r--r--src/video_core/cdma_pusher.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/video_core/cdma_pusher.cpp b/src/video_core/cdma_pusher.cpp
index b60f86260..e3e7432f7 100644
--- a/src/video_core/cdma_pusher.cpp
+++ b/src/video_core/cdma_pusher.cpp
@@ -29,8 +29,8 @@
29#include "video_core/memory_manager.h" 29#include "video_core/memory_manager.h"
30 30
31namespace Tegra { 31namespace Tegra {
32CDmaPusher::CDmaPusher(GPU& gpu) 32CDmaPusher::CDmaPusher(GPU& gpu_)
33 : gpu(gpu), nvdec_processor(std::make_shared<Nvdec>(gpu)), 33 : gpu{gpu_}, nvdec_processor(std::make_shared<Nvdec>(gpu)),
34 vic_processor(std::make_unique<Vic>(gpu, nvdec_processor)), 34 vic_processor(std::make_unique<Vic>(gpu, nvdec_processor)),
35 host1x_processor(std::make_unique<Host1x>(gpu)), 35 host1x_processor(std::make_unique<Host1x>(gpu)),
36 nvdec_sync(std::make_unique<SyncptIncrManager>(gpu)), 36 nvdec_sync(std::make_unique<SyncptIncrManager>(gpu)),
@@ -100,11 +100,11 @@ void CDmaPusher::Step() {
100 } 100 }
101} 101}
102 102
103void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { 103void CDmaPusher::ExecuteCommand(u32 state_offset, u32 data) {
104 switch (current_class) { 104 switch (current_class) {
105 case ChClassId::NvDec: 105 case ChClassId::NvDec:
106 ThiStateWrite(nvdec_thi_state, offset, {data}); 106 ThiStateWrite(nvdec_thi_state, state_offset, {data});
107 switch (static_cast<ThiMethod>(offset)) { 107 switch (static_cast<ThiMethod>(state_offset)) {
108 case ThiMethod::IncSyncpt: { 108 case ThiMethod::IncSyncpt: {
109 LOG_DEBUG(Service_NVDRV, "NVDEC Class IncSyncpt Method"); 109 LOG_DEBUG(Service_NVDRV, "NVDEC Class IncSyncpt Method");
110 const auto syncpoint_id = static_cast<u32>(data & 0xFF); 110 const auto syncpoint_id = static_cast<u32>(data & 0xFF);
@@ -120,16 +120,16 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
120 case ThiMethod::SetMethod1: 120 case ThiMethod::SetMethod1:
121 LOG_DEBUG(Service_NVDRV, "NVDEC method 0x{:X}", 121 LOG_DEBUG(Service_NVDRV, "NVDEC method 0x{:X}",
122 static_cast<u32>(nvdec_thi_state.method_0)); 122 static_cast<u32>(nvdec_thi_state.method_0));
123 nvdec_processor->ProcessMethod( 123 nvdec_processor->ProcessMethod(static_cast<Nvdec::Method>(nvdec_thi_state.method_0),
124 static_cast<Tegra::Nvdec::Method>(nvdec_thi_state.method_0), {data}); 124 {data});
125 break; 125 break;
126 default: 126 default:
127 break; 127 break;
128 } 128 }
129 break; 129 break;
130 case ChClassId::GraphicsVic: 130 case ChClassId::GraphicsVic:
131 ThiStateWrite(vic_thi_state, static_cast<u32>(offset), {data}); 131 ThiStateWrite(vic_thi_state, static_cast<u32>(state_offset), {data});
132 switch (static_cast<ThiMethod>(offset)) { 132 switch (static_cast<ThiMethod>(state_offset)) {
133 case ThiMethod::IncSyncpt: { 133 case ThiMethod::IncSyncpt: {
134 LOG_DEBUG(Service_NVDRV, "VIC Class IncSyncpt Method"); 134 LOG_DEBUG(Service_NVDRV, "VIC Class IncSyncpt Method");
135 const auto syncpoint_id = static_cast<u32>(data & 0xFF); 135 const auto syncpoint_id = static_cast<u32>(data & 0xFF);
@@ -145,8 +145,7 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
145 case ThiMethod::SetMethod1: 145 case ThiMethod::SetMethod1:
146 LOG_DEBUG(Service_NVDRV, "VIC method 0x{:X}, Args=({})", 146 LOG_DEBUG(Service_NVDRV, "VIC method 0x{:X}, Args=({})",
147 static_cast<u32>(vic_thi_state.method_0), data); 147 static_cast<u32>(vic_thi_state.method_0), data);
148 vic_processor->ProcessMethod(static_cast<Tegra::Vic::Method>(vic_thi_state.method_0), 148 vic_processor->ProcessMethod(static_cast<Vic::Method>(vic_thi_state.method_0), {data});
149 {data});
150 break; 149 break;
151 default: 150 default:
152 break; 151 break;
@@ -155,7 +154,7 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
155 case ChClassId::Host1x: 154 case ChClassId::Host1x:
156 // This device is mainly for syncpoint synchronization 155 // This device is mainly for syncpoint synchronization
157 LOG_DEBUG(Service_NVDRV, "Host1X Class Method"); 156 LOG_DEBUG(Service_NVDRV, "Host1X Class Method");
158 host1x_processor->ProcessMethod(static_cast<Tegra::Host1x::Method>(offset), {data}); 157 host1x_processor->ProcessMethod(static_cast<Host1x::Method>(state_offset), {data});
159 break; 158 break;
160 default: 159 default:
161 UNIMPLEMENTED_MSG("Current class not implemented {:X}", static_cast<u32>(current_class)); 160 UNIMPLEMENTED_MSG("Current class not implemented {:X}", static_cast<u32>(current_class));
@@ -163,9 +162,10 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
163 } 162 }
164} 163}
165 164
166void CDmaPusher::ThiStateWrite(ThiRegisters& state, u32 offset, const std::vector<u32>& arguments) { 165void CDmaPusher::ThiStateWrite(ThiRegisters& state, u32 state_offset,
167 u8* const state_offset = reinterpret_cast<u8*>(&state) + sizeof(u32) * offset; 166 const std::vector<u32>& arguments) {
168 std::memcpy(state_offset, arguments.data(), sizeof(u32) * arguments.size()); 167 u8* const state_offset_ptr = reinterpret_cast<u8*>(&state) + sizeof(u32) * state_offset;
168 std::memcpy(state_offset_ptr, arguments.data(), sizeof(u32) * arguments.size());
169} 169}
170 170
171} // namespace Tegra 171} // namespace Tegra