diff options
| author | 2015-05-10 19:51:37 -0300 | |
|---|---|---|
| committer | 2015-05-10 20:05:30 -0300 | |
| commit | 1538a34eda324782bf88fa382201e1e5cf8a237c (patch) | |
| tree | 289d71bd250004be94c6cd3e3698382b7fa184d9 /src | |
| parent | Kernel: Zero-fill shared memory blocks when mapping (diff) | |
| download | yuzu-1538a34eda324782bf88fa382201e1e5cf8a237c.tar.gz yuzu-1538a34eda324782bf88fa382201e1e5cf8a237c.tar.xz yuzu-1538a34eda324782bf88fa382201e1e5cf8a237c.zip | |
GSP: Small tweaks to shared memory initialization
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index e2b6b0b02..917f4685f 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -31,7 +31,7 @@ Kernel::SharedPtr<Kernel::Event> g_interrupt_event; | |||
| 31 | /// GSP shared memoryings | 31 | /// GSP shared memoryings |
| 32 | Kernel::SharedPtr<Kernel::SharedMemory> g_shared_memory; | 32 | Kernel::SharedPtr<Kernel::SharedMemory> g_shared_memory; |
| 33 | /// Thread index into interrupt relay queue, 1 is arbitrary | 33 | /// Thread index into interrupt relay queue, 1 is arbitrary |
| 34 | u32 g_thread_id = 1; | 34 | u32 g_thread_id = 0; |
| 35 | 35 | ||
| 36 | /// Gets a pointer to a thread command buffer in GSP shared memory | 36 | /// Gets a pointer to a thread command buffer in GSP shared memory |
| 37 | static inline u8* GetCommandBuffer(u32 thread_id) { | 37 | static inline u8* GetCommandBuffer(u32 thread_id) { |
| @@ -277,7 +277,7 @@ static void FlushDataCache(Service::Interface* self) { | |||
| 277 | * 1 : "Flags" field, purpose is unknown | 277 | * 1 : "Flags" field, purpose is unknown |
| 278 | * 3 : Handle to GSP synchronization event | 278 | * 3 : Handle to GSP synchronization event |
| 279 | * Outputs: | 279 | * Outputs: |
| 280 | * 0 : Result of function, 0 on success, otherwise error code | 280 | * 1 : Result of function, 0x2A07 on success, otherwise error code |
| 281 | * 2 : Thread index into GSP command buffer | 281 | * 2 : Thread index into GSP command buffer |
| 282 | * 4 : Handle to GSP shared memory | 282 | * 4 : Handle to GSP shared memory |
| 283 | */ | 283 | */ |
| @@ -288,13 +288,11 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) { | |||
| 288 | g_interrupt_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[3]); | 288 | g_interrupt_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[3]); |
| 289 | ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!"); | 289 | ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!"); |
| 290 | 290 | ||
| 291 | using Kernel::MemoryPermission; | ||
| 292 | g_shared_memory = Kernel::SharedMemory::Create(0x1000, MemoryPermission::ReadWrite, | ||
| 293 | MemoryPermission::ReadWrite, "GSPSharedMem"); | ||
| 294 | |||
| 295 | Handle shmem_handle = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom(); | 291 | Handle shmem_handle = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom(); |
| 296 | 292 | ||
| 297 | cmd_buff[1] = 0x2A07; // Value verified by 3dmoo team, purpose unknown, but needed for GSP init | 293 | // This specific code is required for a successful initialization, rather than 0 |
| 294 | cmd_buff[1] = ResultCode((ErrorDescription)519, ErrorModule::GX, | ||
| 295 | ErrorSummary::Success, ErrorLevel::Success).raw; | ||
| 298 | cmd_buff[2] = g_thread_id++; // Thread ID | 296 | cmd_buff[2] = g_thread_id++; // Thread ID |
| 299 | cmd_buff[4] = shmem_handle; // GSP shared memory | 297 | cmd_buff[4] = shmem_handle; // GSP shared memory |
| 300 | 298 | ||
| @@ -529,8 +527,12 @@ Interface::Interface() { | |||
| 529 | Register(FunctionTable); | 527 | Register(FunctionTable); |
| 530 | 528 | ||
| 531 | g_interrupt_event = 0; | 529 | g_interrupt_event = 0; |
| 532 | g_shared_memory = 0; | 530 | |
| 533 | g_thread_id = 1; | 531 | using Kernel::MemoryPermission; |
| 532 | g_shared_memory = Kernel::SharedMemory::Create(0x1000, MemoryPermission::ReadWrite, | ||
| 533 | MemoryPermission::ReadWrite, "GSPSharedMem"); | ||
| 534 | |||
| 535 | g_thread_id = 0; | ||
| 534 | } | 536 | } |
| 535 | 537 | ||
| 536 | } // namespace | 538 | } // namespace |