From 2480f41e685690511f8f15bbeabb6cdc0b2ddaf0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 20 Jul 2018 08:31:08 +0200 Subject: [PATCH] spice-display: access ptr_x/ptr_y under Mutex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The OpenGL-enabled SPICE code was not accessing the cursor position under the SimpleSpiceDisplay lock. Fix this. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-André Lureau Message-id: 20180720063109.4631-2-pbonzini@redhat.com Signed-off-by: Gerd Hoffmann --- ui/spice-display.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index fe734821dd..46df673cd7 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -976,8 +976,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, @@ -1055,10 +1057,15 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl, } 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(); }