SDL: Vita: remove unused variable and allow Razor perf analysis

From 3b6e999244d0b1a7b1ce138097dac6930fd95e55 Mon Sep 17 00:00:00 2001
From: Ivan Epifanov <[EMAIL REDACTED]>
Date: Wed, 23 Jun 2021 14:57:04 +0300
Subject: [PATCH] Vita: remove unused variable and allow Razor perf analysis

---
 src/render/vitagxm/SDL_render_vita_gxm.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index 38703bee0..5bd377ef6 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -38,6 +38,12 @@
 
 #include <psp2/common_dialog.h>
 
+/* #define DEBUG_RAZOR */
+
+#if DEBUG_RAZOR
+#include <psp2/sysmodule.h>
+#endif
+
 static SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags);
 
 static void VITA_GXM_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event);
@@ -253,6 +259,11 @@ VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags)
         data->displayData.wait_vblank = SDL_FALSE;
     }
 
+#if DEBUG_RAZOR
+    sceSysmoduleLoadModule( SCE_SYSMODULE_RAZOR_HUD );
+    sceSysmoduleLoadModule( SCE_SYSMODULE_RAZOR_CAPTURE );
+#endif
+
     if (gxm_init(renderer) != 0)
     {
         return NULL;
@@ -806,10 +817,8 @@ SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd, SDL_bool s
     }
 
     if (data->drawstate.cliprect_enabled && data->drawstate.cliprect_dirty) {
-        const SDL_Rect *viewport = &data->drawstate.viewport;
         const SDL_Rect *rect = &data->drawstate.cliprect;
-        set_clip_rectangle(data, rect->x, rect->y,
-                        rect->x + rect->w, rect->y + rect->h);
+        set_clip_rectangle(data, rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
         data->drawstate.cliprect_dirty = SDL_FALSE;
     }
 
@@ -1113,6 +1122,12 @@ VITA_GXM_RenderPresent(SDL_Renderer *renderer)
 
     sceCommonDialogUpdate(&updateParam);
 
+#if DEBUG_RAZOR
+    sceGxmPadHeartbeat(
+        (const SceGxmColorSurface *)&data->displaySurface[data->backBufferIndex],
+        (SceGxmSyncObject *)data->displayBufferSync[data->backBufferIndex]
+    );
+#endif
 
     sceGxmDisplayQueueAddEntry(
         data->displayBufferSync[data->frontBufferIndex],    // OLD fb