summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/result.h1
-rw-r--r--src/core/hle/service/gsp_gpu.cpp36
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp2
3 files changed, 23 insertions, 16 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index bfb3327ce..57dedcb22 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -26,6 +26,7 @@ enum class ErrorDescription : u32 {
26 FS_NotAFile = 250, 26 FS_NotAFile = 250,
27 FS_NotFormatted = 340, ///< This is used by the FS service when creating a SaveData archive 27 FS_NotFormatted = 340, ///< This is used by the FS service when creating a SaveData archive
28 OutofRangeOrMisalignedAddress = 513, // TODO(purpasmart): Check if this name fits its actual usage 28 OutofRangeOrMisalignedAddress = 513, // TODO(purpasmart): Check if this name fits its actual usage
29 GPU_FirstInitialization = 519,
29 FS_InvalidPath = 702, 30 FS_InvalidPath = 702,
30 InvalidSection = 1000, 31 InvalidSection = 1000,
31 TooLarge = 1001, 32 TooLarge = 1001,
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index f3c7b7df3..ec565f46d 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -44,7 +44,7 @@ Kernel::SharedPtr<Kernel::SharedMemory> g_shared_memory;
44u32 g_thread_id = 0; 44u32 g_thread_id = 0;
45 45
46static bool gpu_right_acquired = false; 46static bool gpu_right_acquired = false;
47 47static bool first_initialization = true;
48/// 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
49static inline u8* GetCommandBuffer(u32 thread_id) { 49static inline u8* GetCommandBuffer(u32 thread_id) {
50 return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer))); 50 return g_shared_memory->GetPointer(0x800 + (thread_id * sizeof(CommandBuffer)));
@@ -347,24 +347,25 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) {
347 u32 flags = cmd_buff[1]; 347 u32 flags = cmd_buff[1];
348 348
349 g_interrupt_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[3]); 349 g_interrupt_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[3]);
350 // TODO(mailwl): return right error code instead assert
350 ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!"); 351 ASSERT_MSG((g_interrupt_event != nullptr), "handle is not valid!");
351 352
352 g_interrupt_event->name = "GSP_GPU::interrupt_event"; 353 g_interrupt_event->name = "GSP_GPU::interrupt_event";
353 354
354 using Kernel::MemoryPermission; 355 if (first_initialization) {
355 g_shared_memory = Kernel::SharedMemory::Create(nullptr, 0x1000, 356 // This specific code is required for a successful initialization, rather than 0
356 MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, 357 first_initialization = false;
357 0, Kernel::MemoryRegion::BASE, "GSP:SharedMemory"); 358 cmd_buff[1] = ResultCode(ErrorDescription::GPU_FirstInitialization, ErrorModule::GX,
358 359 ErrorSummary::Success, ErrorLevel::Success).raw;
359 Handle shmem_handle = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom(); 360 } else {
360 361 cmd_buff[1] = RESULT_SUCCESS.raw;
361 // This specific code is required for a successful initialization, rather than 0 362 }
362 cmd_buff[1] = ResultCode((ErrorDescription)519, ErrorModule::GX,
363 ErrorSummary::Success, ErrorLevel::Success).raw;
364 cmd_buff[2] = g_thread_id++; // Thread ID 363 cmd_buff[2] = g_thread_id++; // Thread ID
365 cmd_buff[4] = shmem_handle; // GSP shared memory 364 cmd_buff[4] = Kernel::g_handle_table.Create(g_shared_memory).MoveFrom(); // GSP shared memory
366 365
367 g_interrupt_event->Signal(); // TODO(bunnei): Is this correct? 366 g_interrupt_event->Signal(); // TODO(bunnei): Is this correct?
367
368 LOG_WARNING(Service_GSP, "called, flags=0x%08X", flags);
368} 369}
369 370
370/** 371/**
@@ -375,12 +376,12 @@ static void RegisterInterruptRelayQueue(Service::Interface* self) {
375static void UnregisterInterruptRelayQueue(Service::Interface* self) { 376static void UnregisterInterruptRelayQueue(Service::Interface* self) {
376 u32* cmd_buff = Kernel::GetCommandBuffer(); 377 u32* cmd_buff = Kernel::GetCommandBuffer();
377 378
378 g_shared_memory = nullptr; 379 g_thread_id = 0;
379 g_interrupt_event = nullptr; 380 g_interrupt_event = nullptr;
380 381
381 cmd_buff[1] = RESULT_SUCCESS.raw; 382 cmd_buff[1] = RESULT_SUCCESS.raw;
382 383
383 LOG_WARNING(Service_GSP, "called"); 384 LOG_WARNING(Service_GSP, "(STUBBED) called");
384} 385}
385 386
386/** 387/**
@@ -718,10 +719,15 @@ Interface::Interface() {
718 Register(FunctionTable); 719 Register(FunctionTable);
719 720
720 g_interrupt_event = nullptr; 721 g_interrupt_event = nullptr;
721 g_shared_memory = nullptr; 722
723 using Kernel::MemoryPermission;
724 g_shared_memory = Kernel::SharedMemory::Create(nullptr, 0x1000,
725 MemoryPermission::ReadWrite, MemoryPermission::ReadWrite,
726 0, Kernel::MemoryRegion::BASE, "GSP:SharedMemory");
722 727
723 g_thread_id = 0; 728 g_thread_id = 0;
724 gpu_right_acquired = false; 729 gpu_right_acquired = false;
730 first_initialization = true;
725} 731}
726 732
727Interface::~Interface() { 733Interface::~Interface() {
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 8f424a435..8410e0a64 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -450,7 +450,7 @@ static const char* GetType(GLenum type) {
450#undef RET 450#undef RET
451} 451}
452 452
453static void DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, 453static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
454 const GLchar* message, const void* user_param) { 454 const GLchar* message, const void* user_param) {
455 Log::Level level; 455 Log::Level level;
456 switch (severity) { 456 switch (severity) {