summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/gsp_gpu.cpp
diff options
context:
space:
mode:
authormailwl <mailwl@gmail.com>2016-04-22 20:13:01 +0200
committermailwl <mailwl@gmail.com>2016-04-22 20:15:25 +0200
commitefdff9ad3ed8856fa492fd08810322030a5e97ee (patch)
treee4f5bb74e874b5718c06f6720bb1b626b15d9f80 /src/core/hle/service/gsp_gpu.cpp
parentMerge pull request #1697 from tfarley/hw-lighting-sync (diff)
downloadyuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.tar
yuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.tar.gz
yuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.tar.bz2
yuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.tar.lz
yuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.tar.xz
yuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.tar.zst
yuzu-efdff9ad3ed8856fa492fd08810322030a5e97ee.zip
Diffstat (limited to 'src/core/hle/service/gsp_gpu.cpp')
-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;
/// 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