kmsdrm: Make this build with significantly older system libraries.

This allows one to build Raspberry Pi versions on an ancient version of
Raspbian and get both the KMSDRM and RPI video targets built into SDL, giving
maximum binary compatibility from linking against an older glibc, etc, but
also making one library that can access video on all RPi models and OS
releases.
This commit is contained in:
Ryan C. Gordon 2020-10-26 09:49:09 -04:00
parent f0c5841714
commit 010d5fba93
3 changed files with 26 additions and 18 deletions

32
configure vendored
View File

@ -21987,12 +21987,12 @@ 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 >= 2.4.82\""; } >&5
($PKG_CONFIG --exists --print-errors "libdrm >= 2.4.82") 2>&5
{ { $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 >= 2.4.82" 2>/dev/null`
pkg_cv_LIBDRM_CFLAGS=`$PKG_CONFIG --cflags "libdrm >= 1.4.82" 2>/dev/null`
else
pkg_failed=yes
fi
@ -22003,12 +22003,12 @@ 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 >= 2.4.82\""; } >&5
($PKG_CONFIG --exists --print-errors "libdrm >= 2.4.82") 2>&5
{ { $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 >= 2.4.82" 2>/dev/null`
pkg_cv_LIBDRM_LIBS=`$PKG_CONFIG --libs "libdrm >= 1.4.82" 2>/dev/null`
else
pkg_failed=yes
fi
@ -22028,9 +22028,9 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBDRM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libdrm >= 2.4.82" 2>&1`
LIBDRM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libdrm >= 1.4.82" 2>&1`
else
LIBDRM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libdrm >= 2.4.82" 2>&1`
LIBDRM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libdrm >= 1.4.82" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBDRM_PKG_ERRORS" >&5
@ -22056,12 +22056,12 @@ 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 >= 17.1.0\""; } >&5
($PKG_CONFIG --exists --print-errors "gbm >= 17.1.0") 2>&5
{ { $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 >= 17.1.0" 2>/dev/null`
pkg_cv_LIBGBM_CFLAGS=`$PKG_CONFIG --cflags "gbm >= 11.1.0" 2>/dev/null`
else
pkg_failed=yes
fi
@ -22072,12 +22072,12 @@ 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 >= 17.1.0\""; } >&5
($PKG_CONFIG --exists --print-errors "gbm >= 17.1.0") 2>&5
{ { $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 >= 17.1.0" 2>/dev/null`
pkg_cv_LIBGBM_LIBS=`$PKG_CONFIG --libs "gbm >= 11.1.0" 2>/dev/null`
else
pkg_failed=yes
fi
@ -22097,9 +22097,9 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBGBM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gbm >= 17.1.0" 2>&1`
LIBGBM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gbm >= 11.1.0" 2>&1`
else
LIBGBM_PKG_ERRORS=`$PKG_CONFIG --print-errors "gbm >= 17.1.0" 2>&1`
LIBGBM_PKG_ERRORS=`$PKG_CONFIG --print-errors "gbm >= 11.1.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBGBM_PKG_ERRORS" >&5

View File

@ -2246,8 +2246,8 @@ AS_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]
if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
video_kmsdrm=no
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.4.82], libdrm_avail=yes, libdrm_avail=no)
PKG_CHECK_MODULES([LIBGBM], [gbm >= 17.1.0], libgbm_avail=yes, libgbm_avail=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_kmsdrm=yes

View File

@ -46,6 +46,14 @@
#include <errno.h>
#include <poll.h>
/* for older KMSDRM headers... */
#ifndef DRM_FORMAT_MOD_VENDOR_NONE
#define DRM_FORMAT_MOD_VENDOR_NONE 0
#endif
#ifndef DRM_FORMAT_MOD_LINEAR
#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0)
#endif
#define KMSDRM_DRI_PATH "/dev/dri/"
#define AMDGPU_COMPAT 1