From 9394ada5d3140e3426592a25722f4fe7083cce9d Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 12 Aug 2011 13:21:51 +0300 Subject: [PATCH] gpu_neon: support caching renderers, update rearmed if --- plugins/gpu_neon/gpu.c | 14 ++++++++++---- plugins/gpu_neon/gpu.h | 4 ++++ plugins/gpu_neon/vout_fb.c | 11 ++++++----- plugins/gpu_neon/vout_sdl.c | 5 ++++- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/plugins/gpu_neon/gpu.c b/plugins/gpu_neon/gpu.c index 30e60097..5bd41512 100644 --- a/plugins/gpu_neon/gpu.c +++ b/plugins/gpu_neon/gpu.c @@ -21,8 +21,8 @@ //#define log_io gpu_log #define log_io(...) -#define log_anomaly gpu_log -//#define log_anomaly(...) +//#define log_anomaly gpu_log +#define log_anomaly(...) struct psx_gpu gpu __attribute__((aligned(64))); @@ -90,11 +90,14 @@ static noinline void get_gpu_info(uint32_t data) long GPUinit(void) { - int ret = vout_init(); - do_reset(); + int ret; + ret = vout_init(); + ret |= renderer_init(); + gpu.lcf_hc = &gpu.zero; gpu.state.frame_count = 0; gpu.state.hcnt = &gpu.zero; + do_reset(); return ret; } @@ -247,6 +250,8 @@ static void start_vram_transfer(uint32_t pos_word, uint32_t size_word, int is_re if (is_read) gpu.status.img = 1; + else + renderer_invalidate_caches(gpu.dma.x, gpu.dma.y, gpu.dma.w, gpu.dma.h); log_io("start_vram_transfer %c (%d, %d) %dx%d\n", is_read ? 'r' : 'w', gpu.dma.x, gpu.dma.y, gpu.dma.w, gpu.dma.h); @@ -484,6 +489,7 @@ long GPUfreeze(uint32_t type, GPUFreeze_t *freeze) freeze->ulStatus = gpu.status.reg; break; case 0: // load + renderer_invalidate_caches(0, 0, 1024, 512); memcpy(gpu.vram, freeze->psxVRam, sizeof(gpu.vram)); memcpy(gpu.regs, freeze->ulControl, sizeof(gpu.regs)); memcpy(gpu.ex_regs, freeze->ulControl + 0xe0, sizeof(gpu.ex_regs)); diff --git a/plugins/gpu_neon/gpu.h b/plugins/gpu_neon/gpu.h index aa0eb7b4..033581e8 100644 --- a/plugins/gpu_neon/gpu.h +++ b/plugins/gpu_neon/gpu.h @@ -84,5 +84,9 @@ extern const unsigned char cmd_lengths[256]; void do_cmd_list(uint32_t *list, int count); +int renderer_init(void); +void renderer_invalidate_caches(int x, int y, int w, int h); +void renderer_flush_queues(void); + int vout_init(void); int vout_finish(void); diff --git a/plugins/gpu_neon/vout_fb.c b/plugins/gpu_neon/vout_fb.c index f80a29f1..b7cb41b2 100644 --- a/plugins/gpu_neon/vout_fb.c +++ b/plugins/gpu_neon/vout_fb.c @@ -43,7 +43,7 @@ static void blit(void) { old_status = gpu.status.reg; old_h = h; - screen_buf = cbs->pl_fbdev_set_mode(stride, h, gpu.status.rgb24 ? 24 : 16); + screen_buf = cbs->pl_vout_set_mode(stride, h, gpu.status.rgb24 ? 24 : 16); } dest = screen_buf; @@ -76,7 +76,7 @@ static void blit(void) } } - screen_buf = cbs->pl_fbdev_flip(); + screen_buf = cbs->pl_vout_flip(); } void GPUupdateLace(void) @@ -85,6 +85,7 @@ void GPUupdateLace(void) return; if (!gpu.status.blanking && gpu.state.fb_dirty) { + renderer_flush_queues(); blit(); gpu.state.fb_dirty = 0; } @@ -95,14 +96,14 @@ long GPUopen(void) gpu.frameskip.enabled = cbs->frameskip; gpu.frameskip.advice = &cbs->fskip_advice; - cbs->pl_fbdev_open(); - screen_buf = cbs->pl_fbdev_flip(); + cbs->pl_vout_open(); + screen_buf = cbs->pl_vout_flip(); return 0; } long GPUclose(void) { - cbs->pl_fbdev_close(); + cbs->pl_vout_close(); return 0; } diff --git a/plugins/gpu_neon/vout_sdl.c b/plugins/gpu_neon/vout_sdl.c index f2f87e95..3152c321 100644 --- a/plugins/gpu_neon/vout_sdl.c +++ b/plugins/gpu_neon/vout_sdl.c @@ -79,8 +79,11 @@ static void blit(void) void GPUupdateLace(void) { - if (!gpu.status.blanking) + if (!gpu.status.blanking && gpu.state.fb_dirty) { + renderer_flush_queues(); blit(); + gpu.state.fb_dirty = 0; + } } long GPUopen(void **dpy) -- 2.39.2