diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 45 |
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 |
| 45 | u32 g_thread_id = 0; | 45 | u32 g_thread_id = 0; |
| 46 | 46 | ||
| 47 | static 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 |
| 48 | static inline u8* GetCommandBuffer(u32 thread_id) { | 50 | static 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 | */ |
| 373 | void SignalInterrupt(InterruptId interrupt_id) { | 375 | void 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 | */ | ||
| 631 | static 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 | */ | ||
| 646 | static 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 | ||
| 629 | const Interface::FunctionInfo FunctionTable[] = { | 656 | const 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 | ||
| 675 | Interface::~Interface() { | 703 | Interface::~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 |