summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar mailwl2016-04-22 21:13:01 +0300
committerGravatar mailwl2016-04-22 21:15:25 +0300
commitefdff9ad3ed8856fa492fd08810322030a5e97ee (patch)
treee4f5bb74e874b5718c06f6720bb1b626b15d9f80
parentMerge pull request #1697 from tfarley/hw-lighting-sync (diff)
downloadyuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.tar.gz
yuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.tar.xz
yuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.zip
gsp::Gpu: implement AcquireRight, ReleaseRight functions
-rw-r--r--src/core/hle/service/gsp_gpu.cpp45
1 files changed, 37 insertions, 8 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 211fcf599..9fb4962d8 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -44,6 +44,8 @@ Kernel::SharedPtr<Kernel::SharedMemory> g_shared_memory;
44/// Thread index into interrupt relay queue 44/// Thread index into interrupt relay queue
45u32 g_thread_id = 0; 45u32 g_thread_id = 0;
46 46
47static bool gpu_right_acquired = false;
48
47/// Gets a pointer to a thread command buffer in GSP shared memory 49/// Gets a pointer to a thread command buffer in GSP shared memory
48static inline u8* GetCommandBuffer(u32 thread_id) { 50static inline u8* GetCommandBuffer(u32 thread_id) {
49 return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer))); 51 return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer)));
@@ -371,14 +373,10 @@ static void UnregisterInterruptRelayQueue(Service::Interface* self) {
371 * @todo This probably does not belong in the GSP module, instead move to video_core 373 * @todo This probably does not belong in the GSP module, instead move to video_core
372 */ 374 */
373void SignalInterrupt(InterruptId interrupt_id) { 375void SignalInterrupt(InterruptId interrupt_id) {
374 if (nullptr == g_interrupt_event) { 376 if (!gpu_right_acquired) {
375 LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!");
376 return;
377 }
378 if (nullptr == g_shared_memory) {
379 LOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!");
380 return; 377 return;
381 } 378 }
379
382 for (int thread_id = 0; thread_id < 0x4; ++thread_id) { 380 for (int thread_id = 0; thread_id < 0x4; ++thread_id) {
383 InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(thread_id); 381 InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(thread_id);
384 u8 next = interrupt_relay_queue->index; 382 u8 next = interrupt_relay_queue->index;
@@ -625,6 +623,35 @@ static void ImportDisplayCaptureInfo(Service::Interface* self) {
625 LOG_WARNING(Service_GSP, "called"); 623 LOG_WARNING(Service_GSP, "called");
626} 624}
627 625
626/**
627 * GSP_GPU::AcquireRight service function
628 * Outputs:
629 * 1: Result code
630 */
631static void AcquireRight(Service::Interface* self) {
632 u32* cmd_buff = Kernel::GetCommandBuffer();
633
634 gpu_right_acquired = true;
635
636 cmd_buff[1] = RESULT_SUCCESS.raw;
637
638 LOG_WARNING(Service_GSP, "called");
639}
640
641/**
642 * GSP_GPU::ReleaseRight service function
643 * Outputs:
644 * 1: Result code
645 */
646static void ReleaseRight(Service::Interface* self) {
647 u32* cmd_buff = Kernel::GetCommandBuffer();
648
649 gpu_right_acquired = false;
650
651 cmd_buff[1] = RESULT_SUCCESS.raw;
652
653 LOG_WARNING(Service_GSP, "called");
654}
628 655
629const Interface::FunctionInfo FunctionTable[] = { 656const Interface::FunctionInfo FunctionTable[] = {
630 {0x00010082, WriteHWRegs, "WriteHWRegs"}, 657 {0x00010082, WriteHWRegs, "WriteHWRegs"},
@@ -648,8 +675,8 @@ const Interface::FunctionInfo FunctionTable[] = {
648 {0x00130042, RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"}, 675 {0x00130042, RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"},
649 {0x00140000, UnregisterInterruptRelayQueue, "UnregisterInterruptRelayQueue"}, 676 {0x00140000, UnregisterInterruptRelayQueue, "UnregisterInterruptRelayQueue"},
650 {0x00150002, nullptr, "TryAcquireRight"}, 677 {0x00150002, nullptr, "TryAcquireRight"},
651 {0x00160042, nullptr, "AcquireRight"}, 678 {0x00160042, AcquireRight, "AcquireRight"},
652 {0x00170000, nullptr, "ReleaseRight"}, 679 {0x00170000, ReleaseRight, "ReleaseRight"},
653 {0x00180000, ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"}, 680 {0x00180000, ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"},
654 {0x00190000, nullptr, "SaveVramSysArea"}, 681 {0x00190000, nullptr, "SaveVramSysArea"},
655 {0x001A0000, nullptr, "RestoreVramSysArea"}, 682 {0x001A0000, nullptr, "RestoreVramSysArea"},
@@ -670,11 +697,13 @@ Interface::Interface() {
670 g_shared_memory = nullptr; 697 g_shared_memory = nullptr;
671 698
672 g_thread_id = 0; 699 g_thread_id = 0;
700 gpu_right_acquired = false;
673} 701}
674 702
675Interface::~Interface() { 703Interface::~Interface() {
676 g_interrupt_event = nullptr; 704 g_interrupt_event = nullptr;
677 g_shared_memory = nullptr; 705 g_shared_memory = nullptr;
706 gpu_right_acquired = false;
678} 707}
679 708
680} // namespace 709} // namespace