aboutsummaryrefslogtreecommitdiff
path: root/ui/spice-display.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-05-15 08:52:27 +0200
committerRichard Henderson <richard.henderson@linaro.org>2024-05-15 08:52:27 +0200
commit265aad58e9cab31d0e69c374ec2efcede7fa8881 (patch)
treeccb773c41e66790441fb8ff5922d23cba6ff5c5c /ui/spice-display.c
parent3d48b6b687c558a042d91370633b91c6e29e0e05 (diff)
parent2e701e6785cd8cc048c608751c6e4f6253c67ab6 (diff)
Merge tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging
UI: small fixes and improvements # -----BEGIN PGP SIGNATURE----- # # iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmZDZEAcHG1hcmNhbmRy # ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5UxvD/9HWbB8JdbV8lNCLePT # a6RUWSqLyP/cV0FCw9URYgAjAYROO966dZopCH7+Sz6goC8tk3IFUoqL0LbtZQjK # zMNueGRbwJj0iGMxFG4wuWBpBF6Dzc4sh90TF3XWSE8PMpWsDY+sP3VRu4sP1qu7 # OmCGTuSwNUugxazPLxvbTpLMnco9b+asAGlAU6WqpcURmia7XN7dBLGzfQ9vMxuc # L5od+pPGfcxuj3ETMG+5OQlIZH1lmX3465LajkUDVxffNfznqMVDYyo4sKNW5KOY # u420AoACeVsANWce1Aw2ekj1ETsvqxj23RClNIgdpDbMsGk9eM6eS+6vRctcM6z4 # wMH6GAKKI3AWj7Q6qY4096bcdNmYD/GOs9dgswqYjf+JLzEVcI1dHQ36K124nKH0 # t+9t3UUx1NBMwAp+EEN94W1ClwOZ0zvapS8zNaf76KIi9Eb4vrIyOlzdTM7SU4kC # CQ4Tu9MBB5WIqzhsVtIH36zDBasgAU8DCtpelDY1AJiODGiQbfZi4yo8eEiQMS1s # onixsXa7zyCCpmxwkYmvF54RbZFlPXxmdvu0jYxKddbEuTGX/Y3qvDAWv1kz6iJS # iGmYtokfkv86XBCTGTAb3QEmFfOWcLnPc59Gg0TF3zyzY3q05nU/qjuIlgYedR/o # TnnNYbyqXumojRCd69Dyy3THEg== # =SW9v # -----END PGP SIGNATURE----- # gpg: Signature made Tue 14 May 2024 03:16:48 PM CEST # 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 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu: ui/sdl2: Allow host to power down screen ui/gtk: Fix mouse/motion event scaling issue with GTK display backend ui/gtk: Add gd_motion_event trace event ui/console: move QemuDmaBuf struct def to dmabuf.c ui/console: Use qemu_dmabuf_new() and free() helpers instead ui/console: Use qemu_dmabuf_set_..() helpers instead ui/console: Use qemu_dmabuf_get_..() helpers instead ui/console: new dmabuf.h and dmabuf.c for QemuDmaBuf struct and helpers ui/gtk: Check if fence_fd is equal to or greater than 0 ui/gtk: Draw guest frame at refresh cycle Allow UNIX socket option for VNC websocket Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'ui/spice-display.c')
-rw-r--r--ui/spice-display.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 6eb98a5a5c..8a8472d029 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -976,6 +976,7 @@ static void qemu_spice_gl_cursor_dmabuf(DisplayChangeListener *dcl,
uint32_t hot_x, uint32_t hot_y)
{
SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
+ uint32_t width, height, texture;
ssd->have_hot = have_hot;
ssd->hot_x = hot_x;
@@ -984,11 +985,13 @@ static void qemu_spice_gl_cursor_dmabuf(DisplayChangeListener *dcl,
trace_qemu_spice_gl_cursor(ssd->qxl.id, dmabuf != NULL, have_hot);
if (dmabuf) {
egl_dmabuf_import_texture(dmabuf);
- if (!dmabuf->texture) {
+ texture = qemu_dmabuf_get_texture(dmabuf);
+ if (!texture) {
return;
}
- egl_fb_setup_for_tex(&ssd->cursor_fb, dmabuf->width, dmabuf->height,
- dmabuf->texture, false);
+ width = qemu_dmabuf_get_width(dmabuf);
+ height = qemu_dmabuf_get_height(dmabuf);
+ egl_fb_setup_for_tex(&ssd->cursor_fb, width, height, texture, false);
} else {
egl_fb_destroy(&ssd->cursor_fb);
}
@@ -1026,6 +1029,7 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
bool y_0_top = false; /* FIXME */
uint64_t cookie;
int fd;
+ uint32_t width, height, texture;
if (!ssd->have_scanout) {
return;
@@ -1042,41 +1046,45 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
if (ssd->guest_dmabuf_refresh) {
QemuDmaBuf *dmabuf = ssd->guest_dmabuf;
+ width = qemu_dmabuf_get_width(dmabuf);
+ height = qemu_dmabuf_get_height(dmabuf);
+
if (render_cursor) {
egl_dmabuf_import_texture(dmabuf);
- if (!dmabuf->texture) {
+ texture = qemu_dmabuf_get_texture(dmabuf);
+ if (!texture) {
return;
}
/* source framebuffer */
- egl_fb_setup_for_tex(&ssd->guest_fb,
- dmabuf->width, dmabuf->height,
- dmabuf->texture, false);
+ egl_fb_setup_for_tex(&ssd->guest_fb, width, height,
+ texture, false);
/* dest framebuffer */
- if (ssd->blit_fb.width != dmabuf->width ||
- ssd->blit_fb.height != dmabuf->height) {
- trace_qemu_spice_gl_render_dmabuf(ssd->qxl.id, dmabuf->width,
- dmabuf->height);
+ if (ssd->blit_fb.width != width ||
+ ssd->blit_fb.height != height) {
+ trace_qemu_spice_gl_render_dmabuf(ssd->qxl.id, width,
+ height);
egl_fb_destroy(&ssd->blit_fb);
egl_fb_setup_new_tex(&ssd->blit_fb,
- dmabuf->width, dmabuf->height);
+ width, height);
fd = egl_get_fd_for_texture(ssd->blit_fb.texture,
&stride, &fourcc, NULL);
- spice_qxl_gl_scanout(&ssd->qxl, fd,
- dmabuf->width, dmabuf->height,
+ spice_qxl_gl_scanout(&ssd->qxl, fd, width, height,
stride, fourcc, false);
}
} else {
- trace_qemu_spice_gl_forward_dmabuf(ssd->qxl.id,
- dmabuf->width, dmabuf->height);
+ stride = qemu_dmabuf_get_stride(dmabuf);
+ fourcc = qemu_dmabuf_get_fourcc(dmabuf);
+ y_0_top = qemu_dmabuf_get_y0_top(dmabuf);
+ fd = qemu_dmabuf_dup_fd(dmabuf);
+
+ trace_qemu_spice_gl_forward_dmabuf(ssd->qxl.id, width, height);
/* 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,
- dmabuf->y0_top);
+ spice_qxl_gl_scanout(&ssd->qxl, fd, width, height,
+ stride, fourcc, y_0_top);
}
- qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height);
+ qemu_spice_gl_monitor_config(ssd, 0, 0, width, height);
ssd->guest_dmabuf_refresh = false;
}