mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-04-25 19:54:58 +02:00
dynamic loading of the rpi video driver
This commit is contained in:
parent
8ec1b99551
commit
303437eda7
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*.swp
|
||||||
|
aclocal.m4
|
||||||
|
*.cache/
|
169
configure
vendored
169
configure
vendored
@ -670,8 +670,6 @@ X_LIBS
|
|||||||
X_PRE_LIBS
|
X_PRE_LIBS
|
||||||
X_CFLAGS
|
X_CFLAGS
|
||||||
XMKMF
|
XMKMF
|
||||||
RPI_LIBS
|
|
||||||
RPI_CFLAGS
|
|
||||||
FUSIONSOUND_LIBS
|
FUSIONSOUND_LIBS
|
||||||
FUSIONSOUND_CFLAGS
|
FUSIONSOUND_CFLAGS
|
||||||
ARTSCONFIG
|
ARTSCONFIG
|
||||||
@ -768,6 +766,7 @@ infodir
|
|||||||
docdir
|
docdir
|
||||||
oldincludedir
|
oldincludedir
|
||||||
includedir
|
includedir
|
||||||
|
runstatedir
|
||||||
localstatedir
|
localstatedir
|
||||||
sharedstatedir
|
sharedstatedir
|
||||||
sysconfdir
|
sysconfdir
|
||||||
@ -925,8 +924,6 @@ PULSEAUDIO_CFLAGS
|
|||||||
PULSEAUDIO_LIBS
|
PULSEAUDIO_LIBS
|
||||||
FUSIONSOUND_CFLAGS
|
FUSIONSOUND_CFLAGS
|
||||||
FUSIONSOUND_LIBS
|
FUSIONSOUND_LIBS
|
||||||
RPI_CFLAGS
|
|
||||||
RPI_LIBS
|
|
||||||
XMKMF
|
XMKMF
|
||||||
DIRECTFB_CFLAGS
|
DIRECTFB_CFLAGS
|
||||||
DIRECTFB_LIBS
|
DIRECTFB_LIBS
|
||||||
@ -978,6 +975,7 @@ datadir='${datarootdir}'
|
|||||||
sysconfdir='${prefix}/etc'
|
sysconfdir='${prefix}/etc'
|
||||||
sharedstatedir='${prefix}/com'
|
sharedstatedir='${prefix}/com'
|
||||||
localstatedir='${prefix}/var'
|
localstatedir='${prefix}/var'
|
||||||
|
runstatedir='${localstatedir}/run'
|
||||||
includedir='${prefix}/include'
|
includedir='${prefix}/include'
|
||||||
oldincludedir='/usr/include'
|
oldincludedir='/usr/include'
|
||||||
docdir='${datarootdir}/doc/${PACKAGE}'
|
docdir='${datarootdir}/doc/${PACKAGE}'
|
||||||
@ -1230,6 +1228,15 @@ do
|
|||||||
| -silent | --silent | --silen | --sile | --sil)
|
| -silent | --silent | --silen | --sile | --sil)
|
||||||
silent=yes ;;
|
silent=yes ;;
|
||||||
|
|
||||||
|
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||||
|
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||||
|
| --run | --ru | --r)
|
||||||
|
ac_prev=runstatedir ;;
|
||||||
|
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||||
|
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||||
|
| --run=* | --ru=* | --r=*)
|
||||||
|
runstatedir=$ac_optarg ;;
|
||||||
|
|
||||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||||
ac_prev=sbindir ;;
|
ac_prev=sbindir ;;
|
||||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||||
@ -1367,7 +1374,7 @@ fi
|
|||||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||||
libdir localedir mandir
|
libdir localedir mandir runstatedir
|
||||||
do
|
do
|
||||||
eval ac_val=\$$ac_var
|
eval ac_val=\$$ac_var
|
||||||
# Remove trailing slashes.
|
# Remove trailing slashes.
|
||||||
@ -1520,6 +1527,7 @@ Fine tuning of the installation directories:
|
|||||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||||
|
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||||
--includedir=DIR C header files [PREFIX/include]
|
--includedir=DIR C header files [PREFIX/include]
|
||||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||||
@ -1737,8 +1745,6 @@ Some influential environment variables:
|
|||||||
C compiler flags for FUSIONSOUND, overriding pkg-config
|
C compiler flags for FUSIONSOUND, overriding pkg-config
|
||||||
FUSIONSOUND_LIBS
|
FUSIONSOUND_LIBS
|
||||||
linker flags for FUSIONSOUND, overriding pkg-config
|
linker flags for FUSIONSOUND, overriding pkg-config
|
||||||
RPI_CFLAGS C compiler flags for RPI, overriding pkg-config
|
|
||||||
RPI_LIBS linker flags for RPI, overriding pkg-config
|
|
||||||
XMKMF Path to xmkmf, Makefile generator for X Window System
|
XMKMF Path to xmkmf, Makefile generator for X Window System
|
||||||
DIRECTFB_CFLAGS
|
DIRECTFB_CFLAGS
|
||||||
C compiler flags for DIRECTFB, overriding pkg-config
|
C compiler flags for DIRECTFB, overriding pkg-config
|
||||||
@ -19937,135 +19943,46 @@ else
|
|||||||
enable_video_rpi=yes
|
enable_video_rpi=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
|
if test x$enable_video = xyes -a x$enable_video_rpi = xyes && \
|
||||||
|
test x$have_loadso = xyes; then
|
||||||
pkg_failed=no
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /opt/vc/include/bcm_host.h" >&5
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPI" >&5
|
$as_echo_n "checking for /opt/vc/include/bcm_host.h... " >&6; }
|
||||||
$as_echo_n "checking for RPI... " >&6; }
|
if ${ac_cv_file__opt_vc_include_bcm_host_h+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
if test -n "$RPI_CFLAGS"; then
|
|
||||||
pkg_cv_RPI_CFLAGS="$RPI_CFLAGS"
|
|
||||||
elif test -n "$PKG_CONFIG"; then
|
|
||||||
if test -n "$PKG_CONFIG" && \
|
|
||||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5
|
|
||||||
($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5
|
|
||||||
ac_status=$?
|
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; }; then
|
|
||||||
pkg_cv_RPI_CFLAGS=`$PKG_CONFIG --cflags "bcm_host brcmegl" 2>/dev/null`
|
|
||||||
else
|
else
|
||||||
pkg_failed=yes
|
test "$cross_compiling" = yes &&
|
||||||
fi
|
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
|
||||||
else
|
if test -r "/opt/vc/include/bcm_host.h"; then
|
||||||
pkg_failed=untried
|
ac_cv_file__opt_vc_include_bcm_host_h=yes
|
||||||
fi
|
|
||||||
if test -n "$RPI_LIBS"; then
|
|
||||||
pkg_cv_RPI_LIBS="$RPI_LIBS"
|
|
||||||
elif test -n "$PKG_CONFIG"; then
|
|
||||||
if test -n "$PKG_CONFIG" && \
|
|
||||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5
|
|
||||||
($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5
|
|
||||||
ac_status=$?
|
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; }; then
|
|
||||||
pkg_cv_RPI_LIBS=`$PKG_CONFIG --libs "bcm_host brcmegl" 2>/dev/null`
|
|
||||||
else
|
else
|
||||||
pkg_failed=yes
|
ac_cv_file__opt_vc_include_bcm_host_h=no
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
pkg_failed=untried
|
|
||||||
fi
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__opt_vc_include_bcm_host_h" >&5
|
||||||
|
$as_echo "$ac_cv_file__opt_vc_include_bcm_host_h" >&6; }
|
||||||
|
if test "x$ac_cv_file__opt_vc_include_bcm_host_h" = xyes; then :
|
||||||
if test $pkg_failed = yes; then
|
have_video_rpi=yes
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
|
|
||||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
|
||||||
_pkg_short_errors_supported=yes
|
|
||||||
else
|
else
|
||||||
_pkg_short_errors_supported=no
|
have_video_rpi=no
|
||||||
fi
|
|
||||||
if test $_pkg_short_errors_supported = yes; then
|
|
||||||
RPI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "bcm_host brcmegl" 2>&1`
|
|
||||||
else
|
|
||||||
RPI_PKG_ERRORS=`$PKG_CONFIG --print-errors "bcm_host brcmegl" 2>&1`
|
|
||||||
fi
|
|
||||||
# Put the nasty error message in config.log where it belongs
|
|
||||||
echo "$RPI_PKG_ERRORS" >&5
|
|
||||||
|
|
||||||
video_rpi=no
|
|
||||||
elif test $pkg_failed = untried; then
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
video_rpi=no
|
|
||||||
else
|
|
||||||
RPI_CFLAGS=$pkg_cv_RPI_CFLAGS
|
|
||||||
RPI_LIBS=$pkg_cv_RPI_LIBS
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
|
||||||
$as_echo "yes" >&6; }
|
|
||||||
video_rpi=yes
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$video_rpi = xno; then
|
fi
|
||||||
if test x$ARCH = xnetbsd; then
|
|
||||||
RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
|
|
||||||
RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
|
|
||||||
else
|
|
||||||
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
|
|
||||||
RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Save the original compiler flags and libraries
|
if test x$have_video_rpi = xyes; then
|
||||||
ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
|
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
|
||||||
|
CFLAGS="$CFLAGS $RPI_CFLAGS"
|
||||||
# Add the Raspberry Pi compiler flags and libraries
|
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
|
||||||
CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
|
||||||
|
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi" >&5
|
|
||||||
$as_echo_n "checking for Raspberry Pi... " >&6; }
|
|
||||||
have_video_rpi=no
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
#include <bcm_host.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
|
|
||||||
bcm_host_init();
|
|
||||||
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
|
|
||||||
have_video_rpi=yes
|
|
||||||
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5
|
|
||||||
$as_echo "$have_video_rpi" >&6; }
|
|
||||||
|
|
||||||
# Restore the compiler flags and libraries
|
|
||||||
CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
|
|
||||||
|
|
||||||
if test x$have_video_rpi = xyes; then
|
|
||||||
CFLAGS="$CFLAGS $RPI_CFLAGS"
|
|
||||||
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
|
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
|
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
|
|
||||||
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
|
|
||||||
|
|
||||||
$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
|
$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
|
||||||
|
|
||||||
SUMMARY_video="${SUMMARY_video} rpi"
|
|
||||||
fi
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define SDL_VIDEO_DRIVER_RPI_DYNAMIC "libbcm_host.so"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
SUMMARY_video="${SUMMARY_video} rpi(dynamic)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20178,8 +20095,6 @@ ac_x_header_dirs='
|
|||||||
/usr/local/include/X11R5
|
/usr/local/include/X11R5
|
||||||
/usr/local/include/X11R4
|
/usr/local/include/X11R4
|
||||||
|
|
||||||
/opt/X11/include
|
|
||||||
|
|
||||||
/usr/X386/include
|
/usr/X386/include
|
||||||
/usr/x386/include
|
/usr/x386/include
|
||||||
/usr/XFree86/include/X11
|
/usr/XFree86/include/X11
|
||||||
|
55
configure.ac
55
configure.ac
@ -1635,49 +1635,20 @@ CheckRPI()
|
|||||||
AC_ARG_ENABLE(video-rpi,
|
AC_ARG_ENABLE(video-rpi,
|
||||||
AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
|
AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
|
||||||
, enable_video_rpi=yes)
|
, enable_video_rpi=yes)
|
||||||
if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
|
if test x$enable_video = xyes -a x$enable_video_rpi = xyes && \
|
||||||
PKG_CHECK_MODULES([RPI], [bcm_host brcmegl], video_rpi=yes, video_rpi=no)
|
test x$have_loadso = xyes; then
|
||||||
|
AC_CHECK_FILE(/opt/vc/include/bcm_host.h, have_video_rpi=yes, have_video_rpi=no)
|
||||||
|
fi
|
||||||
|
|
||||||
if test x$video_rpi = xno; then
|
if test x$have_video_rpi = xyes; then
|
||||||
if test x$ARCH = xnetbsd; then
|
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
|
||||||
RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
|
CFLAGS="$CFLAGS $RPI_CFLAGS"
|
||||||
RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
|
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
|
||||||
else
|
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
|
||||||
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
|
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
|
||||||
RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
|
AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
|
||||||
fi
|
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_RPI_DYNAMIC, "libbcm_host.so", [ ])
|
||||||
fi
|
SUMMARY_video="${SUMMARY_video} rpi(dynamic)"
|
||||||
|
|
||||||
# Save the original compiler flags and libraries
|
|
||||||
ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
|
|
||||||
|
|
||||||
# Add the Raspberry Pi compiler flags and libraries
|
|
||||||
CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS"
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(for Raspberry Pi)
|
|
||||||
have_video_rpi=no
|
|
||||||
AC_TRY_LINK([
|
|
||||||
#include <bcm_host.h>
|
|
||||||
],[
|
|
||||||
bcm_host_init();
|
|
||||||
],[
|
|
||||||
have_video_rpi=yes
|
|
||||||
],[
|
|
||||||
])
|
|
||||||
AC_MSG_RESULT($have_video_rpi)
|
|
||||||
|
|
||||||
# Restore the compiler flags and libraries
|
|
||||||
CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
|
|
||||||
|
|
||||||
if test x$have_video_rpi = xyes; then
|
|
||||||
CFLAGS="$CFLAGS $RPI_CFLAGS"
|
|
||||||
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
|
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
|
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
|
|
||||||
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
|
|
||||||
AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
|
|
||||||
SUMMARY_video="${SUMMARY_video} rpi"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,6 +353,7 @@
|
|||||||
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
|
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
|
||||||
#undef SDL_VIDEO_DRIVER_X11
|
#undef SDL_VIDEO_DRIVER_X11
|
||||||
#undef SDL_VIDEO_DRIVER_RPI
|
#undef SDL_VIDEO_DRIVER_RPI
|
||||||
|
#undef SDL_VIDEO_DRIVER_RPI_DYNAMIC
|
||||||
#undef SDL_VIDEO_DRIVER_KMSDRM
|
#undef SDL_VIDEO_DRIVER_KMSDRM
|
||||||
#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
|
#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
|
||||||
#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
|
#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
#include <android/native_window.h>
|
#include <android/native_window.h>
|
||||||
#include "../core/android/SDL_android.h"
|
#include "../core/android/SDL_android.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if SDL_VIDEO_DRIVER_RPI
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "SDL_sysvideo.h"
|
#include "SDL_sysvideo.h"
|
||||||
#include "SDL_egl_c.h"
|
#include "SDL_egl_c.h"
|
||||||
|
158
src/video/raspberry/SDL_rpidyn.c
Normal file
158
src/video/raspberry/SDL_rpidyn.c
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2021 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_RPI
|
||||||
|
|
||||||
|
#define DEBUG_DYNAMIC_RPI 0
|
||||||
|
|
||||||
|
#include "SDL_rpidyn.h"
|
||||||
|
|
||||||
|
#if DEBUG_DYNAMIC_RPI
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_RPI_DYNAMIC
|
||||||
|
|
||||||
|
#include "SDL_name.h"
|
||||||
|
#include "SDL_loadso.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
void *lib;
|
||||||
|
const char *libname;
|
||||||
|
} rpidynlib;
|
||||||
|
|
||||||
|
static rpidynlib rpilibs[] = {
|
||||||
|
{NULL, SDL_VIDEO_DRIVER_RPI_DYNAMIC}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void *
|
||||||
|
RPI_GetSym(const char *fnname, int *pHasModule)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
void *fn = NULL;
|
||||||
|
for (i = 0; i < SDL_TABLESIZE(rpilibs); i++) {
|
||||||
|
if (rpilibs[i].lib != NULL) {
|
||||||
|
fn = SDL_LoadFunction(rpilibs[i].lib, fnname);
|
||||||
|
if (fn != NULL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG_DYNAMIC_RPI
|
||||||
|
if (fn != NULL)
|
||||||
|
printf("RPI: Found '%s' in %s (%p)\n", fnname, rpilibs[i].libname, fn);
|
||||||
|
else
|
||||||
|
printf("RPI: Symbol '%s' NOT FOUND!\n", fnname);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (fn == NULL)
|
||||||
|
*pHasModule = 0; /* kill this module. */
|
||||||
|
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_DRIVER_RPI_DYNAMIC */
|
||||||
|
|
||||||
|
/* Define all the function pointers and wrappers... */
|
||||||
|
#define SDL_RPI_SYM(rc,fn,params,args,ret) SDL_DYNRPIFN_##fn RPI_##fn = NULL;
|
||||||
|
#include "SDL_rpisym.h"
|
||||||
|
|
||||||
|
/* These SDL_RPI_HAVE_* flags are here whether you have dynamic RPI or not. */
|
||||||
|
#define SDL_RPI_MODULE(modname) int SDL_RPI_HAVE_##modname = 0;
|
||||||
|
#include "SDL_rpisym.h"
|
||||||
|
|
||||||
|
static int rpi_load_refcount = 0;
|
||||||
|
|
||||||
|
void
|
||||||
|
SDL_RPI_UnloadSymbols(void)
|
||||||
|
{
|
||||||
|
/* Don't actually unload if more than one module is using the libs... */
|
||||||
|
if (rpi_load_refcount > 0) {
|
||||||
|
if (--rpi_load_refcount == 0) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* set all the function pointers to NULL. */
|
||||||
|
#define SDL_RPI_MODULE(modname) SDL_RPI_HAVE_##modname = 0;
|
||||||
|
#define SDL_RPI_SYM(rc,fn,params,args,ret) RPI_##fn = NULL;
|
||||||
|
#include "SDL_rpisym.h"
|
||||||
|
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_RPI_DYNAMIC
|
||||||
|
for (i = 0; i < SDL_TABLESIZE(rpilibs); i++) {
|
||||||
|
if (rpilibs[i].lib != NULL) {
|
||||||
|
SDL_UnloadObject(rpilibs[i].lib);
|
||||||
|
rpilibs[i].lib = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* returns non-zero if all needed symbols were loaded. */
|
||||||
|
int
|
||||||
|
SDL_RPI_LoadSymbols(void)
|
||||||
|
{
|
||||||
|
int rc = 1; /* always succeed if not using Dynamic RPI stuff. */
|
||||||
|
|
||||||
|
/* deal with multiple modules (dga, rpi, etc) needing these symbols... */
|
||||||
|
if (rpi_load_refcount++ == 0) {
|
||||||
|
#ifdef SDL_VIDEO_DRIVER_RPI_DYNAMIC
|
||||||
|
int i;
|
||||||
|
int *thismod = NULL;
|
||||||
|
for (i = 0; i < SDL_TABLESIZE(rpilibs); i++) {
|
||||||
|
if (rpilibs[i].libname != NULL) {
|
||||||
|
rpilibs[i].lib = SDL_LoadObject(rpilibs[i].libname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SDL_RPI_MODULE(modname) SDL_RPI_HAVE_##modname = 1; /* default yes */
|
||||||
|
#include "SDL_rpisym.h"
|
||||||
|
|
||||||
|
#define SDL_RPI_MODULE(modname) thismod = &SDL_RPI_HAVE_##modname;
|
||||||
|
#define SDL_RPI_SYM(a,fn,x,y,z) RPI_##fn = (SDL_DYNRPIFN_##fn) RPI_GetSym(#fn,thismod);
|
||||||
|
#include "SDL_rpisym.h"
|
||||||
|
|
||||||
|
if (SDL_RPI_HAVE_BCM) {
|
||||||
|
/* all required symbols loaded. */
|
||||||
|
SDL_ClearError();
|
||||||
|
} else {
|
||||||
|
/* in case something got loaded... */
|
||||||
|
SDL_RPI_UnloadSymbols();
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* no dynamic RPI */
|
||||||
|
|
||||||
|
#define SDL_RPI_MODULE(modname) SDL_RPI_HAVE_##modname = 1; /* default yes */
|
||||||
|
#define SDL_RPI_SYM(a,fn,x,y,z) RPI_##fn = (SDL_DYNRPIFN_##fn) fn;
|
||||||
|
#include "SDL_rpisym.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_DRIVER_RPI */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
51
src/video/raspberry/SDL_rpidyn.h
Normal file
51
src/video/raspberry/SDL_rpidyn.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2021 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"
|
||||||
|
|
||||||
|
#ifndef SDL_rpidyn_h_
|
||||||
|
#define SDL_rpidyn_h_
|
||||||
|
|
||||||
|
#include <bcm_host.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int SDL_RPI_LoadSymbols(void);
|
||||||
|
void SDL_RPI_UnloadSymbols(void);
|
||||||
|
|
||||||
|
/* Declare all the function pointers and wrappers... */
|
||||||
|
#define SDL_RPI_SYM(rc,fn,params,args,ret) \
|
||||||
|
typedef rc (*SDL_DYNRPIFN_##fn) params; \
|
||||||
|
extern SDL_DYNRPIFN_##fn RPI_##fn;
|
||||||
|
#include "SDL_rpisym.h"
|
||||||
|
|
||||||
|
/* These SDL_RPI_HAVE_* flags are here whether you have dynamic RPI or not. */
|
||||||
|
#define SDL_RPI_MODULE(modname) extern int SDL_RPI_HAVE_##modname;
|
||||||
|
#include "SDL_rpisym.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !defined SDL_rpidyn_h_ */
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
@ -89,16 +89,16 @@ RPI_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
|
|||||||
curdata->h = surface->h;
|
curdata->h = surface->h;
|
||||||
|
|
||||||
/* This usage is inspired by Wayland/Weston RPI code, how they figured this out is anyone's guess */
|
/* This usage is inspired by Wayland/Weston RPI code, how they figured this out is anyone's guess */
|
||||||
curdata->resource = vc_dispmanx_resource_create(VC_IMAGE_ARGB8888, surface->w | (surface->pitch << 16), surface->h | (surface->h << 16), &dummy);
|
curdata->resource = RPI_vc_dispmanx_resource_create(VC_IMAGE_ARGB8888, surface->w | (surface->pitch << 16), surface->h | (surface->h << 16), &dummy);
|
||||||
SDL_assert(curdata->resource);
|
SDL_assert(curdata->resource);
|
||||||
vc_dispmanx_rect_set(&dst_rect, 0, 0, curdata->w, curdata->h);
|
RPI_vc_dispmanx_rect_set(&dst_rect, 0, 0, curdata->w, curdata->h);
|
||||||
/* A note from Weston:
|
/* A note from Weston:
|
||||||
* vc_dispmanx_resource_write_data() ignores ifmt,
|
* vc_dispmanx_resource_write_data() ignores ifmt,
|
||||||
* rect.x, rect.width, and uses stride only for computing
|
* rect.x, rect.width, and uses stride only for computing
|
||||||
* the size of the transfer as rect.height * stride.
|
* the size of the transfer as rect.height * stride.
|
||||||
* Therefore we can only write rows starting at x=0.
|
* Therefore we can only write rows starting at x=0.
|
||||||
*/
|
*/
|
||||||
ret = vc_dispmanx_resource_write_data(curdata->resource, VC_IMAGE_ARGB8888, surface->pitch, surface->pixels, &dst_rect);
|
ret = RPI_vc_dispmanx_resource_write_data(curdata->resource, VC_IMAGE_ARGB8888, surface->pitch, surface->pixels, &dst_rect);
|
||||||
SDL_assert (ret == DISPMANX_SUCCESS);
|
SDL_assert (ret == DISPMANX_SUCCESS);
|
||||||
|
|
||||||
cursor->driverdata = curdata;
|
cursor->driverdata = curdata;
|
||||||
@ -131,11 +131,11 @@ RPI_ShowCursor(SDL_Cursor * cursor)
|
|||||||
if (global_cursor != NULL) {
|
if (global_cursor != NULL) {
|
||||||
curdata = (RPI_CursorData *) global_cursor->driverdata;
|
curdata = (RPI_CursorData *) global_cursor->driverdata;
|
||||||
if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
|
if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
|
||||||
update = vc_dispmanx_update_start(0);
|
update = RPI_vc_dispmanx_update_start(0);
|
||||||
SDL_assert(update);
|
SDL_assert(update);
|
||||||
ret = vc_dispmanx_element_remove(update, curdata->element);
|
ret = RPI_vc_dispmanx_element_remove(update, curdata->element);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
ret = vc_dispmanx_update_submit_sync(update);
|
ret = RPI_vc_dispmanx_update_submit_sync(update);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
curdata->element = DISPMANX_NO_HANDLE;
|
curdata->element = DISPMANX_NO_HANDLE;
|
||||||
}
|
}
|
||||||
@ -167,10 +167,10 @@ RPI_ShowCursor(SDL_Cursor * cursor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (curdata->element == DISPMANX_NO_HANDLE) {
|
if (curdata->element == DISPMANX_NO_HANDLE) {
|
||||||
vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16);
|
RPI_vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16);
|
||||||
vc_dispmanx_rect_set(&dst_rect, mouse->x - curdata->hot_x, mouse->y - curdata->hot_y, curdata->w, curdata->h);
|
RPI_vc_dispmanx_rect_set(&dst_rect, mouse->x - curdata->hot_x, mouse->y - curdata->hot_y, curdata->w, curdata->h);
|
||||||
|
|
||||||
update = vc_dispmanx_update_start(0);
|
update = RPI_vc_dispmanx_update_start(0);
|
||||||
SDL_assert(update);
|
SDL_assert(update);
|
||||||
|
|
||||||
env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER);
|
env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER);
|
||||||
@ -178,7 +178,7 @@ RPI_ShowCursor(SDL_Cursor * cursor)
|
|||||||
layer = SDL_atoi(env) + 1;
|
layer = SDL_atoi(env) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
curdata->element = vc_dispmanx_element_add(update,
|
curdata->element = RPI_vc_dispmanx_element_add(update,
|
||||||
data->dispman_display,
|
data->dispman_display,
|
||||||
layer,
|
layer,
|
||||||
&dst_rect,
|
&dst_rect,
|
||||||
@ -189,7 +189,7 @@ RPI_ShowCursor(SDL_Cursor * cursor)
|
|||||||
DISPMANX_NO_HANDLE, // clamp
|
DISPMANX_NO_HANDLE, // clamp
|
||||||
DISPMANX_NO_ROTATE);
|
DISPMANX_NO_ROTATE);
|
||||||
SDL_assert(curdata->element > DISPMANX_NO_HANDLE);
|
SDL_assert(curdata->element > DISPMANX_NO_HANDLE);
|
||||||
ret = vc_dispmanx_update_submit_sync(update);
|
ret = RPI_vc_dispmanx_update_submit_sync(update);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,16 +209,16 @@ RPI_FreeCursor(SDL_Cursor * cursor)
|
|||||||
|
|
||||||
if (curdata != NULL) {
|
if (curdata != NULL) {
|
||||||
if (curdata->element != DISPMANX_NO_HANDLE) {
|
if (curdata->element != DISPMANX_NO_HANDLE) {
|
||||||
update = vc_dispmanx_update_start(0);
|
update = RPI_vc_dispmanx_update_start(0);
|
||||||
SDL_assert(update);
|
SDL_assert(update);
|
||||||
ret = vc_dispmanx_element_remove(update, curdata->element);
|
ret = RPI_vc_dispmanx_element_remove(update, curdata->element);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
ret = vc_dispmanx_update_submit_sync(update);
|
ret = RPI_vc_dispmanx_update_submit_sync(update);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curdata->resource != DISPMANX_NO_HANDLE) {
|
if (curdata->resource != DISPMANX_NO_HANDLE) {
|
||||||
ret = vc_dispmanx_resource_delete(curdata->resource);
|
ret = RPI_vc_dispmanx_resource_delete(curdata->resource);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ RPI_WarpMouseGlobal(int x, int y)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
update = vc_dispmanx_update_start(0);
|
update = RPI_vc_dispmanx_update_start(0);
|
||||||
if (!update) {
|
if (!update) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ RPI_WarpMouseGlobal(int x, int y)
|
|||||||
dst_rect.width = curdata->w;
|
dst_rect.width = curdata->w;
|
||||||
dst_rect.height = curdata->h;
|
dst_rect.height = curdata->h;
|
||||||
|
|
||||||
ret = vc_dispmanx_element_change_attributes(
|
ret = RPI_vc_dispmanx_element_change_attributes(
|
||||||
update,
|
update,
|
||||||
curdata->element,
|
curdata->element,
|
||||||
0,
|
0,
|
||||||
@ -290,7 +290,7 @@ RPI_WarpMouseGlobal(int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Submit asynchronously, otherwise the peformance suffers a lot */
|
/* Submit asynchronously, otherwise the peformance suffers a lot */
|
||||||
ret = vc_dispmanx_update_submit(update, 0, NULL);
|
ret = RPI_vc_dispmanx_update_submit(update, 0, NULL);
|
||||||
if (ret != DISPMANX_SUCCESS) {
|
if (ret != DISPMANX_SUCCESS) {
|
||||||
return SDL_SetError("vc_dispmanx_update_submit() failed");
|
return SDL_SetError("vc_dispmanx_update_submit() failed");
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ RPI_WarpMouseGlobalGraphicOnly(int x, int y)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
update = vc_dispmanx_update_start(0);
|
update = RPI_vc_dispmanx_update_start(0);
|
||||||
if (!update) {
|
if (!update) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ RPI_WarpMouseGlobalGraphicOnly(int x, int y)
|
|||||||
dst_rect.width = curdata->w;
|
dst_rect.width = curdata->w;
|
||||||
dst_rect.height = curdata->h;
|
dst_rect.height = curdata->h;
|
||||||
|
|
||||||
ret = vc_dispmanx_element_change_attributes(
|
ret = RPI_vc_dispmanx_element_change_attributes(
|
||||||
update,
|
update,
|
||||||
curdata->element,
|
curdata->element,
|
||||||
0,
|
0,
|
||||||
@ -346,7 +346,7 @@ RPI_WarpMouseGlobalGraphicOnly(int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Submit asynchronously, otherwise the peformance suffers a lot */
|
/* Submit asynchronously, otherwise the peformance suffers a lot */
|
||||||
ret = vc_dispmanx_update_submit(update, 0, NULL);
|
ret = RPI_vc_dispmanx_update_submit(update, 0, NULL);
|
||||||
if (ret != DISPMANX_SUCCESS) {
|
if (ret != DISPMANX_SUCCESS) {
|
||||||
return SDL_SetError("vc_dispmanx_update_submit() failed");
|
return SDL_SetError("vc_dispmanx_update_submit() failed");
|
||||||
}
|
}
|
||||||
|
57
src/video/raspberry/SDL_rpisym.h
Normal file
57
src/video/raspberry/SDL_rpisym.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2021 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
|
|
||||||
|
#ifndef SDL_RPI_MODULE
|
||||||
|
#define SDL_RPI_MODULE(modname)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SDL_RPI_SYM
|
||||||
|
#define SDL_RPI_SYM(rc,fn,params,args,ret)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SDL_RPI_MODULE(BCM)
|
||||||
|
|
||||||
|
SDL_RPI_SYM(void,bcm_host_init,(void),(),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_display_close,(DISPMANX_DISPLAY_HANDLE_T display),(display),return)
|
||||||
|
SDL_RPI_SYM(DISPMANX_DISPLAY_HANDLE_T,vc_dispmanx_display_open,(uint32_t device),(device),return)
|
||||||
|
SDL_RPI_SYM(DISPMANX_ELEMENT_HANDLE_T,vc_dispmanx_element_add,(DISPMANX_UPDATE_HANDLE_T update, DISPMANX_DISPLAY_HANDLE_T display, int32_t layer, const VC_RECT_T *dest_rect, DISPMANX_RESOURCE_HANDLE_T src, const VC_RECT_T *src_rect, DISPMANX_PROTECTION_T protection, VC_DISPMANX_ALPHA_T *alpha, DISPMANX_CLAMP_T *clamp, DISPMANX_TRANSFORM_T transform),(update,display,layer,dest_rect,src,src_rect,protection,alpha,clamp,transform),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_element_change_attributes,(DISPMANX_UPDATE_HANDLE_T update, DISPMANX_ELEMENT_HANDLE_T element, uint32_t change_flags, int32_t layer, uint8_t opacity, const VC_RECT_T *dest_rect, const VC_RECT_T *src_rect, DISPMANX_RESOURCE_HANDLE_T mask, DISPMANX_TRANSFORM_T transform),(update,element,change_flags,layer,opacity,dest_rect,src_rect,mask,transform),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_element_remove,(DISPMANX_UPDATE_HANDLE_T update, DISPMANX_ELEMENT_HANDLE_T element),(update,element),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_rect_set,(VC_RECT_T *rect, uint32_t x_offset, uint32_t y_offset, uint32_t width, uint32_t height),(rect,x_offset,y_offset,width,height),return)
|
||||||
|
SDL_RPI_SYM(DISPMANX_RESOURCE_HANDLE_T,vc_dispmanx_resource_create,(VC_IMAGE_TYPE_T type, uint32_t width, uint32_t height, uint32_t *native_image_handle),(type,width,height,native_image_handle),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_resource_delete,(DISPMANX_RESOURCE_HANDLE_T res),(res),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_resource_write_data,(DISPMANX_RESOURCE_HANDLE_T res, VC_IMAGE_TYPE_T src_type, int src_pitch, void * src_address, const VC_RECT_T * rect),(res,src_type,src_pitch,src_address,rect),return)
|
||||||
|
SDL_RPI_SYM(DISPMANX_UPDATE_HANDLE_T,vc_dispmanx_update_start,(int32_t priority),(priority),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_update_submit,(DISPMANX_UPDATE_HANDLE_T update, DISPMANX_CALLBACK_FUNC_T cb_func, void *cb_arg),(update,cb_func,cb_arg),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_update_submit_sync,(DISPMANX_UPDATE_HANDLE_T update),(update),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_display_get_info,(DISPMANX_DISPLAY_HANDLE_T display, DISPMANX_MODEINFO_T *pinfo),(display,pinfo),return)
|
||||||
|
SDL_RPI_SYM(int,vc_dispmanx_vsync_callback,(DISPMANX_DISPLAY_HANDLE_T display, DISPMANX_CALLBACK_FUNC_T cb_func, void *cb_arg),(display,cb_func,cb_arg),return)
|
||||||
|
SDL_RPI_SYM(int,vc_tv_get_display_state,(TV_DISPLAY_STATE_T *tvstate),(tvstate),return)
|
||||||
|
SDL_RPI_SYM(int,vc_tv_hdmi_get_property,(HDMI_PROPERTY_PARAM_T *property),(property),return)
|
||||||
|
|
||||||
|
#undef SDL_RPI_MODULE
|
||||||
|
#undef SDL_RPI_SYM
|
||||||
|
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
@ -55,18 +55,20 @@ RPI_Destroy(SDL_VideoDevice * device)
|
|||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->driverdata);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
|
|
||||||
|
SDL_RPI_UnloadSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
RPI_GetRefreshRate()
|
RPI_GetRefreshRate()
|
||||||
{
|
{
|
||||||
TV_DISPLAY_STATE_T tvstate;
|
TV_DISPLAY_STATE_T tvstate;
|
||||||
if (vc_tv_get_display_state( &tvstate ) == 0) {
|
if (RPI_vc_tv_get_display_state( &tvstate ) == 0) {
|
||||||
//The width/height parameters are in the same position in the union
|
//The width/height parameters are in the same position in the union
|
||||||
//for HDMI and SDTV
|
//for HDMI and SDTV
|
||||||
HDMI_PROPERTY_PARAM_T property;
|
HDMI_PROPERTY_PARAM_T property;
|
||||||
property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE;
|
property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE;
|
||||||
vc_tv_hdmi_get_property(&property);
|
RPI_vc_tv_hdmi_get_property(&property);
|
||||||
return property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ?
|
return property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ?
|
||||||
tvstate.display.hdmi.frame_rate * (1000.0f/1001.0f) :
|
tvstate.display.hdmi.frame_rate * (1000.0f/1001.0f) :
|
||||||
tvstate.display.hdmi.frame_rate;
|
tvstate.display.hdmi.frame_rate;
|
||||||
@ -80,6 +82,10 @@ RPI_Create()
|
|||||||
SDL_VideoDevice *device;
|
SDL_VideoDevice *device;
|
||||||
SDL_VideoData *phdata;
|
SDL_VideoData *phdata;
|
||||||
|
|
||||||
|
if (!SDL_RPI_LoadSymbols()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize SDL_VideoDevice structure */
|
/* Initialize SDL_VideoDevice structure */
|
||||||
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||||
if (device == NULL) {
|
if (device == NULL) {
|
||||||
@ -161,13 +167,13 @@ AddDispManXDisplay(const int display_id)
|
|||||||
SDL_DisplayMode current_mode;
|
SDL_DisplayMode current_mode;
|
||||||
SDL_DisplayData *data;
|
SDL_DisplayData *data;
|
||||||
|
|
||||||
handle = vc_dispmanx_display_open(display_id);
|
handle = RPI_vc_dispmanx_display_open(display_id);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
return; /* this display isn't available */
|
return; /* this display isn't available */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vc_dispmanx_display_get_info(handle, &modeinfo) < 0) {
|
if (RPI_vc_dispmanx_display_get_info(handle, &modeinfo) < 0) {
|
||||||
vc_dispmanx_display_close(handle);
|
RPI_vc_dispmanx_display_close(handle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +194,7 @@ AddDispManXDisplay(const int display_id)
|
|||||||
/* Allocate display internal data */
|
/* Allocate display internal data */
|
||||||
data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
|
data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
vc_dispmanx_display_close(handle);
|
RPI_vc_dispmanx_display_close(handle);
|
||||||
return; /* oh well */
|
return; /* oh well */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +209,7 @@ int
|
|||||||
RPI_VideoInit(_THIS)
|
RPI_VideoInit(_THIS)
|
||||||
{
|
{
|
||||||
/* Initialize BCM Host */
|
/* Initialize BCM Host */
|
||||||
bcm_host_init();
|
RPI_bcm_host_init();
|
||||||
|
|
||||||
AddDispManXDisplay(DISPMANX_ID_MAIN_LCD); /* your default display */
|
AddDispManXDisplay(DISPMANX_ID_MAIN_LCD); /* your default display */
|
||||||
AddDispManXDisplay(DISPMANX_ID_FORCE_OTHER); /* an "other" display...maybe DSI-connected screen while HDMI is your main */
|
AddDispManXDisplay(DISPMANX_ID_FORCE_OTHER); /* an "other" display...maybe DSI-connected screen while HDMI is your main */
|
||||||
@ -312,8 +318,8 @@ RPI_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
layer = SDL_atoi(env);
|
layer = SDL_atoi(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispman_update = vc_dispmanx_update_start( 0 );
|
dispman_update = RPI_vc_dispmanx_update_start( 0 );
|
||||||
wdata->dispman_window.element = vc_dispmanx_element_add (dispman_update,
|
wdata->dispman_window.element = RPI_vc_dispmanx_element_add (dispman_update,
|
||||||
displaydata->dispman_display,
|
displaydata->dispman_display,
|
||||||
layer /* layer */,
|
layer /* layer */,
|
||||||
&dst_rect,
|
&dst_rect,
|
||||||
@ -325,7 +331,7 @@ RPI_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
0 /*transform*/);
|
0 /*transform*/);
|
||||||
wdata->dispman_window.width = window->w;
|
wdata->dispman_window.width = window->w;
|
||||||
wdata->dispman_window.height = window->h;
|
wdata->dispman_window.height = window->h;
|
||||||
vc_dispmanx_update_submit_sync(dispman_update);
|
RPI_vc_dispmanx_update_submit_sync(dispman_update);
|
||||||
|
|
||||||
if (!_this->egl_data) {
|
if (!_this->egl_data) {
|
||||||
if (SDL_GL_LoadLibrary(NULL) < 0) {
|
if (SDL_GL_LoadLibrary(NULL) < 0) {
|
||||||
@ -344,7 +350,7 @@ RPI_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
wdata->vsync_cond = SDL_CreateCond();
|
wdata->vsync_cond = SDL_CreateCond();
|
||||||
wdata->vsync_cond_mutex = SDL_CreateMutex();
|
wdata->vsync_cond_mutex = SDL_CreateMutex();
|
||||||
wdata->double_buffer = SDL_TRUE;
|
wdata->double_buffer = SDL_TRUE;
|
||||||
vc_dispmanx_vsync_callback(displaydata->dispman_display, RPI_vsync_callback, (void*)wdata);
|
RPI_vc_dispmanx_vsync_callback(displaydata->dispman_display, RPI_vsync_callback, (void*)wdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup driver data for this window */
|
/* Setup driver data for this window */
|
||||||
@ -372,7 +378,7 @@ RPI_DestroyWindow(_THIS, SDL_Window * window)
|
|||||||
SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
|
SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
|
||||||
SDL_UnlockMutex(data->vsync_cond_mutex);
|
SDL_UnlockMutex(data->vsync_cond_mutex);
|
||||||
|
|
||||||
vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL);
|
RPI_vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL);
|
||||||
|
|
||||||
SDL_DestroyCond(data->vsync_cond);
|
SDL_DestroyCond(data->vsync_cond);
|
||||||
SDL_DestroyMutex(data->vsync_cond_mutex);
|
SDL_DestroyMutex(data->vsync_cond_mutex);
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "EGL/egl.h"
|
#include "EGL/egl.h"
|
||||||
#include "EGL/eglext.h"
|
#include "EGL/eglext.h"
|
||||||
|
|
||||||
|
#include "SDL_rpidyn.h"
|
||||||
|
|
||||||
typedef struct SDL_VideoData
|
typedef struct SDL_VideoData
|
||||||
{
|
{
|
||||||
uint32_t egl_refcount; /* OpenGL ES reference count */
|
uint32_t egl_refcount; /* OpenGL ES reference count */
|
||||||
|
58
test/configure
vendored
58
test/configure
vendored
@ -640,6 +640,7 @@ infodir
|
|||||||
docdir
|
docdir
|
||||||
oldincludedir
|
oldincludedir
|
||||||
includedir
|
includedir
|
||||||
|
runstatedir
|
||||||
localstatedir
|
localstatedir
|
||||||
sharedstatedir
|
sharedstatedir
|
||||||
sysconfdir
|
sysconfdir
|
||||||
@ -720,6 +721,7 @@ datadir='${datarootdir}'
|
|||||||
sysconfdir='${prefix}/etc'
|
sysconfdir='${prefix}/etc'
|
||||||
sharedstatedir='${prefix}/com'
|
sharedstatedir='${prefix}/com'
|
||||||
localstatedir='${prefix}/var'
|
localstatedir='${prefix}/var'
|
||||||
|
runstatedir='${localstatedir}/run'
|
||||||
includedir='${prefix}/include'
|
includedir='${prefix}/include'
|
||||||
oldincludedir='/usr/include'
|
oldincludedir='/usr/include'
|
||||||
docdir='${datarootdir}/doc/${PACKAGE}'
|
docdir='${datarootdir}/doc/${PACKAGE}'
|
||||||
@ -972,6 +974,15 @@ do
|
|||||||
| -silent | --silent | --silen | --sile | --sil)
|
| -silent | --silent | --silen | --sile | --sil)
|
||||||
silent=yes ;;
|
silent=yes ;;
|
||||||
|
|
||||||
|
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||||
|
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||||
|
| --run | --ru | --r)
|
||||||
|
ac_prev=runstatedir ;;
|
||||||
|
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||||
|
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||||
|
| --run=* | --ru=* | --r=*)
|
||||||
|
runstatedir=$ac_optarg ;;
|
||||||
|
|
||||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||||
ac_prev=sbindir ;;
|
ac_prev=sbindir ;;
|
||||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||||
@ -1109,7 +1120,7 @@ fi
|
|||||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||||
libdir localedir mandir
|
libdir localedir mandir runstatedir
|
||||||
do
|
do
|
||||||
eval ac_val=\$$ac_var
|
eval ac_val=\$$ac_var
|
||||||
# Remove trailing slashes.
|
# Remove trailing slashes.
|
||||||
@ -1262,6 +1273,7 @@ Fine tuning of the installation directories:
|
|||||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||||
|
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||||
--includedir=DIR C header files [PREFIX/include]
|
--includedir=DIR C header files [PREFIX/include]
|
||||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||||
@ -3625,34 +3637,8 @@ else
|
|||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
# One or both of the vars are not set, and there is no cached value.
|
# One or both of the vars are not set, and there is no cached value.
|
||||||
ac_x_includes=no
|
ac_x_includes=no ac_x_libraries=no
|
||||||
ac_x_libraries=no
|
rm -f -r conftest.dir
|
||||||
# Do we need to do anything special at all?
|
|
||||||
ac_save_LIBS=$LIBS
|
|
||||||
LIBS="-lX11 $LIBS"
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
XrmInitialize ()
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
# We can compile and link X programs with no special options.
|
|
||||||
ac_x_includes=
|
|
||||||
ac_x_libraries=
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
LIBS="$ac_save_LIBS"
|
|
||||||
# If that didn't work, only try xmkmf and filesystem searches
|
|
||||||
# for native compilation.
|
|
||||||
if test x"$ac_x_includes" = xno && test "$cross_compiling" = no; then :
|
|
||||||
rm -f -r conftest.dir
|
|
||||||
if mkdir conftest.dir; then
|
if mkdir conftest.dir; then
|
||||||
cd conftest.dir
|
cd conftest.dir
|
||||||
cat >Imakefile <<'_ACEOF'
|
cat >Imakefile <<'_ACEOF'
|
||||||
@ -3691,7 +3677,7 @@ _ACEOF
|
|||||||
rm -f -r conftest.dir
|
rm -f -r conftest.dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Standard set of common directories for X headers.
|
# Standard set of common directories for X headers.
|
||||||
# Check X11 before X11Rn because it is often a symlink to the current release.
|
# Check X11 before X11Rn because it is often a symlink to the current release.
|
||||||
ac_x_header_dirs='
|
ac_x_header_dirs='
|
||||||
/usr/X11/include
|
/usr/X11/include
|
||||||
@ -3718,8 +3704,6 @@ ac_x_header_dirs='
|
|||||||
/usr/local/include/X11R5
|
/usr/local/include/X11R5
|
||||||
/usr/local/include/X11R4
|
/usr/local/include/X11R4
|
||||||
|
|
||||||
/opt/X11/include
|
|
||||||
|
|
||||||
/usr/X386/include
|
/usr/X386/include
|
||||||
/usr/x386/include
|
/usr/x386/include
|
||||||
/usr/XFree86/include/X11
|
/usr/XFree86/include/X11
|
||||||
@ -3793,17 +3777,15 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
fi # $ac_x_libraries = no
|
fi # $ac_x_libraries = no
|
||||||
|
|
||||||
fi
|
|
||||||
# Record the results.
|
|
||||||
case $ac_x_includes,$ac_x_libraries in #(
|
case $ac_x_includes,$ac_x_libraries in #(
|
||||||
no,* | *,no | *\'*) :
|
no,* | *,no | *\'*)
|
||||||
# Didn't find X, or a directory has "'" in its name.
|
# Didn't find X, or a directory has "'" in its name.
|
||||||
ac_cv_have_x="have_x=no" ;; #(
|
ac_cv_have_x="have_x=no";; #(
|
||||||
*) :
|
*)
|
||||||
# Record where we found X for the cache.
|
# Record where we found X for the cache.
|
||||||
ac_cv_have_x="have_x=yes\
|
ac_cv_have_x="have_x=yes\
|
||||||
ac_x_includes='$ac_x_includes'\
|
ac_x_includes='$ac_x_includes'\
|
||||||
ac_x_libraries='$ac_x_libraries'" ;;
|
ac_x_libraries='$ac_x_libraries'"
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
;; #(
|
;; #(
|
||||||
|
Loading…
Reference in New Issue
Block a user