mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-26 17:19:22 +00:00
emu: Add SDL2 support
So all we did with the surface in SDL1 was split into window, surface, renderer and texture. Instead of drawing into the surface and then flipping, you build your pixels, then update a texture and then copy the texture to the renderer. Here we use an empty RGB surface to hold our pixels, which enables us to keep most of the code the same. The SDL1 code has been adjusted to refer to "surface" instead of "window" when trying to access the properties of the surface. This approaches the configuration by adding a new --enable-grub-emu-sdl2 argument. If set to yes, or auto detected, it disables SDL1 support automatically. This duplicates the sdl module block in Makefile.core.def which may be something to be aware of, but we also don't want to build separate module. Fixes: https://bugs.debian.org/1038035 Signed-off-by: Julian Andres Klode <julian.klode@canonical.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
d131335d4e
commit
17d6ac1a7d
5 files changed
+151
-24
No files matched your search
@@ -1586,6 +1586,10 @@ else
|
||||
fi
|
||||
AC_SUBST([BOOT_TIME_STATS])
|
||||
|
||||
AC_ARG_ENABLE([grub-emu-sdl2],
|
||||
[AS_HELP_STRING([--enable-grub-emu-sdl2],
|
||||
[build and install the `grub-emu' debugging utility with SDL2 support (default=guessed)])])
|
||||
|
||||
AC_ARG_ENABLE([grub-emu-sdl],
|
||||
[AS_HELP_STRING([--enable-grub-emu-sdl],
|
||||
[build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
|
||||
@@ -1595,6 +1599,28 @@ AC_ARG_ENABLE([grub-emu-pci],
|
||||
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
|
||||
|
||||
if test "$platform" = emu; then
|
||||
if test x"$enable_grub_emu_sdl2" = xno ; then
|
||||
grub_emu_sdl2_excuse="explicitly disabled"
|
||||
fi
|
||||
[if [ x"$grub_emu_sdl2_excuse" = x ]; then
|
||||
# Check for libSDL libraries.]
|
||||
PKG_CHECK_MODULES([SDL2], [sdl2], [
|
||||
AC_DEFINE([HAVE_SDL2], [1], [Define to 1 if you have SDL2 library.])
|
||||
AC_SUBST(HAVE_SDL2)],
|
||||
[grub_emu_sdl2_excuse="libSDL2 libraries are required to build \`grub-emu' with SDL2 support"])
|
||||
[fi]
|
||||
if test x"enable_grub_emu_sdl2" = xyes && test x"$grub_emu_sdl2_excuse" != x ; then
|
||||
AC_MSG_ERROR([SDL2 support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl2_excuse)])
|
||||
fi
|
||||
if test x"$grub_emu_sdl2_excuse" = x ; then
|
||||
enable_grub_emu_sdl2=yes
|
||||
else
|
||||
enable_grub_emu_sdl2=no
|
||||
fi
|
||||
if test x"$enable_grub_emu_sdl2" = xyes ; then
|
||||
grub_emu_sdl_excuse="disabled by sdl2"
|
||||
fi
|
||||
|
||||
|
||||
if test x"$enable_grub_emu_sdl" = xno ; then
|
||||
grub_emu_sdl_excuse="explicitly disabled"
|
||||
@@ -1643,12 +1669,14 @@ AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
|
||||
enable_grub_emu_pci=no
|
||||
fi
|
||||
|
||||
AC_SUBST([enable_grub_emu_sdl2])
|
||||
AC_SUBST([enable_grub_emu_sdl])
|
||||
AC_SUBST([enable_grub_emu_pci])
|
||||
|
||||
else
|
||||
|
||||
# Ignore --enable-emu-* if platform is not emu
|
||||
enable_grub_emu_sdl2=no
|
||||
enable_grub_emu_sdl=no
|
||||
enable_grub_emu_pci=no
|
||||
fi
|
||||
@@ -2075,6 +2103,7 @@ AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
|
||||
AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
|
||||
|
||||
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_SDL2], [test x$enable_grub_emu_sdl2 = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
||||
@@ -2153,6 +2182,11 @@ echo "*******************************************************"
|
||||
echo GRUB2 will be compiled with following components:
|
||||
echo Platform: "$target_cpu"-"$platform"
|
||||
if [ x"$platform" = xemu ]; then
|
||||
if [ x"$grub_emu_sdl2_excuse" = x ]; then
|
||||
echo SDL2 support for grub-emu: Yes
|
||||
else
|
||||
echo SDL2 support for grub-emu: No "($grub_emu_sdl2_excuse)"
|
||||
fi
|
||||
if [ x"$grub_emu_sdl_excuse" = x ]; then
|
||||
echo SDL support for grub-emu: Yes
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user