2020-10-27 03:07:36 +00:00
|
|
|
// Copyright 2020 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include "video_core/command_classes/host1x.h"
|
|
|
|
#include "video_core/gpu.h"
|
|
|
|
|
|
|
|
Tegra::Host1x::Host1x(GPU& gpu_) : gpu(gpu_) {}
|
|
|
|
|
|
|
|
Tegra::Host1x::~Host1x() = default;
|
|
|
|
|
|
|
|
void Tegra::Host1x::StateWrite(u32 offset, u32 arguments) {
|
|
|
|
u8* const state_offset = reinterpret_cast<u8*>(&state) + offset * sizeof(u32);
|
|
|
|
std::memcpy(state_offset, &arguments, sizeof(u32));
|
|
|
|
}
|
|
|
|
|
2020-10-27 06:09:17 +00:00
|
|
|
void Tegra::Host1x::ProcessMethod(Method method, const std::vector<u32>& arguments) {
|
2020-10-27 03:07:36 +00:00
|
|
|
StateWrite(static_cast<u32>(method), arguments[0]);
|
|
|
|
switch (method) {
|
|
|
|
case Method::WaitSyncpt:
|
|
|
|
Execute(arguments[0]);
|
|
|
|
break;
|
|
|
|
case Method::LoadSyncptPayload32:
|
|
|
|
syncpoint_value = arguments[0];
|
|
|
|
break;
|
|
|
|
case Method::WaitSyncpt32:
|
|
|
|
Execute(arguments[0]);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
UNIMPLEMENTED_MSG("Host1x method 0x{:X}", static_cast<u32>(method));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Tegra::Host1x::Execute(u32 data) {
|
2020-12-28 06:02:06 +00:00
|
|
|
u32 syncpointId = (data & 0xFF);
|
|
|
|
u32 threshold = state.load_syncpoint_payload32;
|
|
|
|
|
|
|
|
gpu.WaitFence(syncpointId, threshold);
|
2020-10-27 03:07:36 +00:00
|
|
|
}
|