From 88832200cbd48da7a4e0b989b8d448522ff214ee Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 1 Dec 2008 00:10:49 +0000 Subject: [PATCH] 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 --- README.DirectFB | 61 ++++++++++++++----------- src/video/directfb/SDL_DirectFB_modes.c | 19 ++++++-- 2 files changed, 49 insertions(+), 31 deletions(-) diff --git a/README.DirectFB b/README.DirectFB index bddd77bdb..a5d404ee3 100644 --- a/README.DirectFB +++ b/README.DirectFB @@ -5,45 +5,27 @@ Supports: - Hardware YUV overlays - OpenGL - software only - 2D/3D accelerations (depends on directfb driver) +- multiple displays +- windows What you need: -DirectFB 1.0.0 - required +DirectFB 1.0.1, 1.2.x, 1.3.0 Kernel-Framebuffer support: required: vesafb, radeonfb .... Mesa 7.0.x - optional for OpenGL -As of this writing 20070810 you need to pull Mesa from git and do the following: - ------------------------- -cd mesa -make linux-directfb -make - -echo Installing - pleaser enter sudo pw. - -sudo make install INSTALL_DIR=/usr/local/dfb_GL -cd src/mesa/drivers/directfb -make -sudo make install INSTALL_DIR=/usr/local/dfb_GL ------------------------- - /etc/directfbrc -This file should contain the following two lines to make -your joystick work: +This file should contain the following lines to make +your joystick work and avoid crashes: ------------------------ disable-module=joystick disable-module=linux_input +disable-module=cle266 +disable-module=cyber5k +disable-module=x11input ------------------------ -To run the SDL - testprograms: - -export SDL_VIDEODRIVER=directfb -export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib -export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7 - -./testgl - To use hardware accelerated YUV-overlays for YUV-textures, use: export SDL_DIRECTFB_YUV_DIRECT=1 @@ -52,10 +34,35 @@ This is disabled by default. It will only support one YUV texture, namely the first. Every other YUV texture will be rendered in software. -In addition, you may use +In addition, you may use (directfb-1.2.x) export SDL_DIRECTFB_YUV_UNDERLAY=1 to make the YUV texture an underlay. This will make the cursor to be shown. +OPENGL Support +============== + +As of this writing 20070810 you need to pull Mesa from git and do the following: + +------------------------ +cd mesa +make linux-directfb +make + +echo Installing - please enter sudo pw. + +sudo make install INSTALL_DIR=/usr/local/dfb_GL +cd src/mesa/drivers/directfb +make +sudo make install INSTALL_DIR=/usr/local/dfb_GL +------------------------ + +To run the SDL - testprograms: + +export SDL_VIDEODRIVER=directfb +export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib +export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7 + +./testgl diff --git a/src/video/directfb/SDL_DirectFB_modes.c b/src/video/directfb/SDL_DirectFB_modes.c index bc33f8145..4f8d4cc9a 100644 --- a/src/video/directfb/SDL_DirectFB_modes.c +++ b/src/video/directfb/SDL_DirectFB_modes.c @@ -290,7 +290,7 @@ DirectFB_InitModes(_THIS) SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__); SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor); - SDL_DFB_DEBUG("Found %d screens\n", devdata->numscreens); + SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens); for (i = 0; i < screencbdata->numscreens; i++) { SDL_DFB_CHECKERR(devdata->dfb-> @@ -315,9 +315,8 @@ DirectFB_InitModes(_THIS) } } - SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED)); - /* Query layer configuration to determine the current mode and pixelformat */ + dlc.flags = DLCONF_ALL; layer->GetConfiguration(layer, &dlc); if (DFBToSDLPixelFormat(dlc.pixelformat, &mode.format) != 0) { @@ -348,6 +347,13 @@ DirectFB_InitModes(_THIS) display.current_mode = mode; display.driverdata = dispdata; +#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) + dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_OPTIONS; + ret = layer->SetConfiguration(layer, &dlc); + #endif + + SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED)); + SDL_AddVideoDisplay(&display); } SDL_DFB_FREE(screencbdata); @@ -442,6 +448,11 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) SDL_DFB_DEBUG("Trace\n"); config.flags &= ~fail; SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); +#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) + /* Need to call this twice ! */ + SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); + //SDL_DFB_CHECKERR(data->layer->SetSourceRectangle(data->layer, 0, 0, config.width, config.height)); +#endif /* Double check */ SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); @@ -456,7 +467,7 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) mode->format); return -1; } - + data->pixelformat = rconfig.pixelformat; data->cw = config.width; data->ch = config.height;