diff options
| author | Ameer J <52414509+ameerj@users.noreply.github.com> | 2021-07-05 16:06:09 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-05 16:06:09 -0400 |
| commit | c770fa9823185fd2878310546311b528d421e31c (patch) | |
| tree | 1b2cd25a36cc9b770635174f0a0c38132436f3a2 /src/video_core/command_classes/nvdec.cpp | |
| parent | 942c0d6cdd7975ded7435917ce24fdbaa4b8077d (diff) | |
| parent | 208a04dcffe8142070bd8136b42def6a3233bb0f (diff) | |
Merge pull request #6540 from Kelebek1/nvdec
Slightly refactor NVDEC and codecs for readability and safety
Diffstat (limited to 'src/video_core/command_classes/nvdec.cpp')
| -rw-r--r-- | src/video_core/command_classes/nvdec.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/video_core/command_classes/nvdec.cpp b/src/video_core/command_classes/nvdec.cpp index e4f919afd..b5e3b70fc 100644 --- a/src/video_core/command_classes/nvdec.cpp +++ b/src/video_core/command_classes/nvdec.cpp @@ -8,22 +8,21 @@ namespace Tegra { -Nvdec::Nvdec(GPU& gpu_) : gpu(gpu_), codec(std::make_unique<Codec>(gpu)) {} +#define NVDEC_REG_INDEX(field_name) \ + (offsetof(NvdecCommon::NvdecRegisters, field_name) / sizeof(u64)) + +Nvdec::Nvdec(GPU& gpu_) : gpu(gpu_), state{}, codec(std::make_unique<Codec>(gpu, state)) {} Nvdec::~Nvdec() = default; -void Nvdec::ProcessMethod(Method method, u32 argument) { - if (method == Method::SetVideoCodec) { - codec->StateWrite(static_cast<u32>(method), argument); - } else { - codec->StateWrite(static_cast<u32>(method), static_cast<u64>(argument) << 8); - } +void Nvdec::ProcessMethod(u32 method, u32 argument) { + state.reg_array[method] = static_cast<u64>(argument) << 8; switch (method) { - case Method::SetVideoCodec: + case NVDEC_REG_INDEX(set_codec_id): codec->SetTargetCodec(static_cast<NvdecCommon::VideoCodec>(argument)); break; - case Method::Execute: + case NVDEC_REG_INDEX(execute): Execute(); break; } |
