Skip to content

Commit

Permalink
Freescale i.MX6 video driver
Browse files Browse the repository at this point in the history
---
 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
  • Loading branch information
dbarkar committed Sep 10, 2014
1 parent bcaae0b commit 50cc4ef
Show file tree
Hide file tree
Showing 14 changed files with 843 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -247,6 +247,7 @@ endforeach()
set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE})
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
set_option(VIDEO_MX6 "Use Freescale i.MX6 video driver" OFF)

# TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here
# The options below are for compatibility to configure's default behaviour.
Expand Down Expand Up @@ -678,6 +679,7 @@ if(UNIX AND NOT APPLE)
CheckOpenGLX11()
CheckOpenGLESX11()
CheckWayland()
CheckMX6()
endif()

if(LINUX)
Expand Down
20 changes: 20 additions & 0 deletions cmake/sdlchecks.cmake
Expand Up @@ -600,6 +600,25 @@ macro(CheckDirectFB)
endif(VIDEO_DIRECTFB)
endmacro(CheckDirectFB)

# Requires:
# - n/a
macro(CheckMX6)
if(VIDEO_MX6)
check_c_source_compiles("
#define EGL_API_FB
#include <EGL/eglvivante.h>
int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL_VIVANTE)
if(HAVE_VIDEO_OPENGL_EGL_VIVANTE)
set(HAVE_VIDEO_MX6 TRUE)
set(HAVE_SDL_VIDEO TRUE)

file(GLOB MX6_SOURCES ${SDL2_SOURCE_DIR}/src/video/mx6/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${MX6_SOURCES})
set(SDL_VIDEO_DRIVER_MX6 1)
endif(HAVE_VIDEO_OPENGL_EGL_VIVANTE)
endif(VIDEO_MX6)
endmacro(CheckMX6)

# Requires:
# - nada
macro(CheckOpenGLX11)
Expand All @@ -624,6 +643,7 @@ endmacro(CheckOpenGLX11)
macro(CheckOpenGLESX11)
if(VIDEO_OPENGLES)
check_c_source_compiles("
#define EGL_API_FB
#include <EGL/egl.h>
int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL)
if(HAVE_VIDEO_OPENGL_EGL)
Expand Down
51 changes: 51 additions & 0 deletions configure
Expand Up @@ -832,6 +832,7 @@ enable_video_x11_xrandr
enable_video_x11_scrnsaver
enable_video_x11_xshape
enable_video_x11_vm
enable_video_mx6
enable_video_cocoa
enable_video_directfb
enable_directfb_shared
Expand Down Expand Up @@ -1561,6 +1562,7 @@ Optional Features:
--enable-video-x11-xshape
enable X11 XShape support [[default=yes]]
--enable-video-x11-vm use X11 VM extension for fullscreen [[default=yes]]
--enable-video-mx6 use Freescale i.MX6 video driver [[default=no]]
--enable-video-cocoa use Cocoa video driver [[default=yes]]
--enable-video-directfb use DirectFB video driver [[default=no]]
--enable-directfb-shared
Expand Down Expand Up @@ -20591,6 +20593,53 @@ $as_echo "#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1" >>confdefs.h
fi
}

CheckMX6Video()
{
# Check whether --enable-video-mx6 was given.
if test "${enable_video_mx6+set}" = set; then :
enableval=$enable_video_mx6;
else
enable_video_mx6=no
fi

if test x$enable_video = xyes -a x$enable_video_mx6 = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Vivante GPU SDK" >&5
$as_echo_n "checking for Vivante GPU SDK... " >&6; }
have_viv_sdk=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#define EGL_API_FB
#include <EGL/eglvivante.h>

int
main ()
{


;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

have_viv_sdk=yes

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_viv_sdk" >&5
$as_echo "$have_viv_sdk" >&6; }
if test x$have_viv_sdk = xyes; then

$as_echo "#define SDL_VIDEO_DRIVER_MX6 1" >>confdefs.h

SOURCES="$SOURCES $srcdir/src/video/mx6/*.c"
SUMMARY_video="${SUMMARY_video} mx6"
have_video=yes
fi
fi
}

CheckHaikuVideo()
{
if test x$enable_video = xyes; then
Expand Down Expand Up @@ -21044,6 +21093,7 @@ $as_echo_n "checking for EGL support... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#define EGL_API_FB
#include <EGL/egl.h>
#include <EGL/eglext.h>

Expand Down Expand Up @@ -22818,6 +22868,7 @@ case "$host" in
CheckClockGettime
CheckLinuxVersion
CheckRPATH
CheckMX6Video
# Set up files for the audio library
if test x$enable_audio = xyes; then
case $ARCH in
Expand Down
28 changes: 28 additions & 0 deletions configure.in
Expand Up @@ -1729,6 +1729,32 @@ AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[d
fi
}

dnl Set up the MX6 video driver if enabled
CheckMX6Video()
{
AC_ARG_ENABLE(video-mx6,
AC_HELP_STRING([--enable-video-mx6], [use Freescale i.MX6 video driver [[default=no]]]),
, enable_video_mx6=no)
if test x$enable_video = xyes -a x$enable_video_mx6 = xyes; then
AC_MSG_CHECKING(for Vivante GPU SDK)
have_viv_sdk=no
AC_TRY_COMPILE([
#define EGL_API_FB
#include <EGL/eglvivante.h>
],[
],[
have_viv_sdk=yes
])
AC_MSG_RESULT($have_viv_sdk)
if test x$have_viv_sdk = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_MX6, 1, [ ])
SOURCES="$SOURCES $srcdir/src/video/mx6/*.c"
SUMMARY_video="${SUMMARY_video} mx6"
have_video=yes
fi
fi
}

dnl Set up the Haiku video driver if enabled
CheckHaikuVideo()
{
Expand Down Expand Up @@ -1955,6 +1981,7 @@ CheckOpenGLESX11()
AC_MSG_CHECKING(for EGL support)
video_opengl_egl=no
AC_TRY_COMPILE([
#define EGL_API_FB
#include <EGL/egl.h>
#include <EGL/eglext.h>
],[
Expand Down Expand Up @@ -2809,6 +2836,7 @@ case "$host" in
CheckClockGettime
CheckLinuxVersion
CheckRPATH
CheckMX6Video
# Set up files for the audio library
if test x$enable_audio = xyes; then
case $ARCH in
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config.h.cmake
Expand Up @@ -264,6 +264,7 @@
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
#cmakedefine SDL_VIDEO_DRIVER_MX6 @SDL_VIDEO_DRIVER_MX6@

#if 0
/* !!! FIXME: in configure script version, missing here: */
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config.h.in
Expand Up @@ -308,6 +308,7 @@
#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
#undef SDL_VIDEO_DRIVER_NACL
#undef SDL_VIDEO_DRIVER_MX6

#undef SDL_VIDEO_RENDER_D3D
#undef SDL_VIDEO_RENDER_D3D11
Expand Down
3 changes: 3 additions & 0 deletions src/video/SDL_sysvideo.h
Expand Up @@ -391,6 +391,9 @@ extern VideoBootStrap Wayland_bootstrap;
#if SDL_VIDEO_DRIVER_NACL
extern VideoBootStrap NACL_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_MX6
extern VideoBootStrap MX6_bootstrap;
#endif

extern SDL_VideoDevice *SDL_GetVideoDevice(void);
extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
Expand Down
3 changes: 3 additions & 0 deletions src/video/SDL_video.c
Expand Up @@ -95,6 +95,9 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_NACL
&NACL_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_MX6
&MX6_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DUMMY
&DUMMY_bootstrap,
#endif
Expand Down
45 changes: 45 additions & 0 deletions src/video/mx6/SDL_mx6events.c
@@ -0,0 +1,45 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

#include "../../SDL_internal.h"

#if SDL_VIDEO_DRIVER_MX6

#include "../../events/SDL_sysevents.h"
#include "../../events/SDL_events_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "SDL_mx6video.h"
#include "SDL_mx6events_c.h"

#ifdef SDL_INPUT_LINUXEV
#include "../../core/linux/SDL_evdev.h"
#endif

void MX6_PumpEvents(_THIS)
{
#ifdef SDL_INPUT_LINUXEV
SDL_EVDEV_Poll();
#endif

}

#endif /* SDL_VIDEO_DRIVER_MX6 */

31 changes: 31 additions & 0 deletions src/video/mx6/SDL_mx6events_c.h
@@ -0,0 +1,31 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

#ifndef _SDL_mx6events_c_h
#define _SDL_mx6events_c_h

#include "SDL_mx6video.h"

void MX6_PumpEvents(_THIS);
void MX6_EventInit(_THIS);
void MX6_EventQuit(_THIS);

#endif /* _SDL_mx6events_c_h */

0 comments on commit 50cc4ef

Please sign in to comment.