21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_DIRECTFB 46 #include <directfb_version.h> 47 #include <directfb_strings.h> 51 #include "../SDL_sysvideo.h" 52 #include "../SDL_pixels_c.h" 53 #include "../../events/SDL_events_c.h" 64 static int DirectFB_VideoInit(
_THIS);
65 static void DirectFB_VideoQuit(
_THIS);
67 static int DirectFB_Available(
void);
71 "directfb",
"DirectFB",
72 DirectFB_Available, DirectFB_CreateDevice
75 static const DirectFBSurfaceDrawingFlagsNames(drawing_flags);
76 static const DirectFBSurfaceBlittingFlagsNames(blitting_flags);
77 static const DirectFBAccelerationMaskNames(acceleration_mask);
82 DirectFB_Available(
void)
99 DirectFB_CreateDevice(
int devindex)
137 #if SDL_DIRECTFB_OPENGL 155 device->
free = DirectFB_DeleteDevice;
165 DirectFB_DeviceInformation(IDirectFB * dfb)
167 DFBGraphicsDeviceDescription desc;
170 dfb->GetDeviceDescription(dfb, &desc);
177 SDL_DFB_LOG(
"Driver Vendor: %s", desc.driver.vendor);
178 SDL_DFB_LOG(
"Driver Version: %d.%d", desc.driver.major,
181 SDL_DFB_LOG(
"Video memoory: %d", desc.video_memory);
184 for (n = 0; blitting_flags[
n].flag; n++) {
185 if (desc.blitting_flags & blitting_flags[n].flag)
190 for (n = 0; drawing_flags[
n].flag; n++) {
191 if (desc.drawing_flags & drawing_flags[n].flag)
197 for (n = 0; acceleration_mask[
n].mask; n++) {
198 if (desc.acceleration_mask & acceleration_mask[n].mask)
205 static int readBoolEnv(
const char *env_name,
int def_val)
217 DirectFB_VideoInit(
_THIS)
219 IDirectFB *dfb =
NULL;
220 DFB_DeviceData *devdata =
NULL;
232 DirectFBSetOption(
"system",
"x11");
234 DirectFBSetOption(
"disable-module",
"x11input");
240 if (!devdata->use_linux_input)
243 DirectFBSetOption(
"disable-module",
"linux_input");
248 DirectFB_DeviceInformation(dfb);
254 if (devdata->use_linux_input) {
268 devdata->initialized = 1;
271 devdata->firstwin =
NULL;
272 devdata->grabbed_window =
NULL;
278 #if SDL_DIRECTFB_OPENGL 279 DirectFB_GL_Initialize(
_this);
295 DirectFB_VideoQuit(
_THIS)
303 devdata->events->Reset(devdata->events);
307 #if SDL_DIRECTFB_OPENGL 308 DirectFB_GL_Shutdown(
_this);
311 devdata->initialized = 0;
316 static const struct {
317 DFBSurfacePixelFormat dfb;
319 } pixelformat_tab[] =
338 #if (DFB_VERSION_ATLEAST(1,2,0)) 341 { DSPF_UNKNOWN, SDL_PIXELFORMAT_BGR555 },
347 { DSPF_A8, SDL_PIXELFORMAT_UNKNOWN },
348 { DSPF_AiRGB, SDL_PIXELFORMAT_UNKNOWN },
349 { DSPF_A1, SDL_PIXELFORMAT_UNKNOWN },
350 { DSPF_NV12, SDL_PIXELFORMAT_UNKNOWN },
351 { DSPF_NV16, SDL_PIXELFORMAT_UNKNOWN },
352 { DSPF_ARGB2554, SDL_PIXELFORMAT_UNKNOWN },
353 { DSPF_NV21, SDL_PIXELFORMAT_UNKNOWN },
354 { DSPF_AYUV, SDL_PIXELFORMAT_UNKNOWN },
355 { DSPF_A4, SDL_PIXELFORMAT_UNKNOWN },
356 { DSPF_ARGB1666, SDL_PIXELFORMAT_UNKNOWN },
357 { DSPF_ARGB6666, SDL_PIXELFORMAT_UNKNOWN },
358 { DSPF_RGB18, SDL_PIXELFORMAT_UNKNOWN },
359 { DSPF_LUT2, SDL_PIXELFORMAT_UNKNOWN },
361 #if (DFB_VERSION_ATLEAST(1,3,0)) 362 { DSPF_RGBA4444, SDL_PIXELFORMAT_UNKNOWN },
365 #if (DFB_VERSION_ATLEAST(1,4,3)) 366 { DSPF_RGBA5551, SDL_PIXELFORMAT_UNKNOWN },
367 { DSPF_YUV444P, SDL_PIXELFORMAT_UNKNOWN },
368 { DSPF_ARGB8565, SDL_PIXELFORMAT_UNKNOWN },
369 { DSPF_AVYU, SDL_PIXELFORMAT_UNKNOWN },
370 { DSPF_VYU, SDL_PIXELFORMAT_UNKNOWN },
394 for (i=0; pixelformat_tab[
i].dfb != DSPF_UNKNOWN; i++)
395 if (pixelformat_tab[i].dfb == pixelformat)
397 return pixelformat_tab[
i].sdl;
402 DFBSurfacePixelFormat
407 for (i=0; pixelformat_tab[
i].dfb != DSPF_UNKNOWN; i++)
408 if (pixelformat_tab[i].sdl == format)
410 return pixelformat_tab[
i].dfb;
419 for (i=0, j=0; pixelformat_tab[
i].dfb != DSPF_UNKNOWN; i++)
void DirectFB_ShowWindow(_THIS, SDL_Window *window)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
int DirectFB_CreateWindow(_THIS, SDL_Window *window)
SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
SDL_WindowShaper * DirectFB_CreateShaper(SDL_Window *window)
#define SDL_DFB_LOG(x...)
void(* RestoreWindow)(_THIS, SDL_Window *window)
void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo *ri)
int(* CreateWindowFrom)(_THIS, SDL_Window *window, const void *data)
void SDL_DirectFB_UnLoadLibrary(void)
DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format)
int(* GL_SetSwapInterval)(_THIS, int interval)
void(* ShowWindow)(_THIS, SDL_Window *window)
Uint32 texture_formats[16]
void DirectFB_RaiseWindow(_THIS, SDL_Window *window)
void(* SetWindowSize)(_THIS, SDL_Window *window)
void DirectFB_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
GLuint const GLchar * name
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
Uint32 DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat)
uint32_t Uint32
An unsigned 32-bit integer type.
int(* GL_LoadLibrary)(_THIS, const char *path)
int DirectFB_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
#define SDL_DFB_RELEASE(x)
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
void DirectFB_QuitMouse(_THIS)
static SDL_VideoDevice * _this
void DirectFB_InitMouse(_THIS)
void(* HideWindow)(_THIS, SDL_Window *window)
#define DFBENV_USE_LINUX_INPUT
void(* RaiseWindow)(_THIS, SDL_Window *window)
int(* SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode)
void DirectFB_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
#define DFBENV_USE_YUV_UNDERLAY
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
void DirectFB_QuitKeyboard(_THIS)
void DirectFB_QuitModes(_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 int in j)
void DirectFB_InitModes(_THIS)
void DirectFB_InitKeyboard(_THIS)
void(* DestroyWindow)(_THIS, SDL_Window *window)
void(* SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon)
int DirectFB_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shapeMode)
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)
void DirectFB_PumpEventsWindow(_THIS)
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
#define DFBENV_USE_YUV_DIRECT
#define SDL_DFB_ALLOC_CLEAR(r, s)
#define SDL_DFB_CHECKERR(x...)
Information on the capabilities of a render driver or context.
SDL_WindowShaper *(* CreateShaper)(SDL_Window *window)
int DirectFB_ResizeWindowShape(SDL_Window *window)
int(* ResizeWindowShape)(SDL_Window *window)
int(* SetWindowOpacity)(_THIS, SDL_Window *window, float opacity)
#define DFBENV_USE_X11_CHECK
void(* SetWindowPosition)(_THIS, SDL_Window *window)
int(* CreateWindow)(_THIS, SDL_Window *window)
void DirectFB_SetWindowTitle(_THIS, SDL_Window *window)
void(* MinimizeWindow)(_THIS, SDL_Window *window)
void DirectFB_MaximizeWindow(_THIS, SDL_Window *window)
Uint32 num_texture_formats
SDL_ShapeDriver shape_driver
void DirectFB_SetWindowSize(_THIS, SDL_Window *window)
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
void(* SetWindowTitle)(_THIS, SDL_Window *window)
int(* GL_GetSwapInterval)(_THIS)
void(* MaximizeWindow)(_THIS, SDL_Window *window)
void DirectFB_MinimizeWindow(_THIS, SDL_Window *window)
void DirectFB_DestroyWindow(_THIS, SDL_Window *window)
int DirectFB_SetWindowOpacity(_THIS, SDL_Window *window, float opacity)
void DirectFB_SetWindowPosition(_THIS, SDL_Window *window)
void(* SetWindowGrab)(_THIS, SDL_Window *window, SDL_bool grabbed)
void *(* GL_GetProcAddress)(_THIS, const char *proc)
int DirectFB_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
void DirectFB_HideWindow(_THIS, SDL_Window *window)
void DirectFB_RestoreWindow(_THIS, SDL_Window *window)
void DirectFB_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
int SDL_DirectFB_LoadLibrary(void)
void(* PumpEvents)(_THIS)