misc ui patches, mostly sdl related.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVAafbAAoJEEy22O7T6HE4t4kP/0uizYcn7yoSt2JREKmn6/lh
 dc3cAxuwcxEZ8KXUxWSGCSheQDDdYAaKyK06pl8GUncnRSUOpSvcRvjN6IE7GVZP
 6VQu5cdE69rPKPOIxvGApLbXvwqkngYCiDyKdFiJ/pjn4E7zA5yjv4YOa8LkQsMU
 L9iqPF5NogQ9yZiTepeWULJU/6kqhOAb4gfueGEC5SrePoa8E7chaBF8EjYt+IBB
 E1BJjZ12mtXHgG5mDVL7ysWrPTXMqDJSGKdFfV8uICFK21E0pN4uG6U4mq6+t3rY
 g2KJ3X//3KSSg9vJnNGpFSTSuXqRmf6cgpK0I+r+v99mKpuNRPNPSYBT0GWEfZUX
 TYxL3fTw03PqSHsL/Ep+ppmWOwwNPsryahoCBtPUHNnd48HluTlV62ONyQah8XTk
 TzAaeuGcbAwMwrLjzn92Qz4Dx/8Bdnj67tqGSYVqv+dOKlko41sgY0Q0n9TU1t6P
 oEOEfQvrnfot8Wey4tZ3jAfdxrf1Jr3bc1zehzVWCRusBTt7iCFpWi8kMA6PEfGX
 aivQXBbBJBzJ6B91asKLizjvVBiNvavy+BDWIBNYH++lou9htrdWg23qpH7etWOE
 S9IIFIR57P1+gSdr9k4Bed4B0A9qz5GQA6I1CHHyQSz6S8PU2s8YKC2viljr+hyn
 riFN11We9O20RVL1k7PX
 =OoVt
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-20150312-2' into staging

misc ui patches, mostly sdl related.

# gpg: Signature made Thu Mar 12 14:51:07 2015 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-sdl-20150312-2:
  pixman: add a bunch of PIXMAN_BE_* defines for 32bpp
  Allow the use of X11 from a non standard location.
  configure: opengl overhaul
  sdl: Fix crash when calling sdl_switch() with NULL surface
  sdl: Refresh debug statements

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-03-13 14:03:31 +00:00
commit dea4635998
8 changed files with 81 additions and 32 deletions

59
configure vendored
View File

@ -309,7 +309,7 @@ rbd=""
smartcard_nss="" smartcard_nss=""
libusb="" libusb=""
usb_redir="" usb_redir=""
glx="" opengl=""
zlib="yes" zlib="yes"
lzo="" lzo=""
snappy="" snappy=""
@ -1027,9 +1027,9 @@ for opt do
;; ;;
--enable-vhost-scsi) vhost_scsi="yes" --enable-vhost-scsi) vhost_scsi="yes"
;; ;;
--disable-glx) glx="no" --disable-opengl) opengl="no"
;; ;;
--enable-glx) glx="yes" --enable-opengl) opengl="yes"
;; ;;
--disable-rbd) rbd="no" --disable-rbd) rbd="no"
;; ;;
@ -2084,6 +2084,15 @@ if test "$sparse" != "no" ; then
fi fi
fi fi
##########################################
# X11 probe
x11_cflags=
x11_libs=-lX11
if $pkg_config --exists "x11"; then
x11_cflags=`$pkg_config --cflags x11`
x11_libs=`$pkg_config --libs x11`
fi
########################################## ##########################################
# GTK probe # GTK probe
@ -2111,7 +2120,8 @@ if test "$gtk" != "no"; then
gtk_cflags=`$pkg_config --cflags $gtkpackage` gtk_cflags=`$pkg_config --cflags $gtkpackage`
gtk_libs=`$pkg_config --libs $gtkpackage` gtk_libs=`$pkg_config --libs $gtkpackage`
if $pkg_config --exists "$gtkx11package >= $gtkversion"; then if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
gtk_libs="$gtk_libs -lX11" gtk_cflags="$gtk_cflags $x11_cflags"
gtk_libs="$gtk_libs $x11_libs"
fi fi
libs_softmmu="$gtk_libs $libs_softmmu" libs_softmmu="$gtk_libs $libs_softmmu"
gtk="yes" gtk="yes"
@ -2236,8 +2246,9 @@ if test "$sdl" = "yes" ; then
#endif #endif
int main(void) { return 0; } int main(void) { return 0; }
EOF EOF
if compile_prog "$sdl_cflags" "$sdl_libs" ; then if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
sdl_libs="$sdl_libs -lX11" sdl_cflags="$sdl_cflags $x11_cflags"
sdl_libs="$sdl_libs $x11_libs"
fi fi
libs_softmmu="$sdl_libs $libs_softmmu" libs_softmmu="$sdl_libs $libs_softmmu"
fi fi
@ -3107,23 +3118,20 @@ fi
libs_softmmu="$libs_softmmu $fdt_libs" libs_softmmu="$libs_softmmu $fdt_libs"
########################################## ##########################################
# GLX probe, used by milkymist-tmu2 # opengl probe (for sdl2, milkymist-tmu2)
if test "$glx" != "no" ; then if test "$opengl" != "no" ; then
glx_libs="-lGL -lX11" opengl_pkgs="gl glx"
cat > $TMPC << EOF if $pkg_config $opengl_pkgs x11; then
#include <X11/Xlib.h> opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
#include <GL/gl.h> opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
#include <GL/glx.h> opengl=yes
int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
EOF
if compile_prog "" "-lGL -lX11" ; then
glx=yes
else else
if test "$glx" = "yes" ; then if test "$opengl" = "yes" ; then
feature_not_found "glx" "Install GL devel (e.g. MESA)" feature_not_found "opengl" "Install GL devel (e.g. MESA)"
fi fi
glx_libs= opengl_cflags=""
glx=no opengl_libs=""
opengl=no
fi fi
fi fi
@ -4390,7 +4398,7 @@ echo "xfsctl support $xfs"
echo "nss used $smartcard_nss" echo "nss used $smartcard_nss"
echo "libusb $libusb" echo "libusb $libusb"
echo "usb net redir $usb_redir" echo "usb net redir $usb_redir"
echo "GLX support $glx" echo "OpenGL support $opengl"
echo "libiscsi support $libiscsi" echo "libiscsi support $libiscsi"
echo "libnfs support $libnfs" echo "libnfs support $libnfs"
echo "build guest agent $guest_agent" echo "build guest agent $guest_agent"
@ -4756,9 +4764,10 @@ if test "$usb_redir" = "yes" ; then
echo "CONFIG_USB_REDIR=y" >> $config_host_mak echo "CONFIG_USB_REDIR=y" >> $config_host_mak
fi fi
if test "$glx" = "yes" ; then if test "$opengl" = "yes" ; then
echo "CONFIG_GLX=y" >> $config_host_mak echo "CONFIG_OPENGL=y" >> $config_host_mak
echo "GLX_LIBS=$glx_libs" >> $config_host_mak echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
fi fi
if test "$lzo" = "yes" ; then if test "$lzo" = "yes" ; then

View File

@ -2,7 +2,7 @@
CONFIG_LM32=y CONFIG_LM32=y
CONFIG_MILKYMIST=y CONFIG_MILKYMIST=y
CONFIG_MILKYMIST_TMU2=$(CONFIG_GLX) CONFIG_MILKYMIST_TMU2=$(CONFIG_OPENGL)
CONFIG_FRAMEBUFFER=y CONFIG_FRAMEBUFFER=y
CONFIG_PTIMER=y CONFIG_PTIMER=y
CONFIG_PFLASH_CFI01=y CONFIG_PFLASH_CFI01=y

View File

@ -20,7 +20,8 @@ common-obj-$(CONFIG_ZAURUS) += tc6393xb.o
ifeq ($(CONFIG_MILKYMIST_TMU2),y) ifeq ($(CONFIG_MILKYMIST_TMU2),y)
common-obj-y += milkymist-tmu2.o common-obj-y += milkymist-tmu2.o
libs_softmmu += $(GLX_LIBS) milkymist-tmu2.o-cflags := $(OPENGL_CFLAGS)
libs_softmmu += $(OPENGL_LIBS)
endif endif
obj-$(CONFIG_OMAP) += omap_dss.o obj-$(CONFIG_OMAP) += omap_dss.o

View File

@ -86,7 +86,7 @@ static inline DeviceState *milkymist_pfpu_create(hwaddr base,
return dev; return dev;
} }
#ifdef CONFIG_GLX #ifdef CONFIG_OPENGL
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <GL/glx.h> #include <GL/glx.h>
static const int glx_fbconfig_attr[] = { static const int glx_fbconfig_attr[] = {
@ -100,7 +100,7 @@ static const int glx_fbconfig_attr[] = {
static inline DeviceState *milkymist_tmu2_create(hwaddr base, static inline DeviceState *milkymist_tmu2_create(hwaddr base,
qemu_irq irq) qemu_irq irq)
{ {
#ifdef CONFIG_GLX #ifdef CONFIG_OPENGL
DeviceState *dev; DeviceState *dev;
Display *d; Display *d;
GLXFBConfig *configs; GLXFBConfig *configs;

View File

@ -114,6 +114,7 @@ extern int graphic_width;
extern int graphic_height; extern int graphic_height;
extern int graphic_depth; extern int graphic_depth;
extern DisplayType display_type; extern DisplayType display_type;
extern int display_opengl;
extern const char *keyboard_layout; extern const char *keyboard_layout;
extern int win2k_install_hack; extern int win2k_install_hack;
extern int alt_grab; extern int alt_grab;

View File

@ -27,8 +27,24 @@
#ifdef HOST_WORDS_BIGENDIAN #ifdef HOST_WORDS_BIGENDIAN
# define PIXMAN_BE_r8g8b8 PIXMAN_r8g8b8 # define PIXMAN_BE_r8g8b8 PIXMAN_r8g8b8
# define PIXMAN_BE_x8r8g8b8 PIXMAN_x8r8g8b8
# define PIXMAN_BE_a8r8g8b8 PIXMAN_a8r8g8b8
# define PIXMAN_BE_b8g8r8x8 PIXMAN_b8g8r8x8
# define PIXMAN_BE_b8g8r8a8 PIXMAN_b8g8r8a8
# define PIXMAN_BE_r8g8b8x8 PIXMAN_r8g8b8x8
# define PIXMAN_BE_r8g8b8a8 PIXMAN_r8g8b8a8
# define PIXMAN_BE_x8b8g8r8 PIXMAN_x8b8g8r8
# define PIXMAN_BE_a8b8g8r8 PIXMAN_a8b8g8r8
#else #else
# define PIXMAN_BE_r8g8b8 PIXMAN_b8g8r8 # define PIXMAN_BE_r8g8b8 PIXMAN_b8g8r8
# define PIXMAN_BE_x8r8g8b8 PIXMAN_b8g8r8x8
# define PIXMAN_BE_a8r8g8b8 PIXMAN_b8g8r8a8
# define PIXMAN_BE_b8g8r8x8 PIXMAN_x8r8g8b8
# define PIXMAN_BE_b8g8r8a8 PIXMAN_a8r8g8b8
# define PIXMAN_BE_r8g8b8x8 PIXMAN_x8b8g8r8
# define PIXMAN_BE_r8g8b8a8 PIXMAN_a8b8g8r8
# define PIXMAN_BE_x8b8g8r8 PIXMAN_r8g8b8x8
# define PIXMAN_BE_a8b8g8r8 PIXMAN_r8g8b8a8
#endif #endif
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -61,16 +61,24 @@ static SDL_PixelFormat host_format;
static int scaling_active = 0; static int scaling_active = 0;
static Notifier mouse_mode_notifier; static Notifier mouse_mode_notifier;
#if 0
#define DEBUG_SDL
#endif
static void sdl_update(DisplayChangeListener *dcl, static void sdl_update(DisplayChangeListener *dcl,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
// printf("updating x=%d y=%d w=%d h=%d\n", x, y, w, h);
SDL_Rect rec; SDL_Rect rec;
rec.x = x; rec.x = x;
rec.y = y; rec.y = y;
rec.w = w; rec.w = w;
rec.h = h; rec.h = h;
#ifdef DEBUG_SDL
printf("SDL: Updating x=%d y=%d w=%d h=%d (scaling: %d)\n",
x, y, w, h, scaling_active);
#endif
if (guest_screen) { if (guest_screen) {
if (!scaling_active) { if (!scaling_active) {
SDL_BlitSurface(guest_screen, &rec, real_screen, &rec); SDL_BlitSurface(guest_screen, &rec, real_screen, &rec);
@ -89,7 +97,9 @@ static void do_sdl_resize(int width, int height, int bpp)
int flags; int flags;
SDL_Surface *tmp_screen; SDL_Surface *tmp_screen;
// printf("resizing to %d %d\n", w, h); #ifdef DEBUG_SDL
printf("SDL: Resizing to %dx%d bpp %d\n", width, height, bpp);
#endif
flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL; flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL;
if (gui_fullscreen) { if (gui_fullscreen) {
@ -125,12 +135,13 @@ static void do_sdl_resize(int width, int height, int bpp)
static void sdl_switch(DisplayChangeListener *dcl, static void sdl_switch(DisplayChangeListener *dcl,
DisplaySurface *new_surface) DisplaySurface *new_surface)
{ {
PixelFormat pf = qemu_pixelformat_from_pixman(new_surface->format); PixelFormat pf;
/* temporary hack: allows to call sdl_switch to handle scaling changes */ /* temporary hack: allows to call sdl_switch to handle scaling changes */
if (new_surface) { if (new_surface) {
surface = new_surface; surface = new_surface;
} }
pf = qemu_pixelformat_from_pixman(surface->format);
if (!scaling_active) { if (!scaling_active) {
do_sdl_resize(surface_width(surface), surface_height(surface), 0); do_sdl_resize(surface_width(surface), surface_height(surface), 0);
@ -143,6 +154,12 @@ static void sdl_switch(DisplayChangeListener *dcl,
if (guest_screen != NULL) { if (guest_screen != NULL) {
SDL_FreeSurface(guest_screen); SDL_FreeSurface(guest_screen);
} }
#ifdef DEBUG_SDL
printf("SDL: Creating surface with masks: %08x %08x %08x %08x\n",
pf.rmask, pf.gmask, pf.bmask, pf.amask);
#endif
guest_screen = SDL_CreateRGBSurfaceFrom guest_screen = SDL_CreateRGBSurfaceFrom
(surface_data(surface), (surface_data(surface),
surface_width(surface), surface_height(surface), surface_width(surface), surface_height(surface),
@ -486,6 +503,10 @@ static void sdl_scale(int width, int height)
{ {
int bpp = real_screen->format->BitsPerPixel; int bpp = real_screen->format->BitsPerPixel;
#ifdef DEBUG_SDL
printf("SDL: Scaling to %dx%d bpp %d\n", width, height, bpp);
#endif
if (bpp != 16 && bpp != 32) { if (bpp != 16 && bpp != 32) {
bpp = 32; bpp = 32;
} }

1
vl.c
View File

@ -130,6 +130,7 @@ static int data_dir_idx;
const char *bios_name = NULL; const char *bios_name = NULL;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
DisplayType display_type = DT_DEFAULT; DisplayType display_type = DT_DEFAULT;
int display_opengl;
static int display_remote; static int display_remote;
const char* keyboard_layout = NULL; const char* keyboard_layout = NULL;
ram_addr_t ram_size; ram_addr_t ram_size;