Mercurial > sdl-ios-xcode
comparison src/video/ps3/SDL_ps3modes.c @ 3151:4a88137385f9 gsoc2009_ps3
Moved mode functions to SDL_ps3modes and fixed minor stuff.
author | Martin Lowinski <martin@goldtopf.org> |
---|---|
date | Tue, 21 Jul 2009 05:33:11 +0000 |
parents | |
children | 7f3341cccf42 |
comparison
equal
deleted
inserted
replaced
3150:0cf7bff804ad | 3151:4a88137385f9 |
---|---|
1 /* | |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2009 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Lesser General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2.1 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Lesser General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Lesser General Public | |
16 License along with this library; if not, write to the Free Software | |
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
22 #include "SDL_config.h" | |
23 | |
24 #include "SDL_ps3video.h" | |
25 | |
26 void | |
27 PS3_InitModes(_THIS) | |
28 { | |
29 deprintf(1, "+PS3_InitModes()\n"); | |
30 SDL_VideoDisplay display; | |
31 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; | |
32 SDL_DisplayMode mode; | |
33 PS3_DisplayModeData *modedata; | |
34 unsigned long vid = 0; | |
35 | |
36 modedata = (PS3_DisplayModeData *) SDL_malloc(sizeof(*modedata)); | |
37 if (!displaydata) { | |
38 return; | |
39 } | |
40 | |
41 /* Setting up the DisplayMode */ | |
42 struct ps3fb_ioctl_res res; | |
43 if (ioctl(data->fbdev, PS3FB_IOCTL_SCREENINFO, &res)) { | |
44 SDL_SetError("Can't get PS3FB_IOCTL_SCREENINFO"); | |
45 } | |
46 mode.format = SDL_PIXELFORMAT_RGB888; | |
47 mode.refresh_rate = 0; | |
48 mode.w = res.xres; | |
49 mode.h = res.yres; | |
50 | |
51 /* Setting up driver specific mode data */ | |
52 if (ioctl(data->fbdev, PS3FB_IOCTL_GETMODE, (unsigned long)&vid)) { | |
53 SDL_SetError("Can't get PS3FB_IOCTL_GETMODE"); | |
54 } | |
55 deprintf(2, "PS3FB_IOCTL_GETMODE = %u\n", vid); | |
56 modedata->mode = vid; | |
57 mode.driverdata = modedata; | |
58 | |
59 SDL_zero(display); | |
60 display.desktop_mode = mode; | |
61 display.current_mode = mode; | |
62 | |
63 SDL_AddVideoDisplay(&display); | |
64 deprintf(1, "-PS3_InitModes()\n"); | |
65 } | |
66 | |
67 void | |
68 PS3_GetDisplayModes(_THIS) { | |
69 deprintf(1, "+PS3_GetDisplayModes()\n"); | |
70 deprintf(1, "-PS3_GetDisplayModes()\n"); | |
71 } | |
72 | |
73 static int | |
74 PS3_SetDisplayMode(_THIS, SDL_DisplayMode * mode) | |
75 { | |
76 deprintf(1, "+PS3_SetDisplayMode()\n"); | |
77 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; | |
78 SDL_DisplayData *dispdata = (SDL_DisplayData *) mode->driverdata; | |
79 | |
80 /* We don't care about the current DisplayMode for now */ | |
81 if (ioctl(data->fbdev, PS3FB_IOCTL_SETMODE, (unsigned long)&dispdata->mode)) { | |
82 SDL_SetError("Could not set videomode\n"); | |
83 return -1; | |
84 } | |
85 | |
86 deprintf(1, "-PS3_SetDisplayMode()\n"); | |
87 return 0; | |
88 } | |
89 | |
90 void | |
91 PS3_QuitModes(_THIS) { | |
92 deprintf(1, "+PS3_QuitModes()\n"); | |
93 deprintf(1, "-PS3_QuitModes()\n"); | |
94 } | |
95 | |
96 /* vi: set ts=4 sw=4 expandtab: */ |