From 0b7f536b486f3f411651573009c3da6063b560ea Mon Sep 17 00:00:00 2001 From: aliaspider Date: Sat, 3 Oct 2015 04:42:55 +0100 Subject: [PATCH] (CTR/3DS) some performance tweaks: - use linearAlloc for vout_buf. - use svcFlushProcessDataCache to flush only the required range, invalidating icache doesn't seem to be required. --- frontend/libretro.c | 8 +++++++- libpcsxcore/new_dynarec/new_dynarec.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/libretro.c b/frontend/libretro.c index d834579a..29645875 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -1341,7 +1341,9 @@ void retro_init(void) exit(1); } -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && !defined(VITA) +#ifdef _3DS + vout_buf = linearMemAlign(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2, 0x80); +#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && !defined(VITA) posix_memalign(&vout_buf, 16, VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2); #else vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2); @@ -1407,7 +1409,11 @@ void retro_init(void) void retro_deinit(void) { SysClose(); +#ifdef _3DS + linearFree(vout_buf); +#else free(vout_buf); +#endif vout_buf = NULL; } diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index 487f7f0f..068ca1e7 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -55,7 +55,7 @@ static void __clear_cache(void *start, void *end) { } #elif defined(_3DS) #include "3ds_utils.h" -#define __clear_cache(start,end) ctr_flush_invalidate_cache() +#define __clear_cache(start,end) svcFlushProcessDataCache(0xFFFF8001, start, (end)-(start)) #endif #define MAXBLOCK 4096 -- 2.39.5