summaryrefslogtreecommitdiffstats
path: root/qemu/include/ui
diff options
context:
space:
mode:
authorDon Dugger <n0ano@n0ano.com>2016-06-03 03:33:22 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-06-03 03:33:23 +0000
commitda27230f80795d0028333713f036d44c53cb0e68 (patch)
treeb3d379eaf000adf72b36cb01cdf4d79c3e3f064c /qemu/include/ui
parent0e68cb048bb8aadb14675f5d4286d8ab2fc35449 (diff)
parent437fd90c0250dee670290f9b714253671a990160 (diff)
Merge "These changes are the raw update to qemu-2.6."
Diffstat (limited to 'qemu/include/ui')
-rw-r--r--qemu/include/ui/console.h73
-rw-r--r--qemu/include/ui/egl-context.h14
-rw-r--r--qemu/include/ui/egl-helpers.h14
-rw-r--r--qemu/include/ui/gtk.h44
-rw-r--r--qemu/include/ui/input.h4
-rw-r--r--qemu/include/ui/qemu-pixman.h2
-rw-r--r--qemu/include/ui/qemu-spice.h5
-rw-r--r--qemu/include/ui/sdl2.h23
-rw-r--r--qemu/include/ui/shader.h4
-rw-r--r--qemu/include/ui/spice-display.h16
10 files changed, 182 insertions, 17 deletions
diff --git a/qemu/include/ui/console.h b/qemu/include/ui/console.h
index 047a2b464..d5a88d93e 100644
--- a/qemu/include/ui/console.h
+++ b/qemu/include/ui/console.h
@@ -5,9 +5,7 @@
#include "qom/object.h"
#include "qapi/qmp/qdict.h"
#include "qemu/notify.h"
-#include "qemu/typedefs.h"
#include "qapi-types.h"
-#include "qapi/error.h"
#ifdef CONFIG_OPENGL
# include <epoxy/gl.h>
@@ -30,6 +28,21 @@
#define GUI_REFRESH_INTERVAL_DEFAULT 30
#define GUI_REFRESH_INTERVAL_IDLE 3000
+/* Color number is match to standard vga palette */
+enum qemu_color_names {
+ QEMU_COLOR_BLACK = 0,
+ QEMU_COLOR_BLUE = 1,
+ QEMU_COLOR_GREEN = 2,
+ QEMU_COLOR_CYAN = 3,
+ QEMU_COLOR_RED = 4,
+ QEMU_COLOR_MAGENTA = 5,
+ QEMU_COLOR_YELLOW = 6,
+ QEMU_COLOR_WHITE = 7
+};
+/* Convert to curses char attributes */
+#define ATTR2CHTYPE(c, fg, bg, bold) \
+ ((bold) << 21 | (bg) << 11 | (fg) << 8 | (c))
+
typedef void QEMUPutKBDEvent(void *opaque, int keycode);
typedef void QEMUPutLEDEvent(void *opaque, int ledstate);
typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state);
@@ -157,6 +170,14 @@ void cursor_set_mono(QEMUCursor *c,
void cursor_get_mono_image(QEMUCursor *c, int foreground, uint8_t *mask);
void cursor_get_mono_mask(QEMUCursor *c, int transparent, uint8_t *mask);
+typedef void *QEMUGLContext;
+typedef struct QEMUGLParams QEMUGLParams;
+
+struct QEMUGLParams {
+ int major_ver;
+ int minor_ver;
+};
+
typedef struct DisplayChangeListenerOps {
const char *dpy_name;
@@ -183,6 +204,21 @@ typedef struct DisplayChangeListenerOps {
int x, int y, int on);
void (*dpy_cursor_define)(DisplayChangeListener *dcl,
QEMUCursor *cursor);
+
+ QEMUGLContext (*dpy_gl_ctx_create)(DisplayChangeListener *dcl,
+ QEMUGLParams *params);
+ void (*dpy_gl_ctx_destroy)(DisplayChangeListener *dcl,
+ QEMUGLContext ctx);
+ int (*dpy_gl_ctx_make_current)(DisplayChangeListener *dcl,
+ QEMUGLContext ctx);
+ QEMUGLContext (*dpy_gl_ctx_get_current)(DisplayChangeListener *dcl);
+
+ void (*dpy_gl_scanout)(DisplayChangeListener *dcl,
+ uint32_t backing_id, bool backing_y_0_top,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+ void (*dpy_gl_update)(DisplayChangeListener *dcl,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+
} DisplayChangeListenerOps;
struct DisplayChangeListener {
@@ -198,6 +234,7 @@ DisplayState *init_displaystate(void);
DisplaySurface *qemu_create_displaysurface_from(int width, int height,
pixman_format_code_t format,
int linesize, uint8_t *data);
+DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image);
DisplaySurface *qemu_create_displaysurface_guestmem(int width, int height,
pixman_format_code_t format,
int linesize,
@@ -244,6 +281,20 @@ bool dpy_cursor_define_supported(QemuConsole *con);
bool dpy_gfx_check_format(QemuConsole *con,
pixman_format_code_t format);
+void dpy_gl_scanout(QemuConsole *con,
+ uint32_t backing_id, bool backing_y_0_top,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+void dpy_gl_update(QemuConsole *con,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+
+QEMUGLContext dpy_gl_ctx_create(QemuConsole *con,
+ QEMUGLParams *params);
+void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx);
+int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx);
+QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con);
+
+bool console_has_gl(QemuConsole *con);
+
static inline int surface_stride(DisplaySurface *s)
{
return pixman_image_get_stride(s->image);
@@ -284,13 +335,23 @@ static inline pixman_format_code_t surface_format(DisplaySurface *s)
#ifdef CONFIG_CURSES
#include <curses.h>
typedef chtype console_ch_t;
+extern chtype vga_to_curses[];
#else
typedef unsigned long console_ch_t;
#endif
static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
{
- if (!(ch & 0xff))
+ uint8_t c = ch;
+#ifdef CONFIG_CURSES
+ if (vga_to_curses[c]) {
+ ch &= ~(console_ch_t)0xff;
+ ch |= vga_to_curses[c];
+ }
+#else
+ if (c == '\0') {
ch |= ' ';
+ }
+#endif
*dest = ch;
}
@@ -300,6 +361,7 @@ typedef struct GraphicHwOps {
void (*text_update)(void *opaque, console_ch_t *text);
void (*update_interval)(void *opaque, uint64_t interval);
int (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info);
+ void (*gl_block)(void *opaque, bool block);
} GraphicHwOps;
QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
@@ -312,9 +374,12 @@ void graphic_console_set_hwops(QemuConsole *con,
void graphic_hw_update(QemuConsole *con);
void graphic_hw_invalidate(QemuConsole *con);
void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata);
+void graphic_hw_gl_block(QemuConsole *con, bool block);
QemuConsole *qemu_console_lookup_by_index(unsigned int index);
QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head);
+QemuConsole *qemu_console_lookup_by_device_name(const char *device_id,
+ uint32_t head, Error **errp);
bool qemu_console_is_visible(QemuConsole *con);
bool qemu_console_is_graphic(QemuConsole *con);
bool qemu_console_is_fixedsize(QemuConsole *con);
@@ -386,7 +451,7 @@ static inline int vnc_display_pw_expire(const char *id, time_t expires)
void curses_display_init(DisplayState *ds, int full_screen);
/* input.c */
-int index_from_key(const char *key);
+int index_from_key(const char *key, size_t key_length);
/* gtk.c */
void early_gtk_display_init(int opengl);
diff --git a/qemu/include/ui/egl-context.h b/qemu/include/ui/egl-context.h
new file mode 100644
index 000000000..f004ce11a
--- /dev/null
+++ b/qemu/include/ui/egl-context.h
@@ -0,0 +1,14 @@
+#ifndef EGL_CONTEXT_H
+#define EGL_CONTEXT_H
+
+#include "ui/console.h"
+#include "ui/egl-helpers.h"
+
+QEMUGLContext qemu_egl_create_context(DisplayChangeListener *dcl,
+ QEMUGLParams *params);
+void qemu_egl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx);
+int qemu_egl_make_context_current(DisplayChangeListener *dcl,
+ QEMUGLContext ctx);
+QEMUGLContext qemu_egl_get_current_context(DisplayChangeListener *dcl);
+
+#endif /* EGL_CONTEXT_H */
diff --git a/qemu/include/ui/egl-helpers.h b/qemu/include/ui/egl-helpers.h
index 5ad5dc308..03fcf4bba 100644
--- a/qemu/include/ui/egl-helpers.h
+++ b/qemu/include/ui/egl-helpers.h
@@ -3,14 +3,26 @@
#include <epoxy/gl.h>
#include <epoxy/egl.h>
+#include <gbm.h>
extern EGLDisplay *qemu_egl_display;
extern EGLConfig qemu_egl_config;
+#ifdef CONFIG_OPENGL_DMABUF
+
+extern int qemu_egl_rn_fd;
+extern struct gbm_device *qemu_egl_rn_gbm_dev;
+extern EGLContext qemu_egl_rn_ctx;
+
+int qemu_egl_rendernode_open(void);
+int egl_rendernode_init(void);
+int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);
+
+#endif
+
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 */
diff --git a/qemu/include/ui/gtk.h b/qemu/include/ui/gtk.h
index ee6dffd30..2bf60f3ec 100644
--- a/qemu/include/ui/gtk.h
+++ b/qemu/include/ui/gtk.h
@@ -1,10 +1,6 @@
#ifndef UI_GTK_H
#define UI_GTK_H
-#ifdef _WIN32
-# define _WIN32_WINNT 0x0601 /* needed to get definition of MAPVK_VK_TO_VSC */
-#endif
-
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
/* Work around an -Wstrict-prototypes warning in GTK headers */
#pragma GCC diagnostic push
@@ -24,6 +20,7 @@
#if defined(CONFIG_OPENGL)
#include "ui/egl-helpers.h"
+#include "ui/egl-context.h"
#endif
/* Compatibility define to let us build on both Gtk2 and Gtk3 */
@@ -50,6 +47,11 @@ typedef struct VirtualGfxConsole {
EGLContext ectx;
EGLSurface esurface;
int glupdates;
+ int x, y, w, h;
+ GLuint tex_id;
+ GLuint fbo_id;
+ bool y0_top;
+ bool scanout_mode;
#endif
} VirtualGfxConsole;
@@ -59,6 +61,7 @@ typedef struct VirtualVteConsole {
GtkWidget *scrollbar;
GtkWidget *terminal;
CharDriverState *chr;
+ bool echo;
} VirtualVteConsole;
#endif
@@ -94,6 +97,39 @@ void gd_egl_update(DisplayChangeListener *dcl,
void gd_egl_refresh(DisplayChangeListener *dcl);
void gd_egl_switch(DisplayChangeListener *dcl,
DisplaySurface *surface);
+QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl,
+ QEMUGLParams *params);
+void gd_egl_scanout(DisplayChangeListener *dcl,
+ uint32_t backing_id, bool backing_y_0_top,
+ uint32_t x, uint32_t y,
+ uint32_t w, uint32_t h);
+void gd_egl_scanout_flush(DisplayChangeListener *dcl,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h);
void gtk_egl_init(void);
+int gd_egl_make_current(DisplayChangeListener *dcl,
+ QEMUGLContext ctx);
+
+/* ui/gtk-gl-area.c */
+void gd_gl_area_init(VirtualConsole *vc);
+void gd_gl_area_draw(VirtualConsole *vc);
+void gd_gl_area_update(DisplayChangeListener *dcl,
+ int x, int y, int w, int h);
+void gd_gl_area_refresh(DisplayChangeListener *dcl);
+void gd_gl_area_switch(DisplayChangeListener *dcl,
+ DisplaySurface *surface);
+QEMUGLContext gd_gl_area_create_context(DisplayChangeListener *dcl,
+ QEMUGLParams *params);
+void gd_gl_area_destroy_context(DisplayChangeListener *dcl,
+ QEMUGLContext ctx);
+void gd_gl_area_scanout(DisplayChangeListener *dcl,
+ uint32_t backing_id, bool backing_y_0_top,
+ uint32_t x, uint32_t y,
+ uint32_t w, uint32_t h);
+void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+void gtk_gl_area_init(void);
+QEMUGLContext gd_gl_area_get_current_context(DisplayChangeListener *dcl);
+int gd_gl_area_make_current(DisplayChangeListener *dcl,
+ QEMUGLContext ctx);
#endif /* UI_GTK_H */
diff --git a/qemu/include/ui/input.h b/qemu/include/ui/input.h
index 5d5ac0066..102d8a334 100644
--- a/qemu/include/ui/input.h
+++ b/qemu/include/ui/input.h
@@ -33,7 +33,9 @@ void qemu_input_handler_bind(QemuInputHandlerState *s,
const char *device_id, int head,
Error **errp);
void qemu_input_event_send(QemuConsole *src, InputEvent *evt);
+void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt);
void qemu_input_event_sync(void);
+void qemu_input_event_sync_impl(void);
InputEvent *qemu_input_event_new_key(KeyValue *key, bool down);
void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down);
@@ -63,4 +65,6 @@ void qemu_input_check_mode_change(void);
void qemu_add_mouse_mode_change_notifier(Notifier *notify);
void qemu_remove_mouse_mode_change_notifier(Notifier *notify);
+int input_linux_init(void *opaque, QemuOpts *opts, Error **errp);
+
#endif /* INPUT_H */
diff --git a/qemu/include/ui/qemu-pixman.h b/qemu/include/ui/qemu-pixman.h
index e34c4effc..4a67e0123 100644
--- a/qemu/include/ui/qemu-pixman.h
+++ b/qemu/include/ui/qemu-pixman.h
@@ -16,8 +16,6 @@
#pragma GCC diagnostic pop
#endif
-#include "qemu/typedefs.h"
-
/*
* pixman image formats are defined to be native endian,
* that means host byte order on qemu. So we go define
diff --git a/qemu/include/ui/qemu-spice.h b/qemu/include/ui/qemu-spice.h
index 0dff4229f..aa2436355 100644
--- a/qemu/include/ui/qemu-spice.h
+++ b/qemu/include/ui/qemu-spice.h
@@ -18,12 +18,11 @@
#ifndef QEMU_SPICE_H
#define QEMU_SPICE_H
-#include "config-host.h"
+#include "qapi/error.h"
#ifdef CONFIG_SPICE
#include <spice.h>
-
#include "qemu/option.h"
#include "qemu/config-file.h"
@@ -43,9 +42,7 @@ int qemu_spice_set_pw_expire(time_t expires);
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
const char *subject);
-CharDriverState *qemu_chr_open_spice_vmc(const char *type);
#if SPICE_SERVER_VERSION >= 0x000c02
-CharDriverState *qemu_chr_open_spice_port(const char *name);
void qemu_spice_register_ports(void);
#else
static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
diff --git a/qemu/include/ui/sdl2.h b/qemu/include/ui/sdl2.h
index 2fdad8f30..3f0b57bb1 100644
--- a/qemu/include/ui/sdl2.h
+++ b/qemu/include/ui/sdl2.h
@@ -15,12 +15,19 @@ struct sdl2_console {
SDL_Renderer *real_renderer;
int idx;
int last_vm_running; /* per console for caption reasons */
- int x, y;
+ int x, y, w, h;
int hidden;
int opengl;
int updates;
+ int idle_counter;
SDL_GLContext winctx;
+#ifdef CONFIG_OPENGL
ConsoleGLState *gls;
+ GLuint tex_id;
+ GLuint fbo_id;
+ bool y0_top;
+ bool scanout_mode;
+#endif
};
void sdl2_window_create(struct sdl2_console *scon);
@@ -48,4 +55,18 @@ void sdl2_gl_switch(DisplayChangeListener *dcl,
void sdl2_gl_refresh(DisplayChangeListener *dcl);
void sdl2_gl_redraw(struct sdl2_console *scon);
+QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl,
+ QEMUGLParams *params);
+void sdl2_gl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx);
+int sdl2_gl_make_context_current(DisplayChangeListener *dcl,
+ QEMUGLContext ctx);
+QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl);
+
+void sdl2_gl_scanout(DisplayChangeListener *dcl,
+ uint32_t backing_id, bool backing_y_0_top,
+ uint32_t x, uint32_t y,
+ uint32_t w, uint32_t h);
+void sdl2_gl_scanout_flush(DisplayChangeListener *dcl,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+
#endif /* SDL2_H */
diff --git a/qemu/include/ui/shader.h b/qemu/include/ui/shader.h
index 8509596ac..f7d86188b 100644
--- a/qemu/include/ui/shader.h
+++ b/qemu/include/ui/shader.h
@@ -3,7 +3,9 @@
#include <epoxy/gl.h>
-void qemu_gl_run_texture_blit(GLint texture_blit_prog);
+GLuint qemu_gl_init_texture_blit(GLint texture_blit_prog);
+void qemu_gl_run_texture_blit(GLint texture_blit_prog,
+ GLint texture_blit_vao);
GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src);
GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag);
diff --git a/qemu/include/ui/spice-display.h b/qemu/include/ui/spice-display.h
index b25328a6b..30ccfe3da 100644
--- a/qemu/include/ui/spice-display.h
+++ b/qemu/include/ui/spice-display.h
@@ -24,6 +24,14 @@
#include "ui/console.h"
#include "sysemu/sysemu.h"
+#if defined(CONFIG_OPENGL_DMABUF)
+# if SPICE_SERVER_VERSION >= 0x000d01 /* release 0.13.1 */
+# define HAVE_SPICE_GL 1
+# include "ui/egl-helpers.h"
+# include "ui/egl-context.h"
+# endif
+#endif
+
#define NUM_MEMSLOTS 8
#define MEMSLOT_GENERATION_BITS 8
#define MEMSLOT_SLOT_BITS 8
@@ -50,6 +58,7 @@ enum {
QXL_COOKIE_TYPE_IO,
QXL_COOKIE_TYPE_RENDER_UPDATE_AREA,
QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG,
+ QXL_COOKIE_TYPE_GL_DRAW_DONE,
};
typedef struct QXLCookie {
@@ -104,6 +113,13 @@ struct SimpleSpiceDisplay {
QEMUCursor *cursor;
int mouse_x, mouse_y;
QEMUBH *cursor_bh;
+
+#ifdef HAVE_SPICE_GL
+ /* opengl rendering */
+ QEMUBH *gl_unblock_bh;
+ QEMUTimer *gl_unblock_timer;
+ int dmabuf_fd;
+#endif
};
struct SimpleSpiceUpdate {