opengl rendering in the sdl window
PATCH 1/1 opengl rendering in the sdl window
This patch comes from xen-unstable and adds opengl support for rendering the guest framebuffer in the SDL window.
SDL is needed anyway to open the window and handle the events. Opengl rendering is optional and can be turned off at both compile time and run time (--disable-opengl).
Opengl rendering actually is enabled only when the buffer is shared to avoid adding one more copy of the pixel buffer.
---
configure +31 -0
@@ -271,6 +271,8 @@ for opt do ;; --disable-sdl) sdl="no" ;; + --disable-opengl) opengl="no" + ;; --fmod-lib=*) fmod_lib="$optarg" ;; --fmod-inc=*) fmod_inc="$optarg"
@@ -749,6 +751,26 @@ else fi # -z $sdl ########################################## +# OpenGL test + +if test -z "$opengl" && test "$sdl" = "yes" +then +cat > $TMPC << EOF +#include <GL/gl.h> +#ifndef GL_TEXTURE_RECTANGLE_ARB +#error "Opengl doesn't support GL_TEXTURE_RECTANGLE_ARB" +#endif +int main( void ) { return (int) glGetString(GL_EXTENSIONS); } +EOF +if $cc -o $TMPE $TMPC -lGL 2> /dev/null +then +opengl="yes" +else +opengl="no" +fi +fi + +########################################## # VNC TLS detection if test "$vnc_tls" = "yes" ; then cat > $TMPC <<EOF
@@ -941,6 +963,7 @@ if test "$sdl" != "no" ; then echo "SDL static link $sdl_static" fi echo "curses support $curses" +echo "OpenGL support $opengl" echo "mingw32 support $mingw32" echo "Audio drivers $audio_drv_list" echo "Extra audio cards $audio_card_list"
@@ -1199,6 +1222,14 @@ if test "$sdl1" = "yes" ; then echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak fi fi +if test $opengl = "yes" +then + echo "#define CONFIG_OPENGL 1" >> $config_h + echo "CONFIG_OPENGL=yes" >> $config_mak + echo "SDL_CFLAGS+=-I/usr/include/GL" >> $config_mak + echo "SDL_LIBS+=-lXext" >> $config_mak + echo "SDL_LIBS+=-lGL" >> $config_mak +fi if test "$cocoa" = "yes" ; then echo "#define CONFIG_COCOA 1" >> $config_h echo "CONFIG_COCOA=yes" >> $config_mak
console.h +1 -1
@@ -153,7 +153,7 @@ void qemu_console_resize_shared(QEMUConsole *console, int width, int height, int depth, int linesize, void *pixels);/* sdl.c */ -void sdl_display_init (DisplayState *ds,int full_screen,int no_frame); +void sdl_display_init (DisplayState *ds,int full_screen,int no_frame,int opengl_enable);/* cocoa.m */ void cocoa_display_init (DisplayState *ds,int full_screen);
sdl.c +188 -12
283 lines not on this page · raw message
vl.c +18 -1
@@ -201,6 +201,11 @@ int graphic_height = 600;int graphic_depth =15 ;#endif int full_screen =0 ; +#ifdef CONFIG_OPENGL +int opengl_enabled =1 ; +#else +int opengl_enabled =0 ; +#endif int no_frame =0 ;int no_quit =0 ;CharDriverState *serial_hds[MAX_SERIAL_PORTS ];
@@ -7681,6 +7686,9 @@ static void help(int exitcode)"-no-frame open SDL window without a frame and window decorations\n" "-alt-grab use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt)\n" "-no-quit disable SDL window close capability\n" +#ifdef CONFIG_OPENGL + "-disable-opengl disable OpenGL rendering, using SDL\n" +#endif #endif #ifdef TARGET_I386 "-no-fd-bootchk disable boot signature checking for floppy disks\n"
@@ -7881,6 +7889,7 @@ enum { QEMU_OPTION_no_frame, QEMU_OPTION_alt_grab, QEMU_OPTION_no_quit, + QEMU_OPTION_disable_opengl, QEMU_OPTION_pidfile, QEMU_OPTION_no_kqemu, QEMU_OPTION_kernel_kqemu,
@@ -7983,6 +7992,9 @@ const QEMUOption qemu_options[] = { { "no-frame", 0, QEMU_OPTION_no_frame }, { "alt-grab", 0, QEMU_OPTION_alt_grab }, { "no-quit", 0, QEMU_OPTION_no_quit }, +#ifdef CONFIG_OPENGL + { "disable-opengl", 0, QEMU_OPTION_disable_opengl }, +#endif #endif { "pidfile", HAS_ARG, QEMU_OPTION_pidfile }, { "win2k-hack", 0, QEMU_OPTION_win2k_hack },
@@ -8729,6 +8741,11 @@ int main(int argc, char **argv)case QEMU_OPTION_no_quit: no_quit =1 ;break ; +#ifdef CONFIG_OPENGL +case QEMU_OPTION_disable_opengl: + opengl_enabled =0 ; +break ; +#endif #endif case QEMU_OPTION_pidfile: pid_file = optarg;
@@ -9104,7 +9121,7 @@ int main(int argc, char **argv)#endif {#if defined(CONFIG_SDL ) -sdl_display_init (ds, full_screen, no_frame); +sdl_display_init (ds, full_screen, no_frame, opengl_enabled);#elif defined(CONFIG_COCOA )cocoa_display_init (ds, full_screen);#else
Quoted 11 lines · Stefano Stabellini
This patch comes from xen-unstable and adds opengl support for rendering the guest framebuffer in the SDL window.
SDL is needed anyway to open the window and handle the events. Opengl rendering is optional and can be turned off at both compile time and run time (--disable-opengl).Opengl rendering actually is enabled only when the buffer is shared to avoid adding one more copy of the pixel buffer.
Signed-off-by Stefano Stabellini <[email protected]>
gtk + cairo is much more appealing to me than OpenGL. The general lack of indirect direct rendering support and the spotty state of 3d acceleration in Linux is a major disadvantage to OpenGL.
Regards,
Anthony Liguori
Quoted 10 lines · Anthony Liguori
Quoted 9 lines · Stefano Stabellini
This patch comes from xen-unstable and adds opengl support for rendering the guest framebuffer in the SDL window.
SDL is needed anyway to open the window and handle the events. Opengl rendering is optional and can be turned off at both compile time and run time (--disable-opengl).Opengl rendering actually is enabled only when the buffer is shared to avoid adding one more copy of the pixel buffer.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Stefano Stabellini <[email protected]>gtk + cairo is much more appealing to me than OpenGL. The general lack of indirect direct rendering support and the spotty state of 3d acceleration in Linux is a major disadvantage to OpenGL.
As I suggested before, we could go both SDL+Opengl and Gtk+Cairo introducing a new frontend.