annotate src/video/ps3/SDL_ps3video.c @ 3150:0cf7bff804ad gsoc2009_ps3

Code reviewed and added SPE API documentation.
author Martin Lowinski <martin@goldtopf.org>
date Sun, 19 Jul 2009 11:31:47 +0000
parents 9e902f423497
children 4a88137385f9
rev   line source
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
1 /*
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
4
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
9
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
13 Lesser General Public License for more details.
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
14
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
18
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
19 Sam Lantinga
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
20 slouken@libsdl.org
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
21 */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
22 #include "SDL_config.h"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
23
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
24 /* SDL PS3 video driver implementation based on dummy video driver
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
25 *
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
26 * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
27 * of this was cut-and-pasted from Stephane Peter's work in the AAlib
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
28 * SDL video driver. Renamed to "DUMMY" by Sam Lantinga.
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
29 */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
30
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
31 #include "SDL_video.h"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
32 #include "SDL_mouse.h"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
33 #include "../SDL_sysvideo.h"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
34 #include "../SDL_pixels_c.h"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
35 #include "../../events/SDL_events_c.h"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
36
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
37 #include "SDL_ps3video.h"
3144
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
38 #include "SDL_ps3spe_c.h"
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
39 #include "SDL_ps3events_c.h"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
40 #include "SDL_ps3render_c.h"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
41
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
42 #include <fcntl.h>
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
43 #include <linux/fb.h>
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
44 #include <asm/ps3fb.h>
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
45 #include <sys/mman.h>
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
46
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
47 #define PS3VID_DRIVER_NAME "ps3"
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
48
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
49 /* Initialization/Query functions */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
50 static int PS3_VideoInit(_THIS);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
51 static int PS3_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
3145
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
52 void PS3_InitModes(_THIS);
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
53 void PS3_GetDisplayModes(_THIS);
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
54 static void PS3_VideoQuit(_THIS);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
55
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
56 /* Stores the SPE executable name of fb_writer_spu */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
57 extern spe_program_handle_t fb_writer_spu;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
58
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
59 /* PS3 driver bootstrap functions */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
60
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
61 static int
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
62 PS3_Available(void)
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
63 {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
64 deprintf(1, "PS3_Available()\n");
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
65 const char *envr = SDL_getenv("SDL_VIDEODRIVER");
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
66 if ((envr) && (SDL_strcmp(envr, PS3VID_DRIVER_NAME) == 0)) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
67 return (1);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
68 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
69
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
70 return (0);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
71 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
72
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
73 static void
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
74 PS3_DeleteDevice(SDL_VideoDevice * device)
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
75 {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
76 deprintf(1, "PS3_DeleteDevice()\n");
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
77 SDL_free(device->driverdata);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
78 SDL_free(device);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
79 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
80
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
81 static SDL_VideoDevice *
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
82 PS3_CreateDevice(int devindex)
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
83 {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
84 deprintf(1, "PS3_CreateDevice()\n");
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
85 SDL_VideoDevice *device;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
86 SDL_VideoData *data;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
87
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
88 /* Initialize all variables that we clean on shutdown */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
89 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
90 if (!device) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
91 SDL_OutOfMemory();
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
92 if (device) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
93 SDL_free(device);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
94 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
95 return (0);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
96 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
97 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
98 if (!data) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
99 SDL_OutOfMemory();
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
100 SDL_free(device);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
101 return (0);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
102 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
103 device->driverdata = data;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
104
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
105 /* Set the function pointers */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
106 device->VideoInit = PS3_VideoInit;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
107 device->VideoQuit = PS3_VideoQuit;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
108 device->SetDisplayMode = PS3_SetDisplayMode;
3145
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
109 device->GetDisplayModes = PS3_GetDisplayModes;
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
110 device->PumpEvents = PS3_PumpEvents;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
111
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
112 device->free = PS3_DeleteDevice;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
113
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
114 return device;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
115 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
116
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
117 VideoBootStrap PS3_bootstrap = {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
118 PS3VID_DRIVER_NAME, "SDL PS3 Cell video driver",
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
119 PS3_Available, PS3_CreateDevice
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
120 };
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
121
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
122
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
123 int
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
124 PS3_VideoInit(_THIS)
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
125 {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
126 deprintf(1, "PS3_VideoInit()\n");
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
127
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
128 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
129 SDL_DisplayMode mode;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
130
3146
9e902f423497 YUV-Textures with SPU-support working.
Martin Lowinski <martin@goldtopf.org>
parents: 3145
diff changeset
131 #if 1
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
132 /* Use a fake 32-bpp desktop mode */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
133 mode.format = SDL_PIXELFORMAT_RGB888;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
134 mode.w = 1920;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
135 mode.h = 1080;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
136 mode.refresh_rate = 0;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
137 mode.driverdata = NULL;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
138 SDL_AddBasicVideoDisplay(&mode);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
139 SDL_AddRenderDriver(0, &SDL_PS3_RenderDriver);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
140
3145
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
141 //SDL_zero(mode);
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
142 SDL_AddDisplayMode(0, &mode);
3146
9e902f423497 YUV-Textures with SPU-support working.
Martin Lowinski <martin@goldtopf.org>
parents: 3145
diff changeset
143 //display.desktop_mode = mode;
9e902f423497 YUV-Textures with SPU-support working.
Martin Lowinski <martin@goldtopf.org>
parents: 3145
diff changeset
144 //display.current_mode = mode;
3145
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
145 #endif
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
146
3150
0cf7bff804ad Code reviewed and added SPE API documentation.
Martin Lowinski <martin@goldtopf.org>
parents: 3146
diff changeset
147 /*
0cf7bff804ad Code reviewed and added SPE API documentation.
Martin Lowinski <martin@goldtopf.org>
parents: 3146
diff changeset
148 *PS3 stuff
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
149 */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
150
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
151 /* Create SPU fb_parms and thread structure */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
152 data->fb_parms = (struct fb_writer_parms_t *)
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
153 memalign(16, sizeof(struct fb_writer_parms_t));
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
154 data->fb_thread_data = (spu_data_t *) malloc(sizeof(spu_data_t));
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
155 if (data->fb_parms == NULL || data->fb_thread_data == NULL) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
156 SDL_OutOfMemory();
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
157 return -1;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
158 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
159 data->fb_thread_data->program = fb_writer_spu;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
160 data->fb_thread_data->program_name = "fb_writer_spu";
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
161 data->fb_thread_data->argp = (void *)data->fb_parms;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
162 data->fb_thread_data->keepalive = 1;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
163 data->fb_thread_data->booted = 0;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
164
3144
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
165 SPE_Start(data->fb_thread_data);
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
166
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
167 /* Open the device */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
168 data->fbdev = open(PS3DEV, O_RDWR);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
169 if (data->fbdev < 0) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
170 SDL_SetError("[PS3] Unable to open device %s", PS3DEV);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
171 return -1;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
172 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
173
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
174 /* Take control of frame buffer from kernel, for details see
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
175 * http://felter.org/wesley/files/ps3/linux-20061110-docs/ApplicationProgrammingEnvironment.html
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
176 * kernel will no longer flip the screen itself
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
177 */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
178 ioctl(data->fbdev, PS3FB_IOCTL_ON, 0);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
179
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
180 /* Unblank screen */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
181 ioctl(data->fbdev, FBIOBLANK, 0);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
182
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
183 struct fb_fix_screeninfo fb_finfo;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
184 if (ioctl(data->fbdev, FBIOGET_FSCREENINFO, &fb_finfo)) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
185 SDL_SetError("[PS3] Can't get fixed screeninfo");
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
186 return (0);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
187 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
188
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
189 /* Note: on PS3, fb_finfo.smem_len is enough for double buffering */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
190 if ((data->frame_buffer = (uint8_t *)mmap(0, fb_finfo.smem_len,
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
191 PROT_READ | PROT_WRITE, MAP_SHARED,
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
192 data->fbdev, 0)) == (uint8_t *) - 1) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
193 SDL_SetError("[PS3] Can't mmap for %s", PS3DEV);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
194 return (0);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
195 } else {
3144
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
196 /* Enable double buffering */
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
197 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
198
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
199 /* Blank screen */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
200 memset(data->frame_buffer, 0x00, fb_finfo.smem_len);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
201
3146
9e902f423497 YUV-Textures with SPU-support working.
Martin Lowinski <martin@goldtopf.org>
parents: 3145
diff changeset
202 #if 0
3145
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
203 PS3_InitModes(_this);
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
204
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
205 SDL_AddRenderDriver(0, &SDL_PS3_RenderDriver);
3146
9e902f423497 YUV-Textures with SPU-support working.
Martin Lowinski <martin@goldtopf.org>
parents: 3145
diff changeset
206 #endif
3145
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
207
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
208 /* We're done! */
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
209 return 0;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
210 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
211
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
212 static int
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
213 PS3_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
214 {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
215 deprintf(1, "PS3_SetDisplayMode()\n");
3145
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
216 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
217 SDL_DisplayData *dispdata = (SDL_DisplayData *) mode->driverdata;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
218
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
219 if (ioctl(data->fbdev, PS3FB_IOCTL_SETMODE, (unsigned long)&dispdata->mode)) {
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
220 SDL_SetError("Could not set videomode");
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
221 return -1;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
222 }
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
223 return 0;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
224 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
225
3145
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
226 void PS3_GetDisplayModes(_THIS) {
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
227 deprintf(1, "PS3_GetDisplayModes()\n");
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
228 }
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
229
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
230 void
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
231 PS3_InitModes(_THIS)
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
232 {
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
233 deprintf(1, "PS3_InitModes()\n");
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
234 SDL_VideoDisplay display;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
235 SDL_DisplayMode mode, mode1080p;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
236 SDL_DisplayData *displaydata;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
237 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
238
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
239 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
240 if (!displaydata) {
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
241 return;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
242 }
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
243
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
244 struct ps3fb_ioctl_res res;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
245 if (ioctl(data->fbdev, PS3FB_IOCTL_SCREENINFO, &res)) {
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
246 SDL_SetError("Can't get PS3FB_IOCTL_SCREENINFO");
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
247 }
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
248 mode.format = SDL_PIXELFORMAT_RGB888;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
249 mode.refresh_rate = 0;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
250 mode.w = res.xres;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
251 mode.h = res.yres;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
252
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
253 int vid = 0;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
254 if (ioctl(data->fbdev, PS3FB_IOCTL_GETMODE, (unsigned long)&vid)) {
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
255 SDL_SetError("Can't get PS3FB_IOCTL_GETMODE");
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
256 }
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
257 printf("PS3FB_IOCTL_GETMODE = %u\n", vid);
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
258
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
259 displaydata->mode = vid;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
260 mode.driverdata = displaydata;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
261
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
262 SDL_zero(display);
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
263 display.desktop_mode = mode;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
264 display.current_mode = mode;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
265
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
266 SDL_AddVideoDisplay(&display);
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
267 SDL_AddDisplayMode(_this->current_display, &mode);
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
268
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
269 mode1080p.format = SDL_PIXELFORMAT_RGB888;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
270 mode1080p.refresh_rate = 0;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
271 mode1080p.w = 1920;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
272 mode1080p.h = 1080;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
273
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
274 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
275 if (!displaydata) {
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
276 return;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
277 }
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
278
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
279 displaydata->mode = 133;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
280 mode1080p.driverdata = displaydata;
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
281 SDL_AddDisplayMode(_this->current_display, &mode1080p);
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
282 }
7828eed2f31a Initialise 720p and 1080p display modes in VideoInit().
Martin Lowinski <martin@goldtopf.org>
parents: 3144
diff changeset
283
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
284 void
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
285 PS3_VideoQuit(_THIS)
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
286 {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
287 deprintf(1, "PS3_VideoQuit()\n");
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
288 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
3144
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
289
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
290 /* Unmap framebuffer */
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
291 if (data->frame_buffer) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
292 struct fb_fix_screeninfo fb_finfo;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
293 if (ioctl(data->fbdev, FBIOGET_FSCREENINFO, &fb_finfo) != -1) {
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
294 munmap(data->frame_buffer, fb_finfo.smem_len);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
295 data->frame_buffer = 0;
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
296 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
297 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
298
3144
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
299 /* Shutdown SPE and related resources */
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
300 if (data->fb_parms)
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
301 free((void *)data->fb_parms);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
302 if (data->fb_thread_data) {
3144
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
303 SPE_Shutdown(data->fb_thread_data);
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
304 free((void *)data->fb_thread_data);
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
305 }
3144
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
306
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
307 /* Close device */
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
308 if (data->fbdev > 0) {
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
309 /* Give control of frame buffer back to kernel */
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
310 ioctl(data->fbdev, PS3FB_IOCTL_OFF, 0);
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
311 close(data->fbdev);
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
312 data->fbdev = -1;
0d8d1f870964 Moved SPE-functions to SDL_ps3spe.c.
Martin Lowinski <martin@goldtopf.org>
parents: 3142
diff changeset
313 }
3141
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
314 }
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
315
3df74541339b Added ps3 video driver based on the dummy driver.
Martin Lowinski <martin@goldtopf.org>
parents:
diff changeset
316 /* vi: set ts=4 sw=4 expandtab: */