changeset 984:df5185513c2d

minor fix
author root@henri.cr.ie.u-ryukyu.ac.jp
date Fri, 01 Oct 2010 01:25:45 +0900
parents ff74988bbb2a
children e40dd2384357
files Renderer/Engine/Makefile.cell Renderer/Engine/viewer.cc Renderer/Engine/viewerFB.cc Renderer/Engine/viewerPS3.cc Renderer/Engine/viewerSDL.cc Renderer/Engine/viewerSDL.h
diffstat 6 files changed, 39 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.cell	Fri Oct 01 00:37:06 2010 +0900
+++ b/Renderer/Engine/Makefile.cell	Fri Oct 01 01:25:45 2010 +0900
@@ -13,7 +13,7 @@
 
 LIBS += -lCellManager -lspe2 -lpthread
 
-CFLAGS += -Drestrict=__restrict__ `sdl-config --cflags` `xml2-config --cflags`
+CFLAGS += -D__CERIUM_CELL__ -Drestrict=__restrict__ `sdl-config --cflags` `xml2-config --cflags`
 LIBS   += `sdl-config --libs` -lSDL_image -lGL `xml2-config --libs`
 
 .SUFFIXES: .cc .o
--- a/Renderer/Engine/viewer.cc	Fri Oct 01 00:37:06 2010 +0900
+++ b/Renderer/Engine/viewer.cc	Fri Oct 01 01:25:45 2010 +0900
@@ -98,10 +98,6 @@
 {
     this->manager = manager;
 
-    start_time = get_ticks();
-    this_time  = 0;
-    frames     = 0;
-
     if (spe_num == 0) spe_num = 1;
 
     sgroot = new SceneGraphRoot(this->width, this->height);
@@ -160,6 +156,10 @@
 	data_load->spawn();
     }
     
+    start_time = get_ticks();
+    this_time  = 0;
+    frames     = 0;
+
     MainLoop *mainloop = app->init(this, this->width, this->height);
     mainloop->mainLoop();
 }
@@ -947,10 +947,10 @@
     data_update_wait->spawn();  
     if (profile) {
 	if (frames % 50 == 49) {
+	   manager->show_profile();
            this_time = get_ticks();
-	   manager->show_profile();
            if (this_time != start_time) {
-              printf("\n%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0);
+              printf("\n%f FPS\n", ((((float)frames)*1000.0)/(this_time-start_time)));
               start_time = this_time; frames = 0;
            }
         }
--- a/Renderer/Engine/viewerFB.cc	Fri Oct 01 00:37:06 2010 +0900
+++ b/Renderer/Engine/viewerFB.cc	Fri Oct 01 01:25:45 2010 +0900
@@ -1,6 +1,10 @@
 #include "viewerFB.h"
 #include "fb.h"
 #include <stdio.h>
+#if 0
+#include <asm/ps3fb.h>
+#endif
+
 
 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK
 
@@ -65,6 +69,14 @@
 	}
 	send_current_information("The framebuffer device was mapped !");
 
+#if 0
+    // Take control of frame buffer from kernel
+    ioctl(fd_framebuffer, PS3FB_IOCTL_ON, 0);
+    int field_ndx = 0;
+    ioctl(fd_framebuffer , PS3FB_IOCTL_FSEL,  &field_ndx );
+#endif
+
+
 	printf("fb: 0x%x \n", (unsigned int)fbptr);
 	info.xres = xres;
         info.yres = yres; 
--- a/Renderer/Engine/viewerPS3.cc	Fri Oct 01 00:37:06 2010 +0900
+++ b/Renderer/Engine/viewerPS3.cc	Fri Oct 01 01:25:45 2010 +0900
@@ -52,6 +52,7 @@
     }
 
     screen_info = get_fbdev_addr();
+
     uint32_t *pixels =  screen_info.fbptr[frame_ndx];
 
     if (pixels == 0) {
--- a/Renderer/Engine/viewerSDL.cc	Fri Oct 01 00:37:06 2010 +0900
+++ b/Renderer/Engine/viewerSDL.cc	Fri Oct 01 01:25:45 2010 +0900
@@ -3,6 +3,8 @@
 #include "TaskManager.h"
 #include "viewer_types.h"
 
+#define UGA 1
+
 extern void post2runLoop(void *);
 
 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK
@@ -21,7 +23,7 @@
 	exit(1);
     }
 
-    screen = SDL_SetVideoMode(width, height, bpp, SDL_SWSURFACE);
+    screen = SDL_SetVideoMode(width, height, bpp, SDL_HWSURFACE);
     if (screen == NULL) {
 	fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
 	SDL_Quit();
@@ -45,14 +47,28 @@
 ViewerSDL::clean_pixels()
 {
     //bzero(pixels, sizeof(int)*width*height);
+#if !UGA
     SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0));
+#endif
 }
 
 void
 ViewerSDL::clear_screen()
 {
+#if !UGA
     SDL_BlitSurface(bitmap, NULL, screen, NULL);
     SDL_UpdateRect(screen, 0, 0, 0, 0);        
+#endif
+}
+
+uint32_t *
+ViewerSDL::flip_screen(uint32_t *old)
+{
+#if UGA
+    SDL_BlitSurface(bitmap,NULL,screen,NULL);
+    SDL_UpdateRect(screen,0,0,0,0);
+#endif
+    return old;
 }
 
 void
--- a/Renderer/Engine/viewerSDL.h	Fri Oct 01 00:37:06 2010 +0900
+++ b/Renderer/Engine/viewerSDL.h	Fri Oct 01 01:25:45 2010 +0900
@@ -17,6 +17,8 @@
     void clean_pixels();
     void clear_screen();
     void free_device();
+    uint32_t* flip_screen(uint32_t *);
+
 };
 
 #endif