Freescale i.MX6 video driver
authormastermind <denis.barkar@gmail.com>
Wed, 10 Sep 2014 08:54:01 -0700
changeset 9127a8c38ed1a674
parent 9126 08f3b56969b1
child 9128 3476d867bf43
Freescale i.MX6 video driver
---
CMakeLists.txt | 2 +
cmake/sdlchecks.cmake | 20 +++
configure | 51 +++++++
configure.in | 28 ++++
include/SDL_config.h.cmake | 1 +
include/SDL_config.h.in | 1 +
src/video/SDL_sysvideo.h | 3 +
src/video/SDL_video.c | 3 +
src/video/mx6/SDL_mx6events.c | 45 ++++++
src/video/mx6/SDL_mx6events_c.h | 31 +++++
src/video/mx6/SDL_mx6opengles.c | 211 ++++++++++++++++++++++++++++
src/video/mx6/SDL_mx6opengles.h | 68 +++++++++
src/video/mx6/SDL_mx6video.c | 301 ++++++++++++++++++++++++++++++++++++++++
src/video/mx6/SDL_mx6video.h | 78 +++++++++++
14 files changed, 843 insertions(+)
create mode 100644 src/video/mx6/SDL_mx6events.c
create mode 100644 src/video/mx6/SDL_mx6events_c.h
create mode 100644 src/video/mx6/SDL_mx6opengles.c
create mode 100644 src/video/mx6/SDL_mx6opengles.h
create mode 100644 src/video/mx6/SDL_mx6video.c
create mode 100644 src/video/mx6/SDL_mx6video.h
CMakeLists.txt
cmake/sdlchecks.cmake
configure
configure.in
include/SDL_config.h.cmake
include/SDL_config.h.in
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/mx6/SDL_mx6events.c
src/video/mx6/SDL_mx6events_c.h
src/video/mx6/SDL_mx6opengles.c
src/video/mx6/SDL_mx6opengles.h
src/video/mx6/SDL_mx6video.c
src/video/mx6/SDL_mx6video.h
     1.1 --- a/CMakeLists.txt	Mon Sep 08 01:36:22 2014 -0400
     1.2 +++ b/CMakeLists.txt	Wed Sep 10 08:54:01 2014 -0700
     1.3 @@ -247,6 +247,7 @@
     1.4  set_option(VIDEO_COCOA         "Use Cocoa video driver" ${APPLE})
     1.5  set_option(DIRECTX             "Use DirectX for Windows audio/video" ${WINDOWS})
     1.6  set_option(RENDER_D3D          "Enable the Direct3D render driver" ${WINDOWS})
     1.7 +set_option(VIDEO_MX6           "Use Freescale i.MX6 video driver" OFF)
     1.8  
     1.9  # TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here
    1.10  # The options below are for compatibility to configure's default behaviour.
    1.11 @@ -678,6 +679,7 @@
    1.12      CheckOpenGLX11()
    1.13      CheckOpenGLESX11()
    1.14      CheckWayland()
    1.15 +    CheckMX6()
    1.16    endif()
    1.17  
    1.18    if(LINUX)
     2.1 --- a/cmake/sdlchecks.cmake	Mon Sep 08 01:36:22 2014 -0400
     2.2 +++ b/cmake/sdlchecks.cmake	Wed Sep 10 08:54:01 2014 -0700
     2.3 @@ -601,6 +601,25 @@
     2.4  endmacro(CheckDirectFB)
     2.5  
     2.6  # Requires:
     2.7 +# - n/a
     2.8 +macro(CheckMX6)
     2.9 +  if(VIDEO_MX6)
    2.10 +    check_c_source_compiles("
    2.11 +        #define EGL_API_FB
    2.12 +        #include <EGL/eglvivante.h>
    2.13 +        int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL_VIVANTE)
    2.14 +    if(HAVE_VIDEO_OPENGL_EGL_VIVANTE)
    2.15 +      set(HAVE_VIDEO_MX6 TRUE)
    2.16 +      set(HAVE_SDL_VIDEO TRUE)
    2.17 +
    2.18 +      file(GLOB MX6_SOURCES ${SDL2_SOURCE_DIR}/src/video/mx6/*.c)
    2.19 +      set(SOURCE_FILES ${SOURCE_FILES} ${MX6_SOURCES})
    2.20 +      set(SDL_VIDEO_DRIVER_MX6 1)
    2.21 +    endif(HAVE_VIDEO_OPENGL_EGL_VIVANTE)
    2.22 +  endif(VIDEO_MX6)
    2.23 +endmacro(CheckMX6)
    2.24 +
    2.25 +# Requires:
    2.26  # - nada
    2.27  macro(CheckOpenGLX11)
    2.28    if(VIDEO_OPENGL)
    2.29 @@ -624,6 +643,7 @@
    2.30  macro(CheckOpenGLESX11)
    2.31    if(VIDEO_OPENGLES)
    2.32      check_c_source_compiles("
    2.33 +        #define EGL_API_FB
    2.34          #include <EGL/egl.h>
    2.35          int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL)
    2.36      if(HAVE_VIDEO_OPENGL_EGL)
     3.1 --- a/configure	Mon Sep 08 01:36:22 2014 -0400
     3.2 +++ b/configure	Wed Sep 10 08:54:01 2014 -0700
     3.3 @@ -832,6 +832,7 @@
     3.4  enable_video_x11_scrnsaver
     3.5  enable_video_x11_xshape
     3.6  enable_video_x11_vm
     3.7 +enable_video_mx6
     3.8  enable_video_cocoa
     3.9  enable_video_directfb
    3.10  enable_directfb_shared
    3.11 @@ -1561,6 +1562,7 @@
    3.12    --enable-video-x11-xshape
    3.13                            enable X11 XShape support [[default=yes]]
    3.14    --enable-video-x11-vm   use X11 VM extension for fullscreen [[default=yes]]
    3.15 +  --enable-video-mx6      use Freescale i.MX6 video driver [[default=no]]
    3.16    --enable-video-cocoa    use Cocoa video driver [[default=yes]]
    3.17    --enable-video-directfb use DirectFB video driver [[default=no]]
    3.18    --enable-directfb-shared
    3.19 @@ -20591,6 +20593,53 @@
    3.20      fi
    3.21  }
    3.22  
    3.23 +CheckMX6Video()
    3.24 +{
    3.25 +    # Check whether --enable-video-mx6 was given.
    3.26 +if test "${enable_video_mx6+set}" = set; then :
    3.27 +  enableval=$enable_video_mx6;
    3.28 +else
    3.29 +  enable_video_mx6=no
    3.30 +fi
    3.31 +
    3.32 +    if test x$enable_video = xyes -a x$enable_video_mx6 = xyes; then
    3.33 +        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Vivante GPU SDK" >&5
    3.34 +$as_echo_n "checking for Vivante GPU SDK... " >&6; }
    3.35 +        have_viv_sdk=no
    3.36 +        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    3.37 +/* end confdefs.h.  */
    3.38 +
    3.39 +          #define EGL_API_FB
    3.40 +          #include <EGL/eglvivante.h>
    3.41 +
    3.42 +int
    3.43 +main ()
    3.44 +{
    3.45 +
    3.46 +
    3.47 +  ;
    3.48 +  return 0;
    3.49 +}
    3.50 +_ACEOF
    3.51 +if ac_fn_c_try_compile "$LINENO"; then :
    3.52 +
    3.53 +        have_viv_sdk=yes
    3.54 +
    3.55 +fi
    3.56 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    3.57 +        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_viv_sdk" >&5
    3.58 +$as_echo "$have_viv_sdk" >&6; }
    3.59 +        if test x$have_viv_sdk = xyes; then
    3.60 +
    3.61 +$as_echo "#define SDL_VIDEO_DRIVER_MX6 1" >>confdefs.h
    3.62 +
    3.63 +            SOURCES="$SOURCES $srcdir/src/video/mx6/*.c"
    3.64 +            SUMMARY_video="${SUMMARY_video} mx6"
    3.65 +            have_video=yes
    3.66 +        fi
    3.67 +    fi
    3.68 +}
    3.69 +
    3.70  CheckHaikuVideo()
    3.71  {
    3.72      if test x$enable_video = xyes; then
    3.73 @@ -21044,6 +21093,7 @@
    3.74          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    3.75  /* end confdefs.h.  */
    3.76  
    3.77 +         #define EGL_API_FB
    3.78           #include <EGL/egl.h>
    3.79           #include <EGL/eglext.h>
    3.80  
    3.81 @@ -22818,6 +22868,7 @@
    3.82          CheckClockGettime
    3.83          CheckLinuxVersion
    3.84          CheckRPATH
    3.85 +        CheckMX6Video
    3.86          # Set up files for the audio library
    3.87          if test x$enable_audio = xyes; then
    3.88            case $ARCH in
     4.1 --- a/configure.in	Mon Sep 08 01:36:22 2014 -0400
     4.2 +++ b/configure.in	Wed Sep 10 08:54:01 2014 -0700
     4.3 @@ -1729,6 +1729,32 @@
     4.4      fi
     4.5  }
     4.6  
     4.7 +dnl Set up the MX6 video driver if enabled
     4.8 +CheckMX6Video()
     4.9 +{
    4.10 +    AC_ARG_ENABLE(video-mx6,
    4.11 +AC_HELP_STRING([--enable-video-mx6], [use Freescale i.MX6 video driver [[default=no]]]),
    4.12 +                  , enable_video_mx6=no)
    4.13 +    if test x$enable_video = xyes -a x$enable_video_mx6 = xyes; then
    4.14 +        AC_MSG_CHECKING(for Vivante GPU SDK)
    4.15 +        have_viv_sdk=no
    4.16 +        AC_TRY_COMPILE([
    4.17 +          #define EGL_API_FB
    4.18 +          #include <EGL/eglvivante.h>
    4.19 +        ],[
    4.20 +        ],[
    4.21 +        have_viv_sdk=yes
    4.22 +        ])
    4.23 +        AC_MSG_RESULT($have_viv_sdk)
    4.24 +        if test x$have_viv_sdk = xyes; then
    4.25 +            AC_DEFINE(SDL_VIDEO_DRIVER_MX6, 1, [ ])
    4.26 +            SOURCES="$SOURCES $srcdir/src/video/mx6/*.c"
    4.27 +            SUMMARY_video="${SUMMARY_video} mx6"
    4.28 +            have_video=yes
    4.29 +        fi
    4.30 +    fi
    4.31 +}
    4.32 +
    4.33  dnl Set up the Haiku video driver if enabled
    4.34  CheckHaikuVideo()
    4.35  {
    4.36 @@ -1955,6 +1981,7 @@
    4.37          AC_MSG_CHECKING(for EGL support)
    4.38          video_opengl_egl=no
    4.39          AC_TRY_COMPILE([
    4.40 +         #define EGL_API_FB
    4.41           #include <EGL/egl.h>
    4.42           #include <EGL/eglext.h>
    4.43          ],[
    4.44 @@ -2809,6 +2836,7 @@
    4.45          CheckClockGettime
    4.46          CheckLinuxVersion
    4.47          CheckRPATH
    4.48 +        CheckMX6Video
    4.49          # Set up files for the audio library
    4.50          if test x$enable_audio = xyes; then
    4.51            case $ARCH in
     5.1 --- a/include/SDL_config.h.cmake	Mon Sep 08 01:36:22 2014 -0400
     5.2 +++ b/include/SDL_config.h.cmake	Wed Sep 10 08:54:01 2014 -0700
     5.3 @@ -264,6 +264,7 @@
     5.4  #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
     5.5  #cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
     5.6  #cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
     5.7 +#cmakedefine SDL_VIDEO_DRIVER_MX6 @SDL_VIDEO_DRIVER_MX6@
     5.8  
     5.9  #if 0
    5.10  /* !!! FIXME: in configure script version, missing here: */
     6.1 --- a/include/SDL_config.h.in	Mon Sep 08 01:36:22 2014 -0400
     6.2 +++ b/include/SDL_config.h.in	Wed Sep 10 08:54:01 2014 -0700
     6.3 @@ -308,6 +308,7 @@
     6.4  #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
     6.5  #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
     6.6  #undef SDL_VIDEO_DRIVER_NACL
     6.7 +#undef SDL_VIDEO_DRIVER_MX6
     6.8  
     6.9  #undef SDL_VIDEO_RENDER_D3D
    6.10  #undef SDL_VIDEO_RENDER_D3D11
     7.1 --- a/src/video/SDL_sysvideo.h	Mon Sep 08 01:36:22 2014 -0400
     7.2 +++ b/src/video/SDL_sysvideo.h	Wed Sep 10 08:54:01 2014 -0700
     7.3 @@ -391,6 +391,9 @@
     7.4  #if SDL_VIDEO_DRIVER_NACL
     7.5  extern VideoBootStrap NACL_bootstrap;
     7.6  #endif
     7.7 +#if SDL_VIDEO_DRIVER_MX6
     7.8 +extern VideoBootStrap MX6_bootstrap;
     7.9 +#endif
    7.10  
    7.11  extern SDL_VideoDevice *SDL_GetVideoDevice(void);
    7.12  extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
     8.1 --- a/src/video/SDL_video.c	Mon Sep 08 01:36:22 2014 -0400
     8.2 +++ b/src/video/SDL_video.c	Wed Sep 10 08:54:01 2014 -0700
     8.3 @@ -95,6 +95,9 @@
     8.4  #if SDL_VIDEO_DRIVER_NACL
     8.5      &NACL_bootstrap,
     8.6  #endif
     8.7 +#if SDL_VIDEO_DRIVER_MX6
     8.8 +    &MX6_bootstrap,
     8.9 +#endif
    8.10  #if SDL_VIDEO_DRIVER_DUMMY
    8.11      &DUMMY_bootstrap,
    8.12  #endif
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/video/mx6/SDL_mx6events.c	Wed Sep 10 08:54:01 2014 -0700
     9.3 @@ -0,0 +1,45 @@
     9.4 +/*
     9.5 +  Simple DirectMedia Layer
     9.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
     9.7 +
     9.8 +  This software is provided 'as-is', without any express or implied
     9.9 +  warranty.  In no event will the authors be held liable for any damages
    9.10 +  arising from the use of this software.
    9.11 +
    9.12 +  Permission is granted to anyone to use this software for any purpose,
    9.13 +  including commercial applications, and to alter it and redistribute it
    9.14 +  freely, subject to the following restrictions:
    9.15 +
    9.16 +  1. The origin of this software must not be misrepresented; you must not
    9.17 +     claim that you wrote the original software. If you use this software
    9.18 +     in a product, an acknowledgment in the product documentation would be
    9.19 +     appreciated but is not required.
    9.20 +  2. Altered source versions must be plainly marked as such, and must not be
    9.21 +     misrepresented as being the original software.
    9.22 +  3. This notice may not be removed or altered from any source distribution.
    9.23 +*/
    9.24 +
    9.25 +#include "../../SDL_internal.h"
    9.26 +
    9.27 +#if SDL_VIDEO_DRIVER_MX6
    9.28 +
    9.29 +#include "../../events/SDL_sysevents.h"
    9.30 +#include "../../events/SDL_events_c.h"
    9.31 +#include "../../events/SDL_keyboard_c.h"
    9.32 +#include "SDL_mx6video.h"
    9.33 +#include "SDL_mx6events_c.h"
    9.34 +
    9.35 +#ifdef SDL_INPUT_LINUXEV
    9.36 +#include "../../core/linux/SDL_evdev.h"
    9.37 +#endif
    9.38 +
    9.39 +void MX6_PumpEvents(_THIS)
    9.40 +{
    9.41 +#ifdef SDL_INPUT_LINUXEV
    9.42 +    SDL_EVDEV_Poll();
    9.43 +#endif
    9.44 +    
    9.45 +}
    9.46 +
    9.47 +#endif /* SDL_VIDEO_DRIVER_MX6 */
    9.48 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/video/mx6/SDL_mx6events_c.h	Wed Sep 10 08:54:01 2014 -0700
    10.3 @@ -0,0 +1,31 @@
    10.4 +/*
    10.5 +  Simple DirectMedia Layer
    10.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
    10.7 +
    10.8 +  This software is provided 'as-is', without any express or implied
    10.9 +  warranty.  In no event will the authors be held liable for any damages
   10.10 +  arising from the use of this software.
   10.11 +
   10.12 +  Permission is granted to anyone to use this software for any purpose,
   10.13 +  including commercial applications, and to alter it and redistribute it
   10.14 +  freely, subject to the following restrictions:
   10.15 +
   10.16 +  1. The origin of this software must not be misrepresented; you must not
   10.17 +     claim that you wrote the original software. If you use this software
   10.18 +     in a product, an acknowledgment in the product documentation would be
   10.19 +     appreciated but is not required.
   10.20 +  2. Altered source versions must be plainly marked as such, and must not be
   10.21 +     misrepresented as being the original software.
   10.22 +  3. This notice may not be removed or altered from any source distribution.
   10.23 +*/
   10.24 +
   10.25 +#ifndef _SDL_mx6events_c_h
   10.26 +#define _SDL_mx6events_c_h
   10.27 +
   10.28 +#include "SDL_mx6video.h"
   10.29 +
   10.30 +void MX6_PumpEvents(_THIS);
   10.31 +void MX6_EventInit(_THIS);
   10.32 +void MX6_EventQuit(_THIS);
   10.33 +
   10.34 +#endif /* _SDL_mx6events_c_h */
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/src/video/mx6/SDL_mx6opengles.c	Wed Sep 10 08:54:01 2014 -0700
    11.3 @@ -0,0 +1,211 @@
    11.4 +/*
    11.5 +  Simple DirectMedia Layer
    11.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
    11.7 +
    11.8 +  This software is provided 'as-is', without any express or implied
    11.9 +  warranty.  In no event will the authors be held liable for any damages
   11.10 +  arising from the use of this software.
   11.11 +
   11.12 +  Permission is granted to anyone to use this software for any purpose,
   11.13 +  including commercial applications, and to alter it and redistribute it
   11.14 +  freely, subject to the following restrictions:
   11.15 +
   11.16 +  1. The origin of this software must not be misrepresented; you must not
   11.17 +     claim that you wrote the original software. If you use this software
   11.18 +     in a product, an acknowledgment in the product documentation would be
   11.19 +     appreciated but is not required.
   11.20 +  2. Altered source versions must be plainly marked as such, and must not be
   11.21 +     misrepresented as being the original software.
   11.22 +  3. This notice may not be removed or altered from any source distribution.
   11.23 +*/
   11.24 +#include "../../SDL_internal.h"
   11.25 +
   11.26 +#if SDL_VIDEO_DRIVER_MX6 && SDL_VIDEO_OPENGL_EGL
   11.27 +
   11.28 +#include "SDL_mx6opengles.h"
   11.29 +#include "SDL_loadso.h"
   11.30 +#include "SDL_mx6video.h"
   11.31 +
   11.32 +#define DEFAULT_OGL "libGL.so.1"
   11.33 +#define DEFAULT_EGL "libEGL.so.1"
   11.34 +#define DEFAULT_OGL_ES2 "libGLESv2.so.2"
   11.35 +#define DEFAULT_OGL_ES "libGLESv1_CM.so.1"
   11.36 +
   11.37 +#define LOAD_FUNC(NAME) \
   11.38 +*((void**)&_this->egl_data->NAME) = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
   11.39 +if (!_this->egl_data->NAME) \
   11.40 +{ \
   11.41 +    return SDL_SetError("Could not retrieve EGL function " #NAME); \
   11.42 +}
   11.43 +
   11.44 +#define LOAD_VIV_FUNC(NAME) \
   11.45 +*((void**)&egl_viv_data->NAME) = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
   11.46 +if (!egl_viv_data->NAME) \
   11.47 +{ \
   11.48 +    return SDL_SetError("Could not retrieve EGL function " #NAME); \
   11.49 +}
   11.50 +
   11.51 +/* EGL implementation of SDL OpenGL support */
   11.52 +
   11.53 +int
   11.54 +MX6_GLES_LoadLibrary(_THIS, const char *egl_path) {
   11.55 +    /* The definitions of egl_dll_handle and dll_handle were interchanged for some reason.
   11.56 +       Just left them as is for compatibility */
   11.57 +    void *dll_handle = NULL, *egl_dll_handle = NULL;
   11.58 +    char *path = NULL;
   11.59 +    SDL_DisplayData *displaydata;
   11.60 +
   11.61 +    if (_this->egl_data) {
   11.62 +        return SDL_SetError("OpenGL ES context already created");
   11.63 +    }
   11.64 +
   11.65 +    _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData));
   11.66 +    if (!_this->egl_data) {
   11.67 +        return SDL_OutOfMemory();
   11.68 +    }
   11.69 +
   11.70 +    egl_viv_data = (struct MX6_EGL_VivanteData *) SDL_calloc(1, sizeof(MX6_EGL_VivanteData));
   11.71 +    if (!egl_viv_data) {
   11.72 +        return SDL_OutOfMemory();
   11.73 +    }
   11.74 +
   11.75 +    path = SDL_getenv("SDL_VIDEO_GL_DRIVER");
   11.76 +    if (path != NULL) {
   11.77 +        egl_dll_handle = SDL_LoadObject(path);
   11.78 +    }
   11.79 +
   11.80 +    if (egl_dll_handle == NULL) {
   11.81 +        if(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
   11.82 +            if (_this->gl_config.major_version > 1) {
   11.83 +                path = DEFAULT_OGL_ES2;
   11.84 +                egl_dll_handle = SDL_LoadObject(path);
   11.85 +            }
   11.86 +            else {
   11.87 +                path = DEFAULT_OGL_ES;
   11.88 +                egl_dll_handle = SDL_LoadObject(path);
   11.89 +            }
   11.90 +        }      
   11.91 +        else {
   11.92 +            path = DEFAULT_OGL;
   11.93 +            egl_dll_handle = SDL_LoadObject(path);
   11.94 +        }     
   11.95 +    }
   11.96 +    _this->egl_data->egl_dll_handle = egl_dll_handle;
   11.97 +
   11.98 +    if (egl_dll_handle == NULL) {
   11.99 +        return SDL_SetError("Could not initialize OpenGL / GLES library");
  11.100 +    }
  11.101 +
  11.102 +    if (egl_path != NULL) {
  11.103 +        dll_handle = SDL_LoadObject(egl_path);
  11.104 +    }   
  11.105 +    
  11.106 +    if (SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
  11.107 +        if (dll_handle != NULL) {
  11.108 +            SDL_UnloadObject(dll_handle);
  11.109 +        }
  11.110 +        path = SDL_getenv("SDL_VIDEO_EGL_DRIVER");
  11.111 +        if (path == NULL) {
  11.112 +            path = DEFAULT_EGL;
  11.113 +        }
  11.114 +        dll_handle = SDL_LoadObject(path);
  11.115 +        if (dll_handle == NULL) {
  11.116 +            return SDL_SetError("Could not load EGL library");
  11.117 +        }
  11.118 +    }
  11.119 +
  11.120 +    _this->egl_data->dll_handle = dll_handle;
  11.121 +
  11.122 +    /* Load new function pointers */
  11.123 +    LOAD_FUNC(eglGetDisplay);
  11.124 +    LOAD_FUNC(eglInitialize);
  11.125 +    LOAD_FUNC(eglTerminate);
  11.126 +    LOAD_FUNC(eglGetProcAddress);
  11.127 +    LOAD_FUNC(eglChooseConfig);
  11.128 +    LOAD_FUNC(eglGetConfigAttrib);
  11.129 +    LOAD_FUNC(eglCreateContext);
  11.130 +    LOAD_FUNC(eglDestroyContext);
  11.131 +    LOAD_FUNC(eglCreateWindowSurface);
  11.132 +    LOAD_FUNC(eglDestroySurface);
  11.133 +    LOAD_FUNC(eglMakeCurrent);
  11.134 +    LOAD_FUNC(eglSwapBuffers);
  11.135 +    LOAD_FUNC(eglSwapInterval);
  11.136 +    LOAD_FUNC(eglWaitNative);
  11.137 +    LOAD_FUNC(eglWaitGL);
  11.138 +    LOAD_FUNC(eglBindAPI);
  11.139 +    /* Functions from Vivante GPU SDK */
  11.140 +    LOAD_VIV_FUNC(fbGetDisplay);
  11.141 +    LOAD_VIV_FUNC(fbGetDisplayByIndex);
  11.142 +    LOAD_VIV_FUNC(fbGetDisplayGeometry);
  11.143 +    LOAD_VIV_FUNC(fbGetDisplayInfo);
  11.144 +    LOAD_VIV_FUNC(fbDestroyDisplay);
  11.145 +    LOAD_VIV_FUNC(fbCreateWindow);
  11.146 +    LOAD_VIV_FUNC(fbGetWindowGeometry);
  11.147 +    LOAD_VIV_FUNC(fbGetWindowInfo);
  11.148 +    LOAD_VIV_FUNC(fbDestroyWindow);
  11.149 +    LOAD_VIV_FUNC(fbCreatePixmap);
  11.150 +    LOAD_VIV_FUNC(fbCreatePixmapWithBpp);
  11.151 +    LOAD_VIV_FUNC(fbGetPixmapGeometry);
  11.152 +    LOAD_VIV_FUNC(fbGetPixmapInfo);
  11.153 +    LOAD_VIV_FUNC(fbDestroyPixmap);
  11.154 +   
  11.155 +    displaydata = SDL_GetDisplayDriverData(0);
  11.156 +    displaydata->native_display = egl_viv_data->fbGetDisplayByIndex(0);
  11.157 +    egl_viv_data->fbGetDisplayGeometry(displaydata->native_display, &displaydata->width, &displaydata->height);
  11.158 +
  11.159 +    _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(displaydata->native_display);
  11.160 +    if (!_this->egl_data->egl_display) {
  11.161 +        return SDL_SetError("Could not get EGL display");
  11.162 +    }
  11.163 +    
  11.164 +    if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) {
  11.165 +        return SDL_SetError("Could not initialize EGL");
  11.166 +    }
  11.167 +
  11.168 +    displaydata->egl_display = _this->egl_data->egl_display;
  11.169 +
  11.170 +    _this->gl_config.driver_loaded = 1;
  11.171 +
  11.172 +    if (path) {
  11.173 +        SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1);
  11.174 +    } else {
  11.175 +        *_this->gl_config.driver_path = '\0';
  11.176 +    }
  11.177 +    
  11.178 +    return 0;
  11.179 +}
  11.180 +
  11.181 +void
  11.182 +MX6_GLES_UnloadLibrary(_THIS)
  11.183 +{
  11.184 +    if (_this->egl_data) {
  11.185 +        if (_this->egl_data->egl_display) {
  11.186 +            _this->egl_data->eglTerminate(_this->egl_data->egl_display);
  11.187 +            _this->egl_data->egl_display = NULL;
  11.188 +        }
  11.189 +
  11.190 +        if (_this->egl_data->dll_handle) {
  11.191 +            SDL_UnloadObject(_this->egl_data->dll_handle);
  11.192 +            _this->egl_data->dll_handle = NULL;
  11.193 +        }
  11.194 +        if (_this->egl_data->egl_dll_handle) {
  11.195 +            SDL_UnloadObject(_this->egl_data->egl_dll_handle);
  11.196 +            _this->egl_data->egl_dll_handle = NULL;
  11.197 +        }
  11.198 +        
  11.199 +        SDL_free(_this->egl_data);
  11.200 +        _this->egl_data = NULL;
  11.201 +
  11.202 +        SDL_free(egl_viv_data);
  11.203 +        egl_viv_data = NULL;
  11.204 +    }
  11.205 +}
  11.206 +
  11.207 +SDL_EGL_CreateContext_impl(MX6)
  11.208 +SDL_EGL_SwapWindow_impl(MX6)
  11.209 +SDL_EGL_MakeCurrent_impl(MX6)
  11.210 +
  11.211 +#endif /* SDL_VIDEO_DRIVER_MX6 && SDL_VIDEO_OPENGL_EGL */
  11.212 +
  11.213 +/* vi: set ts=4 sw=4 expandtab: */
  11.214 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/video/mx6/SDL_mx6opengles.h	Wed Sep 10 08:54:01 2014 -0700
    12.3 @@ -0,0 +1,68 @@
    12.4 +/*
    12.5 +  Simple DirectMedia Layer
    12.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
    12.7 +
    12.8 +  This software is provided 'as-is', without any express or implied
    12.9 +  warranty.  In no event will the authors be held liable for any damages
   12.10 +  arising from the use of this software.
   12.11 +
   12.12 +  Permission is granted to anyone to use this software for any purpose,
   12.13 +  including commercial applications, and to alter it and redistribute it
   12.14 +  freely, subject to the following restrictions:
   12.15 +
   12.16 +  1. The origin of this software must not be misrepresented; you must not
   12.17 +     claim that you wrote the original software. If you use this software
   12.18 +     in a product, an acknowledgment in the product documentation would be
   12.19 +     appreciated but is not required.
   12.20 +  2. Altered source versions must be plainly marked as such, and must not be
   12.21 +     misrepresented as being the original software.
   12.22 +  3. This notice may not be removed or altered from any source distribution.
   12.23 +*/
   12.24 +#include "../../SDL_internal.h"
   12.25 +
   12.26 +#ifndef _SDL_mx6opengles_h
   12.27 +#define _SDL_mx6opengles_h
   12.28 +
   12.29 +#if SDL_VIDEO_DRIVER_MX6 && SDL_VIDEO_OPENGL_EGL
   12.30 +
   12.31 +#include "../SDL_sysvideo.h"
   12.32 +#include "../SDL_egl_c.h"
   12.33 +
   12.34 +typedef struct MX6_EGL_VivanteData
   12.35 +{
   12.36 +    EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplay) (void *context);
   12.37 +    EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplayByIndex) (int DisplayIndex);
   12.38 +    void(EGLAPIENTRY *fbGetDisplayGeometry) (EGLNativeDisplayType Display, int *Width, int *Height);
   12.39 +    void(EGLAPIENTRY *fbGetDisplayInfo) (EGLNativeDisplayType Display, int *Width, int *Height, unsigned long *Physical, int *Stride, int *BitsPerPixel);
   12.40 +    void(EGLAPIENTRY *fbDestroyDisplay) (EGLNativeDisplayType Display);
   12.41 +    EGLNativeWindowType(EGLAPIENTRY *fbCreateWindow) (EGLNativeDisplayType Display, int X, int Y, int Width, int Height);
   12.42 +    void(EGLAPIENTRY *fbGetWindowGeometry) (EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height);
   12.43 +    void(EGLAPIENTRY *fbGetWindowInfo) (EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height, int *BitsPerPixel, unsigned int *Offset);
   12.44 +    void(EGLAPIENTRY *fbDestroyWindow) (EGLNativeWindowType Window);
   12.45 +    EGLNativePixmapType(EGLAPIENTRY *fbCreatePixmap) (EGLNativeDisplayType Display, int Width, int Height);
   12.46 +    EGLNativePixmapType(EGLAPIENTRY *fbCreatePixmapWithBpp) (EGLNativeDisplayType Display, int Width, int Height, int BitsPerPixel);
   12.47 +    void(EGLAPIENTRY *fbGetPixmapGeometry) (EGLNativePixmapType Pixmap, int *Width, int *Height);
   12.48 +    void(EGLAPIENTRY *fbGetPixmapInfo) (EGLNativePixmapType Pixmap, int *Width, int *Height, int *BitsPerPixel, int *Stride, void **Bits);
   12.49 +    void(EGLAPIENTRY *fbDestroyPixmap) (EGLNativePixmapType Pixmap);
   12.50 +} MX6_EGL_VivanteData;
   12.51 +
   12.52 +struct MX6_EGL_VivanteData *egl_viv_data;
   12.53 +
   12.54 +/* OpenGLES functions */
   12.55 +#define MX6_GLES_GetAttribute SDL_EGL_GetAttribute
   12.56 +#define MX6_GLES_GetProcAddress SDL_EGL_GetProcAddress
   12.57 +#define MX6_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
   12.58 +#define MX6_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
   12.59 +#define MX6_GLES_DeleteContext SDL_EGL_DeleteContext
   12.60 +
   12.61 +extern int MX6_GLES_LoadLibrary(_THIS, const char *path);
   12.62 +extern void MX6_GLES_UnloadLibrary(_THIS);
   12.63 +extern SDL_GLContext MX6_GLES_CreateContext(_THIS, SDL_Window * window);
   12.64 +extern void MX6_GLES_SwapWindow(_THIS, SDL_Window * window);
   12.65 +extern int MX6_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
   12.66 +
   12.67 +#endif /* SDL_VIDEO_DRIVER_MX6 && SDL_VIDEO_OPENGL_EGL */
   12.68 +
   12.69 +#endif /* _SDL_mx6opengles_h */
   12.70 +
   12.71 +/* vi: set ts=4 sw=4 expandtab: */
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/video/mx6/SDL_mx6video.c	Wed Sep 10 08:54:01 2014 -0700
    13.3 @@ -0,0 +1,301 @@
    13.4 +/*
    13.5 +  Simple DirectMedia Layer
    13.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
    13.7 +
    13.8 +  This software is provided 'as-is', without any express or implied
    13.9 +  warranty.  In no event will the authors be held liable for any damages
   13.10 +  arising from the use of this software.
   13.11 +
   13.12 +  Permission is granted to anyone to use this software for any purpose,
   13.13 +  including commercial applications, and to alter it and redistribute it
   13.14 +  freely, subject to the following restrictions:
   13.15 +
   13.16 +  1. The origin of this software must not be misrepresented; you must not
   13.17 +     claim that you wrote the original software. If you use this software
   13.18 +     in a product, an acknowledgment in the product documentation would be
   13.19 +     appreciated but is not required.
   13.20 +  2. Altered source versions must be plainly marked as such, and must not be
   13.21 +     misrepresented as being the original software.
   13.22 +  3. This notice may not be removed or altered from any source distribution.
   13.23 +*/
   13.24 +
   13.25 +#include "../../SDL_internal.h"
   13.26 +
   13.27 +#if SDL_VIDEO_DRIVER_MX6
   13.28 +
   13.29 +/* SDL internals */
   13.30 +#include "../SDL_sysvideo.h"
   13.31 +#include "SDL_version.h"
   13.32 +#include "SDL_syswm.h"
   13.33 +#include "SDL_loadso.h"
   13.34 +#include "SDL_events.h"
   13.35 +
   13.36 +#ifdef SDL_INPUT_LINUXEV
   13.37 +#include "../../core/linux/SDL_evdev.h"
   13.38 +#endif
   13.39 +
   13.40 +#include "SDL_mx6video.h"
   13.41 +#include "SDL_mx6events_c.h"
   13.42 +#include "SDL_mx6opengles.h"
   13.43 +
   13.44 +static int
   13.45 +MX6_Available(void)
   13.46 +{
   13.47 +    return 1;
   13.48 +}
   13.49 +
   13.50 +static void
   13.51 +MX6_Destroy(SDL_VideoDevice * device)
   13.52 +{
   13.53 +    if (device->driverdata != NULL) {
   13.54 +        device->driverdata = NULL;
   13.55 +    }
   13.56 +}
   13.57 +
   13.58 +static SDL_VideoDevice *
   13.59 +MX6_Create()
   13.60 +{
   13.61 +    SDL_VideoDevice *device;
   13.62 +    SDL_VideoData *phdata;
   13.63 +
   13.64 +    /* Initialize SDL_VideoDevice structure */
   13.65 +    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
   13.66 +    if (device == NULL) {
   13.67 +        SDL_OutOfMemory();
   13.68 +        return NULL;
   13.69 +    }
   13.70 +
   13.71 +    /* Initialize internal data */
   13.72 +    phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
   13.73 +    if (phdata == NULL) {
   13.74 +        SDL_OutOfMemory();
   13.75 +        SDL_free(device);
   13.76 +        return NULL;
   13.77 +    }
   13.78 +
   13.79 +    device->driverdata = phdata;
   13.80 +
   13.81 +    /* Setup amount of available displays and current display */
   13.82 +    device->num_displays = 0;
   13.83 +
   13.84 +    /* Set device free function */
   13.85 +    device->free = MX6_Destroy;
   13.86 +
   13.87 +    /* Setup all functions which we can handle */
   13.88 +    device->VideoInit = MX6_VideoInit;
   13.89 +    device->VideoQuit = MX6_VideoQuit;
   13.90 +    device->GetDisplayModes = MX6_GetDisplayModes;
   13.91 +    device->SetDisplayMode = MX6_SetDisplayMode;
   13.92 +    device->CreateWindow = MX6_CreateWindow;
   13.93 +    device->CreateWindowFrom = MX6_CreateWindowFrom;
   13.94 +    device->SetWindowTitle = MX6_SetWindowTitle;
   13.95 +    device->SetWindowIcon = MX6_SetWindowIcon;
   13.96 +    device->SetWindowPosition = MX6_SetWindowPosition;
   13.97 +    device->SetWindowSize = MX6_SetWindowSize;
   13.98 +    device->ShowWindow = MX6_ShowWindow;
   13.99 +    device->HideWindow = MX6_HideWindow;
  13.100 +    device->RaiseWindow = MX6_RaiseWindow;
  13.101 +    device->MaximizeWindow = MX6_MaximizeWindow;
  13.102 +    device->MinimizeWindow = MX6_MinimizeWindow;
  13.103 +    device->RestoreWindow = MX6_RestoreWindow;
  13.104 +    device->SetWindowGrab = MX6_SetWindowGrab;
  13.105 +    device->DestroyWindow = MX6_DestroyWindow;
  13.106 +    device->GetWindowWMInfo = MX6_GetWindowWMInfo;
  13.107 +
  13.108 +    device->GL_LoadLibrary = MX6_GLES_LoadLibrary;
  13.109 +    device->GL_GetProcAddress = MX6_GLES_GetProcAddress;
  13.110 +    device->GL_UnloadLibrary = MX6_GLES_UnloadLibrary;
  13.111 +    device->GL_CreateContext = MX6_GLES_CreateContext;
  13.112 +    device->GL_MakeCurrent = MX6_GLES_MakeCurrent;
  13.113 +    device->GL_SetSwapInterval = MX6_GLES_SetSwapInterval;
  13.114 +    device->GL_GetSwapInterval = MX6_GLES_GetSwapInterval;
  13.115 +    device->GL_SwapWindow = MX6_GLES_SwapWindow;
  13.116 +    device->GL_DeleteContext = MX6_GLES_DeleteContext;
  13.117 +
  13.118 +    device->PumpEvents = MX6_PumpEvents;
  13.119 +
  13.120 +    return device;
  13.121 +}
  13.122 +
  13.123 +VideoBootStrap MX6_bootstrap = {
  13.124 +    "MX6",
  13.125 +    "Freescale i.MX6 Video Driver",
  13.126 +    MX6_Available,
  13.127 +    MX6_Create
  13.128 +};
  13.129 +
  13.130 +/*****************************************************************************/
  13.131 +/* SDL Video and Display initialization/handling functions                   */
  13.132 +/*****************************************************************************/
  13.133 +int
  13.134 +MX6_VideoInit(_THIS)
  13.135 +{
  13.136 +    SDL_VideoDisplay display;
  13.137 +    SDL_DisplayMode current_mode;
  13.138 +    SDL_DisplayData *data;
  13.139 +    
  13.140 +    data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
  13.141 +    if (data == NULL) {
  13.142 +        return SDL_OutOfMemory();
  13.143 +    }
  13.144 +    
  13.145 +    /* Actual data will be set in SDL_GL_LoadLibrary call below */
  13.146 +    SDL_zero(current_mode);
  13.147 +    current_mode.w = 0;
  13.148 +    current_mode.h = 0;
  13.149 +    current_mode.refresh_rate = 60;
  13.150 +    current_mode.format = SDL_PIXELFORMAT_RGB565;
  13.151 +    current_mode.driverdata = NULL;
  13.152 +
  13.153 +    SDL_zero(display);
  13.154 +    display.desktop_mode = current_mode;
  13.155 +    display.current_mode = current_mode;
  13.156 +    display.driverdata = data;
  13.157 +    SDL_AddVideoDisplay(&display);
  13.158 +
  13.159 +    if (SDL_GL_LoadLibrary(NULL) < 0) {
  13.160 +        return -1;
  13.161 +    }
  13.162 +
  13.163 +#ifdef SDL_INPUT_LINUXEV    
  13.164 +    SDL_EVDEV_Init();
  13.165 +#endif    
  13.166 +
  13.167 +    return 1;
  13.168 +}
  13.169 +
  13.170 +void
  13.171 +MX6_VideoQuit(_THIS)
  13.172 +{
  13.173 +#ifdef SDL_INPUT_LINUXEV    
  13.174 +    SDL_EVDEV_Quit();
  13.175 +#endif    
  13.176 +}
  13.177 +
  13.178 +void
  13.179 +MX6_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
  13.180 +{
  13.181 +    /* Only one display mode available, the current one */
  13.182 +    SDL_AddDisplayMode(display, &display->current_mode);
  13.183 +}
  13.184 +
  13.185 +int
  13.186 +MX6_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
  13.187 +{
  13.188 +    return 0;
  13.189 +}
  13.190 +
  13.191 +int
  13.192 +MX6_CreateWindow(_THIS, SDL_Window * window)
  13.193 +{
  13.194 +    SDL_DisplayData *displaydata;
  13.195 +    SDL_WindowData *wdata;
  13.196 +    
  13.197 +    displaydata = SDL_GetDisplayDriverData(0);
  13.198 +    
  13.199 +    /* Allocate window internal data */
  13.200 +    wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
  13.201 +    if (wdata == NULL) {
  13.202 +        return SDL_OutOfMemory();
  13.203 +    }
  13.204 +
  13.205 +    /* Setup driver data for this window */
  13.206 +    window->driverdata = wdata;
  13.207 +    window->flags |= SDL_WINDOW_OPENGL;
  13.208 +    
  13.209 +    if (!_this->egl_data) {
  13.210 +        return -1;
  13.211 +    }
  13.212 +
  13.213 +    wdata->native_window = egl_viv_data->fbCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);    
  13.214 +    if (!wdata->native_window) {
  13.215 +        return SDL_SetError("MX6: Can't create native window");
  13.216 +    }
  13.217 +
  13.218 +    wdata->egl_surface = SDL_EGL_CreateSurface(_this, wdata->native_window);
  13.219 +    if (wdata->egl_surface == EGL_NO_SURFACE) {
  13.220 +        return SDL_SetError("MX6: Can't create EGL surface");
  13.221 +    }
  13.222 +
  13.223 +    /* Window has been successfully created */
  13.224 +    return 0;
  13.225 +}
  13.226 +
  13.227 +void
  13.228 +MX6_DestroyWindow(_THIS, SDL_Window * window)
  13.229 +{
  13.230 +    SDL_WindowData *wdata;
  13.231 +    
  13.232 +    wdata = window->driverdata;
  13.233 +    if (wdata) {
  13.234 +        SDL_EGL_DestroySurface(_this, wdata->egl_surface);
  13.235 +    }
  13.236 +
  13.237 +    if (egl_viv_data) {
  13.238 +        egl_viv_data->fbDestroyWindow(wdata->native_window);
  13.239 +    }
  13.240 +}
  13.241 +
  13.242 +int
  13.243 +MX6_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
  13.244 +{
  13.245 +    return -1;
  13.246 +}
  13.247 +
  13.248 +void
  13.249 +MX6_SetWindowTitle(_THIS, SDL_Window * window)
  13.250 +{
  13.251 +}
  13.252 +void
  13.253 +MX6_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
  13.254 +{
  13.255 +}
  13.256 +void
  13.257 +MX6_SetWindowPosition(_THIS, SDL_Window * window)
  13.258 +{
  13.259 +}
  13.260 +void
  13.261 +MX6_SetWindowSize(_THIS, SDL_Window * window)
  13.262 +{
  13.263 +}
  13.264 +void
  13.265 +MX6_ShowWindow(_THIS, SDL_Window * window)
  13.266 +{
  13.267 +}
  13.268 +void
  13.269 +MX6_HideWindow(_THIS, SDL_Window * window)
  13.270 +{
  13.271 +}
  13.272 +void
  13.273 +MX6_RaiseWindow(_THIS, SDL_Window * window)
  13.274 +{
  13.275 +}
  13.276 +void
  13.277 +MX6_MaximizeWindow(_THIS, SDL_Window * window)
  13.278 +{
  13.279 +}
  13.280 +void
  13.281 +MX6_MinimizeWindow(_THIS, SDL_Window * window)
  13.282 +{
  13.283 +}
  13.284 +void
  13.285 +MX6_RestoreWindow(_THIS, SDL_Window * window)
  13.286 +{
  13.287 +}
  13.288 +void
  13.289 +MX6_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
  13.290 +{
  13.291 +}
  13.292 +
  13.293 +/*****************************************************************************/
  13.294 +/* SDL Window Manager function                                               */
  13.295 +/*****************************************************************************/
  13.296 +SDL_bool
  13.297 +MX6_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
  13.298 +{
  13.299 +    return SDL_TRUE;
  13.300 +}
  13.301 +
  13.302 +#endif /* SDL_VIDEO_DRIVER_MX6 */
  13.303 +
  13.304 +/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/video/mx6/SDL_mx6video.h	Wed Sep 10 08:54:01 2014 -0700
    14.3 @@ -0,0 +1,78 @@
    14.4 +/*
    14.5 +  Simple DirectMedia Layer
    14.6 +  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
    14.7 +
    14.8 +  This software is provided 'as-is', without any express or implied
    14.9 +  warranty.  In no event will the authors be held liable for any damages
   14.10 +  arising from the use of this software.
   14.11 +
   14.12 +  Permission is granted to anyone to use this software for any purpose,
   14.13 +  including commercial applications, and to alter it and redistribute it
   14.14 +  freely, subject to the following restrictions:
   14.15 +
   14.16 +  1. The origin of this software must not be misrepresented; you must not
   14.17 +     claim that you wrote the original software. If you use this software
   14.18 +     in a product, an acknowledgment in the product documentation would be
   14.19 +     appreciated but is not required.
   14.20 +  2. Altered source versions must be plainly marked as such, and must not be
   14.21 +     misrepresented as being the original software.
   14.22 +  3. This notice may not be removed or altered from any source distribution.
   14.23 +*/
   14.24 +
   14.25 +#ifndef __SDL_MX6VIDEO_H__
   14.26 +#define __SDL_MX6VIDEO_H__
   14.27 +
   14.28 +#include "../../SDL_internal.h"
   14.29 +#include "../SDL_sysvideo.h"
   14.30 +
   14.31 +#include "SDL_egl.h"
   14.32 +
   14.33 +typedef struct SDL_VideoData
   14.34 +{
   14.35 +} SDL_VideoData;
   14.36 +
   14.37 +typedef struct SDL_DisplayData
   14.38 +{
   14.39 +    EGLNativeDisplayType native_display;
   14.40 +    EGLDisplay egl_display;
   14.41 +    int width;
   14.42 +    int height;
   14.43 +} SDL_DisplayData;
   14.44 +
   14.45 +typedef struct SDL_WindowData
   14.46 +{
   14.47 +    EGLNativeWindowType native_window;
   14.48 +    EGLSurface egl_surface;
   14.49 +} SDL_WindowData;
   14.50 +
   14.51 +/****************************************************************************/
   14.52 +/* SDL_VideoDevice functions declaration                                    */
   14.53 +/****************************************************************************/
   14.54 +
   14.55 +/* Display and window functions */
   14.56 +int MX6_VideoInit(_THIS);
   14.57 +void MX6_VideoQuit(_THIS);
   14.58 +void MX6_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
   14.59 +int MX6_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
   14.60 +int MX6_CreateWindow(_THIS, SDL_Window * window);
   14.61 +int MX6_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
   14.62 +void MX6_SetWindowTitle(_THIS, SDL_Window * window);
   14.63 +void MX6_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
   14.64 +void MX6_SetWindowPosition(_THIS, SDL_Window * window);
   14.65 +void MX6_SetWindowSize(_THIS, SDL_Window * window);
   14.66 +void MX6_ShowWindow(_THIS, SDL_Window * window);
   14.67 +void MX6_HideWindow(_THIS, SDL_Window * window);
   14.68 +void MX6_RaiseWindow(_THIS, SDL_Window * window);
   14.69 +void MX6_MaximizeWindow(_THIS, SDL_Window * window);
   14.70 +void MX6_MinimizeWindow(_THIS, SDL_Window * window);
   14.71 +void MX6_RestoreWindow(_THIS, SDL_Window * window);
   14.72 +void MX6_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
   14.73 +void MX6_DestroyWindow(_THIS, SDL_Window * window);
   14.74 +
   14.75 +/* Window manager function */
   14.76 +SDL_bool MX6_GetWindowWMInfo(_THIS, SDL_Window * window,
   14.77 +                             struct SDL_SysWMinfo *info);
   14.78 +
   14.79 +#endif /* __SDL_MX6VIDEO_H__ */
   14.80 +
   14.81 +/* vi: set ts=4 sw=4 expandtab: */