streamline cdma_pusher/command_classes

This commit is contained in:
ameerj 2020-11-23 15:01:40 -05:00 committed by ameerj
parent 77564f987c
commit 09722cb4a7

View File

@ -19,20 +19,13 @@ namespace Tegra {
Vic::Vic(GPU& gpu_, std::shared_ptr<Nvdec> nvdec_processor_) Vic::Vic(GPU& gpu_, std::shared_ptr<Nvdec> nvdec_processor_)
: gpu(gpu_), : gpu(gpu_),
nvdec_processor(std::move(nvdec_processor_)), converted_frame_buffer{nullptr, av_free} nvdec_processor(std::move(nvdec_processor_)), converted_frame_buffer{nullptr, av_free} {}
{}
Vic::~Vic() = default; Vic::~Vic() = default;
void Vic::VicStateWrite(u32 offset, u32 arguments) { void Vic::ProcessMethod(Method method, u32 argument) {
u8* const state_offset = reinterpret_cast<u8*>(&vic_state) + offset * sizeof(u32); LOG_DEBUG(HW_GPU, "Vic method 0x{:X}", static_cast<u32>(method));
std::memcpy(state_offset, &arguments, sizeof(u32)); const u64 arg = static_cast<u64>(argument) << 8;
}
void Vic::ProcessMethod(Method method, const std::vector<u32>& arguments) {
LOG_DEBUG(HW_GPU, "Vic method 0x{:X}", method);
VicStateWrite(static_cast<u32>(method), arguments[0]);
const u64 arg = static_cast<u64>(arguments[0]) << 8;
switch (method) { switch (method) {
case Method::Execute: case Method::Execute:
Execute(); Execute();
@ -56,8 +49,7 @@ void Vic::ProcessMethod(Method method, const std::vector<u32>& arguments) {
void Vic::Execute() { void Vic::Execute() {
if (output_surface_luma_address == 0) { if (output_surface_luma_address == 0) {
LOG_ERROR(Service_NVDRV, "VIC Luma address not set. Received 0x{:X}", LOG_ERROR(Service_NVDRV, "VIC Luma address not set.");
vic_state.output_surface.luma_offset);
return; return;
} }
const VicConfig config{gpu.MemoryManager().Read<u64>(config_struct_address + 0x20)}; const VicConfig config{gpu.MemoryManager().Read<u64>(config_struct_address + 0x20)};