Commit 0015ca5c authored by Daniel P. Berrangé's avatar Daniel P. Berrangé Committed by Gerd Hoffmann
Browse files

ui: remove support for SDL1.2 in favour of SDL2

SDL1.2 was deprecated in the 2.12.0 release with:

  commit e52c6ba3
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Mon Jan 15 14:25:33 2018 +0000

    ui: deprecate use of SDL 1.2 in favour of 2.0 series

    The SDL 2.0 release was made in Aug, 2013:

      https://www.libsdl.org/release/



    That will soon be 4 + 1/2 years ago, which is enough time to consider
    the 2.0 series widely supported.

    Thus we deprecate the SDL 1.2 support, which will allow us to delete it
    in the last release of 2018. By this time, SDL 2.0 will be more than 5
    years old.

    Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
    Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
    Message-id: 20180115142533.24585-1-berrange@redhat.com
    Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>

It is thus able to be removed in the 3.1.0 release.

Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
Message-Id: <20180822131554.3398-4-berrange@redhat.com>

[ kraxel: rebase ]

Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 70cc0c1f
Loading
Loading
Loading
Loading
+7 −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
@@ -6220,16 +6185,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!"
@@ -6434,7 +6389,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
+0 −9
Original line number Diff line number Diff line
@@ -17,15 +17,6 @@ they were first deprecated in the 2.10.0 release.
What follows is a list of all features currently marked as
deprecated.

@section Build options

@subsection SDL 1.2

Previously QEMU has supported building against both SDL 1.2
and 2.0 series APIs. Support for the SDL 1.2 builds will be
discontinued, so maintainers should switch to using SDL 2.0,
which is the default.

@section System emulator command line arguments

@subsection -machine enforce-config-section=on|off (since 3.1)
+0 −5
Original line number Diff line number Diff line
@@ -17,15 +17,10 @@ common-obj-$(call lnot,$(CONFIG_VNC)) += vnc-stubs.o

# ui-sdl module
common-obj-$(CONFIG_SDL) += sdl.mo
ifeq ($(CONFIG_SDLABI),1.2)
sdl.mo-objs := sdl.o sdl_zoom.o
endif
ifeq ($(CONFIG_SDLABI),2.0)
sdl.mo-objs := sdl2.o sdl2-input.o sdl2-2d.o
ifeq ($(CONFIG_OPENGL),y)
sdl.mo-objs += sdl2-gl.o
endif
endif
sdl.mo-cflags := $(SDL_CFLAGS)
sdl.mo-libs := $(SDL_LIBS)

ui/sdl.c

deleted100644 → 0
+0 −1027

File deleted.

Preview size limit exceeded, changes collapsed.

ui/sdl_zoom.c

deleted100644 → 0
+0 −93
Original line number Diff line number Diff line
/*
 * SDL_zoom - surface scaling
 * 
 * Copyright (c) 2009 Citrix Systems, Inc.
 *
 * Derived from: SDL_rotozoom,  LGPL (c) A. Schiffler from the SDL_gfx library.
 * Modifications by Stefano Stabellini.
 *
 * This work is licensed under the terms of the GNU GPL version 2.
 * See the COPYING file in the top-level directory.
 *
 */

#include "qemu/osdep.h"
#include "sdl_zoom.h"

static void sdl_zoom_rgb16(SDL_Surface *src, SDL_Surface *dst, int smooth,
                           SDL_Rect *dst_rect);
static void sdl_zoom_rgb32(SDL_Surface *src, SDL_Surface *dst, int smooth,
                           SDL_Rect *dst_rect);

#define BPP 32
#include  "sdl_zoom_template.h"
#undef BPP
#define BPP 16
#include  "sdl_zoom_template.h"
#undef BPP

int sdl_zoom_blit(SDL_Surface *src_sfc, SDL_Surface *dst_sfc, int smooth,
                  SDL_Rect *in_rect)
{
    SDL_Rect zoom, src_rect;
    int extra;

    /* Grow the size of the modified rectangle to avoid edge artefacts */
    src_rect.x = (in_rect->x > 0) ? (in_rect->x - 1) : 0;
    src_rect.y = (in_rect->y > 0) ? (in_rect->y - 1) : 0;

    src_rect.w = in_rect->w + 1;
    if (src_rect.x + src_rect.w > src_sfc->w)
        src_rect.w = src_sfc->w - src_rect.x;

    src_rect.h = in_rect->h + 1;
    if (src_rect.y + src_rect.h > src_sfc->h)
        src_rect.h = src_sfc->h - src_rect.y;

    /* (x,y) : round down */
    zoom.x = (int)(((float)(src_rect.x * dst_sfc->w)) / (float)(src_sfc->w));
    zoom.y = (int)(((float)(src_rect.y * dst_sfc->h)) / (float)(src_sfc->h));

    /* (w,h) : round up */
    zoom.w = (int)( ((double)((src_rect.w * dst_sfc->w) + (src_sfc->w - 1))) /
                     (double)(src_sfc->w));

    zoom.h = (int)( ((double)((src_rect.h * dst_sfc->h) + (src_sfc->h - 1))) /
                     (double)(src_sfc->h));

    /* Account for any (x,y) rounding by adding one-source-pixel's worth
     * of destination pixels and then edge checking.
     */

    extra = ((dst_sfc->w-1) / src_sfc->w) + 1;

    if ((zoom.x + zoom.w) < (dst_sfc->w - extra))
        zoom.w += extra;
    else
        zoom.w = dst_sfc->w - zoom.x;

    extra = ((dst_sfc->h-1) / src_sfc->h) + 1;

    if ((zoom.y + zoom.h) < (dst_sfc->h - extra))
        zoom.h += extra;
    else
        zoom.h = dst_sfc->h - zoom.y;

    /* The rectangle (zoom.x, zoom.y, zoom.w, zoom.h) is the area on the
     * destination surface that needs to be updated.
     */
    if (src_sfc->format->BitsPerPixel == 32)
        sdl_zoom_rgb32(src_sfc, dst_sfc, smooth, &zoom);
    else if (src_sfc->format->BitsPerPixel == 16)
        sdl_zoom_rgb16(src_sfc, dst_sfc, smooth, &zoom);
    else {
        fprintf(stderr, "pixel format not supported\n");
        return -1;
    }

    /* Return the rectangle of the update to the caller */
    *in_rect = zoom;

    return 0;
}
Loading