YakumoFuji said:
			
		
	
	
		
		
			you might be overwriting something in memory that the GP2X_DEBUG changes that you dont see, and when its removed you overwrite something required...
since your telnetting in, GDB it..
		
		
	 
I looked through all the occurences of GP2X_DEBUG in the source and the only code which is between #ifdef GP2X_DEBUG #endif is either a fprintf or a fputs outputting something to stderr. Nothing that is supposed to be required! 
How would I GDB it?? I don't have GDB on the GP2X!
--------------------
Something else that might be useful: While writing a software rasterizer I realized that the HW accelerated SDL always waits for vsync when double buffering. Without vsync i can reach a higher framerate.
Following is a patch that adds a SDL_GP2X_Vsync function which allows one to control if vsync should be enabled or disabled. The default is to be enabled just like the unmodified SDL.
CODE
Index: include/SDL_gp2x.h
===================================================================
--- include/SDL_gp2x.h    (revision 236)
+++ include/SDL_gp2x.h    (working copy)
@@ -31,7 +31,9 @@
 void SDL_GP2X_AllowGfxMemory(char *start, int size);
 void SDL_GP2X_DenyGfxMemory(char *start, int size);
 
+void SDL_GP2X_Vsync(int enable);
 
+
 #ifdef __cplusplus
 }
 #endif
Index: src/video/gp2x/SDL_gp2xvideo.c
===================================================================
--- src/video/gp2x/SDL_gp2xvideo.c    (revision 236)
+++ src/video/gp2x/SDL_gp2xvideo.c    (working copy)
@@ -182,6 +182,7 @@
 
   device->hidden->mouse_fd = -1;
   device->hidden->keyboard_fd = -1;
+  device->hidden->wait_for_vsync = 1;
   
   // Set the function pointers
   device->VideoInit = GP2X_VideoInit;
@@ -803,11 +804,13 @@
   GP2X_DummyBlit(this);
   do {} while (data->fio[MESGSTATUS] & MESG_BUSY);
 
-  // wait for vblank to start, choose transition type by polarity
-  if (data->vsync_polarity)
-    do {} while ((data->io[GPIOB_PINLVL] & GPIOB_VSYNC));
-  else
-    do {} while (!(data->io[GPIOB_PINLVL] & GPIOB_VSYNC));
+  if (data->wait_for_vsync) {
+    // wait for vblank to start, choose transition type by polarity
+    if (data->vsync_polarity)
+      do {} while ((data->io[GPIOB_PINLVL] & GPIOB_VSYNC));
+    else
+      do {} while (!(data->io[GPIOB_PINLVL] & GPIOB_VSYNC));
+  }
 
   // Wait to be on even field (non-interlaced always returns 0)
   //  do {} while (data->io[SC_STATUS] & SC_DISP_FIELD);
@@ -1548,3 +1551,9 @@
   SDL_PrivateVideoData *data = current_video->hidden;
   data->allow_scratch_memory = 0;
 }
+
+void SDL_GP2X_Vsync(int enable)
+{
+    SDL_PrivateVideoData *data = current_video->hidden;
+    data->wait_for_vsync = enable;
+}
Index: src/video/gp2x/SDL_gp2xvideo.h
===================================================================
--- src/video/gp2x/SDL_gp2xvideo.h    (revision 236)
+++ src/video/gp2x/SDL_gp2xvideo.h    (working copy)
@@ -97,6 +97,7 @@
   int x_offset, y_offset, ptr_offset;
   int w, h, pitch;
   int vsync_polarity;
+  int wait_for_vsync;
   int phys_width, phys_height, phys_pitch, phys_ilace;
   int scale_x, scale_y;
   float xscale, yscale;
Maybe this is useful and might be integrated into the hw accelerated SDL.