diff options
| author | 2016-04-29 20:50:08 -0400 | |
|---|---|---|
| committer | 2016-04-29 20:50:08 -0400 | |
| commit | eb2d6e401583a2429a9751d76ed138d8a7f44810 (patch) | |
| tree | 591d4d6397bcd61a5225277af05622229de49392 | |
| parent | Merge pull request #1726 from MerryMage/read-write-region (diff) | |
| parent | return checks if event and memory created (diff) | |
| download | yuzu-eb2d6e401583a2429a9751d76ed138d8a7f44810.tar.gz yuzu-eb2d6e401583a2429a9751d76ed138d8a7f44810.tar.xz yuzu-eb2d6e401583a2429a9751d76ed138d8a7f44810.zip | |
Merge pull request #1699 from mailwl/gpu-rights
gsp::Gpu: implement AcquireRight, ReleaseRight functions
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 233592d7f..b4c146e08 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -43,6 +43,8 @@ Kernel::SharedPtr<Kernel::SharedMemory> g_shared_memory; | |||
| 43 | /// Thread index into interrupt relay queue | 43 | /// Thread index into interrupt relay queue |
| 44 | u32 g_thread_id = 0; | 44 | u32 g_thread_id = 0; |
| 45 | 45 | ||
| 46 | static bool gpu_right_acquired = false; | ||
| 47 | |||
| 46 | /// Gets a pointer to a thread command buffer in GSP shared memory | 48 | /// Gets a pointer to a thread command buffer in GSP shared memory |
| 47 | static inline u8* GetCommandBuffer(u32 thread_id) { | 49 | static inline u8* GetCommandBuffer(u32 thread_id) { |
| 48 | return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer))); | 50 | return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer))); |
| @@ -370,6 +372,9 @@ static void UnregisterInterruptRelayQueue(Service::Interface* self) { | |||
| 370 | * @todo This probably does not belong in the GSP module, instead move to video_core | 372 | * @todo This probably does not belong in the GSP module, instead move to video_core |
| 371 | */ | 373 | */ |
| 372 | void SignalInterrupt(InterruptId interrupt_id) { | 374 | void SignalInterrupt(InterruptId interrupt_id) { |
| 375 | if (!gpu_right_acquired) { | ||
| 376 | return; | ||
| 377 | } | ||
| 373 | if (nullptr == g_interrupt_event) { | 378 | if (nullptr == g_interrupt_event) { |
| 374 | LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!"); | 379 | LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!"); |
| 375 | return; | 380 | return; |
| @@ -624,6 +629,35 @@ static void ImportDisplayCaptureInfo(Service::Interface* self) { | |||
| 624 | LOG_WARNING(Service_GSP, "called"); | 629 | LOG_WARNING(Service_GSP, "called"); |
| 625 | } | 630 | } |
| 626 | 631 | ||
| 632 | /** | ||
| 633 | * GSP_GPU::AcquireRight service function | ||
| 634 | * Outputs: | ||
| 635 | * 1: Result code | ||
| 636 | */ | ||
| 637 | static void AcquireRight(Service::Interface* self) { | ||
| 638 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 639 | |||
| 640 | gpu_right_acquired = true; | ||
| 641 | |||
| 642 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 643 | |||
| 644 | LOG_WARNING(Service_GSP, "called"); | ||
| 645 | } | ||
| 646 | |||
| 647 | /** | ||
| 648 | * GSP_GPU::ReleaseRight service function | ||
| 649 | * Outputs: | ||
| 650 | * 1: Result code | ||
| 651 | */ | ||
| 652 | static void ReleaseRight(Service::Interface* self) { | ||
| 653 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 654 | |||
| 655 | gpu_right_acquired = false; | ||
| 656 | |||
| 657 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 658 | |||
| 659 | LOG_WARNING(Service_GSP, "called"); | ||
| 660 | } | ||
| 627 | 661 | ||
| 628 | const Interface::FunctionInfo FunctionTable[] = { | 662 | const Interface::FunctionInfo FunctionTable[] = { |
| 629 | {0x00010082, WriteHWRegs, "WriteHWRegs"}, | 663 | {0x00010082, WriteHWRegs, "WriteHWRegs"}, |
| @@ -647,8 +681,8 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 647 | {0x00130042, RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"}, | 681 | {0x00130042, RegisterInterruptRelayQueue, "RegisterInterruptRelayQueue"}, |
| 648 | {0x00140000, UnregisterInterruptRelayQueue, "UnregisterInterruptRelayQueue"}, | 682 | {0x00140000, UnregisterInterruptRelayQueue, "UnregisterInterruptRelayQueue"}, |
| 649 | {0x00150002, nullptr, "TryAcquireRight"}, | 683 | {0x00150002, nullptr, "TryAcquireRight"}, |
| 650 | {0x00160042, nullptr, "AcquireRight"}, | 684 | {0x00160042, AcquireRight, "AcquireRight"}, |
| 651 | {0x00170000, nullptr, "ReleaseRight"}, | 685 | {0x00170000, ReleaseRight, "ReleaseRight"}, |
| 652 | {0x00180000, ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"}, | 686 | {0x00180000, ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"}, |
| 653 | {0x00190000, nullptr, "SaveVramSysArea"}, | 687 | {0x00190000, nullptr, "SaveVramSysArea"}, |
| 654 | {0x001A0000, nullptr, "RestoreVramSysArea"}, | 688 | {0x001A0000, nullptr, "RestoreVramSysArea"}, |
| @@ -669,11 +703,13 @@ Interface::Interface() { | |||
| 669 | g_shared_memory = nullptr; | 703 | g_shared_memory = nullptr; |
| 670 | 704 | ||
| 671 | g_thread_id = 0; | 705 | g_thread_id = 0; |
| 706 | gpu_right_acquired = false; | ||
| 672 | } | 707 | } |
| 673 | 708 | ||
| 674 | Interface::~Interface() { | 709 | Interface::~Interface() { |
| 675 | g_interrupt_event = nullptr; | 710 | g_interrupt_event = nullptr; |
| 676 | g_shared_memory = nullptr; | 711 | g_shared_memory = nullptr; |
| 712 | gpu_right_acquired = false; | ||
| 677 | } | 713 | } |
| 678 | 714 | ||
| 679 | } // namespace | 715 | } // namespace |