cdrom: attempt to deal with broken subq :(
[pcsx_rearmed.git] / plugins / gpu_neon / psx_gpu / psx_gpu_main.c
index 8624ff0..c7ce0ee 100644 (file)
@@ -127,7 +127,7 @@ void update_screen(psx_gpu_struct *psx_gpu, SDL_Surface *screen)
 int main(int argc, char *argv[])
 {
   psx_gpu_struct *psx_gpu = &_psx_gpu;
-  SDL_Surface *screen;
+  SDL_Surface *screen = NULL;
   SDL_Event event;
 
   u32 *list;
@@ -164,17 +164,38 @@ int main(int argc, char *argv[])
   {
     SDL_Init(SDL_INIT_EVERYTHING);
     screen = SDL_SetVideoMode(1024, 512, 32, 0);
+    if (screen == 0)
+    {
+      printf("can't set video mode: %s\n", SDL_GetError());
+      return 1;
+    }
   }
 
 #ifdef NEON_BUILD
+  u16 *vram_ptr;
+#if 0
   system("ofbset -fb /dev/fb1 -mem 6291456 -en 0");
   u32 fbdev_handle = open("/dev/fb1", O_RDWR);
-  u16 *vram_ptr =
   vram_ptr = (mmap((void *)0x50000000, 1024 * 1024 * 2, PROT_READ | PROT_WRITE,
    MAP_SHARED | 0xA0000000, fbdev_handle, 0));
+#elif 1
+  #ifndef MAP_HUGETLB
+  #define MAP_HUGETLB 0x40000 /* arch specific */
+  #endif
+  vram_ptr = (mmap((void *)0x50000000, 1024 * 1024 * 2, PROT_READ | PROT_WRITE,
+   MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB, -1, 0));
+#else
+  vram_ptr = (mmap((void *)0x50000000, 1024 * 1024 * 2, PROT_READ | PROT_WRITE,
+   MAP_ANONYMOUS | MAP_PRIVATE, -1, 0));
+#endif
+  if (vram_ptr == MAP_FAILED)
+  {
+    perror("mmap");
+    return 1;
+  }
   vram_ptr += 64;
 
-  initialize_psx_gpu(psx_gpu, vram_ptr + 64);
+  initialize_psx_gpu(psx_gpu, vram_ptr);
 #else
   initialize_psx_gpu(psx_gpu, _vram + 64);
 #endif
@@ -192,7 +213,7 @@ int main(int argc, char *argv[])
   init_counter();
 #endif
 
-  gpu_parse(psx_gpu, list, size);
+  gpu_parse(psx_gpu, list, size, NULL);
   flush_render_block_buffer(psx_gpu);
 
   clear_stats();
@@ -201,17 +222,18 @@ int main(int argc, char *argv[])
   u32 cycles = get_counter();
 #endif
 
-  gpu_parse(psx_gpu, list, size);
+  gpu_parse(psx_gpu, list, size, NULL);
   flush_render_block_buffer(psx_gpu);
 
-  printf("%-64s: ", argv[1]);
 #ifdef NEON_BUILD
   u32 cycles_elapsed = get_counter() - cycles;
 
-  printf("%d\n", cycles_elapsed);
+  printf("%-64s: %d\n", argv[1], cycles_elapsed);
+#else
+  printf("%-64s: ", argv[1]);
 #endif
 
-#if 0
+#if 1
   u32 i;
 
   for(i = 0; i < 1024 * 512; i++)
@@ -238,7 +260,7 @@ int main(int argc, char *argv[])
   }
 #endif
 
-#if 1
+#if 0
   printf("\n");
   printf("  %d pixels, %d pixel blocks, %d spans\n"
    "   (%lf pixels per block, %lf pixels per span),\n"
@@ -294,6 +316,7 @@ int main(int argc, char *argv[])
      percent_of(sprites_8bpp, sprites), percent_of(sprites_16bpp, sprites),
      percent_of(sprites_untextured, sprites));
   }
+  printf("  %d lines\n", lines);
   printf("\n");
   printf("  %d mismatches\n\n\n", mismatches);
 #endif