aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-08-27 12:30:51 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-08-27 12:30:51 +0100
commit025573be71dab8d7885b787a6ca52d6d9bbfd75c (patch)
treefee015648089335a64b294d39cb223acc9451e61 /ui
parent235c82acca0491465e94be3cae2583b42d37c859 (diff)
parentb1d380372f31672da9318431e84e79bccd8ef3bf (diff)
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180827-v4-pull-request' into staging
ui: misc fixes which piled up during 3.0 release freeze # gpg: Signature made Mon 27 Aug 2018 09:53:07 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-20180827-v4-pull-request: util: promote qemu_egl_rendernode_open() to libqemuutil dmabuf: add y0_top, pass it to spice ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro ui/sdl2: Fix broken -full-screen CLI option spice-display: fix qemu_spice_cursor_refresh_bh locking spice-display: access ptr_x/ptr_y under Mutex vnc: remove support for deprecated tls, x509, x509verify options doc: switch to modern syntax for VNC TLS setup sdl2: redraw correctly when scanout_mode enabled. ui: use enum to string helpers vnc: fix memleak of the "vnc-worker-output" name ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flag Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/console.c6
-rw-r--r--ui/egl-helpers.c51
-rw-r--r--ui/sdl2-gl.c5
-rw-r--r--ui/sdl2.c13
-rw-r--r--ui/spice-display.c42
-rw-r--r--ui/vnc-enc-tight.c2
-rw-r--r--ui/vnc-jobs.c3
-rw-r--r--ui/vnc.c94
8 files changed, 48 insertions, 168 deletions
diff --git a/ui/console.c b/ui/console.c
index bc58458ee8..3a285bae00 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2319,7 +2319,7 @@ bool qemu_display_find_default(DisplayOptions *opts)
for (i = 0; i < ARRAY_SIZE(prio); i++) {
if (dpys[prio[i]] == NULL) {
- ui_module_load_one(DisplayType_lookup.array[prio[i]]);
+ ui_module_load_one(DisplayType_str(prio[i]));
}
if (dpys[prio[i]] == NULL) {
continue;
@@ -2337,11 +2337,11 @@ void qemu_display_early_init(DisplayOptions *opts)
return;
}
if (dpys[opts->type] == NULL) {
- ui_module_load_one(DisplayType_lookup.array[opts->type]);
+ ui_module_load_one(DisplayType_str(opts->type));
}
if (dpys[opts->type] == NULL) {
error_report("Display '%s' is not available.",
- DisplayType_lookup.array[opts->type]);
+ DisplayType_str(opts->type));
exit(1);
}
if (dpys[opts->type]->early_init) {
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 71b6a97bd1..4f475142fc 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -15,9 +15,7 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
-#include <glob.h>
-#include <dirent.h>
-
+#include "qemu/drm.h"
#include "qemu/error-report.h"
#include "ui/console.h"
#include "ui/egl-helpers.h"
@@ -147,57 +145,12 @@ int qemu_egl_rn_fd;
struct gbm_device *qemu_egl_rn_gbm_dev;
EGLContext qemu_egl_rn_ctx;
-static int qemu_egl_rendernode_open(const char *rendernode)
-{
- DIR *dir;
- struct dirent *e;
- int r, fd;
- char *p;
-
- if (rendernode) {
- return open(rendernode, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
- }
-
- dir = opendir("/dev/dri");
- if (!dir) {
- return -1;
- }
-
- fd = -1;
- while ((e = readdir(dir))) {
- if (e->d_type != DT_CHR) {
- continue;
- }
-
- if (strncmp(e->d_name, "renderD", 7)) {
- continue;
- }
-
- p = g_strdup_printf("/dev/dri/%s", e->d_name);
-
- r = open(p, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
- if (r < 0) {
- g_free(p);
- continue;
- }
- fd = r;
- g_free(p);
- break;
- }
-
- closedir(dir);
- if (fd < 0) {
- return -1;
- }
- return fd;
-}
-
int egl_rendernode_init(const char *rendernode, DisplayGLMode mode)
{
qemu_egl_rn_fd = -1;
int rc;
- qemu_egl_rn_fd = qemu_egl_rendernode_open(rendernode);
+ qemu_egl_rn_fd = qemu_drm_rendernode_open(rendernode);
if (qemu_egl_rn_fd == -1) {
error_report("egl: no drm render node available");
goto err;
diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
index 83b71853d1..1bf4542d8d 100644
--- a/ui/sdl2-gl.c
+++ b/ui/sdl2-gl.c
@@ -124,6 +124,11 @@ void sdl2_gl_redraw(struct sdl2_console *scon)
{
assert(scon->opengl);
+ if (scon->scanout_mode) {
+ /* sdl2_gl_scanout_flush actually only care about
+ * the first argument. */
+ return sdl2_gl_scanout_flush(&scon->dcl, 0, 0, 0, 0);
+ }
if (scon->surface) {
sdl2_gl_render_surface(scon);
}
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 76e59427cc..0a9a18a964 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -761,7 +761,6 @@ static void sdl2_display_early_init(DisplayOptions *o)
static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
{
- int flags;
uint8_t data = 0;
char *filename;
int i;
@@ -782,8 +781,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
setenv("SDL_VIDEODRIVER", "x11", 0);
#endif
- flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
- if (SDL_Init(flags)) {
+ if (SDL_Init(SDL_INIT_VIDEO)) {
fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
SDL_GetError());
exit(1);
@@ -792,6 +790,8 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
memset(&info, 0, sizeof(info));
SDL_VERSION(&info.version);
+ gui_fullscreen = o->has_full_screen && o->full_screen;
+
for (i = 0;; i++) {
QemuConsole *con = qemu_console_lookup_by_index(i);
if (!con) {
@@ -844,17 +844,14 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
g_free(filename);
}
- if (sdl2_console->opts->has_full_screen &&
- sdl2_console->opts->full_screen) {
- gui_fullscreen = 1;
+ gui_grab = 0;
+ if (gui_fullscreen) {
sdl_grab_start(0);
}
mouse_mode_notifier.notify = sdl_mouse_mode_change;
qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);
- gui_grab = 0;
-
sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);
sdl_cursor_normal = SDL_GetCursor();
diff --git a/ui/spice-display.c b/ui/spice-display.c
index fe734821dd..2f8adb6b9f 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -450,29 +450,35 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
qemu_mutex_unlock(&ssd->lock);
}
-static void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd)
+void qemu_spice_cursor_refresh_bh(void *opaque)
{
+ SimpleSpiceDisplay *ssd = opaque;
+
+ qemu_mutex_lock(&ssd->lock);
if (ssd->cursor) {
+ QEMUCursor *c = ssd->cursor;
assert(ssd->dcl.con);
- dpy_cursor_define(ssd->dcl.con, ssd->cursor);
+ cursor_get(c);
+ qemu_mutex_unlock(&ssd->lock);
+ dpy_cursor_define(ssd->dcl.con, c);
+ qemu_mutex_lock(&ssd->lock);
+ cursor_put(c);
}
+
if (ssd->mouse_x != -1 && ssd->mouse_y != -1) {
+ int x, y;
assert(ssd->dcl.con);
- dpy_mouse_set(ssd->dcl.con, ssd->mouse_x, ssd->mouse_y, 1);
+ x = ssd->mouse_x;
+ y = ssd->mouse_y;
ssd->mouse_x = -1;
ssd->mouse_y = -1;
+ qemu_mutex_unlock(&ssd->lock);
+ dpy_mouse_set(ssd->dcl.con, x, y, 1);
+ } else {
+ qemu_mutex_unlock(&ssd->lock);
}
}
-void qemu_spice_cursor_refresh_bh(void *opaque)
-{
- SimpleSpiceDisplay *ssd = opaque;
-
- qemu_mutex_lock(&ssd->lock);
- qemu_spice_cursor_refresh_unlocked(ssd);
- qemu_mutex_unlock(&ssd->lock);
-}
-
void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
{
graphic_hw_update(ssd->dcl.con);
@@ -976,8 +982,10 @@ static void qemu_spice_gl_cursor_position(DisplayChangeListener *dcl,
{
SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
+ qemu_mutex_lock(&ssd->lock);
ssd->ptr_x = pos_x;
ssd->ptr_y = pos_y;
+ qemu_mutex_unlock(&ssd->lock);
}
static void qemu_spice_gl_release_dmabuf(DisplayChangeListener *dcl,
@@ -1048,17 +1056,23 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
/* note: spice server will close the fd, so hand over a dup */
spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd),
dmabuf->width, dmabuf->height,
- dmabuf->stride, dmabuf->fourcc, false);
+ dmabuf->stride, dmabuf->fourcc,
+ dmabuf->y0_top);
}
qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height);
ssd->guest_dmabuf_refresh = false;
}
if (render_cursor) {
+ int x, y;
+ qemu_mutex_lock(&ssd->lock);
+ x = ssd->ptr_x;
+ y = ssd->ptr_y;
+ qemu_mutex_unlock(&ssd->lock);
egl_texture_blit(ssd->gls, &ssd->blit_fb, &ssd->guest_fb,
!y_0_top);
egl_texture_blend(ssd->gls, &ssd->blit_fb, &ssd->cursor_fb,
- !y_0_top, ssd->ptr_x, ssd->ptr_y);
+ !y_0_top, x, y);
glFlush();
}
diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c
index f38aceb4da..0b4a5ac71f 100644
--- a/ui/vnc-enc-tight.c
+++ b/ui/vnc-enc-tight.c
@@ -979,7 +979,7 @@ static int send_mono_rect(VncState *vs, int x, int y,
}
#endif
- bytes = (DIV_ROUND_UP(w, 8)) * h;
+ bytes = DIV_ROUND_UP(w, 8) * h;
vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4);
vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE);
diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index b0b15d42a8..929391f85d 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -193,6 +193,7 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
static void vnc_async_encoding_end(VncState *orig, VncState *local)
{
+ buffer_free(&local->output);
orig->tight = local->tight;
orig->zlib = local->zlib;
orig->hextile = local->hextile;
@@ -278,7 +279,7 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)
/* Copy persistent encoding data */
vnc_async_encoding_end(job->vs, &vs);
- qemu_bh_schedule(job->vs->bh);
+ qemu_bh_schedule(job->vs->bh);
} else {
buffer_reset(&vs.output);
/* Copy persistent encoding data */
diff --git a/ui/vnc.c b/ui/vnc.c
index 359693238b..ccb1335d86 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2967,7 +2967,8 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
guest_stride = pixman_image_get_stride(vd->guest.fb);
- guest_ll = pixman_image_get_width(vd->guest.fb) * (DIV_ROUND_UP(guest_bpp, 8));
+ guest_ll = pixman_image_get_width(vd->guest.fb)
+ * DIV_ROUND_UP(guest_bpp, 8);
}
line_bytes = MIN(server_stride, guest_ll);
@@ -3345,10 +3346,6 @@ static QemuOptsList qemu_vnc_opts = {
.name = "tls-creds",
.type = QEMU_OPT_STRING,
},{
- /* Deprecated in favour of tls-creds */
- .name = "x509",
- .type = QEMU_OPT_STRING,
- },{
.name = "share",
.type = QEMU_OPT_STRING,
},{
@@ -3385,14 +3382,6 @@ static QemuOptsList qemu_vnc_opts = {
.name = "sasl",
.type = QEMU_OPT_BOOL,
},{
- /* Deprecated in favour of tls-creds */
- .name = "tls",
- .type = QEMU_OPT_BOOL,
- },{
- /* Deprecated in favour of tls-creds */
- .name = "x509verify",
- .type = QEMU_OPT_STRING,
- },{
.name = "acl",
.type = QEMU_OPT_BOOL,
},{
@@ -3519,51 +3508,6 @@ vnc_display_setup_auth(int *auth,
}
-/*
- * Handle back compat with old CLI syntax by creating some
- * suitable QCryptoTLSCreds objects
- */
-static QCryptoTLSCreds *
-vnc_display_create_creds(bool x509,
- bool x509verify,
- const char *dir,
- const char *id,
- Error **errp)
-{
- gchar *credsid = g_strdup_printf("tlsvnc%s", id);
- Object *parent = object_get_objects_root();
- Object *creds;
- Error *err = NULL;
-
- if (x509) {
- creds = object_new_with_props(TYPE_QCRYPTO_TLS_CREDS_X509,
- parent,
- credsid,
- &err,
- "endpoint", "server",
- "dir", dir,
- "verify-peer", x509verify ? "yes" : "no",
- NULL);
- } else {
- creds = object_new_with_props(TYPE_QCRYPTO_TLS_CREDS_ANON,
- parent,
- credsid,
- &err,
- "endpoint", "server",
- NULL);
- }
-
- g_free(credsid);
-
- if (err) {
- error_propagate(errp, err);
- return NULL;
- }
-
- return QCRYPTO_TLS_CREDS(creds);
-}
-
-
static int vnc_display_get_address(const char *addrstr,
bool websocket,
bool reverse,
@@ -3930,15 +3874,6 @@ void vnc_display_open(const char *id, Error **errp)
credid = qemu_opt_get(opts, "tls-creds");
if (credid) {
Object *creds;
- if (qemu_opt_get(opts, "tls") ||
- qemu_opt_get(opts, "x509") ||
- qemu_opt_get(opts, "x509verify")) {
- error_setg(errp,
- "'tls-creds' parameter is mutually exclusive with "
- "'tls', 'x509' and 'x509verify' parameters");
- goto fail;
- }
-
creds = object_resolve_path_component(
object_get_objects_root(), credid);
if (!creds) {
@@ -3961,31 +3896,6 @@ void vnc_display_open(const char *id, Error **errp)
"Expecting TLS credentials with a server endpoint");
goto fail;
}
- } else {
- const char *path;
- bool tls = false, x509 = false, x509verify = false;
- tls = qemu_opt_get_bool(opts, "tls", false);
- if (tls) {
- path = qemu_opt_get(opts, "x509");
-
- if (path) {
- x509 = true;
- } else {
- path = qemu_opt_get(opts, "x509verify");
- if (path) {
- x509 = true;
- x509verify = true;
- }
- }
- vd->tlscreds = vnc_display_create_creds(x509,
- x509verify,
- path,
- vd->id,
- errp);
- if (!vd->tlscreds) {
- goto fail;
- }
- }
}
acl = qemu_opt_get_bool(opts, "acl", false);