21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_DIRECTFB 28 #define DFB_MAX_MODES 200 30 struct screen_callback_t
39 struct modes_callback_t
45 static DFBEnumerationResult
48 struct modes_callback_t *modedata = (
struct modes_callback_t *) data;
57 if (modedata->nummodes < DFB_MAX_MODES) {
58 modedata->modelist[modedata->nummodes++] =
mode;
64 static DFBEnumerationResult
65 EnumScreensCallback(DFBScreenID screen_id, DFBScreenDescription desc,
68 struct screen_callback_t *devdata = (
struct screen_callback_t *) callbackdata;
70 devdata->screenid[devdata->numscreens++] = screen_id;
74 static DFBEnumerationResult
75 EnumLayersCallback(DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc,
78 struct screen_callback_t *devdata = (
struct screen_callback_t *) callbackdata;
80 if (desc.caps & DLCAPS_SURFACE) {
81 if ((desc.type & DLTF_GRAPHICS) && (desc.type & DLTF_VIDEO)) {
82 if (devdata->vidlayer[devdata->aux] == -1)
83 devdata->vidlayer[devdata->aux] = layer_id;
84 }
else if (desc.type & DLTF_GRAPHICS) {
85 if (devdata->gralayer[devdata->aux] == -1)
86 devdata->gralayer[devdata->aux] = layer_id;
96 DFBDisplayLayerConfig
config;
97 DFBDisplayLayerConfigFlags failed;
100 DLSCL_ADMINISTRATIVE));
101 config.width = mode->
w;
102 config.height = mode->
h;
104 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT;
105 if (devdata->use_yuv_underlays) {
106 config.flags |= DLCONF_OPTIONS;
107 config.options = DLOP_ALPHACHANNEL;
110 data->layer->TestConfiguration(data->layer, &config, &failed);
119 SDL_DFB_ERR(
"Mode %d x %d not available: %x\n", mode->
w,
131 #if (DFB_VERSION_ATLEAST(1,0,0)) 138 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->
driverdata;
141 if (dispdata->vidIDinuse)
142 SDL_DFB_CHECK(dispdata->vidlayer->SwitchContext(dispdata->vidlayer,
153 DFB_DisplayData *dispdata =
NULL;
155 DFBGraphicsDeviceDescription caps;
156 DFBDisplayLayerConfig dlc;
157 struct screen_callback_t *screencbdata;
166 screencbdata->numscreens = 0;
169 screencbdata->gralayer[
i] = -1;
170 screencbdata->vidlayer[
i] = -1;
173 SDL_DFB_CHECKERR(devdata->dfb->EnumScreens(devdata->dfb, &EnumScreensCallback,
176 for (i = 0; i < screencbdata->numscreens; i++) {
180 screencbdata->screenid
183 screencbdata->aux =
i;
186 screen->GetSize(screen, &tcw[i], &tch[i]);
188 screen->Release(screen);
193 devdata->dfb->GetDeviceDescription(devdata->dfb, &caps);
195 for (i = 0; i < screencbdata->numscreens; i++) {
197 screencbdata->gralayer
201 DLSCL_ADMINISTRATIVE));
202 layer->EnableCursor(layer, 1);
205 if (devdata->use_yuv_underlays) {
206 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS;
207 dlc.pixelformat = DSPF_ARGB;
208 dlc.options = DLOP_ALPHACHANNEL;
210 ret = layer->SetConfiguration(layer, &dlc);
213 dlc.pixelformat = DSPF_AiRGB;
219 dlc.flags = DLCONF_ALL;
225 SDL_DFB_ERR(
"Unknown dfb pixelformat %x !\n", dlc.pixelformat);
236 dispdata->layer =
layer;
237 dispdata->pixelformat = dlc.pixelformat;
238 dispdata->cw = tcw[
i];
239 dispdata->ch = tch[
i];
243 dispdata->vidID = screencbdata->vidlayer[
i];
244 dispdata->vidIDinuse = 0;
252 #if (DFB_VERSION_ATLEAST(1,2,0)) 254 DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
256 ret = layer->SetConfiguration(layer, &dlc);
276 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->
driverdata;
278 struct modes_callback_t data;
285 EnumModesCallback, &data));
287 for (i = 0; i < data.nummodes; ++
i) {
288 mode = data.modelist[
i];
291 CheckSetDisplayMode(
_this, display, dispdata, &mode);
293 CheckSetDisplayMode(
_this, display, dispdata, &mode);
295 CheckSetDisplayMode(
_this, display, dispdata, &mode);
297 CheckSetDisplayMode(
_this, display, dispdata, &mode);
299 CheckSetDisplayMode(
_this, display, dispdata, &mode);
316 DFB_DisplayData *data = (DFB_DisplayData *) display->
driverdata;
317 DFBDisplayLayerConfig config, rconfig;
318 DFBDisplayLayerConfigFlags fail = 0;
321 DLSCL_ADMINISTRATIVE));
324 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
326 config.flags |= DLCONF_PIXELFORMAT;
328 data->pixelformat = config.pixelformat;
330 config.width = mode->
w;
331 config.height = mode->
h;
333 if (devdata->use_yuv_underlays) {
334 config.flags |= DLCONF_OPTIONS;
335 config.options = DLOP_ALPHACHANNEL;
338 data->layer->TestConfiguration(data->layer, &config, &fail);
341 (DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
343 SDL_DFB_ERR(
"Error setting mode %dx%d-%x\n", mode->
w, mode->
h,
348 config.flags &= ~fail;
350 #if (DFB_VERSION_ATLEAST(1,2,0)) 358 layer->SetCooperativeLevel(data->layer, DLSCL_SHARED));
360 if ((config.width != rconfig.width) || (config.height != rconfig.height)
362 && (config.pixelformat != rconfig.pixelformat))) {
363 SDL_DFB_ERR(
"Error setting mode %dx%d-%x\n", mode->
w, mode->
h,
368 data->pixelformat = rconfig.pixelformat;
369 data->cw = config.width;
370 data->ch = config.height;
386 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->
driverdata;
395 if (dispdata->layer) {
397 layer->SetCooperativeLevel(dispdata->layer,
398 DLSCL_ADMINISTRATIVE));
400 layer->SetCursorOpacity(dispdata->layer, 0x00));
402 layer->SetCooperativeLevel(dispdata->layer,
#define SDL_DFB_LOG(x...)
DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format)
#define SDL_GetDesktopDisplayMode
The structure that defines a display mode.
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
void DirectFB_SetContext(_THIS, SDL_Window *window)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLint GLint layer
Uint32 DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
GLint GLint GLsizei width
#define SDL_DFB_RELEASE(x)
static SDL_VideoDevice * _this
void DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
#define SDL_DFB_DEVICEDATA(dev)
void DirectFB_QuitModes(_THIS)
void DirectFB_InitModes(_THIS)
SDL_DisplayMode current_mode
SDL_VideoDisplay * displays
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
SDL_DisplayMode desktop_mode
#define SDL_DFB_ALLOC_CLEAR(r, s)
#define SDL_DFB_ERR(x...)
#define SDL_DFB_CHECKERR(x...)
GLint GLint GLsizei GLsizei height
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
EGLSurface EGLNativeWindowType * window
#define SDL_DFB_CHECK(x...)
The type used to identify a window.
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
int DirectFB_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
#define SDL_DFB_CALLOC(r, n, s)