Skip to contentSkip to conversation

qemu-ggi support

PATCH New Bernhard Fischer 3 participants 5 messages Sep 5, 2005 – Dec 10, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-ggi support

Hi,

Attached patch adds support to qemu to display via GGI (www.ggi-project.org).

GGI has several so called display-targets, i.e. you can render your application's output to one of
X11
wsfb
vgl
vgagl
vcsa
svgalib
quartz
memory
ipc
glide
fbdev
directx
etc. without the need to port the application to each of these libraries on your own.

Missing features:
- mouse support is not implemented

thank you,
Bernhard

configure +40 -2
diff -ruNp qemu.oorig/configure qemu/configure
@@ -83,6 +83,7 @@ fmod_inc=""
 linux="no"
 kqemu="no"
 kernel_path=""
+ggi_dir="/usr"
 cocoa="no"
 check_gfx="yes"
 
@@ -169,6 +170,10 @@ for opt do
   ;;
   --static) static="yes"
   ;;
+  --disable-ggi) ggi="no"
+  ;;
+  --ggi-path=*) ggi_dir=${opt#--ggi-path=}
+  ;;
   --disable-sdl) sdl="no"
   ;;
   --enable-fmod) fmod="yes"
@@ -268,6 +273,28 @@ if $cc -fno-reorder-blocks -fno-optimize
    have_gcc3_options="yes"
 fi
 
+if test "$ggi" != "no"
+then
+##########################################
+# GGI probe
+ggi=no
+#ggi_static=no
+cat > $TMPC << EOF
+#include <ggi/ggi.h>
+int main( void ) { return (ggiInit()<0)?1:0; }
+EOF
+#not pretty, but good enough for initial testing
+GGI_INCLUDES="-I$ggi_dir/include"
+GGI_LIBS="-L$ggi_dir/lib -lggi -lgii -lgg"
+case "`uname -s`" in 
+*FreeBSD*|*OpenBSD*) GGI_LIBS="$GGI_LIBS -pthread";;
+esac
+
+if $cc -o $TMPE $GGI_INCLUDES $TMPC $GGI_LIBS 2> /dev/null ; then
+ggi=yes
+fi
+fi # --disable-ggi
+
 ##########################################
 # SDL probe
 
@@ -344,6 +371,7 @@ echo "  --cc=CC                  use C c
 echo "  --host-cc=CC             use C compiler CC [$cc] for dyngen etc."
 echo "  --make=MAKE              use specified make [$make]"
 echo "  --static                 enable static build [$static]"
+echo "  --ggi-path=DIR           use GGI installed in dir [$ggi_dir]"
 echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
 echo "  --enable-adlib           enable Adlib emulation"
 echo "  --enable-fmod            enable FMOD audio output driver"
@@ -433,6 +461,7 @@ echo "static build      $static"
 if test "$darwin" = "yes" ; then
     echo "Cocoa support     $cocoa"
 fi
+echo "GGI support       $ggi"
 echo "SDL support       $sdl"
 if test "$sdl" != "no" ; then
     echo "SDL static link   $sdl_static"
@@ -623,8 +652,8 @@ if expr $target : '.*-user' > /dev/null 
 fi
 
 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
-	-a "$sdl" = "no" -a "$cocoa" = "no" ; then
-    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
+	-a "$ggi" = "no" -a "$sdl" = "no" -a "$cocoa" = "no" ; then
+    echo "ERROR: QEMU requires GGI or SDL or Cocoa for graphical output"
     echo "To build QEMU with graphical output configure with --disable-gfx-check"
     echo "Note that this will disable all output from the virtual graphics card."
     exit 1;
@@ -715,6 +744,15 @@ if test "$target_cpu" = "arm" -o "$targe
   echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
   echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
 fi
+
+# GGI
+if test "$ggi" = "yes" ; then
+  echo "#define CONFIG_GGI 1" >> $config_h
+  echo "CONFIG_GGI=yes" >> $config_mak
+  echo "GGI_INCLUDES= $GGI_INCLUDES" >> $config_mak
+  echo "GGI_LIBS= $GGI_LIBS" >> $config_mak
+fi
+
 # sdl defines
 
 if test "$target_user_only" = "no"; then
ggi.c +219 -0

219 lines not on this page · raw message

ggi_keysym.h +277 -0

277 lines not on this page · raw message

Makefile.target +10 -3
diff -ruNp qemu.oorig/Makefile.target qemu/Makefile.target
@@ -151,6 +151,8 @@ endif
 #########################################################
 
 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+
+DEFINES+=#-DDEBUG_GGI -DDEBUG_TRACE_GGI #-DDEBUG -DDEBUG_KBD -DDEBUG_MOUSE -DDEBUG_GDB 
 LIBS+=-lm
 ifndef CONFIG_USER_ONLY
 LIBS+=-lz
@@ -311,6 +313,9 @@ endif
 ifdef CONFIG_GDBSTUB
 VL_OBJS+=gdbstub.o 
 endif
+ifdef CONFIG_GGI
+VL_OBJS+=ggi.o
+endif
 ifdef CONFIG_SDL
 VL_OBJS+=sdl.o
 endif
@@ -347,14 +352,16 @@ endif
 ifeq ($(ARCH),ia64)
 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
 endif
-
 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
-	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(GGI_LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+
+ggi.o: ggi.c keymaps.c ggi_keysym.h x_keymap.c
+	$(CC) $(CFLAGS) $(DEFINES) $(GGI_INCLUDES) -c -o $@ $<
 
 cocoa.o: cocoa.m
 	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 
-sdl.o: sdl.c keymaps.c sdl_keysym.h
+sdl.o: sdl.c keymaps.c sdl_keysym.h x_keymap.c
 	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
 
 sdlaudio.o: sdlaudio.c
sdl.c +1 -64

71 lines not on this page · raw message

vl.c +3 -1
diff -ruNp qemu.oorig/vl.c qemu/vl.c
@@ -3727,7 +3727,9 @@ int main(int argc, char **argv)
     if (nographic) {
         dumb_display_init(ds);
     } else {
-#if defined(CONFIG_SDL)
+#if defined(CONFIG_GGI)
+        ggi_display_init(ds, full_screen);
+#elif defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen);
 #elif defined(CONFIG_COCOA)
         cocoa_display_init(ds, full_screen);
vl.h +4 -0
diff -ruNp qemu.oorig/vl.h qemu/vl.h
@@ -609,6 +609,10 @@ void pci_cirrus_vga_init(PCIBus *bus, Di
 void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base, 
                          unsigned long vga_ram_offset, int vga_ram_size);
 
+#ifdef CONFIG_GGI
+void ggi_display_init(DisplayState *ds, int full_screen);
+#endif
+
 /* sdl.c */
 void sdl_display_init(DisplayState *ds, int full_screen);
 
x_keymap.c +97 -0

97 lines not on this page · raw message

#1 lore raw

PATCH 1/1 qemu-ggi support

Quoted 15 lines · Bernhard Fischer

Hi,

Attached patch adds support to qemu to display via GGI (www.ggi-project.org).

GGI has several so called display-targets, i.e. you can render your application's output to one of
X11
wsfb
vgl
vgagl
vcsa
svgalib
quartz
memory

Quoted 8 lines

ipc
glide
fbdev
directx
terminfo
libaa
etc. without the need to port the application to each of these libraries on your own.

In other words, you do not have to write support for e.g. cocoa, curses etc in qemu but can use libgii (the input part) and libggi (the output part) to transparently use the I/O the host-system you are running on does provide.

Quoted 3 lines

Missing features:
- mouse support is not implemented

A variety of OS are supported, umong them linux, *BSD, MacOS, Windows, etc.

Rediffed against current cvs.

Per default the path where ggi is searched for is /usr (your distribution normally installs libraries there). If you happen to have gii and ggi somewhere else, do e.g. this to install qemu in /opt/qemu

$ ./configure --ggi-path=/opt/ggi --prefix=/opt/qemu --cc=gcc-3.4 &&
make

Cheers,
Bernhard

configure +53 -4
diff -X excl -rduNp qemu.oorig/configure qemu/configure
@@ -86,6 +86,7 @@ fmod_inc=""
 linux="no"
 kqemu="no"
 kernel_path=""
+ggi_dir="/usr"
 cocoa="no"
 check_gfx="yes"
 check_gcc="yes"
@@ -147,6 +148,8 @@ fi
 
 for opt do
   case "$opt" in
+  --help|-h) show_help=yes
+  ;;
   --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
   ;;
   --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2`
@@ -173,6 +176,10 @@ for opt do
   ;;
   --static) static="yes"
   ;;
+  --disable-ggi) ggi="no"
+  ;;
+  --ggi-path=*) ggi_dir=${opt#--ggi-path=}
+  ;;
   --disable-sdl) sdl="no"
   ;;
   --enable-coreaudio) coreaudio="yes"
@@ -297,6 +304,28 @@ EOF
     fi
 fi
 
+if test "$ggi" != "no"
+then
+##########################################
+# GGI probe
+ggi=no
+#ggi_static=no
+cat > $TMPC << EOF
+#include <ggi/ggi.h>
+int main( void ) { return (ggiInit()<0)?1:0; }
+EOF
+#not pretty, but good enough for initial testing
+GGI_INCLUDES="-I$ggi_dir/include"
+GGI_LIBS="-L$ggi_dir/lib -lggi -lgii -lgg"
+case "`uname -s`" in 
+*FreeBSD*|*OpenBSD*) GGI_LIBS="$GGI_LIBS -pthread";;
+esac
+
+if $cc -o $TMPE $GGI_INCLUDES $TMPC $GGI_LIBS 2> /dev/null ; then
+ggi=yes
+fi
+fi # --disable-ggi
+
 ##########################################
 # SDL probe
 
@@ -348,7 +377,7 @@ fi # sdl compile test
 fi # cross compilation
 fi # -z $sdl
 
-if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
+if test x"$show_help" = x"yes" ; then
 cat << EOF
 
 Usage: configure [options]
@@ -370,9 +399,10 @@ echo "Advanced options (experts only):"
 echo "  --source-path=PATH       path of source code [$source_path]"
 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
 echo "  --cc=CC                  use C compiler CC [$cc]"
-echo "  --host-cc=CC             use C compiler CC [$cc] for dyngen etc."
+echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
 echo "  --make=MAKE              use specified make [$make]"
 echo "  --static                 enable static build [$static]"
+echo "  --ggi-path=DIR           use GGI installed in dir [$ggi_dir]"
 echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
 echo "  --enable-adlib           enable Adlib emulation"
 echo "  --enable-coreaudio       enable Coreaudio audio driver"
@@ -445,6 +475,15 @@ fi # kqemu
 
 fi # kqemu and linux
 
+# sound support libraries
+# alsa
+if test "$alsa" = "yes" ; then
+    cat > $TMPC << EOF
+#include <alsa/asoundlib.h>
+int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
+EOF
+    $cc -o $TMPE $TMPC -lasound 2> /dev/null || alsa="no"
+fi # alsa
 
 echo "Install prefix    $prefix"
 echo "BIOS directory    $datadir"
@@ -465,6 +504,7 @@ echo "static build      $static"
 if test "$darwin" = "yes" ; then
     echo "Cocoa support     $cocoa"
 fi
+echo "GGI support       $ggi"
 echo "SDL support       $sdl"
 if test "$sdl" != "no" ; then
     echo "SDL static link   $sdl_static"
@@ -677,8 +717,8 @@ if expr $target : '.*-user' > /dev/null 
 fi
 
 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
-        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
-    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
+        -a "$sdl" = "no" -a "$cocoa" = "no" -a "$ggi" = "no"  ; then
+    echo "ERROR: QEMU requires GGI, SDL or Cocoa for graphical output"
     echo "To build QEMU with graphical output configure with --disable-gfx-check"
     echo "Note that this will disable all output from the virtual graphics card."
     exit 1;
@@ -769,6 +809,15 @@ if test "$target_cpu" = "arm" -o "$targe
   echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
   echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
 fi
+
+# GGI
+if test "$ggi" = "yes" ; then
+  echo "#define CONFIG_GGI 1" >> $config_h
+  echo "CONFIG_GGI=yes" >> $config_mak
+  echo "GGI_INCLUDES= $GGI_INCLUDES" >> $config_mak
+  echo "GGI_LIBS= $GGI_LIBS" >> $config_mak
+fi
+
 # sdl defines
 
 if test "$target_user_only" = "no"; then
ggi.c +224 -0

224 lines not on this page · raw message

ggi_keysym.h +277 -0

277 lines not on this page · raw message

Makefile +2 -2
diff -X excl -rduNp qemu.oorig/Makefile qemu/Makefile
@@ -63,7 +63,7 @@ install: all 
                        pc-bios/proll.elf \
                        pc-bios/linux_boot.bin "$(datadir)"
 	mkdir -p "$(docdir)"
-	install -m 644 qemu-doc.html  qemu-tech.html "$(docdir)"
+	-install -m 644 qemu-doc.html  qemu-tech.html "$(docdir)"
 ifndef CONFIG_WIN32
 	mkdir -p "$(mandir)/man1"
 	install qemu.1 qemu-img.1 "$(mandir)/man1"
@@ -91,7 +91,7 @@ cscope:
 
 # documentation
 %.html: %.texi
-	texi2html -monolithic -number $<
+	-texi2html -monolithic -number $<
 
 qemu.1: qemu-doc.texi
 	./texi2pod.pl $< qemu.pod
Makefile.target +10 -3
diff -X excl -rduNp qemu.oorig/Makefile.target qemu/Makefile.target
@@ -159,6 +159,8 @@ endif
 #########################################################
 
 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+
+DEFINES+=#-DDEBUG_GGI -DDEBUG_TRACE_GGI #-DDEBUG -DDEBUG_KBD -DDEBUG_MOUSE -DDEBUG_GDB 
 LIBS+=-lm
 ifndef CONFIG_USER_ONLY
 LIBS+=-lz
@@ -338,6 +340,9 @@ endif
 ifdef CONFIG_GDBSTUB
 VL_OBJS+=gdbstub.o 
 endif
+ifdef CONFIG_GGI
+VL_OBJS+=ggi.o
+endif
 ifdef CONFIG_SDL
 VL_OBJS+=sdl.o
 endif
@@ -381,14 +386,16 @@ endif
 ifdef CONFIG_WIN32
 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
 endif
-
 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
-	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(GGI_LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+
+ggi.o: ggi.c keymaps.c ggi_keysym.h x_keymap.c
+	$(CC) $(CFLAGS) $(DEFINES) $(GGI_INCLUDES) -c -o $@ $<
 
 cocoa.o: cocoa.m
 	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 
-sdl.o: sdl.c keymaps.c sdl_keysym.h
+sdl.o: sdl.c keymaps.c sdl_keysym.h x_keymap.c
 	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
 
 sdlaudio.o: sdlaudio.c
sdl.c +1 -64

71 lines not on this page · raw message

vl.c +4 -2
diff -X excl -rduNp qemu.oorig/vl.c qemu/vl.c
@@ -3779,7 +3779,7 @@ void help(void)
 	   "-k language     use keyboard layout (for example \"fr\" for French)\n"
 #endif
 #ifdef HAS_AUDIO
-           "-enable-audio   enable audio support, and all the sound cars\n"
+           "-enable-audio   enable audio support, and all the sound cards\n"
            "-audio-help     print list of audio drivers and their options\n"
            "-soundhw c1,... enable audio support\n"
            "                and only specified sound cards (comma separated list)\n"
@@ -4715,7 +4715,9 @@ int main(int argc, char **argv)
     if (nographic) {
         dumb_display_init(ds);
     } else {
-#if defined(CONFIG_SDL)
+#if defined(CONFIG_GGI)
+        ggi_display_init(ds, full_screen);
+#elif defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen);
 #elif defined(CONFIG_COCOA)
         cocoa_display_init(ds, full_screen);
vl.h +4 -0
diff -X excl -rduNp qemu.oorig/vl.h qemu/vl.h
@@ -659,6 +659,10 @@ void pci_cirrus_vga_init(PCIBus *bus, Di
 void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base, 
                          unsigned long vga_ram_offset, int vga_ram_size);
 
+#ifdef CONFIG_GGI
+void ggi_display_init(DisplayState *ds, int full_screen);
+#endif
+
 /* sdl.c */
 void sdl_display_init(DisplayState *ds, int full_screen);
 
x_keymap.c +97 -0

97 lines not on this page · raw message

#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 27 lines · Bernhard Fischer
Quoted 15 lines · Bernhard Fischer

Hi,

Attached patch adds support to qemu to display via GGI (www.ggi-project.org).

GGI has several so called display-targets, i.e. you can render your application's output to one of
X11
wsfb
vgl
vgagl
vcsa
svgalib
quartz
memory

Quoted 8 lines

ipc
glide
fbdev
directx
terminfo
libaa
etc. without the need to port the application to each of these libraries on your own.

Quoted 4 lines

In other words, you do not have to write support for e.g. cocoa, curses etc in qemu but can use libgii (the input part) and libggi (the output part) to transparently use the I/O the host-system you are running on does provide.

The many display targets sound nice... but what I'd like to have for qemu is a GUI...

IIRC the GUI patches which were posted so far replaced the SDL driver by rendering to a GTK widget, because the current way for embedding SDL into GTK seems to be somewhat hackish.
There have been efforts to create a GTK SDL widget, but I don't know if that's usable already.

So how could GGI be integrated with eg. a GTK GUI? Is there a way that is more "stable" than the current SDL way?

Regards,
Oliver

PS: Is there an OpenGL display target for GGI? I couldn't find any hint about that on the homepage, but I think OpenGL is one of the easiest ways to get 2d hardware acceleration under X11.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDmuwCTFOM6DcNJ6cRAibOAJ4tEqA53yluubjs4l50tmKm7Yw3owCg6J1x Gz+cjbDVe9Dz64buw+ys9Gg=
=0aFB
-----END PGP SIGNATURE-----

#3 lore raw
Quoted 6 lines · Oliver Gerlich

The many display targets sound nice... but what I'd like to have for qemu is a GUI...

IIRC the GUI patches which were posted so far replaced the SDL driver by rendering to a GTK widget, because the current way for embedding SDL into GTK seems to be somewhat hackish.

Yes. It is doable, but the methods to do it in X and in Windows are completely different.

Quoted 3 lines

There have been efforts to create a GTK SDL widget, but I don't know if that's usable already.

It is, but it is ugly. And not really x-platform at the time being.

Quoted 3 lines

So how could GGI be integrated with eg. a GTK GUI? Is there a way that is more "stable" than the current SDL way?

No. If anything it would be much harder.

Quoted 4 lines

Regards,
Oliver

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
#4 lore raw
In reply to Oliver Gerlich
Quoted 39 lines · Oliver Gerlich

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 27 lines · Bernhard Fischer
Quoted 15 lines · Bernhard Fischer

Hi,

Attached patch adds support to qemu to display via GGI (www.ggi-project.org).

GGI has several so called display-targets, i.e. you can render your application's output to one of
X11
wsfb
vgl
vgagl
vcsa
svgalib
quartz
memory

Quoted 8 lines

ipc
glide
fbdev
directx
terminfo
libaa
etc. without the need to port the application to each of these libraries on your own.

Quoted 4 lines

In other words, you do not have to write support for e.g. cocoa, curses etc in qemu but can use libgii (the input part) and libggi (the output part) to transparently use the I/O the host-system you are running on does provide.

The many display targets sound nice... but what I'd like to have for qemu is a GUI...

Quoted 8 lines

IIRC the GUI patches which were posted so far replaced the SDL driver by rendering to a GTK widget, because the current way for embedding SDL into GTK seems to be somewhat hackish.
There have been efforts to create a GTK SDL widget, but I don't know if that's usable already.

So how could GGI be integrated with eg. a GTK GUI? Is there a way that is more "stable" than the current SDL way?

I personally don't need a GUI but want to be able to have qemu display nicely no matter if i'm on a framebuffer console in linux, or if i'm in X11 on whatever OS, etc.

Perhaps look at http://www.ggi-project.org/links.html for Toolkits and Windowing-systems one can use for building a GUI.

Quoted 1 line

From what i hear there is/was a GGI backand for GTK, but i never used it

myself.

Quoted 5 lines

Regards,
Oliver

PS: Is there an OpenGL display target for GGI? I couldn't find any hint

There is mesaggi if you'd want to use GGI as a backend for an openGL implementation. I'm personally not familiar with it, though.

Quoted 2 lines

about that on the homepage, but I think OpenGL is one of the easiest ways to get 2d hardware acceleration under X11.

The easiest way to get 2D acceleration in X11 is to use XAA et al. GGI's display-x is generally as fast as your Xserver's 2D primitives.

Quoted 14 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDmuwCTFOM6DcNJ6cRAibOAJ4tEqA53yluubjs4l50tmKm7Yw3owCg6J1x Gz+cjbDVe9Dz64buw+ys9Gg=
=0aFB
-----END PGP SIGNATURE-----

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel