Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 224 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,8 @@ enable_video_directfb
enable_directfb_shared
enable_video_kmsdrm
enable_kmsdrm_shared
enable_video_atomic
enable_atomic_shared
enable_video_dummy
enable_video_opengl
enable_video_opengles
Expand Down Expand Up @@ -1668,6 +1670,8 @@ Optional Features:
dynamically load directfb support [default=yes]
--enable-video-kmsdrm use KMSDRM video driver [default=yes]
--enable-kmsdrm-shared dynamically load kmsdrm support [default=yes]
--enable-video-atomic use ATOMIC video driver [default=yes]
--enable-atomic-shared dynamically load atomic support [default=yes]
--enable-video-dummy use dummy video driver [default=yes]
--enable-video-opengl include OpenGL support [default=yes]
--enable-video-opengles include OpenGL ES support [default=yes]
Expand Down Expand Up @@ -22264,6 +22268,224 @@ $as_echo "$kmsdrm_shared" >&6; }
fi
}

CheckATOMIC()
{
# Check whether --enable-video-atomic was given.
if test "${enable_video_atomic+set}" = set; then :
enableval=$enable_video_atomic;
else
enable_video_atomic=yes
fi


if test x$enable_video = xyes && \
test x$enable_video_atomic = xyes && \
test x$video_opengl_egl = xyes; then

video_atomic=no


pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm >= 1.4.82" >&5
$as_echo_n "checking for libdrm >= 1.4.82... " >&6; }

if test -n "$LIBDRM_CFLAGS"; then
pkg_cv_LIBDRM_CFLAGS="$LIBDRM_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5
($PKG_CONFIG --exists --print-errors "libdrm >= 1.4.82") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBDRM_CFLAGS=`$PKG_CONFIG --cflags "libdrm >= 1.4.82" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBDRM_LIBS"; then
pkg_cv_LIBDRM_LIBS="$LIBDRM_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5
($PKG_CONFIG --exists --print-errors "libdrm >= 1.4.82") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBDRM_LIBS=`$PKG_CONFIG --libs "libdrm >= 1.4.82" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi



if test $pkg_failed = yes; then
{ $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
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBDRM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdrm >= 1.4.82" 2>&1`
else
LIBDRM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdrm >= 1.4.82" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBDRM_PKG_ERRORS" >&5

libdrm_avail=no
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
libdrm_avail=no
else
LIBDRM_CFLAGS=$pkg_cv_LIBDRM_CFLAGS
LIBDRM_LIBS=$pkg_cv_LIBDRM_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
libdrm_avail=yes
fi

pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gbm >= 11.1.0" >&5
$as_echo_n "checking for gbm >= 11.1.0... " >&6; }

if test -n "$LIBGBM_CFLAGS"; then
pkg_cv_LIBGBM_CFLAGS="$LIBGBM_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5
($PKG_CONFIG --exists --print-errors "gbm >= 11.1.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBGBM_CFLAGS=`$PKG_CONFIG --cflags "gbm >= 11.1.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBGBM_LIBS"; then
pkg_cv_LIBGBM_LIBS="$LIBGBM_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5
($PKG_CONFIG --exists --print-errors "gbm >= 11.1.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBGBM_LIBS=`$PKG_CONFIG --libs "gbm >= 11.1.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi



if test $pkg_failed = yes; then
{ $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
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBGBM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gbm >= 11.1.0" 2>&1`
else
LIBGBM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gbm >= 11.1.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBGBM_PKG_ERRORS" >&5

libgbm_avail=no
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
libgbm_avail=no
else
LIBGBM_CFLAGS=$pkg_cv_LIBGBM_CFLAGS
LIBGBM_LIBS=$pkg_cv_LIBGBM_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
libgbm_avail=yes
fi

if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
video_atomic=yes
fi

if test x$video_atomic = xyes; then
# Check whether --enable-atomic-shared was given.
if test "${enable_atomic_shared+set}" = set; then :
enableval=$enable_atomic_shared;
else
enable_atomic_shared=yes
fi



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

SOURCES="$SOURCES $srcdir/src/video/atomic/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for atomic video backend dynamic loading support" >&5
$as_echo_n "checking for atomic video backend dynamic loading support... " >&6; }
atomic_shared=no
drm_lib=`find_lib "libdrm.so.*" "$DRM_LIBS"`
gbm_lib=`find_lib "libgbm.so.*" "$DRM_LIBS"`
if test x$have_loadso != xyes && \
test x$enable_atomic_shared = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic atomic loading" >&5
$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic atomic loading" >&2;}
fi
if test x$have_loadso = xyes && \
test x$enable_atomic_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
atomic_shared=yes

cat >>confdefs.h <<_ACEOF
#define SDL_VIDEO_DRIVER_ATOMIC_DYNAMIC "$drm_lib"
_ACEOF


cat >>confdefs.h <<_ACEOF
#define SDL_VIDEO_DRIVER_ATOMIC_DYNAMIC_GBM "$gbm_lib"
_ACEOF


cat >>confdefs.h <<_ACEOF
#define HAVE_ATOMIC_SHARED "TRUE"
_ACEOF

SUMMARY_video="${SUMMARY_video} atomic(dynamic)"
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
SUMMARY_video="${SUMMARY_video} atomic"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $atomic_shared" >&5
$as_echo "$atomic_shared" >&6; }
have_video=yes
fi
fi
}

CheckDummyVideo()
{
# Check whether --enable-video-dummy was given.
Expand Down Expand Up @@ -24923,9 +25145,10 @@ $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
CheckRPI
CheckX11
CheckDirectFB
# Need to check for EGL first because KMSDRM and Wayland depends on it.
# Need to check for EGL first because KMSDRM, KMSDRM-ATOMIC and Wayland depends on it.
CheckEGL
CheckKMSDRM
CheckATOMIC
CheckGLX
CheckOpenGL
CheckOpenGLES
Expand Down
57 changes: 56 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,60 @@ CheckKMSDRM()
fi
}

dnl Find ATOMIC
CheckATOMIC()
{
AC_ARG_ENABLE(video-atomic,
[AS_HELP_STRING([--enable-video-atomic], [use ATOMIC video driver [default=no]])],
, enable_video_atomic=yes)

if test x$enable_video = xyes && \
test x$enable_video_atomic = xyes && \
test x$video_opengl_egl = xyes; then

video_atomic=no

PKG_CHECK_MODULES([LIBDRM], [libdrm >= 1.4.82], libdrm_avail=yes, libdrm_avail=no)
PKG_CHECK_MODULES([LIBGBM], [gbm >= 11.1.0], libgbm_avail=yes, libgbm_avail=no)

if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
video_atomic=yes
fi

if test x$video_atomic = xyes; then
AC_ARG_ENABLE(atomic-shared,
[AS_HELP_STRING([--enable-atomic-shared], [dynamically load atomic support [default=yes]])],
, enable_atomic_shared=yes)

AC_DEFINE(SDL_VIDEO_DRIVER_ATOMIC, 1, [ ])
SOURCES="$SOURCES $srcdir/src/video/atomic/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"

AC_MSG_CHECKING(for atomic video backend dynamic loading support)
atomic_shared=no
drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
if test x$have_loadso != xyes && \
test x$enable_atomic_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic atomic loading])
fi
if test x$have_loadso = xyes && \
test x$enable_atomic_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
atomic_shared=yes
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_ATOMIC_DYNAMIC, "$drm_lib", [ ])
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_ATOMIC_DYNAMIC_GBM, "$gbm_lib", [ ])
AC_DEFINE_UNQUOTED(HAVE_ATOMIC_SHARED, "TRUE", [ ])
SUMMARY_video="${SUMMARY_video} atomic(dynamic)"
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
SUMMARY_video="${SUMMARY_video} atomic"
fi
AC_MSG_RESULT($atomic_shared)
have_video=yes
fi
fi
}

dnl rcg04172001 Set up the Null video driver.
CheckDummyVideo()
{
Expand Down Expand Up @@ -3548,9 +3602,10 @@ case "$host" in
CheckRPI
CheckX11
CheckDirectFB
# Need to check for EGL first because KMSDRM and Wayland depends on it.
# Need to check for EGL first because KMSDRM, KMSDRM-ATOMIC and Wayland depends on it.
CheckEGL
CheckKMSDRM
CheckATOMIC
CheckGLX
CheckOpenGL
CheckOpenGLES
Expand Down
3 changes: 3 additions & 0 deletions include/SDL_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@
#undef SDL_VIDEO_DRIVER_KMSDRM
#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC
#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM
#undef SDL_VIDEO_DRIVER_ATOMIC
#undef SDL_VIDEO_DRIVER_ATOMIC_DYNAMIC
#undef SDL_VIDEO_DRIVER_ATOMIC_DYNAMIC_GBM
#undef SDL_VIDEO_DRIVER_ANDROID
#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
Expand Down
4 changes: 2 additions & 2 deletions include/SDL_syswm.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ typedef void *EGLSurface;
#endif
#endif /* SDL_PROTOTYPES_ONLY */

#if defined(SDL_VIDEO_DRIVER_KMSDRM)
#if defined(SDL_VIDEO_DRIVER_KMSDRM) || defined(SDL_VIDEO_ATOMIC)
struct gbm_device;
#endif

Expand Down Expand Up @@ -325,7 +325,7 @@ struct SDL_SysWMinfo
} vivante;
#endif

#if defined(SDL_VIDEO_DRIVER_KMSDRM)
#if defined(SDL_VIDEO_DRIVER_KMSDRM) || defined(SDL_VIDEO_ATOMIC)
struct
{
int dev_index; /**< Device index (ex: the X in /dev/dri/cardX) */
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_sysvideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ extern VideoBootStrap PSP_bootstrap;
extern VideoBootStrap VITA_bootstrap;
extern VideoBootStrap RPI_bootstrap;
extern VideoBootStrap KMSDRM_bootstrap;
extern VideoBootStrap KMSDRM_LEGACY_bootstrap;
extern VideoBootStrap ATOMIC_bootstrap;
extern VideoBootStrap DUMMY_bootstrap;
extern VideoBootStrap Wayland_bootstrap;
extern VideoBootStrap NACL_bootstrap;
Expand Down
3 changes: 3 additions & 0 deletions src/video/SDL_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_KMSDRM
&KMSDRM_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_ATOMIC
&ATOMIC_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_RPI
&RPI_bootstrap,
#endif
Expand Down
Loading