aboutsummaryrefslogtreecommitdiff
path: root/hw/vfio/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 /hw/vfio/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 'hw/vfio/display.c')
-rw-r--r--hw/vfio/display.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index 1aa440c663..fe624a6c9b 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -241,14 +241,11 @@ static VFIODMABuf *vfio_display_get_dmabuf(VFIOPCIDevice *vdev,
dmabuf = g_new0(VFIODMABuf, 1);
dmabuf->dmabuf_id = plane.dmabuf_id;
- dmabuf->buf.width = plane.width;
- dmabuf->buf.height = plane.height;
- dmabuf->buf.backing_width = plane.width;
- dmabuf->buf.backing_height = plane.height;
- dmabuf->buf.stride = plane.stride;
- dmabuf->buf.fourcc = plane.drm_format;
- dmabuf->buf.modifier = plane.drm_format_mod;
- dmabuf->buf.fd = fd;
+ dmabuf->buf = qemu_dmabuf_new(plane.width, plane.height,
+ plane.stride, 0, 0, plane.width,
+ plane.height, plane.drm_format,
+ plane.drm_format_mod, fd, false, false);
+
if (plane_type == DRM_PLANE_TYPE_CURSOR) {
vfio_display_update_cursor(dmabuf, &plane);
}
@@ -260,8 +257,10 @@ static VFIODMABuf *vfio_display_get_dmabuf(VFIOPCIDevice *vdev,
static void vfio_display_free_one_dmabuf(VFIODisplay *dpy, VFIODMABuf *dmabuf)
{
QTAILQ_REMOVE(&dpy->dmabuf.bufs, dmabuf, next);
- dpy_gl_release_dmabuf(dpy->con, &dmabuf->buf);
- close(dmabuf->buf.fd);
+
+ qemu_dmabuf_close(dmabuf->buf);
+ dpy_gl_release_dmabuf(dpy->con, dmabuf->buf);
+ g_clear_pointer(&dmabuf->buf, qemu_dmabuf_free);
g_free(dmabuf);
}
@@ -286,6 +285,7 @@ static void vfio_display_dmabuf_update(void *opaque)
VFIOPCIDevice *vdev = opaque;
VFIODisplay *dpy = vdev->dpy;
VFIODMABuf *primary, *cursor;
+ uint32_t width, height;
bool free_bufs = false, new_cursor = false;
primary = vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_PRIMARY);
@@ -296,11 +296,13 @@ static void vfio_display_dmabuf_update(void *opaque)
return;
}
+ width = qemu_dmabuf_get_width(primary->buf);
+ height = qemu_dmabuf_get_height(primary->buf);
+
if (dpy->dmabuf.primary != primary) {
dpy->dmabuf.primary = primary;
- qemu_console_resize(dpy->con,
- primary->buf.width, primary->buf.height);
- dpy_gl_scanout_dmabuf(dpy->con, &primary->buf);
+ qemu_console_resize(dpy->con, width, height);
+ dpy_gl_scanout_dmabuf(dpy->con, primary->buf);
free_bufs = true;
}
@@ -314,7 +316,7 @@ static void vfio_display_dmabuf_update(void *opaque)
if (cursor && (new_cursor || cursor->hot_updates)) {
bool have_hot = (cursor->hot_x != 0xffffffff &&
cursor->hot_y != 0xffffffff);
- dpy_gl_cursor_dmabuf(dpy->con, &cursor->buf, have_hot,
+ dpy_gl_cursor_dmabuf(dpy->con, cursor->buf, have_hot,
cursor->hot_x, cursor->hot_y);
cursor->hot_updates = 0;
} else if (!cursor && new_cursor) {
@@ -328,7 +330,7 @@ static void vfio_display_dmabuf_update(void *opaque)
cursor->pos_updates = 0;
}
- dpy_gl_update(dpy->con, 0, 0, primary->buf.width, primary->buf.height);
+ dpy_gl_update(dpy->con, 0, 0, width, height);
if (free_bufs) {
vfio_display_free_dmabufs(vdev);