[uae] Re: SDL speedup

  • From: blynel@xxxxxxxxxx
  • To: uae@xxxxxxxxxxxxx
  • Date: Sat, 13 Nov 2004 00:21:28 +0100

...and of course there was an error - aaargh!

Sorry guys!

Here is the correct patch


--- sdlgfx.c    2004-10-26 07:42:20.000000000 +0200
+++ sdlgfx.c.new        2004-11-13 00:12:29.968616112 +0100
@@ -131,22 +131,39 @@
     /* Not implemented for SDL output */
 }
 
+static int pending_flush = 0;
+static int ystart_p, ystop_p;
+
 void flush_block (int ystart, int ystop)
 {
     DEBUG_LOG ("Function: flush_block %d %d\n", ystart, ystop);
 
-    SDL_UnlockSurface (prSDLScreen);
-    SDL_UpdateRect (prSDLScreen, 0, ystart, current_width, ystop - ystart + 1);
-    SDL_LockSurface (prSDLScreen);
+    if (pending_flush) {
+        if (ystart <= ystop_p + 2) {
+           /* merge with pending flush */
+           ystop_p = ystop;
+        } else {
+           /* do previous pending flush and make this flush pending */
+           SDL_UpdateRect (prSDLScreen, 0, ystart_p, current_width, ystop_p - 
ystart_p + 1);
+           ystart_p = ystart;
+           ystop_p = ystop;
+        }
+    } else {
+        /* make this flush pending */
+        ystart_p = ystart;
+        ystop_p = ystop;
+        pending_flush = 1;
+    }
 }
 
 void flush_screen (int ystart, int ystop)
 {
     DEBUG_LOG ("Function: flush_screen\n");
 
-#if 0
-    SDL_UpdateRect(prSDLScreen, 0, 0, current_width, current_height);
-#endif
+    if (pending_flush) {
+        SDL_UpdateRect (prSDLScreen, 0, ystart_p, current_width, ystop_p - 
ystart_p + 1);      
+        pending_flush = 0;
+    }
 }
 
 void flush_clear_screen (void)

Other related posts: