From 5b6bbfc3270ae15aaada57d8b872fc5f9893a17a Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Wed, 6 Sep 2023 13:45:49 +0300 Subject: [PATCH] sceVideoOutGetFlipStatus implementation --- .../PS4/HLE/Graphics/Objects/video_out_ctx.cpp | 10 +++++++++- .../PS4/HLE/Graphics/Objects/video_out_ctx.h | 15 +++++++++++++++ src/Core/PS4/HLE/Graphics/video_out.cpp | 17 ++++++++++++++--- src/Core/PS4/HLE/LibKernel.cpp | 2 +- src/Core/PS4/HLE/LibSceGnmDriver.cpp | 9 +++++++-- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp index 50c6772d..ccf25e92 100644 --- a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp +++ b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp @@ -31,4 +31,12 @@ VideoConfigInternal* VideoOutCtx::getCtx(int handle) { if (handle != 1) return nullptr; return &m_video_out_ctx; // assuming that it's the only ctx TODO check if we need more } -}; // namespace HLE::Graphics::Objects \ No newline at end of file + +void FlipQueue::getFlipStatus(VideoConfigInternal* cfg, SceVideoOutFlipStatus* out) { + Lib::LockMutexGuard lock(m_mutex); + + *out = cfg->m_flip_status; +} + +}; // namespace HLE::Graphics::Objects + diff --git a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h index 0bb3f494..477ce3eb 100644 --- a/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h +++ b/src/Core/PS4/HLE/Graphics/Objects/video_out_ctx.h @@ -6,6 +6,8 @@ using namespace HLE::Libs::Graphics::VideoOut; namespace HLE::Graphics::Objects { +//class FlipQueue; + struct VideoConfigInternal { Lib::Mutex m_mutex; SceVideoOutResolutionStatus m_resolution; @@ -16,6 +18,17 @@ struct VideoConfigInternal { int m_flip_rate = 0; }; +class FlipQueue { + public: + FlipQueue() {} + virtual ~FlipQueue() {} + + void getFlipStatus(VideoConfigInternal* cfg, SceVideoOutFlipStatus* out); + + private: + Lib::Mutex m_mutex; +}; + class VideoOutCtx { public: @@ -24,8 +37,10 @@ class VideoOutCtx { void Init(u32 width, u32 height); int Open(); VideoConfigInternal* getCtx(int handle); + FlipQueue& getFlipQueue() { return m_flip_queue; } private: Lib::Mutex m_mutex; VideoConfigInternal m_video_out_ctx; + FlipQueue m_flip_queue; }; }; // namespace HLE::Graphics::Objects \ No newline at end of file diff --git a/src/Core/PS4/HLE/Graphics/video_out.cpp b/src/Core/PS4/HLE/Graphics/video_out.cpp index 4dce34bc..aaa90544 100644 --- a/src/Core/PS4/HLE/Graphics/video_out.cpp +++ b/src/Core/PS4/HLE/Graphics/video_out.cpp @@ -9,8 +9,8 @@ #include #include - #include "Objects/video_out_ctx.h" + #include "Util/Singleton.h" namespace HLE::Libs::Graphics::VideoOut { @@ -116,8 +116,19 @@ s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode return 0; } s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, SceVideoOutFlipStatus* status) { - // BREAKPOINT(); - PRINT_DUMMY_FUNCTION_NAME(); + PRINT_FUNCTION_NAME(); + auto* videoOut = Singleton::Instance(); + auto* ctx = videoOut->getCtx(handle); + videoOut->getFlipQueue().getFlipStatus(ctx, status); + + LOG_INFO_IF(log_file_videoout, "count = {}\n", status->count); + LOG_INFO_IF(log_file_videoout, "processTime = {}\n", status->processTime); + LOG_INFO_IF(log_file_videoout, "tsc = {}\n", status->tsc); + LOG_INFO_IF(log_file_videoout, "submitTsc = {}\n", status->submitTsc); + LOG_INFO_IF(log_file_videoout, "flipArg = {}\n", status->flipArg); + LOG_INFO_IF(log_file_videoout, "gcQueueNum = {}\n", status->gcQueueNum); + LOG_INFO_IF(log_file_videoout, "flipPendingNum = {}\n", status->flipPendingNum); + LOG_INFO_IF(log_file_videoout, "currentBuffer = {}\n", status->currentBuffer); return 0; } s32 PS4_SYSV_ABI sceVideoOutGetResolutionStatus(s32 handle, SceVideoOutResolutionStatus* status) { diff --git a/src/Core/PS4/HLE/LibKernel.cpp b/src/Core/PS4/HLE/LibKernel.cpp index 9ddf0d70..caf74e32 100644 --- a/src/Core/PS4/HLE/LibKernel.cpp +++ b/src/Core/PS4/HLE/LibKernel.cpp @@ -20,7 +20,7 @@ namespace HLE::Libs::LibKernel { int PS4_SYSV_ABI sceKernelWaitEqueue(/*SceKernelEqueue eq, SceKernelEvent* ev,*/ int num, int* out /*, SceKernelUseconds* timo*/) { - BREAKPOINT(); + PRINT_DUMMY_FUNCTION_NAME(); return 0; } diff --git a/src/Core/PS4/HLE/LibSceGnmDriver.cpp b/src/Core/PS4/HLE/LibSceGnmDriver.cpp index e8be26a9..cc48ba45 100644 --- a/src/Core/PS4/HLE/LibSceGnmDriver.cpp +++ b/src/Core/PS4/HLE/LibSceGnmDriver.cpp @@ -1,6 +1,8 @@ #include "LibSceGnmDriver.h" #include "Libs.h" #include "../Loader/Elf.h" +#include +#include namespace HLE::Libs::LibSceGnmDriver { @@ -61,7 +63,9 @@ namespace HLE::Libs::LibSceGnmDriver { { return 0; } int32_t sceGnmSubmitDone() - { return 0; + { + PRINT_DUMMY_FUNCTION_NAME(); + return 0; } int /* MipStatsError*/ sceGnmDisableMipStatsReport() { return 0; @@ -84,7 +88,8 @@ namespace HLE::Libs::LibSceGnmDriver { void sceGnmDriverTraceInProgress(){} void sceGnmDriverTriggerCapture(){} void sceGnmEndWorkload(){} - void sceGnmFlushGarlic(){} + void sceGnmFlushGarlic() { PRINT_DUMMY_FUNCTION_NAME(); + } void sceGnmGetEqEventType(){} void sceGnmGetEqTimeStamp(){} void sceGnmGetGpuBlockStatus(){}