comparison src/video/ps3/SDL_ps3video.c @ 3152:7f3341cccf42 gsoc2009_ps3

Working 1080p, 720p, 480p videomodes and double buffering.
author Martin Lowinski <martin@goldtopf.org>
date Thu, 06 Aug 2009 12:24:47 +0000
parents 4a88137385f9
children cce01ba54174
comparison
equal deleted inserted replaced
3151:4a88137385f9 3152:7f3341cccf42
57 /* PS3 driver bootstrap functions */ 57 /* PS3 driver bootstrap functions */
58 58
59 static int 59 static int
60 PS3_Available(void) 60 PS3_Available(void)
61 { 61 {
62 deprintf(1, "PS3_Available()\n"); 62 deprintf(1, "+PS3_Available()\n");
63 const char *envr = SDL_getenv("SDL_VIDEODRIVER"); 63 const char *envr = SDL_getenv("SDL_VIDEODRIVER");
64 if ((envr) && (SDL_strcmp(envr, PS3VID_DRIVER_NAME) == 0)) { 64 if ((envr) && (SDL_strcmp(envr, PS3VID_DRIVER_NAME) == 0)) {
65 return (1); 65 return (1);
66 } 66 }
67 67
68 deprintf(1, "-PS3_Available()\n");
68 return (0); 69 return (0);
69 } 70 }
70 71
71 static void 72 static void
72 PS3_DeleteDevice(SDL_VideoDevice * device) 73 PS3_DeleteDevice(SDL_VideoDevice * device)
73 { 74 {
74 deprintf(1, "PS3_DeleteDevice()\n"); 75 deprintf(1, "+PS3_DeleteDevice()\n");
75 SDL_free(device->driverdata); 76 SDL_free(device->driverdata);
76 SDL_free(device); 77 SDL_free(device);
78 deprintf(1, "-PS3_DeleteDevice()\n");
77 } 79 }
78 80
79 static SDL_VideoDevice * 81 static SDL_VideoDevice *
80 PS3_CreateDevice(int devindex) 82 PS3_CreateDevice(int devindex)
81 { 83 {
82 deprintf(1, "PS3_CreateDevice()\n"); 84 deprintf(1, "+PS3_CreateDevice()\n");
83 SDL_VideoDevice *device; 85 SDL_VideoDevice *device;
84 SDL_VideoData *data; 86 SDL_VideoData *data;
85 87
86 /* Initialize all variables that we clean on shutdown */ 88 /* Initialize all variables that we clean on shutdown */
87 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); 89 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
107 device->GetDisplayModes = PS3_GetDisplayModes; 109 device->GetDisplayModes = PS3_GetDisplayModes;
108 device->PumpEvents = PS3_PumpEvents; 110 device->PumpEvents = PS3_PumpEvents;
109 111
110 device->free = PS3_DeleteDevice; 112 device->free = PS3_DeleteDevice;
111 113
114 deprintf(1, "-PS3_CreateDevice()\n");
112 return device; 115 return device;
113 } 116 }
114 117
115 VideoBootStrap PS3_bootstrap = { 118 VideoBootStrap PS3_bootstrap = {
116 PS3VID_DRIVER_NAME, "SDL PS3 Cell video driver", 119 PS3VID_DRIVER_NAME, "SDL PS3 Cell video driver",
211 PS3_VideoQuit(_THIS) 214 PS3_VideoQuit(_THIS)
212 { 215 {
213 deprintf(1, "PS3_VideoQuit()\n"); 216 deprintf(1, "PS3_VideoQuit()\n");
214 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 217 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
215 218
219 PS3_QuitModes(_this);
220
216 /* Unmap framebuffer */ 221 /* Unmap framebuffer */
217 if (data->frame_buffer) { 222 if (data->frame_buffer) {
218 struct fb_fix_screeninfo fb_finfo; 223 struct fb_fix_screeninfo fb_finfo;
219 if (ioctl(data->fbdev, FBIOGET_FSCREENINFO, &fb_finfo) != -1) { 224 if (ioctl(data->fbdev, FBIOGET_FSCREENINFO, &fb_finfo) != -1) {
220 munmap(data->frame_buffer, fb_finfo.smem_len); 225 munmap(data->frame_buffer, fb_finfo.smem_len);
229 SPE_Shutdown(data->fb_thread_data); 234 SPE_Shutdown(data->fb_thread_data);
230 free((void *)data->fb_thread_data); 235 free((void *)data->fb_thread_data);
231 } 236 }
232 237
233 /* Close device */ 238 /* Close device */
234 if (data->fbdev > 0) { 239 if (data->fbdev) {
235 /* Give control of frame buffer back to kernel */ 240 /* Give control of frame buffer back to kernel */
236 ioctl(data->fbdev, PS3FB_IOCTL_OFF, 0); 241 ioctl(data->fbdev, PS3FB_IOCTL_OFF, 0);
237 close(data->fbdev); 242 close(data->fbdev);
238 data->fbdev = -1; 243 data->fbdev = -1;
239 } 244 }