README.DirectFB
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 May 2013 00:43:22 -0700
changeset 7180 3733e68edbc3
parent 6987 7084af936d82
permissions -rw-r--r--
Fixed bug 1846 - _allmul implementation in SDL_stdlib.c doesn't clean up the stack

Colin Barrett

I see this manifest itself (VS2012 x86) as:

"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

in the first call to SDL_GetTicks in my application. The disassembly at the problem line is:

hires_now.QuadPart *= 1000;
00AD0792 push 0
00AD0794 push 3E8h
00AD0799 mov eax,dword ptr [ebp-10h]
00AD079C push eax
00AD079D mov ecx,dword ptr [hires_now]
00AD07A0 push ecx
00AD07A1 call _allmul (0AE7D40h)
00AD07A6 mov dword ptr [hires_now],eax
00AD07A9 mov dword ptr [ebp-10h],edx

Apparently _allmul should be popping the stack but isn't (other similar functions in SDL_stdlib.c - _alldiv and whatnot - DO pop the stack).

A 'ret 10h' at the end of _allmul appears to do the trick
     1 SDL on DirectFB
     2 
     3 Supports:
     4 
     5 - Hardware YUV overlays
     6 - OpenGL - software only
     7 - 2D/3D accelerations (depends on directfb driver)
     8 - multiple displays
     9 - windows
    10 
    11 What you need:
    12 
    13 DirectFB 1.0.1, 1.2.x, 1.3.0
    14 Kernel-Framebuffer support: required: vesafb, radeonfb .... 
    15 Mesa 7.0.x	   - optional for OpenGL
    16 
    17 /etc/directfbrc
    18 
    19 This file should contain the following lines to make
    20 your joystick work and avoid crashes:
    21 ------------------------
    22 disable-module=joystick
    23 disable-module=cle266
    24 disable-module=cyber5k
    25 no-linux-input-grab
    26 ------------------------
    27 
    28 To disable to use x11 backend when DISPLAY variable is found use
    29 
    30 export SDL_DIRECTFB_X11_CHECK=0
    31 
    32 To disable the use of linux input devices, i.e. multimice/multikeyboard support,
    33 use
    34 
    35 export SDL_DIRECTFB_LINUX_INPUT=0
    36 
    37 To use hardware accelerated YUV-overlays for YUV-textures, use:
    38 
    39 export SDL_DIRECTFB_YUV_DIRECT=1
    40 
    41 This is disabled by default. It will only support one 
    42 YUV texture, namely the first. Every other YUV texture will be
    43 rendered in software.
    44 
    45 In addition, you may use (directfb-1.2.x)
    46 
    47 export SDL_DIRECTFB_YUV_UNDERLAY=1
    48 
    49 to make the YUV texture an underlay. This will make the cursor to
    50 be shown.
    51 
    52 Simple Window Manager
    53 =====================
    54 
    55 The driver has support for a very, very basic window manager you may
    56 want to use when running with "wm=default". Use
    57 
    58 export SDL_DIRECTFB_WM=1
    59 
    60 to enable basic window borders. In order to have the window title rendered,
    61 you need to have the following font installed:
    62 
    63 /usr/share/fonts/truetype/freefont/FreeSans.ttf
    64 
    65 OpenGL Support
    66 ==============
    67 
    68 The following instructions will give you *software* OpenGL. However this
    69 works at least on all directfb supported platforms.
    70 
    71 As of this writing 20100802 you need to pull Mesa from git and do the following:
    72 
    73 ------------------------
    74 git clone git://anongit.freedesktop.org/git/mesa/mesa
    75 cd mesa 
    76 git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
    77 ------------------------
    78 
    79 Edit configs/linux-directfb so that the Directories-section looks like
    80 ------------------------
    81 # Directories
    82 SRC_DIRS     = mesa glu 
    83 GLU_DIRS     = sgi
    84 DRIVER_DIRS  = directfb
    85 PROGRAM_DIRS = 
    86 ------------------------
    87 
    88 make linux-directfb
    89 make
    90 
    91 echo Installing - please enter sudo pw.
    92 
    93 sudo make install INSTALL_DIR=/usr/local/dfb_GL
    94 cd src/mesa/drivers/directfb
    95 make
    96 sudo make install INSTALL_DIR=/usr/local/dfb_GL
    97 ------------------------
    98 
    99 To run the SDL - testprograms:
   100 
   101 export SDL_VIDEODRIVER=directfb
   102 export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
   103 export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
   104 
   105 ./testgl
   106