Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_modes.c @ 2815:e759ad5e6f43
Date: Mon, 01 Dec 2008 00:57:15 +0100
From: Couriersud
Subject: SDL : Diff for directfb driver
please find attached a diff against SVN containing the following:
- Updated README.DirectFB a bit
- Fix compile issue with debug output
- Fix display mode setting/switching for directfb >= 1.2.2
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 01 Dec 2008 00:10:49 +0000 |
parents | 140a7edcf2bd |
children | 483f85e35a1a |
comparison
equal
deleted
inserted
replaced
2814:e841aa93e6be | 2815:e759ad5e6f43 |
---|---|
288 | 288 |
289 devdata->dfb->GetDeviceDescription(devdata->dfb, &caps); | 289 devdata->dfb->GetDeviceDescription(devdata->dfb, &caps); |
290 | 290 |
291 SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__); | 291 SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__); |
292 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor); | 292 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor); |
293 SDL_DFB_DEBUG("Found %d screens\n", devdata->numscreens); | 293 SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens); |
294 | 294 |
295 for (i = 0; i < screencbdata->numscreens; i++) { | 295 for (i = 0; i < screencbdata->numscreens; i++) { |
296 SDL_DFB_CHECKERR(devdata->dfb-> | 296 SDL_DFB_CHECKERR(devdata->dfb-> |
297 GetDisplayLayer(devdata->dfb, | 297 GetDisplayLayer(devdata->dfb, |
298 screencbdata->gralayer[i], &layer)); | 298 screencbdata->gralayer[i], &layer)); |
313 dlc.pixelformat = DSPF_AiRGB; | 313 dlc.pixelformat = DSPF_AiRGB; |
314 ret = layer->SetConfiguration(layer, &dlc); | 314 ret = layer->SetConfiguration(layer, &dlc); |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED)); | |
319 | |
320 /* Query layer configuration to determine the current mode and pixelformat */ | 318 /* Query layer configuration to determine the current mode and pixelformat */ |
319 dlc.flags = DLCONF_ALL; | |
321 layer->GetConfiguration(layer, &dlc); | 320 layer->GetConfiguration(layer, &dlc); |
322 | 321 |
323 if (DFBToSDLPixelFormat(dlc.pixelformat, &mode.format) != 0) { | 322 if (DFBToSDLPixelFormat(dlc.pixelformat, &mode.format) != 0) { |
324 SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat); | 323 SDL_DFB_ERR("Unknown dfb pixelformat %x !\n", dlc.pixelformat); |
325 goto error; | 324 goto error; |
345 SDL_zero(display); | 344 SDL_zero(display); |
346 | 345 |
347 display.desktop_mode = mode; | 346 display.desktop_mode = mode; |
348 display.current_mode = mode; | 347 display.current_mode = mode; |
349 display.driverdata = dispdata; | 348 display.driverdata = dispdata; |
349 | |
350 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) | |
351 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_OPTIONS; | |
352 ret = layer->SetConfiguration(layer, &dlc); | |
353 #endif | |
354 | |
355 SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED)); | |
350 | 356 |
351 SDL_AddVideoDisplay(&display); | 357 SDL_AddVideoDisplay(&display); |
352 } | 358 } |
353 SDL_DFB_FREE(screencbdata); | 359 SDL_DFB_FREE(screencbdata); |
354 return; | 360 return; |
440 } | 446 } |
441 | 447 |
442 SDL_DFB_DEBUG("Trace\n"); | 448 SDL_DFB_DEBUG("Trace\n"); |
443 config.flags &= ~fail; | 449 config.flags &= ~fail; |
444 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); | 450 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); |
451 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) | |
452 /* Need to call this twice ! */ | |
453 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); | |
454 //SDL_DFB_CHECKERR(data->layer->SetSourceRectangle(data->layer, 0, 0, config.width, config.height)); | |
455 #endif | |
445 | 456 |
446 /* Double check */ | 457 /* Double check */ |
447 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); | 458 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); |
448 SDL_DFB_CHECKERR(data->layer-> | 459 SDL_DFB_CHECKERR(data->layer-> |
449 SetCooperativeLevel(data->layer, DLSCL_SHARED)); | 460 SetCooperativeLevel(data->layer, DLSCL_SHARED)); |
454 && (config.pixelformat != rconfig.pixelformat))) { | 465 && (config.pixelformat != rconfig.pixelformat))) { |
455 SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h, | 466 SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h, |
456 mode->format); | 467 mode->format); |
457 return -1; | 468 return -1; |
458 } | 469 } |
459 | 470 |
460 data->pixelformat = rconfig.pixelformat; | 471 data->pixelformat = rconfig.pixelformat; |
461 data->cw = config.width; | 472 data->cw = config.width; |
462 data->ch = config.height; | 473 data->ch = config.height; |
463 SDL_CurrentDisplay.current_mode = *mode; | 474 SDL_CurrentDisplay.current_mode = *mode; |
464 | 475 |