Skip to content

Commit

Permalink
mmiyoo drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
Daft-Freak committed Oct 26, 2023
1 parent b424665 commit 0094cd5
Show file tree
Hide file tree
Showing 60 changed files with 8,910 additions and 77 deletions.
108 changes: 70 additions & 38 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -995,6 +996,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
Expand Down Expand Up @@ -1247,6 +1249,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
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)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1384,7 +1395,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1537,6 +1548,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -20926,34 +20938,8 @@ else
$as_echo_n "(cached) " >&6
else
# One or both of the vars are not set, and there is no cached value.
ac_x_includes=no
ac_x_libraries=no
# 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
ac_x_includes=no ac_x_libraries=no
rm -f -r conftest.dir
if mkdir conftest.dir; then
cd conftest.dir
cat >Imakefile <<'_ACEOF'
Expand Down Expand Up @@ -20992,7 +20978,7 @@ _ACEOF
rm -f -r conftest.dir
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.
ac_x_header_dirs='
/usr/X11/include
Expand All @@ -21019,8 +21005,6 @@ ac_x_header_dirs='
/usr/local/include/X11R5
/usr/local/include/X11R4

/opt/X11/include

/usr/X386/include
/usr/x386/include
/usr/XFree86/include/X11
Expand Down Expand Up @@ -21094,17 +21078,15 @@ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi # $ac_x_libraries = no

fi
# Record the results.
case $ac_x_includes,$ac_x_libraries in #(
no,* | *,no | *\'*) :
no,* | *,no | *\'*)
# 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.
ac_cv_have_x="have_x=yes\
ac_x_includes='$ac_x_includes'\
ac_x_libraries='$ac_x_libraries'" ;;
ac_x_libraries='$ac_x_libraries'"
esac
fi
;; #(
Expand Down Expand Up @@ -23131,6 +23113,39 @@ $as_echo "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h
fi
}

CheckMMiyooVideo()
{
if test x$enable_video = xyes; then

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


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

SOURCES="$SOURCES $srcdir/src/video/mmiyoo/*.c"
have_video=yes
EXTRA_CFLAGS="$EXTRA_CFLAGS -fPIC -mcpu=cortex-a7 -mfpu=neon-vfpv4 -O3 -I/opt/mmiyoo/arm-buildroot-linux-gnueabihf/sysroot/usr/include/SDL2"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L. -lEGL -lGLESv2 -lrt -lSDL2_image -lSDL2_ttf -ljson-c"
SUMMARY_video="${SUMMARY_video} mmiyoo"
fi
}

CheckMMiyooAudio()
{
if test x$enable_audio = xyes; then

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

SOURCES="$SOURCES $srcdir/src/audio/mmiyoo/*.c"
have_audio=yes
if test x$HOST = xarm-linux; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMMIYOO -mcpu=cortex-a7 -mfpu=neon-vfpv4 -O3"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Lmmiyoo/libs -lmi_ao -lshmvar -lmi_common -lmi_sys -lmi_gfx"
fi
SUMMARY_audio="${SUMMARY_audio} mmiyoo"
fi
}

# Check whether --enable-video-opengl was given.
if test "${enable_video_opengl+set}" = set; then :
enableval=$enable_video_opengl;
Expand Down Expand Up @@ -25766,6 +25781,13 @@ $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
CheckQNXVideo
;;
esac

case "$MOD" in
*mmiyoo*) ARCH=mmiyoo
CheckMMiyooVideo
;;
esac

CheckVisibilityHidden
CheckDeclarationAfterStatement
CheckDummyVideo
Expand Down Expand Up @@ -25882,6 +25904,9 @@ $as_echo "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h
nto)
CheckQNXAudio
;;
mmiyoo)
CheckMMiyooAudio
;;
esac
fi
# Set up files for the joystick library
Expand Down Expand Up @@ -25913,6 +25938,13 @@ $as_echo "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
have_joystick=yes
;;
mmiyoo)

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

SOURCES="$SOURCES $srcdir/src/joystick/mmiyoo/*.c"
have_joystick=yes
;;
esac
fi
# Set up files for the haptic library
Expand Down
42 changes: 42 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,33 @@ CheckQNXAudio()
fi
}

CheckMMiyooVideo()
{
if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_MMIYOO, 1, [ ])
AC_DEFINE(SDL_VIDEO_RENDER_MMIYOO, 1, [ ])
SOURCES="$SOURCES $srcdir/src/video/mmiyoo/*.c"
have_video=yes
EXTRA_CFLAGS="$EXTRA_CFLAGS -fPIC -mcpu=cortex-a7 -mfpu=neon-vfpv4 -O3 -I/opt/mmiyoo/arm-buildroot-linux-gnueabihf/sysroot/usr/include/SDL2"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L. -lEGL -lGLESv2 -lrt -lSDL2_image -lSDL2_ttf -ljson-c"
SUMMARY_video="${SUMMARY_video} mmiyoo"
fi
}

CheckMMiyooAudio()
{
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_MMIYOO, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/mmiyoo/*.c"
have_audio=yes
if test x$HOST = xarm-linux; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMMIYOO -mcpu=cortex-a7 -mfpu=neon-vfpv4 -O3"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Lmmiyoo/libs -lmi_ao -lshmvar -lmi_common -lmi_sys -lmi_gfx"
fi
SUMMARY_audio="${SUMMARY_audio} mmiyoo"
fi
}

dnl Check to see if OpenGL support is desired
AC_ARG_ENABLE(video-opengl,
[AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [default=yes]])],
Expand Down Expand Up @@ -3665,6 +3692,13 @@ case "$host" in
CheckQNXVideo
;;
esac

case "$MOD" in
*mmiyoo*) ARCH=mmiyoo
CheckMMiyooVideo
;;
esac

CheckVisibilityHidden
CheckDeclarationAfterStatement
CheckDummyVideo
Expand Down Expand Up @@ -3769,6 +3803,9 @@ case "$host" in
nto)
CheckQNXAudio
;;
mmiyoo)
CheckMMiyooAudio
;;
esac
fi
# Set up files for the joystick library
Expand All @@ -3794,6 +3831,11 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
have_joystick=yes
;;
mmiyoo)
AC_DEFINE(SDL_JOYSTICK_MMIYOO, 1, [ ])
SOURCES="$SOURCES $srcdir/src/joystick/mmiyoo/*.c"
have_joystick=yes
;;
esac
fi
# Set up files for the haptic library
Expand Down
5 changes: 5 additions & 0 deletions include/SDL_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,9 @@
/* Enable dynamic libsamplerate support */
#undef SDL_LIBSAMPLERATE_DYNAMIC

#undef SDL_VIDEO_DRIVER_MMIYOO
#undef SDL_VIDEO_RENDER_MMIYOO
#undef SDL_AUDIO_DRIVER_MMIYOO
#undef SDL_JOYSTICK_MMIYOO

#endif /* SDL_config_h_ */
17 changes: 17 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
export MOD=mmiyoo
export CROSS=/opt/mmiyoo/bin/arm-linux-gnueabihf-
export CC=${CROSS}gcc
export AR=${CROSS}ar
export AS=${CROSS}as
export LD=${CROSS}ld
export CXX=${CROSS}g++
export HOST=arm-linux

echo "Building SDL2 for Miyoo Mini / Miyoo Mini Plus"
if [ ! -z "$1" ] && [ "$1" == "config" ]; then
./autogen.sh
./configure --disable-joystick-virtual --disable-sensor --disable-power --disable-alsa --disable-diskaudio --disable-video-x11 --disable-video-wayland --disable-video-kmsdrm --disable-video-vulkan --disable-dbus --disable-ime --disable-fcitx --disable-hidapi --disable-pulseaudio --disable-sndio --disable-libudev --disable-jack --disable-video-opengl --disable-video-opengles --disable-video-opengles2 --disable-oss --disable-dummyaudio --disable-video-dummy --host=${HOST}
fi

make -j4 V=99
3 changes: 3 additions & 0 deletions src/audio/SDL_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ static const AudioBootStrap *const bootstrap[] = {
#endif
#if SDL_AUDIO_DRIVER_DUMMY
&DUMMYAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_MMIYOO
&MMIYOOAUDIO_bootstrap,
#endif
NULL
};
Expand Down
1 change: 1 addition & 0 deletions src/audio/SDL_sysaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ extern AudioBootStrap PSPAUDIO_bootstrap;
extern AudioBootStrap VITAAUD_bootstrap;
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
extern AudioBootStrap OS2AUDIO_bootstrap;
extern AudioBootStrap MMIYOOAUDIO_bootstrap;

#endif /* SDL_sysaudio_h_ */

Expand Down
Loading

0 comments on commit 0094cd5

Please sign in to comment.