export frame count to gpu too
authornotaz <notasas@gmail.com>
Mon, 5 Dec 2011 23:19:35 +0000 (01:19 +0200)
committernotaz <notasas@gmail.com>
Mon, 5 Dec 2011 23:19:35 +0000 (01:19 +0200)
frontend/plugin_lib.c
frontend/plugin_lib.h
plugins/gpu_neon/gpu.c
plugins/gpu_neon/gpu.h
plugins/gpu_neon/vout_fb.c

index e93c12f..eba09fb 100644 (file)
@@ -476,6 +476,7 @@ void pl_start_watchdog(void)
 void pl_init(void)
 {
        extern unsigned int hSyncCount; // from psxcounters
 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;
 
        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;
        tsdev = pl_gun_ts_init();
 
        pl_rearmed_cbs.gpu_hcnt = &hSyncCount;
+       pl_rearmed_cbs.gpu_frame_count = &frame_counter;
 }
 }
index 81a6b28..914cbff 100644 (file)
@@ -47,6 +47,7 @@ struct rearmed_cbs {
        // gpu options
        int   frameskip;
        int   fskip_advice;
        // gpu options
        int   frameskip;
        int   fskip_advice;
+       unsigned int *gpu_frame_count;
        unsigned int *gpu_hcnt;
        struct {
                int   iUseDither;
        unsigned int *gpu_hcnt;
        struct {
                int   iUseDither;
index 12417e6..7f5a8a9 100644 (file)
@@ -17,7 +17,7 @@
 #define noinline __attribute__((noinline))
 
 #define gpu_log(fmt, ...) \
 #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(...)
 
 //#define log_io gpu_log
 #define log_io(...)
@@ -94,7 +94,7 @@ long GPUinit(void)
   ret  = vout_init();
   ret |= renderer_init();
 
   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;
   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
     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;
   {
     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;
 
   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;
   gpu.state.last_list.hcnt = *gpu.state.hcnt;
   gpu.state.last_list.words = dma_words;
   gpu.state.last_list.addr = start_addr;
index 5ededcb..7269a52 100644 (file)
@@ -64,8 +64,8 @@ struct psx_gpu {
   uint32_t zero;
   struct {
     uint32_t fb_dirty:1;
   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;
     struct {
       uint32_t addr;
       uint32_t words;
index 344c755..394f6a3 100644 (file)
@@ -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.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
 }
 
 // vim:shiftwidth=2:expandtab