diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-04-27 11:39:31 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-04-27 11:39:31 +0100 |
commit | 10f4718b51d77ff06878afd326c3d3dd140770ee (patch) | |
tree | 2ae5bb09217ce4801b1e413e02fc8a842d2db0b6 /ui | |
parent | dcbd26f881557b83b99869b138b337feaf2d705d (diff) | |
parent | 8983e3e35033ecb9234725c2bba65f020824969b (diff) | |
download | qemu-10f4718b51d77ff06878afd326c3d3dd140770ee.zip qemu-10f4718b51d77ff06878afd326c3d3dd140770ee.tar.gz qemu-10f4718b51d77ff06878afd326c3d3dd140770ee.tar.bz2 |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180427-pull-request' into staging
vnc: fix use-after-free.
sdl2: gles support.
vfio-display: add reset support.
# gpg: Signature made Fri 27 Apr 2018 10:54:17 BST
# gpg: using RSA key 4CB6D8EED3E87138
# 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>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/ui-20180427-pull-request:
ui: introduce vfio_display_reset
console: introduce dpy_gfx_update_full
sdl: Allow OpenGL ES context creation
sdl: Move DisplayOptions global to sdl2_console
qapi: Parameter gl of DisplayType now accept an enum
vnc: fix use-after-free
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/console.c | 10 | ||||
-rw-r--r-- | ui/sdl2-gl.c | 19 | ||||
-rw-r--r-- | ui/sdl2.c | 10 | ||||
-rw-r--r-- | ui/vnc.c | 5 |
4 files changed, 35 insertions, 9 deletions
diff --git a/ui/console.c b/ui/console.c index 3fb2f4e..b02510c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1574,6 +1574,16 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h) } } +void dpy_gfx_update_full(QemuConsole *con) +{ + if (!con->surface) { + return; + } + dpy_gfx_update(con, 0, 0, + surface_width(con->surface), + surface_height(con->surface)); +} + void dpy_gfx_replace_surface(QemuConsole *con, DisplaySurface *surface) { diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index c3683e6..83b7185 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -140,12 +140,27 @@ QEMUGLContext sdl2_gl_create_context(DisplayChangeListener *dcl, SDL_GL_MakeCurrent(scon->real_window, scon->winctx); SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, - SDL_GL_CONTEXT_PROFILE_CORE); + if (scon->opts->gl == DISPLAYGL_MODE_ON || + scon->opts->gl == DISPLAYGL_MODE_CORE) { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_CORE); + } else if (scon->opts->gl == DISPLAYGL_MODE_ES) { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_ES); + } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, params->major_ver); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, params->minor_ver); ctx = SDL_GL_CreateContext(scon->real_window); + + /* If SDL fail to create a GL context and we use the "on" flag, + * then try to fallback to GLES. + */ + if (!ctx && scon->opts->gl == DISPLAYGL_MODE_ON) { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_ES); + ctx = SDL_GL_CreateContext(scon->real_window); + } return (QEMUGLContext)ctx; } @@ -32,7 +32,6 @@ static int sdl2_num_outputs; static struct sdl2_console *sdl2_console; -static DisplayOptions *opts; static SDL_Surface *guest_sprite_surface; static int gui_grab; /* if true, all keyboard/mouse events are grabbed */ @@ -566,7 +565,7 @@ static void handle_windowevent(SDL_Event *ev) break; case SDL_WINDOWEVENT_CLOSE: if (qemu_console_is_graphic(scon->dcl.con)) { - if (opts->has_window_close && !opts->window_close) { + if (scon->opts->has_window_close && !scon->opts->window_close) { allow_close = false; } if (allow_close) { @@ -613,7 +612,7 @@ void sdl2_poll_events(struct sdl2_console *scon) handle_textinput(ev); break; case SDL_QUIT: - if (opts->has_window_close && !opts->window_close) { + if (scon->opts->has_window_close && !scon->opts->window_close) { allow_close = false; } if (allow_close) { @@ -770,7 +769,6 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) SDL_SysWMinfo info; assert(o->type == DISPLAY_TYPE_SDL); - opts = o; #ifdef __linux__ /* on Linux, SDL may use fbcon|directfb|svgalib when run without @@ -806,6 +804,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) return; } sdl2_console = g_new0(struct sdl2_console, sdl2_num_outputs); + sdl2_console->opts = o; for (i = 0; i < sdl2_num_outputs; i++) { QemuConsole *con = qemu_console_lookup_by_index(i); assert(con != NULL); @@ -846,7 +845,8 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) g_free(filename); } - if (opts->has_full_screen && opts->full_screen) { + if (sdl2_console->opts->has_full_screen && + sdl2_console->opts->full_screen) { gui_fullscreen = 1; sdl_grab_start(0); } @@ -1539,13 +1539,14 @@ gboolean vnc_client_io(QIOChannel *ioc G_GNUC_UNUSED, VncState *vs = opaque; if (condition & G_IO_IN) { if (vnc_client_read(vs) < 0) { - goto end; + /* vs is free()ed here */ + return TRUE; } } if (condition & G_IO_OUT) { vnc_client_write(vs); } -end: + if (vs->disconnecting) { if (vs->ioc_tag != 0) { g_source_remove(vs->ioc_tag); |