mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-18 14:10:04 +00:00
gsp::Gpu: implement AcquireRight, ReleaseRight functions
This commit is contained in:
parent
57a5fc40c0
commit
efdff9ad3e
@ -44,6 +44,8 @@ Kernel::SharedPtr<Kernel::SharedMemory> g_shared_memory;
|
||||
/// Thread index into interrupt relay queue
|
||||
u32 g_thread_id = 0;
|
||||
|
||||
static bool gpu_right_acquired = false;
|
||||
|
||||
/// Gets a pointer to a thread command buffer in GSP shared memory
|
||||
static inline u8* GetCommandBuffer(u32 thread_id) {
|
||||
return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer)));
|
||||
@ -371,14 +373,10 @@ static void UnregisterInterruptRelayQueue(Service::Interface* self) {
|
||||
* @todo This probably does not belong in the GSP module, instead move to video_core
|
||||
*/
|
||||
void SignalInterrupt(InterruptId interrupt_id) {
|
||||
if (nullptr == g_interrupt_event) {
|
||||
LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!");
|
||||
return;
|
||||
}
|
||||
if (nullptr == g_shared_memory) {
|
||||
LOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!");
|
||||
if (!gpu_right_acquired) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int thread_id = 0; thread_id < 0x4; ++thread_id) {
|
||||
InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(thread_id);
|
||||
u8 next = interrupt_relay_queue->index;
|
||||
@ -625,6 +623,35 @@ static void ImportDisplayCaptureInfo(Service::Interface* self) {
|
||||
LOG_WARNING(Service_GSP, "called");
|
||||
}
|
||||
|
||||
/**
|
||||
* GSP_GPU::AcquireRight service function
|
||||
* Outputs:
|
||||
* 1: Result code
|
||||
*/
|
||||
static void AcquireRight(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
gpu_right_acquired = true;
|
||||
|
||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||
|
||||
LOG_WARNING(Service_GSP, "called");
|
||||
}
|
||||
|
||||
/**
|
||||
* GSP_GPU::ReleaseRight service function
|
||||
* Outputs:
|
||||
* 1: Result code
|
||||
*/
|
||||
static void ReleaseRight(Service::Interface* self) {
|
||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||
|
||||
gpu_right_acquired = false;
|
||||
|
||||
cmd_buff[1] = RESULT_SUCCESS.raw;
|
||||
|
||||
LOG_WARNING(Service_GSP, "called");
|
||||
}
|
||||
|
||||
const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x00010082, WriteHWRegs, "WriteHWRegs"},
|
||||
@ -648,8 +675,8 @@ const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x00130042, RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"},
|
||||
{0x00140000, UnregisterInterruptRelayQueue, "UnregisterInterruptRelayQueue"},
|
||||
{0x00150002, nullptr, "TryAcquireRight"},
|
||||
{0x00160042, nullptr, "AcquireRight"},
|
||||
{0x00170000, nullptr, "ReleaseRight"},
|
||||
{0x00160042, AcquireRight, "AcquireRight"},
|
||||
{0x00170000, ReleaseRight, "ReleaseRight"},
|
||||
{0x00180000, ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"},
|
||||
{0x00190000, nullptr, "SaveVramSysArea"},
|
||||
{0x001A0000, nullptr, "RestoreVramSysArea"},
|
||||
@ -670,11 +697,13 @@ Interface::Interface() {
|
||||
g_shared_memory = nullptr;
|
||||
|
||||
g_thread_id = 0;
|
||||
gpu_right_acquired = false;
|
||||
}
|
||||
|
||||
Interface::~Interface() {
|
||||
g_interrupt_event = nullptr;
|
||||
g_shared_memory = nullptr;
|
||||
gpu_right_acquired = false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user