Commit a1bc3e7d authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20190201-pull-request' into staging



ui: fix build with SDL disabled, drop SDL1 support.

# gpg: Signature made Fri 01 Feb 2019 12:30:47 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20190201-pull-request:
  ui: remove support for SDL1.2 in favour of SDL2
  hw/display/milkymist-tmu2: Move inlined code from header to source
  hw/display/milkymist-tmu2: Explicit the dependency to both X11 / OpenGL
  configure: LM32 Milkymist Texture Mapping Unit (tmu2) also depends of X11
  hw/display: Move Milkymist specific hardware out of common-obj list

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents cfe6c547 0015ca5c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ F: disas/lm32.c
F: hw/lm32/
F: hw/*/lm32_*
F: hw/*/milkymist-*
F: include/hw/display/milkymist_tmu2.h
F: include/hw/char/lm32_juart.h
F: include/hw/lm32/
F: tests/tcg/lm32/
+17 −53
Original line number Diff line number Diff line
@@ -348,7 +348,6 @@ docs=""
fdt=""
netmap="no"
sdl=""
sdlabi=""
sdl_image=""
virtfs=""
mpath=""
@@ -577,7 +576,6 @@ query_pkg_config() {
    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
}
pkg_config=query_pkg_config
sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"

# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
@@ -1044,8 +1042,6 @@ for opt do
  ;;
  --enable-sdl) sdl="yes"
  ;;
  --with-sdlabi=*) sdlabi="$optarg"
  ;;
  --disable-sdl-image) sdl_image="no"
  ;;
  --enable-sdl-image) sdl_image="yes"
@@ -1711,7 +1707,6 @@ disabled with --disable-FEATURE, default is enabled if available:
  nettle          nettle cryptography support
  gcrypt          libgcrypt cryptography support
  sdl             SDL UI
  --with-sdlabi     select preferred SDL ABI 1.2 or 2.0
  sdl_image       SDL Image support for icons
  gtk             gtk UI
  vte             vte support for the gtk UI
@@ -2927,37 +2922,11 @@ fi

sdl_probe ()
{
  sdl_too_old=no
  if test "$sdlabi" = ""; then
      if $pkg_config --exists "sdl2"; then
          sdlabi=2.0
      elif $pkg_config --exists "sdl"; then
          sdlabi=1.2
      else
          sdlabi=2.0
      fi
  fi

  if test $sdlabi = "2.0"; then
      sdl_config=$sdl2_config
      sdlname=sdl2
      sdlconfigname=sdl2_config
  elif test $sdlabi = "1.2"; then
      sdlname=sdl
      sdlconfigname=sdl_config
  else
      error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
  fi

  if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
    sdl_config=$sdlconfigname
  fi

  if $pkg_config $sdlname --exists; then
    sdlconfig="$pkg_config $sdlname"
  if $pkg_config sdl2 --exists; then
    sdlconfig="$pkg_config sdl2"
    sdlversion=$($sdlconfig --modversion 2>/dev/null)
  elif has ${sdl_config}; then
    sdlconfig="$sdl_config"
    sdlconfig="$sdl2_config"
    sdlversion=$($sdlconfig --version)
  else
    if test "$sdl" = "yes" ; then
@@ -2979,8 +2948,8 @@ EOF
  sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
  sdl_cflags="$sdl_cflags -Wno-undef"  # workaround 2.0.8 bug
  if test "$static" = "yes" ; then
    if $pkg_config $sdlname --exists; then
      sdl_libs=$($pkg_config $sdlname --static --libs 2>/dev/null)
    if $pkg_config sdl2 --exists; then
      sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null)
    else
      sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
    fi
@@ -2988,11 +2957,7 @@ EOF
    sdl_libs=$($sdlconfig --libs 2>/dev/null)
  fi
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
    if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then
      sdl_too_old=yes
    else
    sdl=yes
    fi

    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
    if test "$sdl" = "yes" -a "$static" = "yes" ; then
@@ -3008,7 +2973,7 @@ EOF
    fi # static link
  else # sdl not found
    if test "$sdl" = "yes" ; then
      feature_not_found "sdl" "Install SDL devel"
      feature_not_found "sdl" "Install SDL2 devel"
    fi
    sdl=no
  fi # sdl compile test
@@ -4047,6 +4012,16 @@ EOF
  fi
fi

if test "$opengl" = "yes" -a "$have_x11" = "yes"; then
  for target in $target_list; do
    case $target in
      lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL
        need_x11=yes
      ;;
    esac
  done
fi

##########################################
# libxml2 probe
if test "$libxml2" != "no" ; then
@@ -6221,16 +6196,6 @@ echo "docker $docker"
echo "libpmem support   $libpmem"
echo "libudev           $libudev"

if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
fi

if test "$sdlabi" = "1.2"; then
    echo
    echo "WARNING: Use of SDL 1.2 is deprecated and will be removed in"
    echo "WARNING: future releases. Please switch to using SDL 2.0"
fi

if test "$supported_cpu" = "no"; then
    echo
    echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
@@ -6435,7 +6400,6 @@ if test "$have_x11" = "yes" -a "$need_x11" = "yes"; then
fi
if test "$sdl" = "yes" ; then
  echo "CONFIG_SDL=m" >> $config_host_mak
  echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
  echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
  if test "$sdl_image" = "yes" ; then
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

CONFIG_LM32=y
CONFIG_MILKYMIST=y
CONFIG_MILKYMIST_TMU2=$(CONFIG_OPENGL)
CONFIG_MILKYMIST_TMU2=$(call land,$(CONFIG_X11),$(CONFIG_OPENGL))
CONFIG_FRAMEBUFFER=y
CONFIG_PTIMER=y
CONFIG_PFLASH_CFI01=y
+4 −4
Original line number Diff line number Diff line
@@ -25,12 +25,12 @@ common-obj-$(CONFIG_BOCHS_DISPLAY) += edid-region.o
common-obj-$(CONFIG_BLIZZARD) += blizzard.o
common-obj-$(CONFIG_EXYNOS4) += exynos4210_fimd.o
common-obj-$(CONFIG_FRAMEBUFFER) += framebuffer.o
common-obj-$(CONFIG_MILKYMIST) += milkymist-vgafb.o
obj-$(CONFIG_MILKYMIST) += milkymist-vgafb.o
common-obj-$(CONFIG_ZAURUS) += tc6393xb.o

common-obj-$(CONFIG_MILKYMIST_TMU2) += milkymist-tmu2.o
milkymist-tmu2.o-cflags := $(X11_CFLAGS)
milkymist-tmu2.o-libs := $(X11_LIBS)
obj-$(CONFIG_MILKYMIST_TMU2) += milkymist-tmu2.o
milkymist-tmu2.o-cflags := $(X11_CFLAGS) $(OPENGL_CFLAGS)
milkymist-tmu2.o-libs := $(X11_LIBS) $(OPENGL_LIBS)

obj-$(CONFIG_OMAP) += omap_dss.o
obj-$(CONFIG_OMAP) += omap_lcdc.o
+49 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "hw/display/milkymist_tmu2.h"

#include <X11/Xlib.h>
#include <epoxy/gl.h>
@@ -499,3 +500,51 @@ static void milkymist_tmu2_register_types(void)
}

type_init(milkymist_tmu2_register_types)

DeviceState *milkymist_tmu2_create(hwaddr base, qemu_irq irq)
{
    DeviceState *dev;
    Display *d;
    GLXFBConfig *configs;
    int nelements;
    int ver_major, ver_minor;

    /* check that GLX will work */
    d = XOpenDisplay(NULL);
    if (d == NULL) {
        return NULL;
    }

    if (!glXQueryVersion(d, &ver_major, &ver_minor)) {
        /*
         * Yeah, sometimes getting the GLX version can fail.
         * Isn't X beautiful?
         */
        XCloseDisplay(d);
        return NULL;
    }

    if ((ver_major < 1) || ((ver_major == 1) && (ver_minor < 3))) {
        printf("Your GLX version is %d.%d,"
          "but TMU emulation needs at least 1.3. TMU disabled.\n",
          ver_major, ver_minor);
        XCloseDisplay(d);
        return NULL;
    }

    configs = glXChooseFBConfig(d, 0, glx_fbconfig_attr, &nelements);
    if (configs == NULL) {
        XCloseDisplay(d);
        return NULL;
    }

    XFree(configs);
    XCloseDisplay(d);

    dev = qdev_create(NULL, TYPE_MILKYMIST_TMU2);
    qdev_init_nofail(dev);
    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);

    return dev;
}
Loading