Ui 20180312 patches
[Qemu-devel] [PULL 02/14] make: switch language file build to be gtk module aware
In reply to Gerd HoffmannFrom: Bruce Rogers <[email protected]>
Now that gtk support builds as a module, CONFIG_GTK changed from y to m. Adjust Makefile correspondingly.
Message-id: [email protected]
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -851,7 +851,7 @@ ifneq ($(BLOBS),) $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \ done endif -ifeq ($(CONFIG_GTK),y) +ifeq ($(CONFIG_GTK),m) $(MAKE) -C po $@ endif $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 03/14] sdl: workaround bug in sdl 2.0.8 headers
In reply to Gerd Hoffmannhttps://bugs.debian.org/cgi-bin/bugreport.cgi?bug=892087
Message-id: [email protected]
--- configure | 1 + 1 file changed, 1 insertion(+)
configure +1 -0
@@ -2875,6 +2875,7 @@ if test "$sdl" != "no" ; then int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } EOF sdl_cflags=$($sdlconfig --cflags 2>/dev/null) + sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug if test "$static" = "yes" ; then if $pkg_config $sdlname --exists; then sdl_libs=$($pkg_config $sdlname --static --libs 2>/dev/null)
Signature · 1 line
2.9.3
The following changes since commit e4ae62b802cec437f877f2cadc4ef059cc0eca76:
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2018-03-09 17:28:16 +0000)
are available in the git repository at:
git://git.kraxel.org/qemu tags/ui-20180312-pull-request
for you to fetch changes up to f771c5440e04626f1cf9a6a7d1b1c6cd8168cacd:
qapi: Add device ID and head parameters to screendump (2018-03-12 09:03:15 +0100)
----------------------------------------------------------------
gtk,spice: add dmabuf support.
sdl,vnc,gtk: bugfixes.
ui/qapi: add device ID and head parameters to screendump.
build: try improve handling of clang warnings.
----------------------------------------------------------------
Bruce Rogers (1):
make: switch language file build to be gtk module aware
Gerd Hoffmann (12):
build: try improve handling of clang warnings
sdl: workaround bug in sdl 2.0.8 headers
ui/gtk: make GtkGlArea usage a runtime option
ui/gtk: group gtk.mo declarations in Makefile
ui/opengl: Makefile cleanup
ui/gtk: use GtkGlArea on wayland only
ui/gtk-egl: add scanout_dmabuf support
ui/gtk-egl: add cursor_dmabuf support
vnc: deal with surface NULL pointers
spice: drop dprint() debug logging
spice: add scanout_dmabuf support
spice: add cursor_dmabuf support
Thomas Huth (1):
qapi: Add device ID and head parameters to screendump
configure | 3 +- Makefile | 2 +- include/ui/console.h | 2 + include/ui/gtk.h | 14 ++++ include/ui/spice-display.h | 9 +++ hmp.c | 4 +- ui/console.c | 34 +++++--- ui/gtk-egl.c | 63 ++++++++++++++- ui/gtk.c | 68 +++++++++------- ui/spice-display.c | 194 ++++++++++++++++++++++++++++++++------------- ui/vnc.c | 10 +++ util/coroutine-ucontext.c | 4 +- hmp-commands.hx | 7 +- qapi/ui.json | 10 ++- ui/Makefile.objs | 25 +++--- ui/trace-events | 12 +++ 16 files changed, 349 insertions(+), 112 deletions(-)
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 11/14] spice: drop dprint() debug logging
Some calls are deleted, some are converted into tracepoints.
Message-id: [email protected]
--- ui/spice-display.c | 75 ++++++++++++++++-------------------------------------- ui/trace-events | 9 +++++++ 2 files changed, 31 insertions(+), 53 deletions(-)
ui/spice-display.c +22 -53
@@ -26,20 +26,8 @@#include "ui/spice-display.h" -static int debug =0 ;bool spice_opengl; -static void GCC_FMT_ATTR(2, 3) dprint(int level, const char *fmt, ...) -{ - va_list args; - - if (level <= debug) { -va_start (args, fmt); -vfprintf (stderr, fmt, args); -va_end (args); - } -} -int qemu_spice_rect_is_empty (const QXLRect * r) {return r->top == r->bottom || r->left == r->right;
@@ -322,8 +310,6 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) {QXLDevMemSlot memslot; -dprint (1 ,"%s/%d:\n" , __func__, ssd->qxl.id); -memset (&memslot,0 ,sizeof (memslot)); memslot.slot_group_id =MEMSLOT_GROUP_HOST ; memslot.virt_end = ~0 ;
@@ -347,10 +333,6 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) ssd->buf =g_malloc (ssd->bufsize); } -dprint (1 ,"%s/%d: %ux%u (size %" PRIu64"/%d)\n" , __func__, ssd->qxl.id, -surface_width (ssd->ds),surface_height (ssd->ds), - surface_size, ssd->bufsize); - surface.format = SPICE_SURFACE_FMT_32_xRGB; surface.width =surface_width (ssd->ds); surface.height =surface_height (ssd->ds);
@@ -366,8 +348,6 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)void qemu_spice_destroy_host_primary (SimpleSpiceDisplay *ssd) { -dprint (1 ,"%s/%d:\n" , __func__, ssd->qxl.id); -qemu_spice_destroy_primary_surface (ssd,0 ,QXL_SYNC ); }
@@ -389,8 +369,7 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd, {QXLRect update_area; -dprint (2 ,"%s/%d: x %d y %d w %d h %d\n" , __func__, - ssd->qxl.id, x, y, w, h); +trace_qemu_spice_display_update (ssd->qxl.id, x, y, w, h); update_area.left = x, update_area.right = x + w; update_area.top = y;
@@ -413,8 +392,10 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, surface_height(surface) == pixman_image_get_height(ssd->surface) && surface_format(surface) == pixman_image_get_format(ssd->surface)) {/* no-resize fast path: just swap backing store */ -dprint (1 ,"%s/%d: fast (%dx%d)\n" , __func__, ssd->qxl.id, -surface_width (surface),surface_height (surface)); +trace_qemu_spice_display_surface (ssd->qxl.id, +surface_width (surface), +surface_height (surface), + true);qemu_mutex_lock (&ssd->lock); ssd->ds = surface;pixman_image_unref (ssd->surface);
@@ -427,11 +408,10 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, }/* full mode switch */ -dprint (1 ,"%s/%d: full (%dx%d -> %dx%d)\n" , __func__, ssd->qxl.id, - ssd->surface ?pixman_image_get_width (ssd->surface) :0 , - ssd->surface ?pixman_image_get_height (ssd->surface) :0 , - surface ?surface_width (surface) :0 , - surface ?surface_height (surface) :0 ); +trace_qemu_spice_display_surface (ssd->qxl.id, + surface ?surface_width (surface) :0 , + surface ?surface_height (surface) :0 , + false);memset (&ssd->dirty,0 ,sizeof (ssd->dirty));if (ssd->surface) {
@@ -495,7 +475,6 @@ void qemu_spice_cursor_refresh_bh(void *opaque)void qemu_spice_display_refresh (SimpleSpiceDisplay *ssd) { -dprint (3 ,"%s/%d:\n" , __func__, ssd->qxl.id);graphic_hw_update (ssd->dcl.con);qemu_mutex_lock (&ssd->lock);
@@ -505,10 +484,10 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) }qemu_mutex_unlock (&ssd->lock); +trace_qemu_spice_display_refresh (ssd->qxl.id, ssd->notify);if (ssd->notify) { ssd->notify =0 ;qemu_spice_wakeup (ssd); -dprint (2 ,"%s/%d: notify\n" , __func__, ssd->qxl.id); } }
@@ -516,21 +495,17 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)static void interface_attach_worker (QXLInstance *sin,QXLWorker *qxl_worker) { -SimpleSpiceDisplay *ssd =container_of (sin, SimpleSpiceDisplay, qxl); - -dprint (1 ,"%s/%d:\n" , __func__, ssd->qxl.id); +/* nothing to do */ }static void interface_set_compression_level (QXLInstance *sin,int level) { -dprint (1 ,"%s/%d:\n" , __func__, sin->id);/* nothing to do */ }#if SPICE_NEEDS_SET_MM_TIME static void interface_set_mm_time (QXLInstance *sin,uint32_t mm_time) { -dprint (3 ,"%s/%d:\n" , __func__, sin->id);/* nothing to do */ }#endif
@@ -554,8 +529,6 @@ static int interface_get_command(QXLInstance *sin, QXLCommandExt *ext)SimpleSpiceUpdate *update;int ret = false; -dprint (3 ,"%s/%d:\n" , __func__, ssd->qxl.id); -qemu_mutex_lock (&ssd->lock); update =QTAILQ_FIRST (&ssd->updates);if (update !=NULL ) {
@@ -570,7 +543,6 @@ static int interface_get_command(QXLInstance *sin, QXLCommandExt *ext)static int interface_req_cmd_notification (QXLInstance *sin) { -dprint (2 ,"%s/%d:\n" , __func__, sin->id);return 1 ; }
@@ -582,7 +554,6 @@ static void interface_release_resource(QXLInstance *sin,SimpleSpiceCursor *cursor;QXLCommandExt *ext; -dprint (2 ,"%s/%d:\n" , __func__, ssd->qxl.id); ext = (void *)(intptr_t )(rext.info->id);switch (ext->cmd.type) {case QXL_CMD_DRAW :
@@ -603,8 +574,6 @@ static int interface_get_cursor_command(QXLInstance *sin, QXLCommandExt *ext)SimpleSpiceDisplay *ssd =container_of (sin, SimpleSpiceDisplay, qxl);int ret; -dprint (3 ,"%s/%d:\n" , __func__, ssd->qxl.id); -qemu_mutex_lock (&ssd->lock);if (ssd->ptr_define) { *ext = ssd->ptr_define->ext;
@@ -623,7 +592,6 @@ static int interface_get_cursor_command(QXLInstance *sin, QXLCommandExt *ext)static int interface_req_cursor_notification (QXLInstance *sin) { -dprint (2 ,"%s:\n" , __func__);return 1 ; }
@@ -680,7 +648,7 @@ static void interface_set_client_capabilities(QXLInstance *sin, uint8_t client_present, uint8_t caps[58]) { -dprint (3 ,"%s:\n" , __func__); +/* nothing to do */ } static int interface_client_monitors_config(QXLInstance *sin,
@@ -705,9 +673,9 @@ static int interface_client_monitors_config(QXLInstance *sin, info.width = mc->monitors[head].width; info.height = mc->monitors[head].height; } + +trace_qemu_spice_ui_info (ssd->qxl.id, info.width, info.height);dpy_set_ui_info (ssd->dcl.con, &info); -dprint (1 ,"%s/%d: size %dx%d\n" , __func__, ssd->qxl.id, - info.width, info.height);return 1 ; }
@@ -902,9 +870,10 @@ static void spice_gl_switch(DisplayChangeListener *dcl,return ; } -dprint (1 ,"%s: %dx%d (stride %d/%d, fourcc 0x%x)\n" , __func__, -surface_width (ssd->ds),surface_height (ssd->ds), -surface_stride (ssd->ds), stride, fourcc); +trace_qemu_spice_gl_surface (ssd->qxl.id, +surface_width (ssd->ds), +surface_height (ssd->ds), + fourcc);/* note: spice server will close the fd */ spice_qxl_gl_scanout(&ssd->qxl, fd,
@@ -932,7 +901,7 @@ static void qemu_spice_gl_scanout_disable(DisplayChangeListener *dcl) {SimpleSpiceDisplay *ssd =container_of (dcl, SimpleSpiceDisplay, dcl); -dprint (1 ,"%s: no framebuffer\n" , __func__); +trace_qemu_spice_gl_scanout_disable (ssd->qxl.id);spice_qxl_gl_scanout (&ssd->qxl,-1 ,0 ,0 ,0 ,0 , false);qemu_spice_gl_monitor_config (ssd,0 ,0 ,0 ,0 ); ssd->have_surface = false;
@@ -957,8 +926,7 @@ static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl,fprintf (stderr,"%s: failed to get fd for texture\n" , __func__);return ; } -dprint (1 ,"%s: %dx%d (stride %d, fourcc 0x%x)\n" , __func__, - w, h, stride, fourcc); +trace_qemu_spice_gl_scanout_texture (ssd->qxl.id, w, h, fourcc);/* note: spice server will close the fd */ spice_qxl_gl_scanout(&ssd->qxl, fd, backing_width, backing_height,
@@ -978,7 +946,8 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,return ; } -dprint (2 ,"%s: %dx%d+%d+%d\n" , __func__, w, h, x, y); + +trace_qemu_spice_gl_update (ssd->qxl.id, w, h, x, y);qemu_spice_gl_block (ssd, true); cookie = (uintptr_t )qxl_cookie_new (QXL_COOKIE_TYPE_GL_DRAW_DONE ,0 );spice_qxl_gl_draw_async (&ssd->qxl, x, y, w, h, cookie);
ui/trace-events +9 -0
@@ -75,6 +75,15 @@ qemu_spice_create_primary_surface(int qid, uint32_t sid, void *surface, int asyn qemu_spice_destroy_primary_surface(int qid, uint32_t sid, int async) "%d sid=%u async=%d" qemu_spice_wakeup(uint32_t qid) "%d" qemu_spice_create_update(uint32_t left, uint32_t right, uint32_t top, uint32_t bottom) "lr %d -> %d, tb -> %d -> %d" +qemu_spice_display_update(int qid, uint32_t x, uint32_t y, uint32_t w, uint32_t h) "%d +%d+%d %dx%d" +qemu_spice_display_surface(int qid, uint32_t w, uint32_t h, int fast) "%d %dx%d, fast %d" +qemu_spice_display_refresh(int qid, int notify) "%d notify %d" +qemu_spice_ui_info(int qid, uint32_t width, uint32_t height) "%d %dx%d" + +qemu_spice_gl_surface(int qid, uint32_t w, uint32_t h, uint32_t fourcc) "%d %dx%d, fourcc 0x%x" +qemu_spice_gl_scanout_disable(int qid) "%d" +qemu_spice_gl_scanout_texture(int qid, uint32_t w, uint32_t h, uint32_t fourcc) "%d %dx%d, fourcc 0x%x" +qemu_spice_gl_update(int qid, uint32_t x, uint32_t y, uint32_t w, uint32_t h) "%d +%d+%d %dx%d" # ui/keymaps.c keymap_parse(const char *file) "file %s"
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 01/14] build: try improve handling of clang warnings
In reply to Gerd HoffmannThis patch disables the pragma diagnostic -Wunused-but-set-variable for clang in util/coroutine-ucontext.c.
This in turn allows us to remove it from the configure check, so the CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE will succeed for clang.
With that in place clang builds (linux) will use -Werror by default, which breaks the build due to warning about unaligned struct members.
Just turning off this warning isn't a good idea as it indicates portability problems. So make it a warning again, using -Wno-error=address-of-packed-member. That way it doesn't break the build but still shows up in the logs.
Now clang builds qemu without errors. Well, almost. There are some left in the rdma code. Leaving that to the rdma people. All others can use --disable-rdma to workarounds this.
Message-Id: <[email protected]>
--- configure | 2 +- util/coroutine-ucontext.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
configure +1 -1
@@ -1692,6 +1692,7 @@ gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags" gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags" gcc_flags="-Wno-string-plus-int $gcc_flags" +gcc_flags="-Wno-error=address-of-packed-member $gcc_flags" # Note that we do not add -Werror to gcc_flags here, because that would # enable it for all configure tests. If a configure test failed due # to -Werror this would just silently disable some features,
@@ -4860,7 +4861,6 @@ fi pragma_disable_unused_but_set=no cat > $TMPC << EOF #pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" #pragma GCC diagnostic ignored "-Wstrict-prototypes" #pragma GCC diagnostic pop
util/coroutine-ucontext.c +2 -2
@@ -170,7 +170,7 @@ Coroutine *qemu_coroutine_new(void) }#ifdef CONFIG_VALGRIND_H -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE +#if defined(CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE ) && !defined(__clang__)/* Work around an unused variable in the valgrind.h macro... */ #pragma GCC diagnostic push#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
@@ -179,7 +179,7 @@ static inline void valgrind_stack_deregister(CoroutineUContext *co) {VALGRIND_STACK_DEREGISTER (co->valgrind_stack_id); } -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE +#if defined(CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE ) && !defined(__clang__)#pragma GCC diagnostic pop#endif #endif
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 05/14] ui/gtk: group gtk.mo declarations in Makefile
In reply to Gerd HoffmannMessage-id: [email protected]
--- ui/Makefile.objs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
ui/Makefile.objs +7 -5
@@ -38,6 +38,13 @@ common-obj-$(CONFIG_GTK) += gtk.mo gtk.mo-objs := gtk.o gtk.mo-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS) gtk.mo-libs := $(GTK_LIBS) $(VTE_LIBS) +ifeq ($(CONFIG_OPENGL),y) +gtk.mo-objs += gtk-egl.o +gtk.mo-libs += $(OPENGL_LIBS) +ifeq ($(CONFIG_GTK_GL),y) +gtk.mo-objs += gtk-gl-area.o +endif +endif common-obj-$(CONFIG_CURSES) += curses.mo curses.mo-objs := curses.o
@@ -50,11 +57,6 @@ common-obj-y += console-gl.o common-obj-y += egl-helpers.o common-obj-y += egl-context.o common-obj-$(CONFIG_OPENGL_DMABUF) += egl-headless.o -ifeq ($(CONFIG_GTK_GL),y) -gtk.mo-objs += gtk-gl-area.o -endif -gtk.mo-objs += gtk-egl.o -gtk.mo-libs += $(OPENGL_LIBS) endif shader.o-libs += $(OPENGL_LIBS)
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 08/14] ui/gtk-egl: add scanout_dmabuf support
In reply to Gerd HoffmannAdd support for dmabuf scanouts to gtk-egl.
Message-id: [email protected]
--- include/ui/gtk.h | 4 ++++ ui/gtk-egl.c | 23 +++++++++++++++++++++++ ui/gtk.c | 2 ++ 3 files changed, 29 insertions(+)
include/ui/gtk.h +4 -0
@@ -113,6 +113,10 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl,uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h); +void gd_egl_scanout_dmabuf (DisplayChangeListener *dcl, +QemuDmaBuf *dmabuf); +void gd_egl_release_dmabuf (DisplayChangeListener *dcl, +QemuDmaBuf *dmabuf);void gd_egl_scanout_flush (DisplayChangeListener *dcl,uint32_t x,uint32_t y,uint32_t w,uint32_t h);void gtk_egl_init (void );
ui/gtk-egl.c +23 -0
@@ -194,6 +194,29 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl, backing_id, false); } +void gd_egl_scanout_dmabuf (DisplayChangeListener *dcl, +QemuDmaBuf *dmabuf) +{ +#ifdef CONFIG_OPENGL_DMABUF +egl_dmabuf_import_texture (dmabuf); +if (!dmabuf->texture) { +return ; + } + +gd_egl_scanout_texture (dcl, dmabuf->texture, + false, dmabuf->width, dmabuf->height, +0 ,0 , dmabuf->width, dmabuf->height); +#endif +} + +void gd_egl_release_dmabuf (DisplayChangeListener *dcl, +QemuDmaBuf *dmabuf) +{ +#ifdef CONFIG_OPENGL_DMABUF +egl_dmabuf_release_texture (dmabuf); +#endif +} +void gd_egl_scanout_flush (DisplayChangeListener *dcl,uint32_t x,uint32_t y,uint32_t w,uint32_t h) {
ui/gtk.c +2 -0
@@ -744,6 +744,8 @@ static const DisplayChangeListenerOps dcl_egl_ops = { .dpy_gl_ctx_get_current = qemu_egl_get_current_context, .dpy_gl_scanout_disable = gd_egl_scanout_disable, .dpy_gl_scanout_texture = gd_egl_scanout_texture, + .dpy_gl_scanout_dmabuf = gd_egl_scanout_dmabuf, + .dpy_gl_release_dmabuf = gd_egl_release_dmabuf, .dpy_gl_update = gd_egl_scanout_flush, };
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 09/14] ui/gtk-egl: add cursor_dmabuf support
In reply to Gerd HoffmannAdd support for cursor dmabufs to gtk-egl. Just blend in the cursor (if we have one) when rendering the dmabuf.
Message-id: [email protected]
--- include/ui/gtk.h | 8 ++++++++ ui/gtk-egl.c | 40 +++++++++++++++++++++++++++++++++++++++- ui/gtk.c | 2 ++ 3 files changed, 49 insertions(+), 1 deletion(-)
include/ui/gtk.h +8 -0
@@ -54,6 +54,9 @@ typedef struct VirtualGfxConsole {int x, y, w, h;egl_fb guest_fb;egl_fb win_fb; +egl_fb cursor_fb; +int cursor_x; +int cursor_y;bool y0_top;bool scanout_mode;#endif
@@ -115,6 +118,11 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl, uint32_t w, uint32_t h);void gd_egl_scanout_dmabuf (DisplayChangeListener *dcl,QemuDmaBuf *dmabuf); +void gd_egl_cursor_dmabuf (DisplayChangeListener *dcl, +QemuDmaBuf *dmabuf,bool have_hot, +uint32_t hot_x,uint32_t hot_y); +void gd_egl_cursor_position (DisplayChangeListener *dcl, +uint32_t pos_x,uint32_t pos_y);void gd_egl_release_dmabuf (DisplayChangeListener *dcl,QemuDmaBuf *dmabuf); void gd_egl_scanout_flush(DisplayChangeListener *dcl,
ui/gtk-egl.c +39 -1
@@ -19,6 +19,7 @@#include "ui/console.h" #include "ui/gtk.h" #include "ui/egl-helpers.h" +#include "ui/shader.h" #include "sysemu/sysemu.h"
@@ -209,6 +210,35 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,#endif } +void gd_egl_cursor_dmabuf (DisplayChangeListener *dcl, +QemuDmaBuf *dmabuf,bool have_hot, +uint32_t hot_x,uint32_t hot_y) +{ +#ifdef CONFIG_OPENGL_DMABUF +VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl); + +if (dmabuf) { +egl_dmabuf_import_texture (dmabuf); +if (!dmabuf->texture) { +return ; + } +egl_fb_setup_for_tex (&vc->gfx.cursor_fb, dmabuf->width, dmabuf->height, + dmabuf->texture, false); + }else { +egl_fb_destroy (&vc->gfx.cursor_fb); + } +#endif +} + +void gd_egl_cursor_position (DisplayChangeListener *dcl, +uint32_t pos_x,uint32_t pos_y) +{ +VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl); + + vc->gfx.cursor_x = pos_x; + vc->gfx.cursor_y = pos_y; +} +void gd_egl_release_dmabuf (DisplayChangeListener *dcl,QemuDmaBuf *dmabuf) {
@@ -237,7 +267,15 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl, window =gtk_widget_get_window (vc->gfx.drawing_area);gdk_drawable_get_size (window, &ww, &wh);egl_fb_setup_default (&vc->gfx.win_fb, ww, wh); -egl_fb_blit (&vc->gfx.win_fb, &vc->gfx.guest_fb, !vc->gfx.y0_top); +if (vc->gfx.cursor_fb.texture) { +egl_texture_blit (vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.guest_fb, + vc->gfx.y0_top); +egl_texture_blend (vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.cursor_fb, + vc->gfx.y0_top, + vc->gfx.cursor_x, vc->gfx.cursor_y); + }else { +egl_fb_blit (&vc->gfx.win_fb, &vc->gfx.guest_fb, !vc->gfx.y0_top); + }eglSwapBuffers (qemu_egl_display, vc->gfx.esurface); }
ui/gtk.c +2 -0
@@ -745,6 +745,8 @@ static const DisplayChangeListenerOps dcl_egl_ops = { .dpy_gl_scanout_disable = gd_egl_scanout_disable, .dpy_gl_scanout_texture = gd_egl_scanout_texture, .dpy_gl_scanout_dmabuf = gd_egl_scanout_dmabuf, + .dpy_gl_cursor_dmabuf = gd_egl_cursor_dmabuf, + .dpy_gl_cursor_position = gd_egl_cursor_position, .dpy_gl_release_dmabuf = gd_egl_release_dmabuf, .dpy_gl_update = gd_egl_scanout_flush, };
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 10/14] vnc: deal with surface NULL pointers
In reply to Gerd HoffmannSecondary displays in multihead setups are allowed to have a NULL DisplaySurface. Typically user interfaces handle this by hiding the window which shows the display in question.
This isn't an option for vnc though because it simply hasn't a concept of windows or outputs. So handle the situation by showing a placeholder DisplaySurface instead. Also check in console_select whenever a surface is preset in the first place before requesting an update.
This fixes a segfault which can be triggered by switching to an unused display (via vtrl-alt-<nr>) in a multihead setup, for example using -device virtio-vga,max_outputs=2.
Message-id: [email protected]
--- include/ui/console.h | 2 ++ ui/console.c | 10 ++++++---- ui/vnc.c | 10 ++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-)
include/ui/console.h +2 -0
@@ -260,6 +260,8 @@ DisplaySurface *qemu_create_displaysurface_guestmem(int width, int height,pixman_format_code_t format, int linesize, uint64_t addr); +DisplaySurface *qemu_create_message_surface (int w,int h, +const char *msg);PixelFormat qemu_default_pixelformat (int bpp);DisplaySurface *qemu_create_displaysurface (int width,int height);
ui/console.c +6 -4
@@ -1039,8 +1039,10 @@ void console_select(unsigned int index) dcl->ops->dpy_gfx_switch (dcl, s->surface); } } -dpy_gfx_update (s,0 ,0 ,surface_width (s->surface), -surface_height (s->surface)); +if (s->surface) { +dpy_gfx_update (s,0 ,0 ,surface_width (s->surface), +surface_height (s->surface)); + } }if (ds->have_text) {dpy_text_resize (s, s->width, s->height);
@@ -1370,8 +1372,8 @@ DisplaySurface *qemu_create_displaysurface_guestmem(int width, int height,return surface; } -static DisplaySurface *qemu_create_message_surface (int w,int h, -const char *msg) +DisplaySurface *qemu_create_message_surface (int w,int h, +const char *msg) {DisplaySurface *surface =qemu_create_displaysurface (w, h);pixman_color_t bg = color_table_rgb[0 ][QEMU_COLOR_BLACK ];
ui/vnc.c +10 -0
@@ -746,9 +746,19 @@ static void vnc_update_server_surface(VncDisplay *vd)static void vnc_dpy_switch (DisplayChangeListener *dcl,DisplaySurface *surface) { +static const char placeholder_msg[] = +"Display output is not active." ; +static DisplaySurface *placeholder;VncDisplay *vd =container_of (dcl, VncDisplay, dcl);VncState *vs; +if (surface ==NULL ) { +if (placeholder ==NULL ) { + placeholder =qemu_create_message_surface (640 ,480 , placeholder_msg); + } + surface = placeholder; + } +vnc_abort_display_jobs (vd); vd->ds = surface;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 12/14] spice: add scanout_dmabuf support
In reply to Gerd HoffmannAdd support for scanout dmabufs. Just
pass them through to spice-server.
Message-id: [email protected]
--- ui/spice-display.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
ui/spice-display.c +15 -0
@@ -936,6 +936,20 @@ static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl, ssd->have_scanout = true; } +static void qemu_spice_gl_scanout_dmabuf (DisplayChangeListener *dcl, +QemuDmaBuf *dmabuf) +{ +SimpleSpiceDisplay *ssd =container_of (dcl, SimpleSpiceDisplay, 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); +qemu_spice_gl_monitor_config (ssd,0 ,0 , dmabuf->width, dmabuf->height); + ssd->have_surface = false; + ssd->have_scanout = true; +} +static void qemu_spice_gl_update (DisplayChangeListener *dcl,uint32_t x,uint32_t y,uint32_t w,uint32_t h) {
@@ -969,6 +983,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = { .dpy_gl_scanout_disable = qemu_spice_gl_scanout_disable, .dpy_gl_scanout_texture = qemu_spice_gl_scanout_texture, + .dpy_gl_scanout_dmabuf = qemu_spice_gl_scanout_dmabuf, .dpy_gl_update = qemu_spice_gl_update, };
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 13/14] spice: add cursor_dmabuf support
In reply to Gerd HoffmannAdd support for cursor dmabufs. qemu has to render the cursor for that, so in case a cursor is present qemu allocates a new dmabuf, blits the scanout, blends in the pointer and passes on the new dmabuf to spice-server. Without cursor qemu continues to simply pass on the scanout dmabuf as-is.
Message-id: [email protected]
--- include/ui/spice-display.h | 9 ++++ ui/spice-display.c | 114 +++++++++++++++++++++++++++++++++++++++++++-- ui/trace-events | 3 ++ 3 files changed, 121 insertions(+), 5 deletions(-)
include/ui/spice-display.h +9 -0
@@ -122,6 +122,15 @@ struct SimpleSpiceDisplay {int gl_updates;bool have_scanout;bool have_surface; + +QemuDmaBuf *guest_dmabuf; +bool guest_dmabuf_refresh; +bool render_cursor; + +egl_fb guest_fb; +egl_fb blit_fb; +egl_fb cursor_fb; +bool have_hot;#endif };
ui/spice-display.c +109 -5
140 lines not on this page · raw message
ui/trace-events +3 -0
@@ -83,6 +83,9 @@ qemu_spice_ui_info(int qid, uint32_t width, uint32_t height) "%d %dx%d" qemu_spice_gl_surface(int qid, uint32_t w, uint32_t h, uint32_t fourcc) "%d %dx%d, fourcc 0x%x" qemu_spice_gl_scanout_disable(int qid) "%d" qemu_spice_gl_scanout_texture(int qid, uint32_t w, uint32_t h, uint32_t fourcc) "%d %dx%d, fourcc 0x%x" +qemu_spice_gl_cursor(int qid, bool enabled, bool hotspot) "%d enabled %d, hotspot %d" +qemu_spice_gl_forward_dmabuf(int qid, uint32_t width, uint32_t height) "%d %dx%d" +qemu_spice_gl_render_dmabuf(int qid, uint32_t width, uint32_t height) "%d %dx%d" qemu_spice_gl_update(int qid, uint32_t x, uint32_t y, uint32_t w, uint32_t h) "%d +%d+%d %dx%d" # ui/keymaps.c
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 14/14] qapi: Add device ID and head parameters to screendump
In reply to Gerd HoffmannFrom: Thomas Huth <[email protected]>
QEMU's screendump command can only take dumps from the primary display. When using multiple VGA cards, there is no way to get a dump from a secondary card or other display heads yet. So let's add a 'device' and a 'head' parameter to the HMP and QMP commands to be able to specify alternative devices and heads with the screendump command, too.
Message-id: [email protected]
--- hmp.c | 4 +++- ui/console.c | 24 +++++++++++++++++++----- hmp-commands.hx | 7 ++++--- qapi/ui.json | 10 +++++++++- 4 files changed, 35 insertions(+), 10 deletions(-)
hmp.c +3 -1
@@ -2140,9 +2140,11 @@ err_out:void hmp_screendump (Monitor *mon,const QDict *qdict) {const char *filename =qdict_get_str (qdict,"filename" ); +const char *id =qdict_get_try_str (qdict,"device" ); +int64_t head =qdict_get_try_int (qdict,"head" ,0 );Error *err =NULL ; -qmp_screendump (filename, &err); +qmp_screendump (filename, id !=NULL , id, id !=NULL , head, &err);hmp_handle_error (mon, &err); }
ui/console.c +19 -5
@@ -344,14 +344,28 @@ write_err: goto out; } -void qmp_screendump (const char *filename,Error **errp) +void qmp_screendump (const char *filename,bool has_device,const char *device, +bool has_head,int64_t head,Error **errp) { -QemuConsole *con =qemu_console_lookup_by_index (0 ); +QemuConsole *con;DisplaySurface *surface; -if (con ==NULL ) { -error_setg (errp,"There is no QemuConsole I can screendump from." ); -return ; +if (has_device) { + con =qemu_console_lookup_by_device_name (device, has_head ? head :0 , + errp); +if (!con) { +return ; + } + }else { +if (has_head) { +error_setg (errp,"'head' must be specified together with 'device'" ); +return ; + } + con =qemu_console_lookup_by_index (0 ); +if (!con) { +error_setg (errp,"There is no console to take a screendump from" ); +return ; + } }graphic_hw_update (con);
hmp-commands.hx +4 -3
@@ -253,9 +253,10 @@ ETEXI { .name = "screendump", - .args_type = "filename:F", - .params = "filename", - .help = "save screen into PPM image 'filename'", + .args_type = "filename:F,device:s?,head:i?", + .params = "filename [device [head]]", + .help = "save screen from head 'head' of display device 'device' " + "into PPM image 'filename'", .cmd = hmp_screendump, },
qapi/ui.json +9 -1
@@ -77,6 +77,13 @@ # # @filename: the path of a new PPM file to store the image # +# @device: ID of the display device that should be dumped. If this parameter +# is missing, the primary display will be used. (Since 2.12) +# +# @head: head to use in case the device supports multiple heads. If this +# parameter is missing, head #0 will be used. Also note that the head +# can only be specified in conjunction with the device ID. (Since 2.12) +# # Returns: Nothing on success # # Since: 0.14.0
@@ -88,7 +95,8 @@ # <- { "return": {} } # ## -{ 'command': 'screendump', 'data': {'filename': 'str'} } +{ 'command': 'screendump', + 'data': {'filename': 'str', '*device': 'str', '*head': 'int'} } ## # == Spice
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 04/14] ui/gtk: make GtkGlArea usage a runtime option
In reply to Gerd HoffmannCompile in both gtk-egl and gtk-gl-area, then allow to choose at runtime instead of compile time which opengl variant we want use.
Message-id: [email protected]
--- include/ui/gtk.h | 2 ++ ui/gtk.c | 53 +++++++++++++++++++++++++++++------------------------ ui/Makefile.objs | 3 +-- 3 files changed, 32 insertions(+), 26 deletions(-)
include/ui/gtk.h +2 -0
@@ -90,6 +90,8 @@ typedef struct VirtualConsole { }; } VirtualConsole; +extern bool gtk_use_gl_area; +/* ui/gtk.c */ void gd_update_windowsize (VirtualConsole *vc);
ui/gtk.c +29 -24
108 lines not on this page · raw message
ui/Makefile.objs +1 -2
@@ -52,11 +52,10 @@ common-obj-y += egl-context.o common-obj-$(CONFIG_OPENGL_DMABUF) += egl-headless.o ifeq ($(CONFIG_GTK_GL),y) gtk.mo-objs += gtk-gl-area.o -else +endif gtk.mo-objs += gtk-egl.o gtk.mo-libs += $(OPENGL_LIBS) endif -endif shader.o-libs += $(OPENGL_LIBS) console-gl.o-libs += $(OPENGL_LIBS)
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 06/14] ui/opengl: Makefile cleanup
In reply to Gerd HoffmannWith gtk.mo bits moved away we don't need the ifeq any more. Also add missing opengl libs for some objects.
Message-id: [email protected]
--- ui/Makefile.objs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
ui/Makefile.objs +6 -6
@@ -51,14 +51,14 @@ curses.mo-objs := curses.o curses.mo-cflags := $(CURSES_CFLAGS) curses.mo-libs := $(CURSES_LIBS) -ifeq ($(CONFIG_OPENGL),y) -common-obj-y += shader.o -common-obj-y += console-gl.o -common-obj-y += egl-helpers.o -common-obj-y += egl-context.o +common-obj-$(CONFIG_OPENGL) += shader.o +common-obj-$(CONFIG_OPENGL) += console-gl.o +common-obj-$(CONFIG_OPENGL) += egl-helpers.o +common-obj-$(CONFIG_OPENGL) += egl-context.o common-obj-$(CONFIG_OPENGL_DMABUF) += egl-headless.o -endif shader.o-libs += $(OPENGL_LIBS) console-gl.o-libs += $(OPENGL_LIBS) egl-helpers.o-libs += $(OPENGL_LIBS) +egl-context.o-libs += $(OPENGL_LIBS) +egl-headless.o-libs += $(OPENGL_LIBS)
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 07/14] ui/gtk: use GtkGlArea on wayland only
In reply to Gerd HoffmannFor dma-buf support we need a egl context. The gtk x11 backend uses glx contexts though. We can't use the GtkGlArea widget on x11 because of that, so use our own gtk-egl code instead. wayland continues to use the GtkGlArea widget.
Message-id: [email protected]
--- ui/gtk.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
ui/gtk.c +8 -5
@@ -2440,12 +2440,15 @@ static void early_gtk_display_init(DisplayOptions *opts)assert (opts->type ==DISPLAY_TYPE_GTK );if (opts->has_gl && opts->gl) {#if defined(CONFIG_OPENGL ) -#if defined(CONFIG_GTK_GL ) - gtk_use_gl_area = true; -gtk_gl_area_init (); -#else -gtk_egl_init (); +#if defined(CONFIG_GTK_GL ) && defined(GDK_WINDOWING_WAYLAND ) +if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) { + gtk_use_gl_area = true; +gtk_gl_area_init (); + }#endif + { +gtk_egl_init (); + }#endif }
Signature · 1 line
2.9.3
Peter Maydell
AppliedQuoted 10 lines · Gerd Hoffmann
The following changes since commit
e4ae62b802cec437f877f2cadc4ef059cc0eca76:Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2018-03-09 17:28:16 +0000)
are available in the git repository at:
git://git.kraxel.org/qemutags/ui-20180312-pull-requestfor you to fetch changes up to
f771c5440e04626f1cf9a6a7d1b1c6cd8168cacd:
Quoted 8 lines
qapi: Add device ID and head parameters to screendump (2018-03-12 09:03:15 +0100)
----------------------------------------------------------------
gtk,spice: add dmabuf support.
sdl,vnc,gtk: bugfixes.
ui/qapi: add device ID and head parameters to screendump.
build: try improve handling of clang warnings.
Applied, thanks.
-- PMM
Re: [Qemu-devel] [PULL 13/14] spice: add cursor_dmabuf support
In reply to Gerd HoffmannQuoted 6 lines · Gerd Hoffmann
Add support for cursor dmabufs. qemu has to render the cursor for that, so in case a cursor is present qemu allocates a new dmabuf, blits the scanout, blends in the pointer and passes on the new dmabuf to spice-server. Without cursor qemu continues to simply pass on the scanout dmabuf as-is.
ui/spice-display.c static void qemu_spice_gl_scanout_dmabuf(DisplayChangeListener *dcl, · line 1052
Quoted 8 lines
ui/spice-display.c +8
-0+ }else { +trace_qemu_spice_gl_forward_dmabuf (ssd->qxl.id, + dmabuf->width, dmabuf->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, false); + }
Coverity complains about this, because it doesn't know that spice_qxl_gl_scanout() closes the fd it's passed. Is it worth adding something to our coverity model to indicate this? (Coverity complained in CID 1390616, which I have marked as a false-positive for now.)
thanks
-- PMM
Re: [Qemu-devel] [PULL 13/14] spice: add cursor_dmabuf support
In reply to Gerd HoffmannQuoted 9 lines · Gerd Hoffmann
Add support for cursor dmabufs. qemu has to render the cursor for that, so in case a cursor is present qemu allocates a new dmabuf, blits the scanout, blends in the pointer and passes on the new dmabuf to spice-server. Without cursor qemu continues to simply pass on the scanout dmabuf as-is.
Signed-off-by Gerd Hoffmann <[email protected]>Reviewed-by Marc-André Lureau <[email protected]>Message-id: [email protected]
ui/spice-display.c static void qemu_spice_gl_scanout_dmabuf(DisplayChangeListener *dcl, · line 980
Quoted 7 lines
ui/spice-display.c +7
-0+static void qemu_spice_gl_cursor_position (DisplayChangeListener *dcl, +uint32_t pos_x,uint32_t pos_y) +{ +SimpleSpiceDisplay *ssd =container_of (dcl, SimpleSpiceDisplay, dcl); + + ssd->ptr_x = pos_x; + ssd->ptr_y = pos_y;
Is it safe to write to these fields of ssd without holding ssd->lock ? Coverity thinks it might not be (CID 1390631) because we do take the lock to update them in display_mouse_set().
thanks
-- PMM
Re: [Qemu-devel] [PULL 13/14] spice: add cursor_dmabuf support
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Gerd Hoffmann
Add support for cursor dmabufs. qemu has to render the cursor for that, so in case a cursor is present qemu allocates a new dmabuf, blits the scanout, blends in the pointer and passes on the new dmabuf to spice-server. Without cursor qemu continues to simply pass on the scanout dmabuf as-is.
Quoted 14 lines
ui/spice-display.c static void qemu_spice_gl_scanout_dmabuf(DisplayChangeListener *dcl, · line 980
Quoted 10 lines
Signed-off-by Gerd Hoffmann <[email protected]>Reviewed-by Marc-André Lureau <[email protected]>Message-id: [email protected]
ui/spice-display.c +7
-0+static void qemu_spice_gl_cursor_position (DisplayChangeListener *dcl, +uint32_t pos_x,uint32_t pos_y) +{ +SimpleSpiceDisplay *ssd =container_of (dcl, SimpleSpiceDisplay, dcl); + + ssd->ptr_x = pos_x; + ssd->ptr_y = pos_y;Is it safe to write to these fields of ssd without holding
ssd->lock? Coverity thinks it might not be (CID 1390631) because we do take the lock to update them indisplay_mouse_set().
Ping for opinions on this coverity issue?
thanks
-- PMM
Re: [Qemu-devel] [PULL 13/14] spice: add cursor_dmabuf support
Quoted 23 lines · Peter Maydell
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Gerd Hoffmann
Add support for cursor dmabufs. qemu has to render the cursor for that, so in case a cursor is present qemu allocates a new dmabuf, blits the scanout, blends in the pointer and passes on the new dmabuf to spice-server. Without cursor qemu continues to simply pass on the scanout dmabuf as-is.
Quoted 14 lines
ui/spice-display.c static void qemu_spice_gl_scanout_dmabuf(DisplayChangeListener *dcl, · line 980
Quoted 10 lines
Signed-off-by Gerd Hoffmann <[email protected]>Reviewed-by Marc-André Lureau <[email protected]>Message-id: [email protected]
ui/spice-display.c +7
-0+static void qemu_spice_gl_cursor_position (DisplayChangeListener *dcl, +uint32_t pos_x,uint32_t pos_y) +{ +SimpleSpiceDisplay *ssd =container_of (dcl, SimpleSpiceDisplay, dcl); + + ssd->ptr_x = pos_x; + ssd->ptr_y = pos_y;Is it safe to write to these fields of ssd without holding
ssd->lock? Coverity thinks it might not be (CID 1390631) because we do take the lock to update them indisplay_mouse_set().
Quoted 1 line
Ping for opinions on this coverity issue?
Ping^2 ?
thanks
-- PMM