From 6637810fe6c6610f73f0b1b12e56e9b48268d0ee Mon Sep 17 00:00:00 2001 From: MrPurple666 Date: Sun, 1 Feb 2026 02:02:23 +0100 Subject: [android] gpu logs functions (#3389) Since Android is a pain when it comes to checking GPU logs in more depth, this is a better way to see what's going on, especially for testers... This should be expanded to Mali, Xclipse, and Tensor in the future. Since I don't own any of these devices, it's up to developers with similar capabilities to add support for this system. ~~The GPU log sharing button should also be added in the future... For now, they are available in the same location as the traditional logs.~~ Added on 572810e022 Co-authored-by: DraVee Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3389 Reviewed-by: DraVee Reviewed-by: CamilleLaVey Co-authored-by: MrPurple666 Co-committed-by: MrPurple666 --- src/video_core/vulkan_common/vulkan_device.cpp | 109 +++++++++++++++++++++++++ 1 file changed, 109 insertions(+) (limited to 'src/video_core/vulkan_common/vulkan_device.cpp') diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 8c596fe347..0b3aea6d2e 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -13,6 +13,8 @@ #include #include +#include + #include "common/assert.h" #include "common/literals.h" #include @@ -22,6 +24,7 @@ #include "video_core/vulkan_common/vma.h" #include "video_core/vulkan_common/vulkan_device.h" #include "video_core/vulkan_common/vulkan_wrapper.h" +#include "video_core/gpu_logging/gpu_logging.h" #if defined(ANDROID) && defined(ARCHITECTURE_arm64) #include @@ -734,9 +737,13 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR }; vk::Check(vmaCreateAllocator(&allocator_info, &allocator)); + + // Initialize GPU logging if enabled + InitializeGPULogging(); } Device::~Device() { + ShutdownGPULogging(); vmaDestroyAllocator(allocator); } @@ -1622,4 +1629,106 @@ std::vector Device::GetDeviceQueueCreateInfos() const { return queue_cis; } +void Device::InitializeGPULogging() { + if (!Settings::values.gpu_logging_enabled.GetValue()) { + return; + } + + // Detect driver type + const auto driver_id = GetDriverID(); + GPU::Logging::DriverType detected_driver = GPU::Logging::DriverType::Unknown; + + if (driver_id == VK_DRIVER_ID_MESA_TURNIP) { + detected_driver = GPU::Logging::DriverType::Turnip; + } else if (driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY) { + detected_driver = GPU::Logging::DriverType::Qualcomm; + } + + // Get log level from settings + const auto log_level = static_cast( + static_cast(Settings::values.gpu_log_level.GetValue())); + + // Initialize GPU logger + GPU::Logging::GPULogger::GetInstance().Initialize(log_level, detected_driver); + + // Configure feature flags + GPU::Logging::GPULogger::GetInstance().EnableVulkanCallTracking( + Settings::values.gpu_log_vulkan_calls.GetValue()); + GPU::Logging::GPULogger::GetInstance().EnableShaderDumps( + Settings::values.gpu_log_shader_dumps.GetValue()); + GPU::Logging::GPULogger::GetInstance().EnableMemoryTracking( + Settings::values.gpu_log_memory_tracking.GetValue()); + GPU::Logging::GPULogger::GetInstance().EnableDriverDebugInfo( + Settings::values.gpu_log_driver_debug.GetValue()); + GPU::Logging::GPULogger::GetInstance().SetRingBufferSize( + Settings::values.gpu_log_ring_buffer_size.GetValue()); + + // Log comprehensive driver and extension information + if (Settings::values.gpu_log_driver_debug.GetValue()) { + std::string driver_info; + + // Device information + const auto& props = properties.properties; + driver_info += fmt::format("Device: {}\n", props.deviceName); + driver_info += fmt::format("Driver Name: {}\n", properties.driver.driverName); + driver_info += fmt::format("Driver Info: {}\n", properties.driver.driverInfo); + + // Version information + const u32 driver_version = props.driverVersion; + const u32 api_version = props.apiVersion; + driver_info += fmt::format("Driver Version: {}.{}.{}\n", + VK_API_VERSION_MAJOR(driver_version), + VK_API_VERSION_MINOR(driver_version), + VK_API_VERSION_PATCH(driver_version)); + driver_info += fmt::format("Vulkan API Version: {}.{}.{}\n", + VK_API_VERSION_MAJOR(api_version), + VK_API_VERSION_MINOR(api_version), + VK_API_VERSION_PATCH(api_version)); + driver_info += fmt::format("Driver ID: {}\n", static_cast(driver_id)); + + // Vendor and device IDs + driver_info += fmt::format("Vendor ID: 0x{:04X}\n", props.vendorID); + driver_info += fmt::format("Device ID: 0x{:04X}\n", props.deviceID); + + // Extensions - separate QCOM extensions from others + driver_info += "\n=== Loaded Vulkan Extensions ===\n"; + std::vector qcom_exts; + std::vector other_exts; + + for (const auto& ext : loaded_extensions) { + if (ext.find("QCOM") != std::string::npos || ext.find("qcom") != std::string::npos) { + qcom_exts.push_back(ext); + } else { + other_exts.push_back(ext); + } + } + + // Log QCOM extensions first + if (!qcom_exts.empty()) { + driver_info += "\nQualcomm Proprietary Extensions:\n"; + for (const auto& ext : qcom_exts) { + driver_info += fmt::format(" - {}\n", ext); + } + } + + // Log other extensions + if (!other_exts.empty()) { + driver_info += "\nStandard Extensions:\n"; + for (const auto& ext : other_exts) { + driver_info += fmt::format(" - {}\n", ext); + } + } + + driver_info += fmt::format("\nTotal Extensions Loaded: {}\n", loaded_extensions.size()); + + GPU::Logging::GPULogger::GetInstance().LogDriverDebugInfo(driver_info); + } +} + +void Device::ShutdownGPULogging() { + if (GPU::Logging::GPULogger::GetInstance().IsInitialized()) { + GPU::Logging::GPULogger::GetInstance().Shutdown(); + } +} + } // namespace Vulkan -- cgit v1.2.3