On Mon, Sep 05, 2005 at 03:30:59PM +0200, Bernhard Fischer wrote: >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 >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. > >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
diff -X excl -rduNp qemu.oorig/configure qemu/configure --- qemu.oorig/configure 2005-12-10 14:07:53.000000000 +0100 +++ qemu/configure 2005-12-10 14:08:54.000000000 +0100 @@ -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 diff -X excl -rduNp qemu.oorig/ggi.c qemu/ggi.c --- qemu.oorig/ggi.c 1970-01-01 01:00:00.000000000 +0100 +++ qemu/ggi.c 2005-12-10 14:08:54.000000000 +0100 @@ -0,0 +1,224 @@ +/* vi: set sw=4 ts=4: */ +/* Copyright (c) 2005 Bernhard Fischer */ +/* #include license.bsd */ + +#include "vl.h" +/* both softfloat.h and ggi/system.h define the uint types. + * ugly workaround: */ +#define uint8 softfloat_uint8 +#define uint16 softfloat_uint16 +#define uint32 softfloat_uint32 +#define uint64 softfloat_uint64 + +#include <ggi/gii.h> /* input handling */ +#include <ggi/ggi.h> /* output handling */ + +#ifdef DEBUG_TRACE_GGI +# define trace(args...) printf(args) +#else +# define trace(args...) +#endif +#ifdef DEBUG_GGI +#define dbg(args...) printf(args) +#else +#define dbg(args...) +#endif + +static ggi_visual_t v = NULL; +static ggi_mode m; +static const ggi_directbuffer *db; + +static void ggi_display_exit(void) +{ + trace("ggi_display_exit\n"); + if (db) { + if (db->resource) + ggiResourceRelease(db->resource); + } + if (v) + ggiClose(v); + ggiExit(); +} + +static void ggi_update_vis(DisplayState *ds, int x, int y, int w, int h) +{ + trace("ggi_update_vis x=%d y=%d w=%d h=%d\n", x, y, w, h); + ggiFlushRegion(v, x, y, w, h); +} + +static void _ggi_get_directbuf(DisplayState *ds) +{ + int err; + + if (!(db = ggiDBGetBuffer(v, 0))) { + fprintf(stderr, "Failed to acquire directbuffer.\n"); + ggi_display_exit(); + } + if (!(db->type & GGI_DB_SIMPLE_PLB)) { + fprintf(stderr, "Error: non-standard display buffer.\n"); + ggi_display_exit(); + } + + if ((err=ggiResourceAcquire(db->resource, GGI_ACTYPE_WRITE))) { + fprintf(stderr, "Error acquiring directbuffer. (%d)\n", err); + ggi_display_exit(); + } + ds->data = db->write; + ds->linesize = db->buffer.plb.stride; + ds->depth = GT_SIZE(m.graphtype); + ds->width = m.visible.x; + ds->height = m.visible.y; +} + +static void ggi_resize_vis(DisplayState *ds, int w, int h) +{ + ggi_mode newmode; + int err; + + trace("ggi_resize_vis w=%d h=%d\n", w, h); + ggiGetMode(v, &newmode); + newmode.visible.x = w; + newmode.visible.y = h; + + ggiCheckMode(v, &newmode); +#ifdef DEBUG_GGI + fprintf(stderr, "Using mode: "); + ggiFPrintMode(stderr, &newmode); + fprintf(stderr, "\n"); +#endif + if (db) { + if (db->resource) + ggiResourceRelease(db->resource); + } + + err = ggiSetMode(v, &newmode); + if (err) { + fprintf(stderr, "Failed to set a video mode. (%d)\n", err); + ggi_display_exit(); + } + ggiGetMode(v, &m); + _ggi_get_directbuf(ds); +} + +static void _process_input(int count); + +static void ggi_refresh_vis(DisplayState *ds) +{ + int count; + struct timeval tv = {0,100}; + trace("ggi_refresh_vis\n"); + if (is_active_console(vga_console)) + vga_update_display(); + + ggiEventPoll(v, emKey|emPointer, &tv); + if ((count=ggiEventsQueued(v, emKey | emPointer | emExpose))) + _process_input(count); +} + +static void _kbd_layout_init(void); + +void ggi_display_init(DisplayState *ds, int full_screen) +{ + int err; + + trace("ggi_display_init\n"); + _kbd_layout_init(); + if ((err=ggiInit()) < 0) { + fprintf(stderr, "Failed to initialize ggi (%i)\n", err); + exit(1); + } + if (!(v = ggiOpen(NULL))) + ggiPanic("Unable to open default visual, exiting.\n"); + + ggiSetFlags(v, GGIFLAG_ASYNC); + if (!(err=ggiSetEventMask(v, emKey | emPointer))) + fprintf(stderr, "Failed to set eventmask for input, continuing. (%i)\n", + err); + ggiCheckSimpleMode(v, 640, 400, GGI_AUTO, GT_AUTO, &m); +#ifdef DEBUG_GGI + fprintf(stderr, "Suggested mode: "); + ggiFPrintMode(stderr, &m); + fprintf(stderr, "\n"); +#endif + if ((err = ggiSetMode(v, &m))) { + fprintf(stderr, "Failed to set a video mode. (%d)\n", err); + ggi_display_exit(); + } + ggiGetMode(v, &m); + + ds->dpy_update = ggi_update_vis; + ds->dpy_resize = ggi_resize_vis; + ds->dpy_refresh = ggi_refresh_vis; + + _ggi_get_directbuf(ds); + + atexit(ggi_display_exit); +} + +/** input handling */ +#include "ggi_keysym.h" +#include "x_keymap.c" +#include "keymaps.c" +static kbd_layout_t *kbd_layout = NULL; + +static void _kbd_layout_init(void) +{ + if (keyboard_layout) { + kbd_layout = init_keyboard_layout(keyboard_layout); + if (!kbd_layout) { + fprintf(stderr, "Failed to initialize keyboard layout, exiting.\n"); + exit(1); + } + } +} + +static void _process_input(int count) { + ggi_event ev; + int key, scan, pbutton, px, py, pz; + trace("_process_input\n"); + while (count--) { + ggiEventRead(v, &ev, emKey | emPointer); + + switch (ev.any.type) { + case evKeyPress: + case evKeyRepeat: + case evKeyRelease: + key = ev.key.button; + scan = kbd_layout ? keysym2scancode(kbd_layout, ev.key.sym) : + (key<89)?(key):_native_scancode(key-89); + if (ev.key.sym == GIIK_Pause) { + key = (ev.any.type == evKeyRelease) ? GII_KM_LOCK : 0; + kbd_put_keycode(GII_KT_FN); + kbd_put_keycode(0x1d | key); + kbd_put_keycode(GIIUC_E); + return; + } else { + if (scan & 0x80) + kbd_put_keycode(GII_KT_SPEC); + + if (ev.any.type == evKeyRelease) + kbd_put_keycode(scan | 0x80); + else + kbd_put_keycode(scan & 0x7f); + } + break; +#if 0 + case evPtrAbsolute: + px = ev.pmove.x; + py = ev.pmove.y; + pz = ev.pmove.z; + case evPtrButtonPress: + case evPtrButtonRelease: + pbutton = ev.pbutton.button; +fprintf(stderr, "### mouse: %d, %d, %d, %d(0x%x)\n", + ev.pmove.x,ev.pmove.y, ev.pmove.z, pbutton); + kbd_mouse_event(ev.pmove.x, ev.pmove.y, ev.pmove.z, pbutton); + break; + case evPtrRelative: +#endif + default: +fprintf(stderr, "\ttype non key\n"); + break; + } + }; +} diff -X excl -rduNp qemu.oorig/ggi_keysym.h qemu/ggi_keysym.h --- qemu.oorig/ggi_keysym.h 1970-01-01 01:00:00.000000000 +0100 +++ qemu/ggi_keysym.h 2005-12-10 14:08:54.000000000 +0100 @@ -0,0 +1,277 @@ +/* vi: set sw=4 ts=4: */ +typedef struct { + const char *name; + int keysym; +} name2keysym_t; +static name2keysym_t name2keysym [] = { + /* ascii */ + { "space", 0x020}, + { "exclam", 0x021}, + { "quotedbl", 0x022}, + { "numbersign", 0x023}, + { "dollar", 0x024}, + { "percent", 0x025}, + { "ampersand", 0x026}, + { "apostrophe", 0x027}, + { "parenleft", 0x028}, + { "parenright", 0x029}, + { "asterisk", 0x02a}, + { "plus", 0x02b}, + { "comma", 0x02c}, + { "minus", 0x02d}, + { "period", 0x02e}, + { "slash", 0x02f}, + { "0", 0x030}, + { "1", 0x031}, + { "2", 0x032}, + { "3", 0x033}, + { "4", 0x034}, + { "5", 0x035}, + { "6", 0x036}, + { "7", 0x037}, + { "8", 0x038}, + { "9", 0x039}, + { "colon", 0x03a}, + { "semicolon", 0x03b}, + { "less", 0x03c}, + { "equal", 0x03d}, + { "greater", 0x03e}, + { "question", 0x03f}, + { "at", 0x040}, + { "A", 0x041}, + { "B", 0x042}, + { "C", 0x043}, + { "D", 0x044}, + { "E", 0x045}, + { "F", 0x046}, + { "G", 0x047}, + { "H", 0x048}, + { "I", 0x049}, + { "J", 0x04a}, + { "K", 0x04b}, + { "L", 0x04c}, + { "M", 0x04d}, + { "N", 0x04e}, + { "O", 0x04f}, + { "P", 0x050}, + { "Q", 0x051}, + { "R", 0x052}, + { "S", 0x053}, + { "T", 0x054}, + { "U", 0x055}, + { "V", 0x056}, + { "W", 0x057}, + { "X", 0x058}, + { "Y", 0x059}, + { "Z", 0x05a}, + { "bracketleft", 0x05b}, + { "backslash", 0x05c}, + { "bracketright", 0x05d}, + { "asciicircum", 0x05e}, + { "underscore", 0x05f}, + { "grave", 0x060}, + { "a", 0x061}, + { "b", 0x062}, + { "c", 0x063}, + { "d", 0x064}, + { "e", 0x065}, + { "f", 0x066}, + { "g", 0x067}, + { "h", 0x068}, + { "i", 0x069}, + { "j", 0x06a}, + { "k", 0x06b}, + { "l", 0x06c}, + { "m", 0x06d}, + { "n", 0x06e}, + { "o", 0x06f}, + { "p", 0x070}, + { "q", 0x071}, + { "r", 0x072}, + { "s", 0x073}, + { "t", 0x074}, + { "u", 0x075}, + { "v", 0x076}, + { "w", 0x077}, + { "x", 0x078}, + { "y", 0x079}, + { "z", 0x07a}, + { "braceleft", 0x07b}, + { "bar", 0x07c}, + { "braceright", 0x07d}, + { "asciitilde", 0x07e}, + /* latin1 */ + { "nobreakspace", 0x0a0}, + { "exclamdown", 0x0a1}, + { "cent", 0x0a2}, + { "sterling", 0x0a3}, + { "currency", 0x0a4}, + { "yen", 0x0a5}, + { "brokenbar", 0x0a6}, + { "section", 0x0a7}, + { "diaeresis", 0x0a8}, + { "copyright", 0x0a9}, + { "ordfeminine", 0x0aa}, + { "guillemotleft", 0x0ab}, + { "notsign", 0x0ac}, + { "hyphen", 0x0ad}, + { "registered", 0x0ae}, + { "macron", 0x0af}, + { "degree", 0x0b0}, + { "plusminus", 0x0b1}, + { "twosuperior", 0x0b2}, + { "threesuperior", 0x0b3}, + { "acute", 0x0b4}, + { "mu", 0x0b5}, + { "paragraph", 0x0b6}, + { "periodcentered", 0x0b7}, + { "cedilla", 0x0b8}, + { "onesuperior", 0x0b9}, + { "masculine", 0x0ba}, + { "guillemotright", 0x0bb}, + { "onequarter", 0x0bc}, + { "onehalf", 0x0bd}, + { "threequarters", 0x0be}, + { "questiondown", 0x0bf}, + { "Agrave", 0x0c0}, + { "Aacute", 0x0c1}, + { "Acircumflex", 0x0c2}, + { "Atilde", 0x0c3}, + { "Adiaeresis", 0x0c4}, + { "Aring", 0x0c5}, + { "AE", 0x0c6}, + { "Ccedilla", 0x0c7}, + { "Egrave", 0x0c8}, + { "Eacute", 0x0c9}, + { "Ecircumflex", 0x0ca}, + { "Ediaeresis", 0x0cb}, + { "Igrave", 0x0cc}, + { "Iacute", 0x0cd}, + { "Icircumflex", 0x0ce}, + { "Idiaeresis", 0x0cf}, + { "ETH", 0x0d0}, + { "Eth", 0x0d0}, + { "Ntilde", 0x0d1}, + { "Ograve", 0x0d2}, + { "Oacute", 0x0d3}, + { "Ocircumflex", 0x0d4}, + { "Otilde", 0x0d5}, + { "Odiaeresis", 0x0d6}, + { "multiply", 0x0d7}, + { "Ooblique", 0x0d8}, + { "Oslash", 0x0d8}, + { "Ugrave", 0x0d9}, + { "Uacute", 0x0da}, + { "Ucircumflex", 0x0db}, + { "Udiaeresis", 0x0dc}, + { "Yacute", 0x0dd}, + { "THORN", 0x0de}, + { "Thorn", 0x0de}, + { "ssharp", 0x0df}, + { "agrave", 0x0e0}, + { "aacute", 0x0e1}, + { "acircumflex", 0x0e2}, + { "atilde", 0x0e3}, + { "adiaeresis", 0x0e4}, + { "aring", 0x0e5}, + { "ae", 0x0e6}, + { "ccedilla", 0x0e7}, + { "egrave", 0x0e8}, + { "eacute", 0x0e9}, + { "ecircumflex", 0x0ea}, + { "ediaeresis", 0x0eb}, + { "igrave", 0x0ec}, + { "iacute", 0x0ed}, + { "icircumflex", 0x0ee}, + { "idiaeresis", 0x0ef}, + { "eth", 0x0f0}, + { "ntilde", 0x0f1}, + { "ograve", 0x0f2}, + { "oacute", 0x0f3}, + { "ocircumflex", 0x0f4}, + { "otilde", 0x0f5}, + { "odiaeresis", 0x0f6}, + { "division", 0x0f7}, + { "oslash", 0x0f8}, + { "ooblique", 0x0f8}, + { "ugrave", 0x0f9}, + { "uacute", 0x0fa}, + { "ucircumflex", 0x0fb}, + { "udiaeresis", 0x0fc}, + { "yacute", 0x0fd}, + { "thorn", 0x0fe}, + { "ydiaeresis", 0x0ff}, + {"EuroSign", 00}, + /* modifiers */ + {"Control_L", GIIK_CtrlL}, + {"Control_R", GIIK_CtrlR}, + {"Alt_L", GIIK_AltL}, + {"Alt_R", GIIK_AltR}, + {"Caps_Lock", GIIK_Caps}, + {"Meta_L", GIIK_MetaL}, + {"Meta_R", GIIK_MetaR}, + {"Shift_L", GIIK_ShiftL}, + {"Shift_R", GIIK_ShiftR}, + {"Super_L", GIIK_SuperL}, + {"Super_R", GIIK_SuperR}, + + /* special */ + {"BackSpace", GIIUC_BackSpace}, + {"Tab", GIIUC_Tab}, + {"Return", GIIUC_Return}, + {"Right", GIIK_Right}, + {"Left", GIIK_Left}, + {"Up", GIIK_Up}, + {"Down", GIIK_Down}, + {"Page_Down", GIIK_PageDown}, + {"Page_Up", GIIK_PageUp}, + {"Insert", GIIK_Insert}, + {"Delete", GIIK_Delete}, + {"Home", GIIK_Home}, + {"End", GIIK_End}, + {"Scroll_Lock", GIIK_ScrollLock}, + {"F1", GIIK_F1}, + {"F2", GIIK_F2}, + {"F3", GIIK_F3}, + {"F4", GIIK_F4}, + {"F5", GIIK_F5}, + {"F6", GIIK_F6}, + {"F7", GIIK_F7}, + {"F8", GIIK_F8}, + {"F9", GIIK_F9}, + {"F10", GIIK_F10}, + {"F11", GIIK_F11}, + {"F12", GIIK_F12}, + {"F13", GIIK_F13}, + {"F14", GIIK_F14}, + {"F15", GIIK_F15}, + {"Sys_Req", GIIK_SysRq}, + {"KP_0", GIIK_P0}, + {"KP_1", GIIK_P1}, + {"KP_2", GIIK_P2}, + {"KP_3", GIIK_P3}, + {"KP_4", GIIK_P4}, + {"KP_5", GIIK_P5}, + {"KP_6", GIIK_P6}, + {"KP_7", GIIK_P7}, + {"KP_8", GIIK_P8}, + {"KP_9", GIIK_P9}, + {"KP_Add", GIIK_PPlus}, + {"KP_Decimal", GIIK_PSeparator}, + {"KP_Divide", GIIK_PSlash}, + {"KP_Enter", GIIK_PEnter}, + {"KP_Equal", GIIK_PEqual}, + {"KP_Multiply", GIIK_PAsterisk}, + {"KP_Subtract", GIIK_PMinus}, + {"help", GIIK_Help}, + {"Menu", GIIK_Menu}, +{"Power", GIIK_Boot}, + {"Print", GIIK_PrintScreen}, + {"Mode_switch", GIIK_ModeSwitch}, + {"Multi_Key", GIIK_Compose}, + {"Num_Lock", GIIK_Num}, + {"Pause", GIIK_Pause}, + {"Escape", GIIUC_Escape}, + + {NULL,0} +}; diff -X excl -rduNp qemu.oorig/Makefile qemu/Makefile --- qemu.oorig/Makefile 2005-12-10 14:07:52.000000000 +0100 +++ qemu/Makefile 2005-12-10 14:08:54.000000000 +0100 @@ -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 diff -X excl -rduNp qemu.oorig/Makefile.target qemu/Makefile.target --- qemu.oorig/Makefile.target 2005-12-10 14:07:52.000000000 +0100 +++ qemu/Makefile.target 2005-12-10 14:08:54.000000000 +0100 @@ -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 diff -X excl -rduNp qemu.oorig/sdl.c qemu/sdl.c --- qemu.oorig/sdl.c 2005-10-31 11:13:10.000000000 +0100 +++ qemu/sdl.c 2005-12-10 14:08:54.000000000 +0100 @@ -105,70 +105,7 @@ static uint8_t sdl_keyevent_to_keycode(c } #else - -static const uint8_t x_keycode_to_pc_keycode[61] = { - 0xc7, /* 97 Home */ - 0xc8, /* 98 Up */ - 0xc9, /* 99 PgUp */ - 0xcb, /* 100 Left */ - 0x4c, /* 101 KP-5 */ - 0xcd, /* 102 Right */ - 0xcf, /* 103 End */ - 0xd0, /* 104 Down */ - 0xd1, /* 105 PgDn */ - 0xd2, /* 106 Ins */ - 0xd3, /* 107 Del */ - 0x9c, /* 108 Enter */ - 0x9d, /* 109 Ctrl-R */ - 0x0, /* 110 Pause */ - 0xb7, /* 111 Print */ - 0xb5, /* 112 Divide */ - 0xb8, /* 113 Alt-R */ - 0xc6, /* 114 Break */ - 0x0, /* 115 */ - 0x0, /* 116 */ - 0x0, /* 117 */ - 0x0, /* 118 */ - 0x0, /* 119 */ - 0x70, /* 120 Hiragana_Katakana */ - 0x0, /* 121 */ - 0x0, /* 122 */ - 0x73, /* 123 backslash */ - 0x0, /* 124 */ - 0x0, /* 125 */ - 0x0, /* 126 */ - 0x0, /* 127 */ - 0x0, /* 128 */ - 0x79, /* 129 Henkan */ - 0x0, /* 130 */ - 0x7b, /* 131 Muhenkan */ - 0x0, /* 132 */ - 0x7d, /* 133 Yen */ - 0x0, /* 134 */ - 0x0, /* 135 */ - 0x47, /* 136 KP_7 */ - 0x48, /* 137 KP_8 */ - 0x49, /* 138 KP_9 */ - 0x4b, /* 139 KP_4 */ - 0x4c, /* 140 KP_5 */ - 0x4d, /* 141 KP_6 */ - 0x4f, /* 142 KP_1 */ - 0x50, /* 143 KP_2 */ - 0x51, /* 144 KP_3 */ - 0x52, /* 145 KP_0 */ - 0x53, /* 146 KP_. */ - 0x47, /* 147 KP_HOME */ - 0x48, /* 148 KP_UP */ - 0x49, /* 149 KP_PgUp */ - 0x4b, /* 150 KP_Left */ - 0x4c, /* 151 KP_ */ - 0x4d, /* 152 KP_Right */ - 0x4f, /* 153 KP_End */ - 0x50, /* 154 KP_Down */ - 0x51, /* 155 KP_PgDn */ - 0x52, /* 156 KP_Ins */ - 0x53, /* 157 KP_Del */ -}; +#include "x_keymap.c" static uint8_t sdl_keyevent_to_keycode(const SDL_KeyboardEvent *ev) { diff -X excl -rduNp qemu.oorig/vl.c qemu/vl.c --- qemu.oorig/vl.c 2005-12-10 14:07:53.000000000 +0100 +++ qemu/vl.c 2005-12-10 14:08:54.000000000 +0100 @@ -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); diff -X excl -rduNp qemu.oorig/vl.h qemu/vl.h --- qemu.oorig/vl.h 2005-12-10 14:07:53.000000000 +0100 +++ qemu/vl.h 2005-12-10 14:08:54.000000000 +0100 @@ -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); diff -X excl -rduNp qemu.oorig/x_keymap.c qemu/x_keymap.c --- qemu.oorig/x_keymap.c 1970-01-01 01:00:00.000000000 +0100 +++ qemu/x_keymap.c 2005-12-10 14:08:54.000000000 +0100 @@ -0,0 +1,97 @@ +/* + * QEMU SDL display driver + * + * Copyright (c) 2003 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +static const uint8_t x_keycode_to_pc_keycode[61] = { + 0xc7, /* 97 Home */ + 0xc8, /* 98 Up */ + 0xc9, /* 99 PgUp */ + 0xcb, /* 100 Left */ + 0x4c, /* 101 KP-5 */ + 0xcd, /* 102 Right */ + 0xcf, /* 103 End */ + 0xd0, /* 104 Down */ + 0xd1, /* 105 PgDn */ + 0xd2, /* 106 Ins */ + 0xd3, /* 107 Del */ + 0x9c, /* 108 Enter */ + 0x9d, /* 109 Ctrl-R */ + 0x0, /* 110 Pause */ + 0xb7, /* 111 Print */ + 0xb5, /* 112 Divide */ + 0xb8, /* 113 Alt-R */ + 0xc6, /* 114 Break */ + 0x0, /* 115 */ + 0x0, /* 116 */ + 0x0, /* 117 */ + 0x0, /* 118 */ + 0x0, /* 119 */ + 0x70, /* 120 Hiragana_Katakana */ + 0x0, /* 121 */ + 0x0, /* 122 */ + 0x73, /* 123 backslash */ + 0x0, /* 124 */ + 0x0, /* 125 */ + 0x0, /* 126 */ + 0x0, /* 127 */ + 0x0, /* 128 */ + 0x79, /* 129 Henkan */ + 0x0, /* 130 */ + 0x7b, /* 131 Muhenkan */ + 0x0, /* 132 */ + 0x7d, /* 133 Yen */ + 0x0, /* 134 */ + 0x0, /* 135 */ + 0x47, /* 136 KP_7 */ + 0x48, /* 137 KP_8 */ + 0x49, /* 138 KP_9 */ + 0x4b, /* 139 KP_4 */ + 0x4c, /* 140 KP_5 */ + 0x4d, /* 141 KP_6 */ + 0x4f, /* 142 KP_1 */ + 0x50, /* 143 KP_2 */ + 0x51, /* 144 KP_3 */ + 0x52, /* 145 KP_0 */ + 0x53, /* 146 KP_. */ + 0x47, /* 147 KP_HOME */ + 0x48, /* 148 KP_UP */ + 0x49, /* 149 KP_PgUp */ + 0x4b, /* 150 KP_Left */ + 0x4c, /* 151 KP_ */ + 0x4d, /* 152 KP_Right */ + 0x4f, /* 153 KP_End */ + 0x50, /* 154 KP_Down */ + 0x51, /* 155 KP_PgDn */ + 0x52, /* 156 KP_Ins */ + 0x53, /* 157 KP_Del */ +}; + +static uint8_t _native_scancode(const int key) +{ +#if defined(_WIN32) && 0 + return key; +#else + return x_keycode_to_pc_keycode[key]; +#endif +} +
_______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel