Skip to content

Commit

Permalink
Merge tag 'fixes-pull-request' of https://gitlab.com/marcandre.lureau…
Browse files Browse the repository at this point in the history
…/qemu into staging

Fixes for 8.1

Hi,

Here is a collection of ui, dump and chardev fixes that are worth for 8.1.

thanks

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmTRWDscHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5eUrD/9BvqJ87XSKchV01jji
# PmA+yFyI0JSG68oYbNPYJXxkLWdRCKp6GGcT8h1yiVtGH/SVey9spxDqbV+sK0uW
# FmqIcmSBbjI4A6+Mne07Iyd0QtgL9H6YNenRXDFLIXLh84HP47Dg9vfgx4AsRY7O
# efcCdi43/PoJOelVfn9wIkP/8DU4pZV6IsdtdUxZ3rtu/zwjW61rLzuxtLcAoCIE
# rAYiTp699NH5fKBbMzm3puK4hpaPLj4GuGPrSaWVSCcgARqi7LWpgZC5i+a6FUfS
# eWzK8WkdvHIPaUPRNl70LTWPKVxJ4PdSxFlIKgiH0bnpXHBvJnO2y1v4jaiGI0y2
# WSHKJWY513zTF4B+pMdQLjNiLotkiqtAXHw5rrjPTuVHxi1N5w6Z/BvWOSAvs8V6
# ijYmjksNoqwfpbPRTyu8psLcmj3fo2UIjQ739PgLN2lfC8d+nzdx4PIIq/ybQdZZ
# 7QBJGhxP33Ou8c3ok43Jz3go6w0WOKM0ucG1K1iTVxQ27leMKTO5Zsm2TShG2pMG
# CY6d/dumID8+G7sho8TmtTDjC5ZBkY5e27etkS+P4p+Buc60lqDrL+u6UadxWNZ1
# 3ifsQ1PhVTRuhZUJNMcX1Qo3PuEfAOH1ZuCbvXpubHwcUr4o/ZqlVrMaJtYB3ueo
# 7SX8YistmktaEeN+Y50qoiEVgg==
# =ANQg
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 07 Aug 2023 01:46:51 PM PDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]

* tag 'fixes-pull-request' of https://gitlab.com/marcandre.lureau/qemu:
  ui/gtk: set scanout mode in gd_egl/gd_gl_area_scanout_texture
  hw/i386/vmmouse:add relative packet flag for button status
  dump: kdump-zlib data pages not dumped with pvtime/aarch64
  virtio-gpu: reset gfx resources in main thread
  virtio-gpu: free BHs, by implementing unrealize
  chardev: report the handshake error

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Aug 7, 2023
2 parents 474892a + 58ea90f commit 0450cf0
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 15 deletions.
12 changes: 10 additions & 2 deletions chardev/char-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,12 @@ static void tcp_chr_websock_handshake(QIOTask *task, gpointer user_data)
{
Chardev *chr = user_data;
SocketChardev *s = user_data;
Error *err = NULL;

if (qio_task_propagate_error(task, NULL)) {
if (qio_task_propagate_error(task, &err)) {
error_reportf_err(err,
"websock handshake of character device %s failed: ",
chr->label);
tcp_chr_disconnect(chr);
} else {
if (s->do_telnetopt) {
Expand Down Expand Up @@ -778,8 +782,12 @@ static void tcp_chr_tls_handshake(QIOTask *task,
{
Chardev *chr = user_data;
SocketChardev *s = user_data;
Error *err = NULL;

if (qio_task_propagate_error(task, NULL)) {
if (qio_task_propagate_error(task, &err)) {
error_reportf_err(err,
"TLS handshake of character device %s failed: ",
chr->label);
tcp_chr_disconnect(chr);
} else {
if (s->is_websock) {
Expand Down
4 changes: 2 additions & 2 deletions dump/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1293,8 +1293,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,

memcpy(buf + addr % page_size, hbuf, n);
addr += n;
if (addr % page_size == 0) {
/* we filled up the page */
if (addr % page_size == 0 || addr >= block->target_end) {
/* we filled up the page or the current block is finished */
break;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion hw/display/virtio-gpu-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ virtio_gpu_base_set_features(VirtIODevice *vdev, uint64_t features)
trace_virtio_gpu_features(((features & virgl) == virgl));
}

static void
void
virtio_gpu_base_device_unrealize(DeviceState *qdev)
{
VirtIOGPUBase *g = VIRTIO_GPU_BASE(qdev);
Expand Down
48 changes: 41 additions & 7 deletions hw/display/virtio-gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include "qemu/units.h"
#include "qemu/iov.h"
#include "sysemu/cpus.h"
#include "ui/console.h"
#include "trace.h"
#include "sysemu/dma.h"
Expand Down Expand Up @@ -41,6 +42,7 @@ virtio_gpu_find_check_resource(VirtIOGPU *g, uint32_t resource_id,

static void virtio_gpu_cleanup_mapping(VirtIOGPU *g,
struct virtio_gpu_simple_resource *res);
static void virtio_gpu_reset_bh(void *opaque);

void virtio_gpu_update_cursor_data(VirtIOGPU *g,
struct virtio_gpu_scanout *s,
Expand Down Expand Up @@ -1387,22 +1389,57 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
&qdev->mem_reentrancy_guard);
g->cursor_bh = qemu_bh_new_guarded(virtio_gpu_cursor_bh, g,
&qdev->mem_reentrancy_guard);
g->reset_bh = qemu_bh_new(virtio_gpu_reset_bh, g);
qemu_cond_init(&g->reset_cond);
QTAILQ_INIT(&g->reslist);
QTAILQ_INIT(&g->cmdq);
QTAILQ_INIT(&g->fenceq);
}

void virtio_gpu_reset(VirtIODevice *vdev)
static void virtio_gpu_device_unrealize(DeviceState *qdev)
{
VirtIOGPU *g = VIRTIO_GPU(vdev);
VirtIOGPU *g = VIRTIO_GPU(qdev);

g_clear_pointer(&g->ctrl_bh, qemu_bh_delete);
g_clear_pointer(&g->cursor_bh, qemu_bh_delete);
g_clear_pointer(&g->reset_bh, qemu_bh_delete);
qemu_cond_destroy(&g->reset_cond);
virtio_gpu_base_device_unrealize(qdev);
}

static void virtio_gpu_reset_bh(void *opaque)
{
VirtIOGPU *g = VIRTIO_GPU(opaque);
struct virtio_gpu_simple_resource *res, *tmp;
struct virtio_gpu_ctrl_command *cmd;
int i = 0;

QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) {
virtio_gpu_resource_destroy(g, res);
}

for (i = 0; i < g->parent_obj.conf.max_outputs; i++) {
dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL);
}

g->reset_finished = true;
qemu_cond_signal(&g->reset_cond);
}

void virtio_gpu_reset(VirtIODevice *vdev)
{
VirtIOGPU *g = VIRTIO_GPU(vdev);
struct virtio_gpu_ctrl_command *cmd;

if (qemu_in_vcpu_thread()) {
g->reset_finished = false;
qemu_bh_schedule(g->reset_bh);
while (!g->reset_finished) {
qemu_cond_wait_iothread(&g->reset_cond);
}
} else {
virtio_gpu_reset_bh(g);
}

while (!QTAILQ_EMPTY(&g->cmdq)) {
cmd = QTAILQ_FIRST(&g->cmdq);
QTAILQ_REMOVE(&g->cmdq, cmd, next);
Expand All @@ -1416,10 +1453,6 @@ void virtio_gpu_reset(VirtIODevice *vdev)
g_free(cmd);
}

for (i = 0; i < g->parent_obj.conf.max_outputs; i++) {
dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL);
}

virtio_gpu_base_reset(VIRTIO_GPU_BASE(vdev));
}

Expand Down Expand Up @@ -1492,6 +1525,7 @@ static void virtio_gpu_class_init(ObjectClass *klass, void *data)
vgbc->gl_flushed = virtio_gpu_handle_gl_flushed;

vdc->realize = virtio_gpu_device_realize;
vdc->unrealize = virtio_gpu_device_unrealize;
vdc->reset = virtio_gpu_reset;
vdc->get_config = virtio_gpu_get_config;
vdc->set_config = virtio_gpu_set_config;
Expand Down
15 changes: 12 additions & 3 deletions hw/i386/vmmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@

#define VMMOUSE_VERSION 0x3442554a

#define VMMOUSE_RELATIVE_PACKET 0x00010000

#define VMMOUSE_LEFT_BUTTON 0x20
#define VMMOUSE_RIGHT_BUTTON 0x10
#define VMMOUSE_MIDDLE_BUTTON 0x08

#ifdef DEBUG_VMMOUSE
#define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
#else
Expand Down Expand Up @@ -103,15 +109,18 @@ static void vmmouse_mouse_event(void *opaque, int x, int y, int dz, int buttons_
x, y, dz, buttons_state);

if ((buttons_state & MOUSE_EVENT_LBUTTON))
buttons |= 0x20;
buttons |= VMMOUSE_LEFT_BUTTON;
if ((buttons_state & MOUSE_EVENT_RBUTTON))
buttons |= 0x10;
buttons |= VMMOUSE_RIGHT_BUTTON;
if ((buttons_state & MOUSE_EVENT_MBUTTON))
buttons |= 0x08;
buttons |= VMMOUSE_MIDDLE_BUTTON;

if (s->absolute) {
x <<= 1;
y <<= 1;
} else{
/* add for guest vmmouse driver to judge this is a relative packet. */
buttons |= VMMOUSE_RELATIVE_PACKET;
}

s->queue[s->nb_queue++] = buttons;
Expand Down
4 changes: 4 additions & 0 deletions include/hw/virtio/virtio-gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ struct VirtIOGPU {

QEMUBH *ctrl_bh;
QEMUBH *cursor_bh;
QEMUBH *reset_bh;
QemuCond reset_cond;
bool reset_finished;

QTAILQ_HEAD(, virtio_gpu_simple_resource) reslist;
QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq;
Expand Down Expand Up @@ -238,6 +241,7 @@ bool virtio_gpu_base_device_realize(DeviceState *qdev,
VirtIOHandleOutput ctrl_cb,
VirtIOHandleOutput cursor_cb,
Error **errp);
void virtio_gpu_base_device_unrealize(DeviceState *qdev);
void virtio_gpu_base_reset(VirtIOGPUBase *g);
void virtio_gpu_base_fill_display_info(VirtIOGPUBase *g,
struct virtio_gpu_resp_display_info *dpy_info);
Expand Down
1 change: 1 addition & 0 deletions ui/gtk-egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl,
eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
vc->gfx.esurface, vc->gfx.ectx);

gtk_egl_set_scanout_mode(vc, true);
egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
backing_id, false);
}
Expand Down
1 change: 1 addition & 0 deletions ui/gtk-gl-area.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
return;
}

gtk_gl_area_set_scanout_mode(vc, true);
egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
backing_id, false);
}
Expand Down

0 comments on commit 0450cf0

Please sign in to comment.