From ee768ca9494f5d2a3b969d47862e544d60591d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 10 Nov 2017 13:02:24 +0100 Subject: [PATCH] Logging improvements, avoid resetting the Android text drawer unnecessarily --- Common/Vulkan/VulkanContext.cpp | 14 ++++++++++++-- android/jni/app-android.cpp | 5 +++-- android/src/org/ppsspp/ppsspp/NativeActivity.java | 2 +- ext/native/gfx_es2/draw_text_android.cpp | 3 ++- ext/native/thin3d/VulkanQueueRunner.cpp | 6 +++--- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Common/Vulkan/VulkanContext.cpp b/Common/Vulkan/VulkanContext.cpp index c31ee34647..a0f17daaf2 100644 --- a/Common/Vulkan/VulkanContext.cpp +++ b/Common/Vulkan/VulkanContext.cpp @@ -65,6 +65,16 @@ std::string VulkanVendorString(uint32_t vendorId) { } } +const char *PresentModeString(VkPresentModeKHR presentMode) { + switch (presentMode) { + case VK_PRESENT_MODE_IMMEDIATE_KHR: return "IMMEDIATE"; + case VK_PRESENT_MODE_MAILBOX_KHR: return "MAILBOX"; + case VK_PRESENT_MODE_FIFO_KHR: return "FIFO"; + case VK_PRESENT_MODE_FIFO_RELAXED_KHR: return "FIFO_RELAXED"; + default: return "UNKNOWN"; + } +} + VulkanContext::VulkanContext() { if (!VulkanLoad()) { init_error_ = "Failed to load Vulkan driver library"; @@ -719,7 +729,7 @@ bool VulkanContext::InitSwapchain() { // to fall back in a sensible way. VkPresentModeKHR swapchainPresentMode = VK_PRESENT_MODE_MAX_ENUM_KHR; for (size_t i = 0; i < presentModeCount; i++) { - ILOG("Supported present mode: %d", presentModes[i]); + ILOG("Supported present mode: %d (%s)", presentModes[i], PresentModeString(presentModes[i])); } for (size_t i = 0; i < presentModeCount; i++) { if (swapchainPresentMode == VK_PRESENT_MODE_MAX_ENUM_KHR) { @@ -743,7 +753,7 @@ bool VulkanContext::InitSwapchain() { // HACK swapchainPresentMode = VK_PRESENT_MODE_FIFO_KHR; #endif - ILOG("Chosen present mode: %d", swapchainPresentMode); + ILOG("Chosen present mode: %d (%s)", swapchainPresentMode, PresentModeString(swapchainPresentMode)); delete[] presentModes; // Determine the number of VkImage's to use in the swap chain (we desire to // own only 1 image at a time, besides the images being displayed and diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 27637ecf3d..15adb0a638 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -742,7 +742,8 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv ILOG("NativeApp.backbufferResize(%d x %d)", bufw, bufh); bool new_size = pixel_xres != bufw || pixel_yres != bufh; - + int old_w = pixel_xres; + int old_h = pixel_yres; // pixel_*res is the backbuffer resolution. pixel_xres = bufw; pixel_yres = bufh; @@ -770,7 +771,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv ILOG("pixel_xres=%d pixel_yres=%d", pixel_xres, pixel_yres); if (new_size) { - ILOG("Size change detected - calling NativeResized()"); + ILOG("Size change detected (previously %d,%d) - calling NativeResized()", old_w, old_h); NativeResized(); } } diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index 59738c8418..ac68259a45 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -58,7 +58,7 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C // Remember to loadLibrary your JNI .so in a static {} block // Adjust these as necessary - private static String TAG = "NativeActivity"; + private static String TAG = "PPSSPPNativeActivity"; // Allows us to skip a lot of initialization on secondary calls to onCreate. private static boolean initialized = false; diff --git a/ext/native/gfx_es2/draw_text_android.cpp b/ext/native/gfx_es2/draw_text_android.cpp index 4ed14cbc55..c8e7ed1925 100644 --- a/ext/native/gfx_es2/draw_text_android.cpp +++ b/ext/native/gfx_es2/draw_text_android.cpp @@ -29,7 +29,8 @@ TextDrawerAndroid::TextDrawerAndroid(Draw::DrawContext *draw) : TextDrawer(draw) } else { ELOG("Failed to find class: '%s'", textRendererClassName); } - dpiScale_ = 1.0f; + dpiScale_ = CalculateDPIScale(); + ILOG("Initializing TextDrawerAndroid with DPI scale %f", dpiScale_); } TextDrawerAndroid::~TextDrawerAndroid() { diff --git a/ext/native/thin3d/VulkanQueueRunner.cpp b/ext/native/thin3d/VulkanQueueRunner.cpp index 4b566d12e6..bcaaf086a3 100644 --- a/ext/native/thin3d/VulkanQueueRunner.cpp +++ b/ext/native/thin3d/VulkanQueueRunner.cpp @@ -2,14 +2,14 @@ #include "VulkanQueueRunner.h" #include "VulkanRenderManager.h" -// Debug help: adb logcat -s DEBUG NativeActivity NativeApp PPSSPP +// Debug help: adb logcat -s DEBUG PPSSPPNativeActivity PPSSPP // TODO: This is only enough for 4x render resolution / 4x texture upscale for debugger. // Maybe we should use a dynamically allocated one for larger? const uint32_t readbackBufferSize = 2048 * 2048 * 4; void VulkanQueueRunner::CreateDeviceObjects() { - ILOG("VulkanQueueRuner::CreateDeviceObjects"); + ILOG("VulkanQueueRunner::CreateDeviceObjects"); InitBackbufferRenderPass(); InitRenderpasses(); @@ -37,7 +37,7 @@ void VulkanQueueRunner::CreateDeviceObjects() { } void VulkanQueueRunner::DestroyDeviceObjects() { - ILOG("VulkanQueueRuner::DestroyDeviceObjects"); + ILOG("VulkanQueueRunner::DestroyDeviceObjects"); VkDevice device = vulkan_->GetDevice(); vulkan_->Delete().QueueDeleteDeviceMemory(readbackMemory_); vkFreeMemory(device, readbackMemory_, nullptr);