Commit 2a90c454 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150529-1' into staging



gtk: add opengl rendering support.
small bugfixes for gtk and opengl ui code.

# gpg: Signature made Fri May 29 10:44:54 2015 BST 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-gtk-20150529-1:
  gtk: Replace gdk_cursor_new()
  gtk: add opengl support, using egl
  ui: add egl-helpers
  ui: shader.h protect against double inclusion
  ui: use libexpoxy

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 9441aa28 63c67b6d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3166,14 +3166,14 @@ else
fi

if test "$opengl" != "no" ; then
  opengl_pkgs="gl glesv2"
  opengl_pkgs="gl glesv2 epoxy egl"
  if $pkg_config $opengl_pkgs x11 && test "$have_glx" = "yes"; then
    opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
    opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
    opengl=yes
  else
    if test "$opengl" = "yes" ; then
      feature_not_found "opengl" "Install GL devel (e.g. MESA)"
      feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
    fi
    opengl_cflags=""
    opengl_libs=""
+2 −3
Original line number Diff line number Diff line
@@ -10,8 +10,7 @@
#include "qapi/error.h"

#ifdef CONFIG_OPENGL
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
# include <epoxy/gl.h>
#endif

/* keyboard/mouse support */
@@ -394,7 +393,7 @@ void curses_display_init(DisplayState *ds, int full_screen);
int index_from_key(const char *key);

/* gtk.c */
void early_gtk_display_init(void);
void early_gtk_display_init(int opengl);
void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover);

#endif
+16 −0
Original line number Diff line number Diff line
#ifndef EGL_HELPERS_H
#define EGL_HELPERS_H

#include <epoxy/gl.h>
#include <epoxy/egl.h>

extern EGLDisplay *qemu_egl_display;
extern EGLConfig qemu_egl_config;

EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);

int qemu_egl_init_dpy(EGLNativeDisplayType dpy, bool gles, bool debug);
EGLContext qemu_egl_init_ctx(void);
bool qemu_egl_has_ext(const char *haystack, const char *needle);

#endif /* EGL_HELPERS_H */
+23 −0
Original line number Diff line number Diff line
@@ -22,6 +22,10 @@
#include <X11/XKBlib.h>
#endif

#if defined(CONFIG_OPENGL)
#include "ui/egl-helpers.h"
#endif

/* Compatibility define to let us build on both Gtk2 and Gtk3 */
#if GTK_CHECK_VERSION(3, 0, 0)
static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh)
@@ -41,6 +45,12 @@ typedef struct VirtualGfxConsole {
    cairo_surface_t *surface;
    double scale_x;
    double scale_y;
#if defined(CONFIG_OPENGL)
    ConsoleGLState *gls;
    EGLContext ectx;
    EGLSurface esurface;
    int glupdates;
#endif
} VirtualGfxConsole;

#if defined(CONFIG_VTE)
@@ -73,4 +83,17 @@ typedef struct VirtualConsole {
    };
} VirtualConsole;

/* ui/gtk.c */
void gd_update_windowsize(VirtualConsole *vc);

/* ui/gtk-egl.c */
void gd_egl_init(VirtualConsole *vc);
void gd_egl_draw(VirtualConsole *vc);
void gd_egl_update(DisplayChangeListener *dcl,
                   int x, int y, int w, int h);
void gd_egl_refresh(DisplayChangeListener *dcl);
void gd_egl_switch(DisplayChangeListener *dcl,
                   DisplaySurface *surface);
void gtk_egl_init(void);

#endif /* UI_GTK_H */
+6 −4
Original line number Diff line number Diff line
#ifdef CONFIG_OPENGL
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
#endif
#ifndef QEMU_SHADER_H
#define QEMU_SHADER_H

#include <epoxy/gl.h>

void qemu_gl_run_texture_blit(GLint texture_blit_prog);

@@ -9,3 +9,5 @@ GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src);
GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag);
GLuint qemu_gl_create_compile_link_program(const GLchar *vert_src,
                                           const GLchar *frag_src);

#endif /* QEMU_SHADER_H */
Loading