gpu_neon: frameskip: skip blits until flipped
authornotaz <notasas@gmail.com>
Fri, 12 Aug 2011 21:47:16 +0000 (00:47 +0300)
committernotaz <notasas@gmail.com>
Fri, 12 Aug 2011 21:57:33 +0000 (00:57 +0300)
plugins/gpu_neon/gpu.c
plugins/gpu_neon/gpu.h
plugins/gpu_neon/vout_fb.c

index 5bd4151..2db4379 100644 (file)
@@ -113,7 +113,7 @@ void GPUwriteStatus(uint32_t data)
   uint32_t cmd = data >> 24;
 
   if (cmd < ARRAY_SIZE(gpu.regs)) {
-    if (cmd != 0 && gpu.regs[cmd] == data)
+    if (cmd != 0 && cmd != 5 && gpu.regs[cmd] == data)
       return;
     gpu.regs[cmd] = data;
   }
index 033581e..cc202c5 100644 (file)
@@ -74,6 +74,7 @@ struct psx_gpu {
     uint32_t enabled:1;
     uint32_t active:1;
     uint32_t frame_ready:1;
+    uint32_t skipped_blits:5;
     const int *advice;
   } frameskip;
 };
index b7cb41b..1dfa8ab 100644 (file)
@@ -81,20 +81,29 @@ static void blit(void)
 
 void GPUupdateLace(void)
 {
-  if (gpu.frameskip.enabled && !gpu.frameskip.frame_ready)
+  if (gpu.status.blanking || !gpu.state.fb_dirty)
     return;
 
-  if (!gpu.status.blanking && gpu.state.fb_dirty) {
-    renderer_flush_queues();
-    blit();
-    gpu.state.fb_dirty = 0;
+  if (gpu.frameskip.enabled) {
+    if (!gpu.frameskip.frame_ready && gpu.frameskip.skipped_blits < 6) {
+      gpu.frameskip.skipped_blits++;
+      return;
+    }
+    gpu.frameskip.frame_ready = 0;
+    gpu.frameskip.skipped_blits = 0;
   }
+
+  renderer_flush_queues();
+  blit();
+  gpu.state.fb_dirty = 0;
 }
 
 long GPUopen(void)
 {
   gpu.frameskip.enabled = cbs->frameskip;
   gpu.frameskip.advice = &cbs->fskip_advice;
+  gpu.frameskip.active = 0;
+  gpu.frameskip.frame_ready = 1;
 
   cbs->pl_vout_open();
   screen_buf = cbs->pl_vout_flip();
@@ -110,9 +119,6 @@ long GPUclose(void)
 void GPUrearmedCallbacks(const struct rearmed_cbs *cbs_)
 {
   cbs = cbs_;
-  gpu.frameskip.enabled = cbs->frameskip;
-  gpu.frameskip.advice = &cbs->fskip_advice;
-  gpu.frameskip.active = gpu.frameskip.frame_ready = 0;
 }
 
 // vim:shiftwidth=2:expandtab