Date: Mon, 01 Dec 2008 00:57:15 +0100
authorSam Lantinga <slouken@libsdl.org>
Mon, 01 Dec 2008 00:10:49 +0000
changeset 2815e759ad5e6f43
parent 2814 e841aa93e6be
child 2816 22e393158355
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
src/video/directfb/SDL_DirectFB_modes.c
     1.1 --- a/README.DirectFB	Mon Dec 01 00:07:45 2008 +0000
     1.2 +++ b/README.DirectFB	Mon Dec 01 00:10:49 2008 +0000
     1.3 @@ -5,13 +5,45 @@
     1.4  - Hardware YUV overlays
     1.5  - OpenGL - software only
     1.6  - 2D/3D accelerations (depends on directfb driver)
     1.7 +- multiple displays
     1.8 +- windows
     1.9  
    1.10  What you need:
    1.11  
    1.12 -DirectFB 1.0.0 - required
    1.13 +DirectFB 1.0.1, 1.2.x, 1.3.0
    1.14  Kernel-Framebuffer support: required: vesafb, radeonfb .... 
    1.15  Mesa 7.0.x	   - optional for OpenGL
    1.16  
    1.17 +/etc/directfbrc
    1.18 +
    1.19 +This file should contain the following lines to make
    1.20 +your joystick work and avoid crashes:
    1.21 +------------------------
    1.22 +disable-module=joystick
    1.23 +disable-module=linux_input
    1.24 +disable-module=cle266
    1.25 +disable-module=cyber5k
    1.26 +disable-module=x11input
    1.27 +------------------------
    1.28 +
    1.29 +To use hardware accelerated YUV-overlays for YUV-textures, use:
    1.30 +
    1.31 +export SDL_DIRECTFB_YUV_DIRECT=1
    1.32 +
    1.33 +This is disabled by default. It will only support one 
    1.34 +YUV texture, namely the first. Every other YUV texture will be
    1.35 +rendered in software.
    1.36 +
    1.37 +In addition, you may use (directfb-1.2.x)
    1.38 +
    1.39 +export SDL_DIRECTFB_YUV_UNDERLAY=1
    1.40 +
    1.41 +to make the YUV texture an underlay. This will make the cursor to
    1.42 +be shown.
    1.43 +
    1.44 +OPENGL Support
    1.45 +==============
    1.46 +
    1.47  As of this writing 20070810 you need to pull Mesa from git and do the following:
    1.48  
    1.49  ------------------------
    1.50 @@ -19,7 +51,7 @@
    1.51  make linux-directfb
    1.52  make
    1.53  
    1.54 -echo Installing - pleaser enter sudo pw.
    1.55 +echo Installing - please enter sudo pw.
    1.56  
    1.57  sudo make install INSTALL_DIR=/usr/local/dfb_GL
    1.58  cd src/mesa/drivers/directfb
    1.59 @@ -27,15 +59,6 @@
    1.60  sudo make install INSTALL_DIR=/usr/local/dfb_GL
    1.61  ------------------------
    1.62  
    1.63 -/etc/directfbrc
    1.64 -
    1.65 -This file should contain the following two lines to make
    1.66 -your joystick work:
    1.67 -------------------------
    1.68 -disable-module=joystick
    1.69 -disable-module=linux_input
    1.70 -------------------------
    1.71 -
    1.72  To run the SDL - testprograms:
    1.73  
    1.74  export SDL_VIDEODRIVER=directfb
    1.75 @@ -43,19 +66,3 @@
    1.76  export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
    1.77  
    1.78  ./testgl
    1.79 -
    1.80 -To use hardware accelerated YUV-overlays for YUV-textures, use:
    1.81 -
    1.82 -export SDL_DIRECTFB_YUV_DIRECT=1
    1.83 -
    1.84 -This is disabled by default. It will only support one 
    1.85 -YUV texture, namely the first. Every other YUV texture will be
    1.86 -rendered in software.
    1.87 -
    1.88 -In addition, you may use 
    1.89 -
    1.90 -export SDL_DIRECTFB_YUV_UNDERLAY=1
    1.91 -
    1.92 -to make the YUV texture an underlay. This will make the cursor to
    1.93 -be shown.
    1.94 -
     2.1 --- a/src/video/directfb/SDL_DirectFB_modes.c	Mon Dec 01 00:07:45 2008 +0000
     2.2 +++ b/src/video/directfb/SDL_DirectFB_modes.c	Mon Dec 01 00:10:49 2008 +0000
     2.3 @@ -290,7 +290,7 @@
     2.4  
     2.5      SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__);
     2.6      SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor);
     2.7 -    SDL_DFB_DEBUG("Found %d screens\n", devdata->numscreens);
     2.8 +    SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens);
     2.9  
    2.10      for (i = 0; i < screencbdata->numscreens; i++) {
    2.11          SDL_DFB_CHECKERR(devdata->dfb->
    2.12 @@ -315,9 +315,8 @@
    2.13              }
    2.14          }
    2.15  
    2.16 -        SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED));
    2.17 -
    2.18          /* Query layer configuration to determine the current mode and pixelformat */
    2.19 +        dlc.flags = DLCONF_ALL;
    2.20          layer->GetConfiguration(layer, &dlc);
    2.21  
    2.22          if (DFBToSDLPixelFormat(dlc.pixelformat, &mode.format) != 0) {
    2.23 @@ -348,6 +347,13 @@
    2.24          display.current_mode = mode;
    2.25          display.driverdata = dispdata;
    2.26  
    2.27 +#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2)
    2.28 +       	dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_OPTIONS;
    2.29 +       	ret = layer->SetConfiguration(layer, &dlc);
    2.30 + #endif
    2.31 +
    2.32 +        SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED));
    2.33 +
    2.34          SDL_AddVideoDisplay(&display);
    2.35      }
    2.36      SDL_DFB_FREE(screencbdata);
    2.37 @@ -442,6 +448,11 @@
    2.38      SDL_DFB_DEBUG("Trace\n");
    2.39      config.flags &= ~fail;
    2.40      SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
    2.41 +#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2)
    2.42 +    /* Need to call this twice ! */
    2.43 +    SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
    2.44 +    //SDL_DFB_CHECKERR(data->layer->SetSourceRectangle(data->layer, 0, 0, config.width, config.height));
    2.45 +#endif
    2.46  
    2.47      /* Double check */
    2.48      SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig));
    2.49 @@ -456,7 +467,7 @@
    2.50                      mode->format);
    2.51          return -1;
    2.52      }
    2.53 -
    2.54 +    
    2.55      data->pixelformat = rconfig.pixelformat;
    2.56      data->cw = config.width;
    2.57      data->ch = config.height;