From dc0a410a7e900ae1205a5551e7838afd01a4d045 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sun, 28 Jan 2018 20:24:09 +0100 Subject: [PATCH] Added (unused) multithreaded version of copyall for P96 modes - might come in handy for some platforms, but no benefit for current ones --- src/osdep/picasso96.cpp | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/osdep/picasso96.cpp b/src/osdep/picasso96.cpp index bc8087fb..ff2178ed 100644 --- a/src/osdep/picasso96.cpp +++ b/src/osdep/picasso96.cpp @@ -3112,15 +3112,13 @@ static void copyall(uae_u8 *src, uae_u8 *dst) __builtin_bswap16(*((uae_u16 *)(src + i + 2))) << 16 | __builtin_bswap16(*((uae_u16 *)(src + i))) ); - } -#else -#ifdef USE_ARMNEON + } +#elif USE_ARMNEON copy_screen_16bit_swap(dst, src, picasso96_state.Width * picasso96_state.Height * 2); #else copy_screen_16bit_swap_arm(dst, src, picasso96_state.Width * picasso96_state.Height * 2); #endif -#endif -} + } else if (picasso96_state.RGBFormat == RGBFB_CLUT) { #ifdef TINKER @@ -3153,16 +3151,35 @@ static void copyall(uae_u8 *src, uae_u8 *dst) ) ); } -#else -#ifdef USE_ARMNEON +#elif USE_ARMNEON copy_screen_32bit_to_16bit_neon(dst, src, picasso96_state.Width * picasso96_state.Height * 4); #else copy_screen_32bit_to_16bit_arm(dst, src, picasso96_state.Width * picasso96_state.Height * 4); -#endif #endif } } +#ifdef MULTITHREADED_COPYALL +static struct srcdst_t { + uae_u8 *src; + uae_u8 *dst; +} srcdst; + +static int copyall_multithreaded_wrapper(void *ptr) { + copyall(srcdst.src, srcdst.dst); + if (currprefs.leds_on_screen) + picasso_statusline(srcdst.dst); + return 0; + +} + +static void copyall_multithreaded(uae_u8 *src, uae_u8 *dst) +{ + srcdst.src = src; srcdst.dst = dst; + SDL_DetachThread(SDL_CreateThread(copyall_multithreaded_wrapper, "copyall_thread", nullptr)); +} +#endif + bool picasso_flushpixels(uae_u8 *src, int off) { uae_u8 *src_start; @@ -3181,7 +3198,11 @@ bool picasso_flushpixels(uae_u8 *src, int off) if (dst == NULL) return false; +#ifdef MULTITHREADED_COPYALL + copyall_multithreaded(src + off, dst); +#else copyall(src + off, dst); +#endif if (currprefs.leds_on_screen) picasso_statusline(dst);