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;
53 mode.refresh_rate = 0;
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));
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;
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;
193 devdata->dfb->GetDeviceDescription(devdata->dfb, &caps);
195 for (
i = 0;
i < screencbdata->numscreens;
i++) {
197 screencbdata->gralayer
201 DLSCL_ADMINISTRATIVE));
205 if (devdata->use_yuv_underlays) {
206 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS;
207 dlc.pixelformat = DSPF_ARGB;
208 dlc.options = DLOP_ALPHACHANNEL;
213 dlc.pixelformat = DSPF_AiRGB;
219 dlc.flags = DLCONF_ALL;
225 SDL_DFB_ERR(
"Unknown dfb pixelformat %x !\n", dlc.pixelformat);
231 mode.refresh_rate = 0;
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 |
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) {
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);
317 DFBDisplayLayerConfig
config, rconfig;
318 DFBDisplayLayerConfigFlags fail = 0;
321 DLSCL_ADMINISTRATIVE));
324 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
326 config.flags |= DLCONF_PIXELFORMAT;
333 if (devdata->use_yuv_underlays) {
334 config.flags |= DLCONF_OPTIONS;
335 config.options = DLOP_ALPHACHANNEL;
341 (DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT |
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))) {
368 data->pixelformat = rconfig.pixelformat;
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,
void DirectFB_SetContext(_THIS, SDL_Window *window)
void DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
void DirectFB_InitModes(_THIS)
int DirectFB_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
void DirectFB_QuitModes(_THIS)
#define SDL_DFB_ERR(x...)
#define SDL_DFB_CHECKERR(x...)
#define SDL_DFB_ALLOC_CLEAR(r, s)
#define SDL_DFB_CHECK(x...)
#define SDL_DFB_LOG(x...)
#define SDL_DFB_DEVICEDATA(dev)
#define SDL_DFB_CALLOC(r, n, s)
#define SDL_DFB_RELEASE(x)
DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format)
Uint32 DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat)
#define SDL_GetDesktopDisplayMode
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei width
GLint GLint GLsizei GLsizei height
GLenum GLuint GLint GLint layer
@ SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_UNKNOWN
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send_event)
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window)
static SDL_VideoDevice * _this
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)
EGLSurface EGLNativeWindowType * window
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 skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
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
The structure that defines a display mode.
SDL_VideoDisplay * displays
SDL_DisplayMode desktop_mode
SDL_DisplayMode current_mode
The type used to identify a window.