X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fgpu_neon%2Fpsx_gpu_if.c;h=ad017614b527758764a22177704643556063f358;hp=ea98ade85e9de4c39f4dc170b2a5a0695c8ae389;hb=HEAD;hpb=1587b08ecb80dd257ac255f76e716a6053c2785b diff --git a/plugins/gpu_neon/psx_gpu_if.c b/plugins/gpu_neon/psx_gpu_if.c index ea98ade8..f85155e3 100644 --- a/plugins/gpu_neon/psx_gpu_if.c +++ b/plugins/gpu_neon/psx_gpu_if.c @@ -10,7 +10,6 @@ #include #include -#include #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #ifndef min @@ -39,23 +38,17 @@ sync_enhancement_buffers(int x, int y, int w, int h); static psx_gpu_struct egpu __attribute__((aligned(256))); -int do_cmd_list(uint32_t *list, int count, int *last_cmd) +int do_cmd_list(uint32_t *list, int count, + int *cycles_sum, int *cycles_last, int *last_cmd) { int ret; -#if defined(__arm__) && defined(NEON_BUILD) && !defined(SIMD_BUILD) - // the asm doesn't bother to save callee-save vector regs, so do it here - __asm__ __volatile__("":::"q4","q5","q6","q7"); -#endif - if (gpu.state.enhancement_active) - ret = gpu_parse_enhanced(&egpu, list, count * 4, (u32 *)last_cmd); + ret = gpu_parse_enhanced(&egpu, list, count * 4, + cycles_sum, cycles_last, (u32 *)last_cmd); else - ret = gpu_parse(&egpu, list, count * 4, (u32 *)last_cmd); - -#if defined(__arm__) && defined(NEON_BUILD) && !defined(SIMD_BUILD) - __asm__ __volatile__("":::"q4","q5","q6","q7"); -#endif + ret = gpu_parse(&egpu, list, count * 4, + cycles_sum, cycles_last, (u32 *)last_cmd); ex_regs[1] &= ~0x1ff; ex_regs[1] |= egpu.texture_settings & 0x1ff; @@ -85,8 +78,9 @@ static void map_enhancement_buffer(void) // to be able to reuse 1024-width code better (triangle setup, // dithering phase, lines). egpu.enhancement_buf_ptr = gpu.mmap(ENHANCEMENT_BUF_SIZE); - if (egpu.enhancement_buf_ptr == NULL) { + if (egpu.enhancement_buf_ptr == NULL || egpu.enhancement_buf_ptr == (void *)(intptr_t)-1) { fprintf(stderr, "failed to map enhancement buffer\n"); + egpu.enhancement_buf_ptr = NULL; gpu.get_enhancement_bufer = NULL; } else { @@ -129,6 +123,8 @@ sync_enhancement_buffers(int x, int y, int w, int h) // due to intersection stuff, see the update_enhancement_buf_scanouts() mess int s_w = max(gpu.screen.hres, gpu.screen.w); int s_h = gpu.screen.vres; + if (gpu.screen.y < 0) + s_h -= gpu.screen.y; s_w = min(s_w, 512); for (i = 0; i < ARRAY_SIZE(egpu.enhancement_scanouts); i++) { const struct psx_gpu_scanout *s = &egpu.enhancement_scanouts[i]; @@ -143,6 +139,9 @@ sync_enhancement_buffers(int x, int y, int w, int h) x2 = min(right, s->x + s_w); y1 = max(y, s->y); y2 = min(bottom, s->y + s_h); + // 16-byte align for the asm version + x2 += x1 & 7; + x1 &= ~7; scale2x_tiles8(dst + y1 * 1024*2 + x1 * 2, src + y1 * 1024 + x1, (x2 - x1 + 7) / 8u, y2 - y1); } @@ -150,7 +149,9 @@ sync_enhancement_buffers(int x, int y, int w, int h) void renderer_sync_ecmds(uint32_t *ecmds) { - gpu_parse(&egpu, ecmds + 1, 6 * 4, NULL); + s32 dummy0 = 0; + u32 dummy1 = 0; + gpu_parse(&egpu, ecmds + 1, 6 * 4, &dummy0, &dummy0, &dummy1); } void renderer_update_caches(int x, int y, int w, int h, int state_changed) @@ -159,10 +160,13 @@ void renderer_update_caches(int x, int y, int w, int h, int state_changed) if (gpu.state.enhancement_active) { if (state_changed) { + int vres = gpu.screen.vres; + if (gpu.screen.y < 0) + vres -= gpu.screen.y; memset(egpu.enhancement_scanouts, 0, sizeof(egpu.enhancement_scanouts)); egpu.enhancement_scanout_eselect = 0; update_enhancement_buf_scanouts(&egpu, - gpu.screen.src_x, gpu.screen.src_y, gpu.screen.hres, gpu.screen.vres); + gpu.screen.src_x, gpu.screen.src_y, gpu.screen.hres, vres); return; } sync_enhancement_buffers(x, y, w, h); @@ -190,10 +194,13 @@ void renderer_notify_res_change(void) void renderer_notify_scanout_change(int x, int y) { + int vres = gpu.screen.vres; if (!gpu.state.enhancement_active || !egpu.enhancement_buf_ptr) return; - update_enhancement_buf_scanouts(&egpu, x, y, gpu.screen.hres, gpu.screen.vres); + if (gpu.screen.y < 0) + vres -= gpu.screen.y; + update_enhancement_buf_scanouts(&egpu, x, y, gpu.screen.hres, vres); } #include "../../frontend/plugin_lib.h" @@ -206,12 +213,37 @@ void renderer_set_config(const struct rearmed_cbs *cbs) } if (cbs->pl_set_gpu_caps) cbs->pl_set_gpu_caps(GPU_CAP_SUPPORTS_2X); + + egpu.allow_dithering = cbs->dithering; + egpu.force_dithering = cbs->dithering >> 1; + /* + if (!egpu.allow_dithering) { + egpu.dither_table[0] = dither_table_row(0, 0, 0, 0); + egpu.dither_table[1] = dither_table_row(0, 0, 0, 0); + egpu.dither_table[2] = dither_table_row(0, 0, 0, 0); + egpu.dither_table[3] = dither_table_row(0, 0, 0, 0); + } else { + egpu.dither_table[0] = dither_table_row(-4, 0, -3, 1); + egpu.dither_table[1] = dither_table_row(2, -2, 3, -1); + egpu.dither_table[2] = dither_table_row(-3, 1, -4, 0); + egpu.dither_table[3] = dither_table_row(3, -1, 2, -2); + } + */ - disable_main_render = cbs->gpu_neon.enhancement_no_main; + egpu.hack_disable_main = cbs->gpu_neon.enhancement_no_main; + egpu.hack_texture_adj = cbs->gpu_neon.enhancement_tex_adj; if (gpu.state.enhancement_enable) { if (gpu.mmap != NULL && egpu.enhancement_buf_ptr == NULL) map_enhancement_buffer(); } } +void renderer_sync(void) +{ +} + +void renderer_notify_update_lace(int updated) +{ +} + // vim:ts=2:sw=2:expandtab