From ad2ccfbc0976bb01a516d6694e71d9fd29d861c1 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Fri, 2 Oct 2015 00:30:29 +0100 Subject: [PATCH] (CTR/3DS) improve performance by using a DMA friendly vout_buf. --- platform/libretro/libretro.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index 62b168e3..61d6f7b7 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -26,13 +26,16 @@ #ifdef _3DS #include "3ds/3ds_utils.h" -#define MEMOP_PROT 6 +#define MEMOP_MAP 4 +#define MEMOP_UNMAP 5 +#define MEMOP_PROT 6 + int svcDuplicateHandle(unsigned int* out, unsigned int original); int svcCloseHandle(unsigned int handle); int svcControlProcessMemory(unsigned int process, void* addr0, void* addr1, unsigned int size, unsigned int type, unsigned int perm); -#define MEMOP_MAP 4 -#define MEMOP_UNMAP 5 +void* linearMemAlign(size_t size, size_t alignment); +void linearFree(void* mem); static int ctr_svchack_successful = 0; #endif @@ -1235,7 +1238,11 @@ void retro_init(void) vout_width = 320; vout_height = 240; +#ifdef _3DS + vout_buf = linearMemAlign(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2, 0x80); +#else vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2); +#endif PicoInit(); PicoDrawSetOutFormat(PDF_RGB555, 0); @@ -1250,5 +1257,11 @@ void retro_init(void) void retro_deinit(void) { +#ifdef _3DS + linearFree(vout_buf); +#else + free(vout_buf); +#endif + vout_buf = NULL; PicoExit(); } -- 2.39.5