From: notaz Date: Mon, 5 Dec 2011 23:19:35 +0000 (+0200) Subject: export frame count to gpu too X-Git-Tag: r12~36 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ece2f0c51ef6b679cd5765900b567ef47dde1e8;p=pcsx_rearmed.git export frame count to gpu too --- diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index e93c12f9..eba09fb1 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -476,6 +476,7 @@ void pl_start_watchdog(void) void pl_init(void) { extern unsigned int hSyncCount; // from psxcounters + extern unsigned int frame_counter; pl_vout_w = pl_vout_h = 256; pl_vout_bpp = 16; @@ -483,4 +484,5 @@ void pl_init(void) tsdev = pl_gun_ts_init(); pl_rearmed_cbs.gpu_hcnt = &hSyncCount; + pl_rearmed_cbs.gpu_frame_count = &frame_counter; } diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index 81a6b285..914cbff8 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -47,6 +47,7 @@ struct rearmed_cbs { // gpu options int frameskip; int fskip_advice; + unsigned int *gpu_frame_count; unsigned int *gpu_hcnt; struct { int iUseDither; diff --git a/plugins/gpu_neon/gpu.c b/plugins/gpu_neon/gpu.c index 12417e6e..7f5a8a92 100644 --- a/plugins/gpu_neon/gpu.c +++ b/plugins/gpu_neon/gpu.c @@ -17,7 +17,7 @@ #define noinline __attribute__((noinline)) #define gpu_log(fmt, ...) \ - printf("%d:%03d: " fmt, gpu.state.frame_count, *gpu.state.hcnt, ##__VA_ARGS__) + printf("%d:%03d: " fmt, *gpu.state.frame_count, *gpu.state.hcnt, ##__VA_ARGS__) //#define log_io gpu_log #define log_io(...) @@ -94,7 +94,7 @@ long GPUinit(void) ret = vout_init(); ret |= renderer_init(); - gpu.state.frame_count = 0; + gpu.state.frame_count = &gpu.zero; gpu.state.hcnt = &gpu.zero; do_reset(); return ret; @@ -379,9 +379,9 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr) flush_cmd_buffer(); // ff7 sends it's main list twice, detect this - if (gpu.state.frame_count == gpu.state.last_list.frame && - *gpu.state.hcnt - gpu.state.last_list.hcnt <= 1 && - gpu.state.last_list.words > 1024) + if (*gpu.state.frame_count == gpu.state.last_list.frame && + *gpu.state.hcnt - gpu.state.last_list.hcnt <= 1 && + gpu.state.last_list.words > 1024) { llist_entry = rambase + (gpu.state.last_list.addr & 0x1fffff) / 4; *llist_entry |= 0x800000; @@ -423,7 +423,7 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr) if (llist_entry) *llist_entry &= ~0x800000; - gpu.state.last_list.frame = gpu.state.frame_count; + gpu.state.last_list.frame = *gpu.state.frame_count; gpu.state.last_list.hcnt = *gpu.state.hcnt; gpu.state.last_list.words = dma_words; gpu.state.last_list.addr = start_addr; diff --git a/plugins/gpu_neon/gpu.h b/plugins/gpu_neon/gpu.h index 5ededcb3..7269a526 100644 --- a/plugins/gpu_neon/gpu.h +++ b/plugins/gpu_neon/gpu.h @@ -64,8 +64,8 @@ struct psx_gpu { uint32_t zero; struct { uint32_t fb_dirty:1; - uint32_t frame_count; - uint32_t *hcnt; + uint32_t *frame_count; + uint32_t *hcnt; /* hsync count */ struct { uint32_t addr; uint32_t words; diff --git a/plugins/gpu_neon/vout_fb.c b/plugins/gpu_neon/vout_fb.c index 344c755e..394f6a3b 100644 --- a/plugins/gpu_neon/vout_fb.c +++ b/plugins/gpu_neon/vout_fb.c @@ -126,6 +126,7 @@ void GPUrearmedCallbacks(const struct rearmed_cbs *cbs_) gpu.frameskip.active = 0; gpu.frameskip.frame_ready = 1; gpu.state.hcnt = cbs->gpu_hcnt; + gpu.state.frame_count = cbs->gpu_frame_count; } // vim:shiftwidth=2:expandtab