Skip to content
Permalink
Browse files

Expanded the iMX6 video driver into a general Vivante video driver th…

…at works across multiple SoCs
  • Loading branch information
slouken committed Oct 15, 2014
1 parent f7abb7c commit 251ca855f760c8df307c2a5a83d701e7a78a86b0
@@ -247,7 +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)
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})

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

if(LINUX)
@@ -602,22 +602,33 @@ endmacro(CheckDirectFB)

# Requires:
# - n/a
macro(CheckMX6)
if(VIDEO_MX6)
macro(CheckVivante)
if(VIDEO_VIVANTE)
check_c_source_compiles("
#include <gc_vdk.h>
int main(int argc, char** argv) {}" HAVE_VIDEO_VIVANTE_VDK)
check_c_source_compiles("
#define LINUX
#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)
int main(int argc, char** argv) {}" HAVE_VIDEO_VIVANTE_EGL_FB)
if(HAVE_VIDEO_VIVANTE_VDK OR HAVE_VIDEO_VIVANTE_EGL_FB)
set(HAVE_VIDEO_VIVANTE 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)
file(GLOB VIVANTE_SOURCES ${SDL2_SOURCE_DIR}/src/video/vivante/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${VIVANTE_SOURCES})
set(SDL_VIDEO_DRIVER_VIVANTE 1)
if(HAVE_VIDEO_VIVANTE_VDK)
set(SDL_VIDEO_DRIVER_VIVANTE_VDK 1)
list(APPEND EXTRA_LIBS VDK VIVANTE)
else
set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB")
list(APPEND EXTRA_LIBS EGL)
endif(HAVE_VIDEO_VIVANTE_VDK)
endif(HAVE_VIDEO_VIVANTE_VDK OR HAVE_VIDEO_VIVANTE_EGL_FB)
endif(VIDEO_VIVANTE)
endmacro(CheckVivante)

# Requires:
# - nada
@@ -1729,27 +1729,46 @@ 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()
dnl Set up the Vivante video driver if enabled
CheckVivanteVideo()
{
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_ARG_ENABLE(video-vivante,
AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]),
, enable_video_vivante=yes)
if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then
AC_MSG_CHECKING(for Vivante VDK API)
have_vivante_vdk=no
AC_TRY_COMPILE([
#define LINUX
#define EGL_API_FB
#include <gc_vdk.h>
],[
],[
have_vivante_vdk=yes
])
AC_MSG_RESULT($have_vivante_vdk)

AC_MSG_CHECKING(for Vivante FB API)
have_vivante_egl=no
AC_TRY_COMPILE([
#define LINUX
#define EGL_API_FB
#include <EGL/eglvivante.h>
],[
],[
have_viv_sdk=yes
have_vivante_egl=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"
AC_MSG_RESULT($have_vivante_egl)

if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ])
EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
if test x$have_vivante_vdk = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ])
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK"
fi
SOURCES="$SOURCES $srcdir/src/video/vivante/*.c"
SUMMARY_video="${SUMMARY_video} vivante"
have_video=yes
fi
fi
@@ -1987,9 +2006,10 @@ 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>
#define LINUX
#define EGL_API_FB
#include <EGL/egl.h>
#include <EGL/eglext.h>
],[
],[
video_opengl_egl=yes
@@ -2268,10 +2288,10 @@ AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[def
AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
, enable_pthread_sem=yes)
case "$host" in
*-*-androideabi*)
*-*-androideabi*)
pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
pthread_lib=""
;;
;;
*-*-linux*|*-*-uclinux*)
pthread_cflags="-D_REENTRANT"
pthread_lib="-lpthread"
@@ -2846,7 +2866,7 @@ case "$host" in
CheckClockGettime
CheckLinuxVersion
CheckRPATH
CheckMX6Video
CheckVivanteVideo
# Set up files for the audio library
if test x$enable_audio = xyes; then
case $ARCH in
@@ -264,7 +264,8 @@
#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@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@

#if 0
/* !!! FIXME: in configure script version, missing here: */
@@ -308,7 +308,8 @@
#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_DRIVER_VIVANTE
#undef SDL_VIDEO_DRIVER_VIVANTE_VDK

#undef SDL_VIDEO_RENDER_D3D
#undef SDL_VIDEO_RENDER_D3D11
@@ -38,7 +38,7 @@
#define DEFAULT_OGL_ES_PVR "/opt/vc/lib/libGLES_CM.so"
#define DEFAULT_OGL_ES "/opt/vc/lib/libGLESv1_CM.so"

#elif SDL_VIDEO_DRIVER_ANDROID
#elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE
/* Android */
#define DEFAULT_EGL "libEGL.so"
#define DEFAULT_OGL_ES2 "libGLESv2.so"
@@ -391,8 +391,8 @@ extern VideoBootStrap Wayland_bootstrap;
#if SDL_VIDEO_DRIVER_NACL
extern VideoBootStrap NACL_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_MX6
extern VideoBootStrap MX6_bootstrap;
#if SDL_VIDEO_DRIVER_VIVANTE
extern VideoBootStrap VIVANTE_bootstrap;
#endif

extern SDL_VideoDevice *SDL_GetVideoDevice(void);
@@ -62,6 +62,12 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_MIR
&MIR_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_WAYLAND
&Wayland_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_VIVANTE
&VIVANTE_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DIRECTFB
&DirectFB_bootstrap,
#endif
@@ -89,15 +95,9 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_RPI
&RPI_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_WAYLAND
&Wayland_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_NACL
&NACL_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_MX6
&MX6_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DUMMY
&DUMMY_bootstrap,
#endif

0 comments on commit 251ca85

Please sign in to comment.