From 7cbb3405af40fb28e4ede1c0b0aa0a90950f8808 Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle Date: Fri, 25 Oct 2024 16:15:57 +0300 Subject: [PATCH] gnmdriver: Add sceGnmSubmitCommandBuffersForWorkload --- src/core/libraries/gnmdriver/gnmdriver.cpp | 16 ++++++++++------ src/core/libraries/gnmdriver/gnmdriver.h | 6 +++++- src/core/libraries/kernel/kernel.cpp | 3 ++- src/core/libraries/kernel/kernel.h | 2 +- src/core/libraries/libs.h | 4 ++-- src/video_core/texture_cache/texture_cache.cpp | 2 +- src/video_core/texture_cache/texture_cache.h | 4 ++-- 7 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/core/libraries/gnmdriver/gnmdriver.cpp b/src/core/libraries/gnmdriver/gnmdriver.cpp index 31d1f6d31..857089caa 100644 --- a/src/core/libraries/gnmdriver/gnmdriver.cpp +++ b/src/core/libraries/gnmdriver/gnmdriver.cpp @@ -2120,9 +2120,11 @@ s32 PS4_SYSV_ABI sceGnmSubmitAndFlipCommandBuffersForWorkload( ccb_sizes_in_bytes); } -s32 PS4_SYSV_ABI sceGnmSubmitCommandBuffers(u32 count, const u32* dcb_gpu_addrs[], - u32* dcb_sizes_in_bytes, const u32* ccb_gpu_addrs[], - u32* ccb_sizes_in_bytes) { +int PS4_SYSV_ABI sceGnmSubmitCommandBuffersForWorkload(u32 workload, u32 count, + const u32* dcb_gpu_addrs[], + u32* dcb_sizes_in_bytes, + const u32* ccb_gpu_addrs[], + u32* ccb_sizes_in_bytes) { LOG_DEBUG(Lib_GnmDriver, "called"); if (!dcb_gpu_addrs || !dcb_sizes_in_bytes) { @@ -2207,9 +2209,11 @@ s32 PS4_SYSV_ABI sceGnmSubmitCommandBuffers(u32 count, const u32* dcb_gpu_addrs[ return ORBIS_OK; } -int PS4_SYSV_ABI sceGnmSubmitCommandBuffersForWorkload() { - LOG_ERROR(Lib_GnmDriver, "(STUBBED) called"); - return ORBIS_OK; +s32 PS4_SYSV_ABI sceGnmSubmitCommandBuffers(u32 count, const u32* dcb_gpu_addrs[], + u32* dcb_sizes_in_bytes, const u32* ccb_gpu_addrs[], + u32* ccb_sizes_in_bytes) { + return sceGnmSubmitCommandBuffersForWorkload(count, count, dcb_gpu_addrs, dcb_sizes_in_bytes, + ccb_gpu_addrs, ccb_sizes_in_bytes); } int PS4_SYSV_ABI sceGnmSubmitDone() { diff --git a/src/core/libraries/gnmdriver/gnmdriver.h b/src/core/libraries/gnmdriver/gnmdriver.h index 8d9a1f235..1d3c126b2 100644 --- a/src/core/libraries/gnmdriver/gnmdriver.h +++ b/src/core/libraries/gnmdriver/gnmdriver.h @@ -213,7 +213,11 @@ int PS4_SYSV_ABI sceGnmSubmitAndFlipCommandBuffersForWorkload( s32 PS4_SYSV_ABI sceGnmSubmitCommandBuffers(u32 count, const u32* dcb_gpu_addrs[], u32* dcb_sizes_in_bytes, const u32* ccb_gpu_addrs[], u32* ccb_sizes_in_bytes); -int PS4_SYSV_ABI sceGnmSubmitCommandBuffersForWorkload(); +int PS4_SYSV_ABI sceGnmSubmitCommandBuffersForWorkload(u32 workload, u32 count, + const u32* dcb_gpu_addrs[], + u32* dcb_sizes_in_bytes, + const u32* ccb_gpu_addrs[], + u32* ccb_sizes_in_bytes); int PS4_SYSV_ABI sceGnmSubmitDone(); int PS4_SYSV_ABI sceGnmUnmapComputeQueue(); int PS4_SYSV_ABI sceGnmUnregisterAllResourcesForOwner(); diff --git a/src/core/libraries/kernel/kernel.cpp b/src/core/libraries/kernel/kernel.cpp index 9fac109a3..7b64b2cd6 100644 --- a/src/core/libraries/kernel/kernel.cpp +++ b/src/core/libraries/kernel/kernel.cpp @@ -239,7 +239,7 @@ s32 PS4_SYSV_ABI sceKernelGetModuleInfoForUnwind(VAddr addr, int flags, if (!info) { return ORBIS_KERNEL_ERROR_EFAULT; } - if (info->st_size <= sizeof(OrbisModuleInfoForUnwind)) { + if (info->st_size < sizeof(OrbisModuleInfoForUnwind)) { return ORBIS_KERNEL_ERROR_EINVAL; } @@ -250,6 +250,7 @@ s32 PS4_SYSV_ABI sceKernelGetModuleInfoForUnwind(VAddr addr, int flags, const auto mod_info = module->GetModuleInfoEx(); // Fill in module info. + std::memset(info, 0, sizeof(OrbisModuleInfoForUnwind)); info->name = mod_info.name; info->eh_frame_hdr_addr = mod_info.eh_frame_hdr_addr; info->eh_frame_addr = mod_info.eh_frame_addr; diff --git a/src/core/libraries/kernel/kernel.h b/src/core/libraries/kernel/kernel.h index 89de5c849..f6865d22f 100644 --- a/src/core/libraries/kernel/kernel.h +++ b/src/core/libraries/kernel/kernel.h @@ -37,7 +37,7 @@ struct WrapperImpl { static R PS4_SYSV_ABI wrap(Args... args) { u32 ret = f(args...); if (ret != 0) { - LOG_ERROR(Lib_Kernel, "Function {} returned {}", std::string_view{name.value}, ret); + // LOG_ERROR(Lib_Kernel, "Function {} returned {}", std::string_view{name.value}, ret); ret += SCE_KERNEL_ERROR_UNKNOWN; } return ret; diff --git a/src/core/libraries/libs.h b/src/core/libraries/libs.h index 41a78e133..375f1abd6 100644 --- a/src/core/libraries/libs.h +++ b/src/core/libraries/libs.h @@ -45,8 +45,8 @@ struct wrapper_impl { template constexpr auto wrapper = wrapper_impl::wrap; -#define W(foo) wrapper<#foo, decltype(&foo), foo> -// #define W(foo) foo +// #define W(foo) wrapper<#foo, decltype(&foo), foo> +#define W(foo) foo #define LIB_FUNCTION(nid, lib, libversion, mod, moduleVersionMajor, moduleVersionMinor, f) \ { \ diff --git a/src/video_core/texture_cache/texture_cache.cpp b/src/video_core/texture_cache/texture_cache.cpp index 279e0d82b..fd6d646bc 100644 --- a/src/video_core/texture_cache/texture_cache.cpp +++ b/src/video_core/texture_cache/texture_cache.cpp @@ -99,7 +99,7 @@ ImageId TextureCache::ResolveDepthOverlap(const ImageInfo& requested_info, Image if (cache_info.resources == requested_info.resources) { return cache_image_id; } else { - UNREACHABLE(); + // UNREACHABLE(); } } diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 3bbfd952c..cafe70552 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -36,8 +36,8 @@ static constexpr u32 MaxInvalidateDist = 12_MB; class TextureCache { struct Traits { using Entry = boost::container::small_vector; - static constexpr size_t AddressSpaceBits = 39; - static constexpr size_t FirstLevelBits = 9; + static constexpr size_t AddressSpaceBits = 40; + static constexpr size_t FirstLevelBits = 10; static constexpr size_t PageBits = 20; }; using PageTable = MultiLevelPageTable;