comparison src/video/directfb/SDL_DirectFB_modes.c @ 5202:164f20ba08eb

Updated the DirectFB support, from Couriersud attached is a working directfb driver diff which works with the current changes. There are a number of changes around it as well, e.g. configure.in. The directfb renderdriver right now still depends on a some "includes" from src/video/directfb. That's why it is not yet moved to the new render folder.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 05 Feb 2011 16:07:10 -0800
parents b196d2758026
children 58265e606e4e
comparison
equal deleted inserted replaced
5201:7c3422025c35 5202:164f20ba08eb
16 License along with this library; if not, write to the Free Software 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 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21
22 SDL1.3 DirectFB driver by couriersud@arcor.de
23
21 */ 24 */
22 #include "SDL_config.h"
23 25
24 #include "SDL_DirectFB_video.h" 26 #include "SDL_DirectFB_video.h"
27 #include "SDL_DirectFB_modes.h"
25 28
26 #define DFB_MAX_MODES 200 29 #define DFB_MAX_MODES 200
27 30
28 struct scn_callback_t 31 struct screen_callback_t
29 { 32 {
30 int numscreens; 33 int numscreens;
31 DFBScreenID screenid[DFB_MAX_SCREENS]; 34 DFBScreenID screenid[DFB_MAX_SCREENS];
32 DFBDisplayLayerID gralayer[DFB_MAX_SCREENS]; 35 DFBDisplayLayerID gralayer[DFB_MAX_SCREENS];
33 DFBDisplayLayerID vidlayer[DFB_MAX_SCREENS]; 36 DFBDisplayLayerID vidlayer[DFB_MAX_SCREENS];
38 { 41 {
39 int nummodes; 42 int nummodes;
40 SDL_DisplayMode *modelist; 43 SDL_DisplayMode *modelist;
41 }; 44 };
42 45
43 static const struct {
44 DFBSurfacePixelFormat dfb;
45 Uint32 sdl;
46 } pixelformat_tab[] =
47 {
48 { DSPF_LUT8, SDL_PIXELFORMAT_INDEX8 }, /* 8 bit LUT (8 bit color and alpha lookup from palette) */
49 { DSPF_RGB332, SDL_PIXELFORMAT_RGB332 }, /* 8 bit RGB (1 byte, red 3@5, green 3@2, blue 2@0) */
50 { DSPF_ARGB4444, SDL_PIXELFORMAT_ARGB4444 }, /* 16 bit ARGB (2 byte, alpha 4@12, red 4@8, green 4@4, blue 4@0) */
51 { DSPF_ARGB1555, SDL_PIXELFORMAT_ARGB1555 }, /* 16 bit ARGB (2 byte, alpha 1@15, red 5@10, green 5@5, blue 5@0) */
52 { DSPF_RGB16, SDL_PIXELFORMAT_RGB565 }, /* 16 bit RGB (2 byte, red 5@11, green 6@5, blue 5@0) */
53 { DSPF_RGB24, SDL_PIXELFORMAT_RGB24 }, /* 24 bit RGB (3 byte, red 8@16, green 8@8, blue 8@0) */
54 { DSPF_RGB32, SDL_PIXELFORMAT_RGB888 }, /* 24 bit RGB (4 byte, nothing@24, red 8@16, green 8@8, blue 8@0) */
55 { DSPF_ARGB, SDL_PIXELFORMAT_ARGB8888 }, /* 32 bit ARGB (4 byte, alpha 8@24, red 8@16, green 8@8, blue 8@0) */
56 { DSPF_RGB444, SDL_PIXELFORMAT_RGB444 }, /* 16 bit RGB (2 byte, nothing @12, red 4@8, green 4@4, blue 4@0) */
57 { DSPF_YV12, SDL_PIXELFORMAT_YV12 }, /* 12 bit YUV (8 bit Y plane followed by 8 bit quarter size V/U planes) */
58 { DSPF_I420,SDL_PIXELFORMAT_IYUV }, /* 12 bit YUV (8 bit Y plane followed by 8 bit quarter size U/V planes) */
59 { DSPF_YUY2, SDL_PIXELFORMAT_YUY2 }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */
60 { DSPF_UYVY, SDL_PIXELFORMAT_UYVY }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */
61 { DSPF_RGB555, SDL_PIXELFORMAT_RGB555 }, /* 16 bit RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */
62
63 #if (DFB_VERSION_ATLEAST(1,2,0))
64 { DSPF_BGR555, SDL_PIXELFORMAT_BGR555 }, /* 16 bit BGR (2 byte, nothing @15, blue 5@10, green 5@5, red 5@0) */
65 #else
66 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR555 },
67 #endif
68
69 /* Pfff ... nonmatching formats follow */
70
71 { DSPF_ALUT44, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit ALUT (1 byte, alpha 4@4, color lookup 4@0) */
72 { DSPF_A8, SDL_PIXELFORMAT_UNKNOWN }, /* 8 bit alpha (1 byte, alpha 8@0), e.g. anti-aliased glyphs */
73 { DSPF_AiRGB, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit ARGB (4 byte, inv. alpha 8@24, red 8@16, green 8@8, blue 8@0) */
74 { DSPF_A1, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (1 byte/ 8 pixel, most significant bit used first) */
75 { DSPF_NV12, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CbCr [15:0] plane) */
76 { DSPF_NV16, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit YUV (8 bit Y plane followed by one 16 bit half width CbCr [15:0] plane) */
77 { DSPF_ARGB2554, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit ARGB (2 byte, alpha 2@14, red 5@9, green 5@4, blue 4@0) */
78 { DSPF_NV21, SDL_PIXELFORMAT_UNKNOWN }, /* 12 bit YUV (8 bit Y plane followed by one 16 bit quarter size CrCb [15:0] plane) */
79 { DSPF_AYUV, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AYUV (4 byte, alpha 8@24, Y 8@16, Cb 8@8, Cr 8@0) */
80 { DSPF_A4, SDL_PIXELFORMAT_UNKNOWN }, /* 4 bit alpha (1 byte/ 2 pixel, more significant nibble used first) */
81 { DSPF_ARGB1666, SDL_PIXELFORMAT_UNKNOWN }, /* 1 bit alpha (3 byte/ alpha 1@18, red 6@16, green 6@6, blue 6@0) */
82 { DSPF_ARGB6666, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit alpha (3 byte/ alpha 6@18, red 6@16, green 6@6, blue 6@0) */
83 { DSPF_RGB18, SDL_PIXELFORMAT_UNKNOWN }, /* 6 bit RGB (3 byte/ red 6@16, green 6@6, blue 6@0) */
84 { DSPF_LUT2, SDL_PIXELFORMAT_UNKNOWN }, /* 2 bit LUT (1 byte/ 4 pixel, 2 bit color and alpha lookup from palette) */
85
86 #if (DFB_VERSION_ATLEAST(1,3,0))
87 { DSPF_RGBA4444, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 4@12, green 4@8, blue 4@4, alpha 4@0) */
88 #endif
89
90 #if (DFB_VERSION_ATLEAST(1,4,0))
91 { DSPF_RGBA5551, SDL_PIXELFORMAT_UNKNOWN }, /* 16 bit RGBA (2 byte, red 5@11, green 5@6, blue 5@1, alpha 1@0) */
92 { DSPF_YUV444P, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit full YUV planar (8 bit Y plane followed by an 8 bit Cb and an 8 bit Cr plane) */
93 { DSPF_ARGB8565, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit ARGB (3 byte, alpha 8@16, red 5@11, green 6@5, blue 5@0) */
94 { DSPF_AVYU, SDL_PIXELFORMAT_UNKNOWN }, /* 32 bit AVYU 4:4:4 (4 byte, alpha 8@24, Cr 8@16, Y 8@8, Cb 8@0) */
95 { DSPF_VYU, SDL_PIXELFORMAT_UNKNOWN }, /* 24 bit VYU 4:4:4 (3 byte, Cr 8@16, Y 8@8, Cb 8@0) */
96 #endif
97
98 { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX1LSB },
99 { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX1MSB },
100 { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4LSB },
101 { DSPF_UNKNOWN, SDL_PIXELFORMAT_INDEX4MSB },
102 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR24 },
103 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR888 },
104 { DSPF_UNKNOWN, SDL_PIXELFORMAT_RGBA8888 },
105 { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR8888 },
106 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGRA8888 },
107 { DSPF_UNKNOWN, SDL_PIXELFORMAT_ARGB2101010 },
108 { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR4444 },
109 { DSPF_UNKNOWN, SDL_PIXELFORMAT_ABGR1555 },
110 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR565 },
111 { DSPF_UNKNOWN, SDL_PIXELFORMAT_YVYU }, /**< Packed mode: Y0+V0+Y1+U0 (1 pla */
112 };
113
114 static Uint32
115 DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat)
116 {
117 int i;
118
119 for (i=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++)
120 if (pixelformat_tab[i].dfb == pixelformat)
121 {
122 return pixelformat_tab[i].sdl;
123 }
124 return SDL_PIXELFORMAT_UNKNOWN;
125 }
126
127 static DFBSurfacePixelFormat
128 SDLToDFBPixelFormat(Uint32 format)
129 {
130 int i;
131
132 for (i=0; pixelformat_tab[i].dfb != DSPF_UNKNOWN; i++)
133 if (pixelformat_tab[i].sdl == format)
134 {
135 return pixelformat_tab[i].dfb;
136 }
137 return DSPF_UNKNOWN;
138 }
139
140 static DFBEnumerationResult 46 static DFBEnumerationResult
141 EnumModesCallback(int width, int height, int bpp, void *data) 47 EnumModesCallback(int width, int height, int bpp, void *data)
142 { 48 {
143 struct modes_callback_t *modedata = (struct modes_callback_t *) data; 49 struct modes_callback_t *modedata = (struct modes_callback_t *) data;
144 SDL_DisplayMode mode; 50 SDL_DisplayMode mode;
155 61
156 return DFENUM_OK; 62 return DFENUM_OK;
157 } 63 }
158 64
159 static DFBEnumerationResult 65 static DFBEnumerationResult
160 cbScreens(DFBScreenID screen_id, DFBScreenDescription desc, 66 EnumScreensCallback(DFBScreenID screen_id, DFBScreenDescription desc,
161 void *callbackdata) 67 void *callbackdata)
162 { 68 {
163 struct scn_callback_t *devdata = (struct scn_callback_t *) callbackdata; 69 struct screen_callback_t *devdata = (struct screen_callback_t *) callbackdata;
164 70
165 devdata->screenid[devdata->numscreens++] = screen_id; 71 devdata->screenid[devdata->numscreens++] = screen_id;
166 return DFENUM_OK; 72 return DFENUM_OK;
167 } 73 }
168 74
169 DFBEnumerationResult 75 static DFBEnumerationResult
170 cbLayers(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc, 76 EnumLayersCallback(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc,
171 void *callbackdata) 77 void *callbackdata)
172 { 78 {
173 struct scn_callback_t *devdata = (struct scn_callback_t *) callbackdata; 79 struct screen_callback_t *devdata = (struct screen_callback_t *) callbackdata;
174 80
175 if (desc.caps & DLCAPS_SURFACE) { 81 if (desc.caps & DLCAPS_SURFACE) {
176 if ((desc.type & DLTF_GRAPHICS) && (desc.type & DLTF_VIDEO)) { 82 if ((desc.type & DLTF_GRAPHICS) && (desc.type & DLTF_VIDEO)) {
177 if (devdata->vidlayer[devdata->aux] == -1) 83 if (devdata->vidlayer[devdata->aux] == -1)
178 devdata->vidlayer[devdata->aux] = layer_id; 84 devdata->vidlayer[devdata->aux] = layer_id;
193 99
194 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, 100 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
195 DLSCL_ADMINISTRATIVE)); 101 DLSCL_ADMINISTRATIVE));
196 config.width = mode->w; 102 config.width = mode->w;
197 config.height = mode->h; 103 config.height = mode->h;
198 config.pixelformat = SDLToDFBPixelFormat(mode->format); 104 config.pixelformat = DirectFB_SDLToDFBPixelFormat(mode->format);
199 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT; 105 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
200 if (devdata->use_yuv_underlays) { 106 if (devdata->use_yuv_underlays) {
201 config.flags |= DLCONF_OPTIONS; 107 config.flags |= DLCONF_OPTIONS;
202 config.options = DLOP_ALPHACHANNEL; 108 config.options = DLOP_ALPHACHANNEL;
203 } 109 }
204 failed = 0; 110 failed = 0;
205 data->layer->TestConfiguration(data->layer, &config, &failed); 111 data->layer->TestConfiguration(data->layer, &config, &failed);
206 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, 112 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
207 DLSCL_SHARED)); 113 DLSCL_SHARED));
208 if (failed == 0) 114 if (failed == 0)
115 {
209 SDL_AddDisplayMode(display, mode); 116 SDL_AddDisplayMode(display, mode);
117 SDL_DFB_LOG("Mode %d x %d Added\n", mode->w, mode->h);
118 }
210 else 119 else
211 SDL_DFB_ERR("Mode %d x %d not available: %x\n", mode->w, 120 SDL_DFB_ERR("Mode %d x %d not available: %x\n", mode->w,
212 mode->h, failed); 121 mode->h, failed);
213 122
214 return; 123 return;
215 error: 124 error:
216 return; 125 return;
126 }
127
128
129 void
130 DirectFB_SetContext(_THIS, SDL_Window *window)
131 {
132 #if (DFB_VERSION_ATLEAST(1,0,0))
133 /* FIXME: does not work on 1.0/1.2 with radeon driver
134 * the approach did work with the matrox driver
135 * This has simply no effect.
136 */
137
138 SDL_VideoDisplay *display = window->display;
139 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
140
141 /* FIXME: should we handle the error */
142 if (dispdata->vidIDinuse)
143 SDL_DFB_CHECK(dispdata->vidlayer->SwitchContext(dispdata->vidlayer,
144 DFB_TRUE));
145 #endif
217 } 146 }
218 147
219 void 148 void
220 DirectFB_InitModes(_THIS) 149 DirectFB_InitModes(_THIS)
221 { 150 {
224 SDL_VideoDisplay display; 153 SDL_VideoDisplay display;
225 DFB_DisplayData *dispdata = NULL; 154 DFB_DisplayData *dispdata = NULL;
226 SDL_DisplayMode mode; 155 SDL_DisplayMode mode;
227 DFBGraphicsDeviceDescription caps; 156 DFBGraphicsDeviceDescription caps;
228 DFBDisplayLayerConfig dlc; 157 DFBDisplayLayerConfig dlc;
229 struct scn_callback_t *screencbdata; 158 struct screen_callback_t *screencbdata;
230 159
231 int tcw[DFB_MAX_SCREENS]; 160 int tcw[DFB_MAX_SCREENS];
232 int tch[DFB_MAX_SCREENS]; 161 int tch[DFB_MAX_SCREENS];
233 int i; 162 int i;
234 DFBResult ret; 163 DFBResult ret;
235 164
236 SDL_DFB_CALLOC(screencbdata, 1, sizeof(*screencbdata)); 165 SDL_DFB_ALLOC_CLEAR(screencbdata, sizeof(*screencbdata));
237 166
238 screencbdata->numscreens = 0; 167 screencbdata->numscreens = 0;
239 168
240 for (i = 0; i < DFB_MAX_SCREENS; i++) { 169 for (i = 0; i < DFB_MAX_SCREENS; i++) {
241 screencbdata->gralayer[i] = -1; 170 screencbdata->gralayer[i] = -1;
242 screencbdata->vidlayer[i] = -1; 171 screencbdata->vidlayer[i] = -1;
243 } 172 }
244 173
245 SDL_DFB_CHECKERR(devdata->dfb->EnumScreens(devdata->dfb, &cbScreens, 174 SDL_DFB_CHECKERR(devdata->dfb->EnumScreens(devdata->dfb, &EnumScreensCallback,
246 screencbdata)); 175 screencbdata));
247 176
248 for (i = 0; i < screencbdata->numscreens; i++) { 177 for (i = 0; i < screencbdata->numscreens; i++) {
249 IDirectFBScreen *screen; 178 IDirectFBScreen *screen;
250 179
251 SDL_DFB_CHECKERR(devdata->dfb->GetScreen(devdata->dfb, 180 SDL_DFB_CHECKERR(devdata->dfb->GetScreen(devdata->dfb,
252 screencbdata->screenid 181 screencbdata->screenid
253 [i], &screen)); 182 [i], &screen));
254 183
255 screencbdata->aux = i; 184 screencbdata->aux = i;
256 SDL_DFB_CHECKERR(screen->EnumDisplayLayers(screen, &cbLayers, 185 SDL_DFB_CHECKERR(screen->EnumDisplayLayers(screen, &EnumLayersCallback,
257 screencbdata)); 186 screencbdata));
258 screen->GetSize(screen, &tcw[i], &tch[i]); 187 screen->GetSize(screen, &tcw[i], &tch[i]);
188
259 screen->Release(screen); 189 screen->Release(screen);
260 } 190 }
261 191
262 /* Query card capabilities */ 192 /* Query card capabilities */
263 193
264 devdata->dfb->GetDeviceDescription(devdata->dfb, &caps); 194 devdata->dfb->GetDeviceDescription(devdata->dfb, &caps);
265
266 SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__);
267 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor);
268 SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens);
269 195
270 for (i = 0; i < screencbdata->numscreens; i++) { 196 for (i = 0; i < screencbdata->numscreens; i++) {
271 SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb, 197 SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
272 screencbdata->gralayer 198 screencbdata->gralayer
273 [i], &layer)); 199 [i], &layer));
280 if (devdata->use_yuv_underlays) { 206 if (devdata->use_yuv_underlays) {
281 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS; 207 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS;
282 dlc.pixelformat = DSPF_ARGB; 208 dlc.pixelformat = DSPF_ARGB;
283 dlc.options = DLOP_ALPHACHANNEL; 209 dlc.options = DLOP_ALPHACHANNEL;
284 210
285 ret = SDL_DFB_CHECK(layer->SetConfiguration(layer, &dlc)); 211 ret = layer->SetConfiguration(layer, &dlc);
286 if (ret != DFB_OK) { 212 if (ret != DFB_OK) {
287 /* try AiRGB if the previous failed */ 213 /* try AiRGB if the previous failed */
288 dlc.pixelformat = DSPF_AiRGB; 214 dlc.pixelformat = DSPF_AiRGB;
289 SDL_DFB_CHECKERR(layer->SetConfiguration(layer, &dlc)); 215 SDL_DFB_CHECKERR(layer->SetConfiguration(layer, &dlc));
290 } 216 }
292 218
293 /* Query layer configuration to determine the current mode and pixelformat */ 219 /* Query layer configuration to determine the current mode and pixelformat */
294 dlc.flags = DLCONF_ALL; 220 dlc.flags = DLCONF_ALL;
295 SDL_DFB_CHECKERR(layer->GetConfiguration(layer, &dlc)); 221 SDL_DFB_CHECKERR(layer->GetConfiguration(layer, &dlc));
296 222
297 mode.format = DFBToSDLPixelFormat(dlc.pixelformat); 223 mode.format = DirectFB_DFBToSDLPixelFormat(dlc.pixelformat);
298 224
299 if (mode.format == SDL_PIXELFORMAT_UNKNOWN) { 225 if (mode.format == SDL_PIXELFORMAT_UNKNOWN) {
300 SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat); 226 SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat);
301 goto error; 227 goto error;
302 } 228 }
304 mode.w = dlc.width; 230 mode.w = dlc.width;
305 mode.h = dlc.height; 231 mode.h = dlc.height;
306 mode.refresh_rate = 0; 232 mode.refresh_rate = 0;
307 mode.driverdata = NULL; 233 mode.driverdata = NULL;
308 234
309 SDL_DFB_CALLOC(dispdata, 1, sizeof(*dispdata)); 235 SDL_DFB_ALLOC_CLEAR(dispdata, sizeof(*dispdata));
310 236
311 dispdata->layer = layer; 237 dispdata->layer = layer;
312 dispdata->pixelformat = dlc.pixelformat; 238 dispdata->pixelformat = dlc.pixelformat;
313 dispdata->cw = tcw[i]; 239 dispdata->cw = tcw[i];
314 dispdata->ch = tch[i]; 240 dispdata->ch = tch[i];
397 323
398 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config)); 324 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config));
399 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT; 325 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
400 if (mode->format != SDL_PIXELFORMAT_UNKNOWN) { 326 if (mode->format != SDL_PIXELFORMAT_UNKNOWN) {
401 config.flags |= DLCONF_PIXELFORMAT; 327 config.flags |= DLCONF_PIXELFORMAT;
402 config.pixelformat = SDLToDFBPixelFormat(mode->format); 328 config.pixelformat = DirectFB_SDLToDFBPixelFormat(mode->format);
403 data->pixelformat = config.pixelformat; 329 data->pixelformat = config.pixelformat;
404 } 330 }
405 config.width = mode->w; 331 config.width = mode->w;
406 config.height = mode->h; 332 config.height = mode->h;
407 333
418 SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h, 344 SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h,
419 mode->format); 345 mode->format);
420 return -1; 346 return -1;
421 } 347 }
422 348
423 SDL_DFB_DEBUG("Trace\n");
424 config.flags &= ~fail; 349 config.flags &= ~fail;
425 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); 350 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
426 #if (DFB_VERSION_ATLEAST(1,2,0)) 351 #if (DFB_VERSION_ATLEAST(1,2,0))
427 /* Need to call this twice ! */ 352 /* Need to call this twice ! */
428 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); 353 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
452 } 377 }
453 378
454 void 379 void
455 DirectFB_QuitModes(_THIS) 380 DirectFB_QuitModes(_THIS)
456 { 381 {
457 //DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata;
458 SDL_DisplayMode tmode; 382 SDL_DisplayMode tmode;
459 int i; 383 int i;
460 384
461 for (i = 0; i < _this->num_displays; ++i) { 385 for (i = 0; i < _this->num_displays; ++i) {
462 SDL_VideoDisplay *display = &_this->displays[i]; 386 SDL_VideoDisplay *display = &_this->displays[i];