Merge pull request #5124 from lioncash/video-shadow
video_core: Resolve more variable shadowing scenarios
This commit is contained in:
commit
e6a896c4bd
42 changed files with 219 additions and 206 deletions
|
|
@ -29,8 +29,8 @@
|
|||
#include "video_core/memory_manager.h"
|
||||
|
||||
namespace Tegra {
|
||||
CDmaPusher::CDmaPusher(GPU& gpu)
|
||||
: gpu(gpu), nvdec_processor(std::make_shared<Nvdec>(gpu)),
|
||||
CDmaPusher::CDmaPusher(GPU& gpu_)
|
||||
: gpu{gpu_}, nvdec_processor(std::make_shared<Nvdec>(gpu)),
|
||||
vic_processor(std::make_unique<Vic>(gpu, nvdec_processor)),
|
||||
host1x_processor(std::make_unique<Host1x>(gpu)),
|
||||
nvdec_sync(std::make_unique<SyncptIncrManager>(gpu)),
|
||||
|
|
@ -100,11 +100,11 @@ void CDmaPusher::Step() {
|
|||
}
|
||||
}
|
||||
|
||||
void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
|
||||
void CDmaPusher::ExecuteCommand(u32 state_offset, u32 data) {
|
||||
switch (current_class) {
|
||||
case ChClassId::NvDec:
|
||||
ThiStateWrite(nvdec_thi_state, offset, {data});
|
||||
switch (static_cast<ThiMethod>(offset)) {
|
||||
ThiStateWrite(nvdec_thi_state, state_offset, {data});
|
||||
switch (static_cast<ThiMethod>(state_offset)) {
|
||||
case ThiMethod::IncSyncpt: {
|
||||
LOG_DEBUG(Service_NVDRV, "NVDEC Class IncSyncpt Method");
|
||||
const auto syncpoint_id = static_cast<u32>(data & 0xFF);
|
||||
|
|
@ -120,16 +120,16 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
|
|||
case ThiMethod::SetMethod1:
|
||||
LOG_DEBUG(Service_NVDRV, "NVDEC method 0x{:X}",
|
||||
static_cast<u32>(nvdec_thi_state.method_0));
|
||||
nvdec_processor->ProcessMethod(
|
||||
static_cast<Tegra::Nvdec::Method>(nvdec_thi_state.method_0), {data});
|
||||
nvdec_processor->ProcessMethod(static_cast<Nvdec::Method>(nvdec_thi_state.method_0),
|
||||
{data});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ChClassId::GraphicsVic:
|
||||
ThiStateWrite(vic_thi_state, static_cast<u32>(offset), {data});
|
||||
switch (static_cast<ThiMethod>(offset)) {
|
||||
ThiStateWrite(vic_thi_state, static_cast<u32>(state_offset), {data});
|
||||
switch (static_cast<ThiMethod>(state_offset)) {
|
||||
case ThiMethod::IncSyncpt: {
|
||||
LOG_DEBUG(Service_NVDRV, "VIC Class IncSyncpt Method");
|
||||
const auto syncpoint_id = static_cast<u32>(data & 0xFF);
|
||||
|
|
@ -145,8 +145,7 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
|
|||
case ThiMethod::SetMethod1:
|
||||
LOG_DEBUG(Service_NVDRV, "VIC method 0x{:X}, Args=({})",
|
||||
static_cast<u32>(vic_thi_state.method_0), data);
|
||||
vic_processor->ProcessMethod(static_cast<Tegra::Vic::Method>(vic_thi_state.method_0),
|
||||
{data});
|
||||
vic_processor->ProcessMethod(static_cast<Vic::Method>(vic_thi_state.method_0), {data});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -155,7 +154,7 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
|
|||
case ChClassId::Host1x:
|
||||
// This device is mainly for syncpoint synchronization
|
||||
LOG_DEBUG(Service_NVDRV, "Host1X Class Method");
|
||||
host1x_processor->ProcessMethod(static_cast<Tegra::Host1x::Method>(offset), {data});
|
||||
host1x_processor->ProcessMethod(static_cast<Host1x::Method>(state_offset), {data});
|
||||
break;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Current class not implemented {:X}", static_cast<u32>(current_class));
|
||||
|
|
@ -163,9 +162,10 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) {
|
|||
}
|
||||
}
|
||||
|
||||
void CDmaPusher::ThiStateWrite(ThiRegisters& state, u32 offset, const std::vector<u32>& arguments) {
|
||||
u8* const state_offset = reinterpret_cast<u8*>(&state) + sizeof(u32) * offset;
|
||||
std::memcpy(state_offset, arguments.data(), sizeof(u32) * arguments.size());
|
||||
void CDmaPusher::ThiStateWrite(ThiRegisters& state, u32 state_offset,
|
||||
const std::vector<u32>& arguments) {
|
||||
u8* const state_offset_ptr = reinterpret_cast<u8*>(&state) + sizeof(u32) * state_offset;
|
||||
std::memcpy(state_offset_ptr, arguments.data(), sizeof(u32) * arguments.size());
|
||||
}
|
||||
|
||||
} // namespace Tegra
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ struct ChCommand {
|
|||
std::vector<u32> arguments;
|
||||
};
|
||||
|
||||
using ChCommandHeaderList = std::vector<Tegra::ChCommandHeader>;
|
||||
using ChCommandList = std::vector<Tegra::ChCommand>;
|
||||
using ChCommandHeaderList = std::vector<ChCommandHeader>;
|
||||
using ChCommandList = std::vector<ChCommand>;
|
||||
|
||||
struct ThiRegisters {
|
||||
u32_le increment_syncpt{};
|
||||
|
|
@ -96,7 +96,7 @@ enum class ThiMethod : u32 {
|
|||
|
||||
class CDmaPusher {
|
||||
public:
|
||||
explicit CDmaPusher(GPU& gpu);
|
||||
explicit CDmaPusher(GPU& gpu_);
|
||||
~CDmaPusher();
|
||||
|
||||
/// Push NVDEC command buffer entries into queue
|
||||
|
|
@ -109,17 +109,17 @@ public:
|
|||
void Step();
|
||||
|
||||
/// Invoke command class devices to execute the command based on the current state
|
||||
void ExecuteCommand(u32 offset, u32 data);
|
||||
void ExecuteCommand(u32 state_offset, u32 data);
|
||||
|
||||
private:
|
||||
/// Write arguments value to the ThiRegisters member at the specified offset
|
||||
void ThiStateWrite(ThiRegisters& state, u32 offset, const std::vector<u32>& arguments);
|
||||
void ThiStateWrite(ThiRegisters& state, u32 state_offset, const std::vector<u32>& arguments);
|
||||
|
||||
GPU& gpu;
|
||||
|
||||
std::shared_ptr<Tegra::Nvdec> nvdec_processor;
|
||||
std::unique_ptr<Tegra::Vic> vic_processor;
|
||||
std::unique_ptr<Tegra::Host1x> host1x_processor;
|
||||
std::shared_ptr<Nvdec> nvdec_processor;
|
||||
std::unique_ptr<Vic> vic_processor;
|
||||
std::unique_ptr<Host1x> host1x_processor;
|
||||
std::unique_ptr<SyncptIncrManager> nvdec_sync;
|
||||
std::unique_ptr<SyncptIncrManager> vic_sync;
|
||||
ChClassId current_class{};
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ constexpr std::array<s32, 254> map_lut{
|
|||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
VP9::VP9(GPU& gpu) : gpu(gpu) {}
|
||||
VP9::VP9(GPU& gpu_) : gpu{gpu_} {}
|
||||
|
||||
VP9::~VP9() = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ private:
|
|||
|
||||
class VP9 {
|
||||
public:
|
||||
explicit VP9(GPU& gpu);
|
||||
explicit VP9(GPU& gpu_);
|
||||
~VP9();
|
||||
|
||||
VP9(const VP9&) = delete;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace Tegra {
|
||||
|
||||
DmaPusher::DmaPusher(Core::System& system, GPU& gpu) : gpu{gpu}, system{system} {}
|
||||
DmaPusher::DmaPusher(Core::System& system_, GPU& gpu_) : gpu{gpu_}, system{system_} {}
|
||||
|
||||
DmaPusher::~DmaPusher() = default;
|
||||
|
||||
|
|
@ -152,7 +152,12 @@ void DmaPusher::SetState(const CommandHeader& command_header) {
|
|||
|
||||
void DmaPusher::CallMethod(u32 argument) const {
|
||||
if (dma_state.method < non_puller_methods) {
|
||||
gpu.CallMethod({dma_state.method, argument, dma_state.subchannel, dma_state.method_count});
|
||||
gpu.CallMethod(GPU::MethodCall{
|
||||
dma_state.method,
|
||||
argument,
|
||||
dma_state.subchannel,
|
||||
dma_state.method_count,
|
||||
});
|
||||
} else {
|
||||
subchannels[dma_state.subchannel]->CallMethod(dma_state.method, argument,
|
||||
dma_state.is_last_call);
|
||||
|
|
|
|||
|
|
@ -87,11 +87,11 @@ inline CommandHeader BuildCommandHeader(BufferMethods method, u32 arg_count, Sub
|
|||
struct CommandList final {
|
||||
CommandList() = default;
|
||||
explicit CommandList(std::size_t size) : command_lists(size) {}
|
||||
explicit CommandList(std::vector<Tegra::CommandHeader>&& prefetch_command_list)
|
||||
: prefetch_command_list{std::move(prefetch_command_list)} {}
|
||||
explicit CommandList(std::vector<CommandHeader>&& prefetch_command_list_)
|
||||
: prefetch_command_list{std::move(prefetch_command_list_)} {}
|
||||
|
||||
std::vector<Tegra::CommandListHeader> command_lists;
|
||||
std::vector<Tegra::CommandHeader> prefetch_command_list;
|
||||
std::vector<CommandListHeader> command_lists;
|
||||
std::vector<CommandHeader> prefetch_command_list;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -103,7 +103,7 @@ struct CommandList final {
|
|||
*/
|
||||
class DmaPusher final {
|
||||
public:
|
||||
explicit DmaPusher(Core::System& system, GPU& gpu);
|
||||
explicit DmaPusher(Core::System& system_, GPU& gpu_);
|
||||
~DmaPusher();
|
||||
|
||||
void Push(CommandList&& entries) {
|
||||
|
|
@ -112,7 +112,7 @@ public:
|
|||
|
||||
void DispatchCalls();
|
||||
|
||||
void BindSubchannel(Tegra::Engines::EngineInterface* engine, u32 subchannel_id) {
|
||||
void BindSubchannel(Engines::EngineInterface* engine, u32 subchannel_id) {
|
||||
subchannels[subchannel_id] = engine;
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ private:
|
|||
|
||||
bool ib_enable{true}; ///< IB mode enabled
|
||||
|
||||
std::array<Tegra::Engines::EngineInterface*, max_subchannels> subchannels{};
|
||||
std::array<Engines::EngineInterface*, max_subchannels> subchannels{};
|
||||
|
||||
GPU& gpu;
|
||||
Core::System& system;
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@
|
|||
|
||||
namespace Tegra::Engines::Upload {
|
||||
|
||||
State::State(MemoryManager& memory_manager, Registers& regs)
|
||||
: regs{regs}, memory_manager{memory_manager} {}
|
||||
State::State(MemoryManager& memory_manager_, Registers& regs_)
|
||||
: regs{regs_}, memory_manager{memory_manager_} {}
|
||||
|
||||
State::~State() = default;
|
||||
|
||||
void State::ProcessExec(const bool is_linear) {
|
||||
void State::ProcessExec(const bool is_linear_) {
|
||||
write_offset = 0;
|
||||
copy_size = regs.line_length_in * regs.line_count;
|
||||
inner_buffer.resize(copy_size);
|
||||
this->is_linear = is_linear;
|
||||
is_linear = is_linear_;
|
||||
}
|
||||
|
||||
void State::ProcessData(const u32 data, const bool is_last_call) {
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ struct Registers {
|
|||
|
||||
class State {
|
||||
public:
|
||||
State(MemoryManager& memory_manager, Registers& regs);
|
||||
explicit State(MemoryManager& memory_manager_, Registers& regs_);
|
||||
~State();
|
||||
|
||||
void ProcessExec(bool is_linear);
|
||||
void ProcessExec(bool is_linear_);
|
||||
void ProcessData(u32 data, bool is_last_call);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
namespace Tegra::Engines {
|
||||
|
||||
KeplerMemory::KeplerMemory(Core::System& system, MemoryManager& memory_manager)
|
||||
: system{system}, upload_state{memory_manager, regs.upload} {}
|
||||
KeplerMemory::KeplerMemory(Core::System& system_, MemoryManager& memory_manager)
|
||||
: system{system_}, upload_state{memory_manager, regs.upload} {}
|
||||
|
||||
KeplerMemory::~KeplerMemory() = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Tegra::Engines {
|
|||
|
||||
class KeplerMemory final : public EngineInterface {
|
||||
public:
|
||||
KeplerMemory(Core::System& system, MemoryManager& memory_manager);
|
||||
explicit KeplerMemory(Core::System& system_, MemoryManager& memory_manager);
|
||||
~KeplerMemory();
|
||||
|
||||
/// Write the value to the register identified by method.
|
||||
|
|
|
|||
|
|
@ -16,8 +16,10 @@ namespace Tegra::Engines {
|
|||
|
||||
using namespace Texture;
|
||||
|
||||
MaxwellDMA::MaxwellDMA(Core::System& system, MemoryManager& memory_manager)
|
||||
: system{system}, memory_manager{memory_manager} {}
|
||||
MaxwellDMA::MaxwellDMA(Core::System& system_, MemoryManager& memory_manager_)
|
||||
: system{system_}, memory_manager{memory_manager_} {}
|
||||
|
||||
MaxwellDMA::~MaxwellDMA() = default;
|
||||
|
||||
void MaxwellDMA::CallMethod(u32 method, u32 method_argument, bool is_last_call) {
|
||||
ASSERT_MSG(method < NUM_REGS, "Invalid MaxwellDMA register");
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ public:
|
|||
};
|
||||
static_assert(sizeof(RemapConst) == 12);
|
||||
|
||||
explicit MaxwellDMA(Core::System& system, MemoryManager& memory_manager);
|
||||
~MaxwellDMA() = default;
|
||||
explicit MaxwellDMA(Core::System& system_, MemoryManager& memory_manager_);
|
||||
~MaxwellDMA();
|
||||
|
||||
/// Write the value to the register identified by method.
|
||||
void CallMethod(u32 method, u32 method_argument, bool is_last_call) override;
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ namespace VideoCommon {
|
|||
|
||||
class FenceBase {
|
||||
public:
|
||||
FenceBase(u32 payload, bool is_stubbed)
|
||||
: address{}, payload{payload}, is_semaphore{false}, is_stubbed{is_stubbed} {}
|
||||
explicit FenceBase(u32 payload_, bool is_stubbed_)
|
||||
: address{}, payload{payload_}, is_semaphore{false}, is_stubbed{is_stubbed_} {}
|
||||
|
||||
FenceBase(GPUVAddr address, u32 payload, bool is_stubbed)
|
||||
: address{address}, payload{payload}, is_semaphore{true}, is_stubbed{is_stubbed} {}
|
||||
explicit FenceBase(GPUVAddr address_, u32 payload_, bool is_stubbed_)
|
||||
: address{address_}, payload{payload_}, is_semaphore{true}, is_stubbed{is_stubbed_} {}
|
||||
|
||||
GPUVAddr GetAddress() const {
|
||||
return address;
|
||||
|
|
|
|||
|
|
@ -232,8 +232,12 @@ void GPU::CallMultiMethod(u32 method, u32 subchannel, const u32* base_start, u32
|
|||
CallEngineMultiMethod(method, subchannel, base_start, amount, methods_pending);
|
||||
} else {
|
||||
for (std::size_t i = 0; i < amount; i++) {
|
||||
CallPullerMethod(
|
||||
{method, base_start[i], subchannel, methods_pending - static_cast<u32>(i)});
|
||||
CallPullerMethod(MethodCall{
|
||||
method,
|
||||
base_start[i],
|
||||
subchannel,
|
||||
methods_pending - static_cast<u32>(i),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,16 +149,16 @@ public:
|
|||
u32 subchannel{};
|
||||
u32 method_count{};
|
||||
|
||||
MethodCall(u32 method, u32 argument, u32 subchannel = 0, u32 method_count = 0)
|
||||
: method(method), argument(argument), subchannel(subchannel),
|
||||
method_count(method_count) {}
|
||||
explicit MethodCall(u32 method_, u32 argument_, u32 subchannel_ = 0, u32 method_count_ = 0)
|
||||
: method(method_), argument(argument_), subchannel(subchannel_),
|
||||
method_count(method_count_) {}
|
||||
|
||||
[[nodiscard]] bool IsLastCall() const {
|
||||
return method_count <= 1;
|
||||
}
|
||||
};
|
||||
|
||||
explicit GPU(Core::System& system, bool is_async, bool use_nvdec);
|
||||
explicit GPU(Core::System& system_, bool is_async_, bool use_nvdec_);
|
||||
virtual ~GPU();
|
||||
|
||||
/// Binds a renderer to the GPU.
|
||||
|
|
@ -414,8 +414,8 @@ private:
|
|||
std::condition_variable sync_cv;
|
||||
|
||||
struct FlushRequest {
|
||||
FlushRequest(u64 fence, VAddr addr, std::size_t size)
|
||||
: fence{fence}, addr{addr}, size{size} {}
|
||||
explicit FlushRequest(u64 fence_, VAddr addr_, std::size_t size_)
|
||||
: fence{fence_}, addr{addr_}, size{size_} {}
|
||||
u64 fence;
|
||||
VAddr addr;
|
||||
std::size_t size;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
namespace VideoCommon {
|
||||
|
||||
GPUAsynch::GPUAsynch(Core::System& system, bool use_nvdec)
|
||||
: GPU{system, true, use_nvdec}, gpu_thread{system} {}
|
||||
GPUAsynch::GPUAsynch(Core::System& system_, bool use_nvdec_)
|
||||
: GPU{system_, true, use_nvdec_}, gpu_thread{system_} {}
|
||||
|
||||
GPUAsynch::~GPUAsynch() = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace VideoCommon {
|
|||
/// Implementation of GPU interface that runs the GPU asynchronously
|
||||
class GPUAsynch final : public Tegra::GPU {
|
||||
public:
|
||||
explicit GPUAsynch(Core::System& system, bool use_nvdec);
|
||||
explicit GPUAsynch(Core::System& system_, bool use_nvdec_);
|
||||
~GPUAsynch() override;
|
||||
|
||||
void Start() override;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace VideoCommon {
|
||||
|
||||
GPUSynch::GPUSynch(Core::System& system, bool use_nvdec) : GPU{system, false, use_nvdec} {}
|
||||
GPUSynch::GPUSynch(Core::System& system_, bool use_nvdec_) : GPU{system_, false, use_nvdec_} {}
|
||||
|
||||
GPUSynch::~GPUSynch() = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace VideoCommon {
|
|||
/// Implementation of GPU interface that runs the GPU synchronously
|
||||
class GPUSynch final : public Tegra::GPU {
|
||||
public:
|
||||
explicit GPUSynch(Core::System& system, bool use_nvdec);
|
||||
explicit GPUSynch(Core::System& system_, bool use_nvdec_);
|
||||
~GPUSynch() override;
|
||||
|
||||
void Start() override;
|
||||
|
|
|
|||
|
|
@ -39,23 +39,23 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,
|
|||
CommandDataContainer next;
|
||||
while (state.is_running) {
|
||||
next = state.queue.PopWait();
|
||||
if (const auto submit_list = std::get_if<SubmitListCommand>(&next.data)) {
|
||||
if (auto* submit_list = std::get_if<SubmitListCommand>(&next.data)) {
|
||||
dma_pusher.Push(std::move(submit_list->entries));
|
||||
dma_pusher.DispatchCalls();
|
||||
} else if (const auto command_list = std::get_if<SubmitChCommandEntries>(&next.data)) {
|
||||
} else if (auto* command_list = std::get_if<SubmitChCommandEntries>(&next.data)) {
|
||||
// NVDEC
|
||||
cdma_pusher.Push(std::move(command_list->entries));
|
||||
cdma_pusher.DispatchCalls();
|
||||
} else if (const auto data = std::get_if<SwapBuffersCommand>(&next.data)) {
|
||||
} else if (const auto* data = std::get_if<SwapBuffersCommand>(&next.data)) {
|
||||
renderer.SwapBuffers(data->framebuffer ? &*data->framebuffer : nullptr);
|
||||
} else if (std::holds_alternative<OnCommandListEndCommand>(next.data)) {
|
||||
renderer.Rasterizer().ReleaseFences();
|
||||
} else if (std::holds_alternative<GPUTickCommand>(next.data)) {
|
||||
system.GPU().TickWork();
|
||||
} else if (const auto data = std::get_if<FlushRegionCommand>(&next.data)) {
|
||||
renderer.Rasterizer().FlushRegion(data->addr, data->size);
|
||||
} else if (const auto data = std::get_if<InvalidateRegionCommand>(&next.data)) {
|
||||
renderer.Rasterizer().OnCPUWrite(data->addr, data->size);
|
||||
} else if (const auto* flush = std::get_if<FlushRegionCommand>(&next.data)) {
|
||||
renderer.Rasterizer().FlushRegion(flush->addr, flush->size);
|
||||
} else if (const auto* invalidate = std::get_if<InvalidateRegionCommand>(&next.data)) {
|
||||
renderer.Rasterizer().OnCPUWrite(invalidate->addr, invalidate->size);
|
||||
} else if (std::holds_alternative<EndProcessingCommand>(next.data)) {
|
||||
return;
|
||||
} else {
|
||||
|
|
@ -65,7 +65,7 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer,
|
|||
}
|
||||
}
|
||||
|
||||
ThreadManager::ThreadManager(Core::System& system) : system{system} {}
|
||||
ThreadManager::ThreadManager(Core::System& system_) : system{system_} {}
|
||||
|
||||
ThreadManager::~ThreadManager() {
|
||||
if (!thread.joinable()) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue