ui: console+vnc fixes, switch spice to pure opengl with gl=on.
[Qemu-devel] [PULL 1/4] console: skip same-size resize
In reply to Gerd HoffmannFrom: Marc-André Lureau <[email protected]>
virtio-gpu does a set-scanout at each frame (it might be a driver regression). qemu_console_resize() recreate a surface even if the size didn't change, and this shows up in profiling reports because the surface is cleared. With this patch, I get a +15-20% glmark2 improvement.
Message-id: [email protected]
--- ui/console.c | 7 +++++++ 1 file changed, 7 insertions(+)
ui/console.c +7 -0
@@ -2101,6 +2101,13 @@ void qemu_console_resize(QemuConsole *s, int width, int height)DisplaySurface *surface;assert (s->console_type ==GRAPHIC_CONSOLE ); + +if (s->surface && +pixman_image_get_width (s->surface->image) == width && +pixman_image_get_height (s->surface->image) == height) { +return ; + } + surface =qemu_create_displaysurface (width, height);dpy_gfx_replace_surface (s, surface); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 3/4] spice/gl: render DisplaySurface via opengl
In reply to Gerd HoffmannThis switches over spice (in opengl mode) to render DisplaySurface updates into a opengl texture, using the helper functions in ui/console-gl.c. With this patch applied spice (with gl=on) will stop using qxl rendering ops, it will use dma-buf passing all the time, i.e. for bios/bootloader (before virtio-gpu driver is loaded) too.
This should improve performance even using spice (with gl=on) with non-accelerated stdvga because we stop squeezing all display updates through a unix/tcp socket and basically using a shared memory transport instead.
Message-id: [email protected]
--- include/ui/spice-display.h | 5 ++- ui/spice-display.c | 92 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 88 insertions(+), 9 deletions(-)
include/ui/spice-display.h +4 -1
@@ -119,7 +119,10 @@ struct SimpleSpiceDisplay {/* opengl rendering */ QEMUBH *gl_unblock_bh;QEMUTimer *gl_unblock_timer; -int dmabuf_fd; +ConsoleGLState *gls; +int gl_updates; +bool have_scanout; +bool have_surface;#endif };
ui/spice-display.c +84 -8
125 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 2/4] console: track gl_block state in QemuConsole
In reply to Gerd HoffmannKeep track of gl_block state (added in bba19b8 console: block rendering until client is done) in QemuConsole and allow to query it. This way we can avoid state inconsistencies in case different code paths make use of this.
Message-id: [email protected]
--- include/ui/console.h | 1 + ui/console.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-)
include/ui/console.h +1 -0
@@ -387,6 +387,7 @@ QemuConsole *qemu_console_lookup_by_device_name(const char *device_id,bool qemu_console_is_visible (QemuConsole *con);bool qemu_console_is_graphic (QemuConsole *con);bool qemu_console_is_fixedsize (QemuConsole *con); +bool qemu_console_is_gl_blocked (QemuConsole *con);char *qemu_console_get_label (QemuConsole *con);int qemu_console_get_index (QemuConsole *con);uint32_t qemu_console_get_head (QemuConsole *con);
ui/console.c +11 -4
@@ -123,6 +123,7 @@ struct QemuConsole {DisplaySurface *surface;int dcls;DisplayChangeListener *gl; +bool gl_block;/* Graphic console state. */ Object *device;
@@ -264,10 +265,10 @@ void graphic_hw_update(QemuConsole *con)void graphic_hw_gl_block (QemuConsole *con,bool block) { -if (!con) { - con = active_console; - } -if (con && con->hw_ops->gl_block) { +assert (con !=NULL ); + + con->gl_block = block; +if (con->hw_ops->gl_block) { con->hw_ops->gl_block (con->hw, block); } }
@@ -1879,6 +1880,12 @@ bool qemu_console_is_fixedsize(QemuConsole *con)return con && (con->console_type !=TEXT_CONSOLE ); } +bool qemu_console_is_gl_blocked (QemuConsole *con) +{ +assert (con !=NULL ); +return con->gl_block; +} +char *qemu_console_get_label (QemuConsole *con) {if (con->console_type ==GRAPHIC_CONSOLE ) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 4/4] ui/vnc-enc-tight: remove switch and have single return
In reply to Gerd HoffmannFrom: Alex Bennée <[email protected]>
When enabling the sanitizer build it will complain about control reaching a non-void function. Normally the compiler should detect that there is only one possible exit given a static VNC_SERVER_FB_BYTES.
As we always expect a static VNC_SERVER_FB_BYTES I've added a compile time assert and just called the sub-function directly.
--- ui/vnc-enc-tight.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
ui/vnc-enc-tight.c +2 -4
@@ -707,10 +707,8 @@ check_solid_tile32(VncState *vs, int x, int y, int w, int h,static bool check_solid_tile (VncState *vs,int x,int y,int w,int h,uint32_t * color,bool samecolor) { -switch (VNC_SERVER_FB_BYTES ) { -case 4 : -return check_solid_tile32 (vs, x, y, w, h, color, samecolor); - } +QEMU_BUILD_BUG_ON (VNC_SERVER_FB_BYTES !=4 ); +return check_solid_tile32 (vs, x, y, w, h, color, samecolor); } static void find_best_solid_area(VncState *vs, int x, int y, int w, int h,
Signature · 1 line
1.8.3.1
Hi,
Here is the ui patch queue with two small bug fixes and with pure opengl support for spice, i.e. with gl=on we'll render everything (including classic DisplaySurfaces) into a opengl texture for dma-buf passing.
please pull,
Gerd
The following changes since commit 7cfdc02dae0d2ff58c897496cfdbbafc0eda0f3f:
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2016-09-26 19:47:00 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-ui-20160928-1
for you to fetch changes up to d9d2663c336b4ff7af9528f2cd3736791f4c0da5:
ui/vnc-enc-tight: remove switch and have single return (2016-09-28 12:55:09 +0200)
----------------------------------------------------------------
ui: console+vnc fixes, switch spice to pure opengl with gl=on.
----------------------------------------------------------------
Alex Bennée (1):
ui/vnc-enc-tight: remove switch and have single return
Gerd Hoffmann (2):
console: track gl_block state in QemuConsole spice/gl: render DisplaySurface via opengl
Marc-André Lureau (1):
console: skip same-size resize
include/ui/console.h | 1 + include/ui/spice-display.h | 5 ++- ui/console.c | 22 +++++++++-- ui/spice-display.c | 92 ++++++++++++++++++++++++++++++++++++++++++---- ui/vnc-enc-tight.c | 6 +-- 5 files changed, 109 insertions(+), 17 deletions(-)
Peter Maydell
AppliedQuoted 29 lines · Gerd Hoffmann
Hi,
Here is the ui patch queue with two small bug fixes and with pure opengl support for spice, i.e. with gl=on we'll render everything (including classic DisplaySurfaces) into a opengl texture for dma-buf passing.
please pull,
GerdThe following changes since commit
7cfdc02dae0d2ff58c897496cfdbbafc0eda0f3f:Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2016-09-26 19:47:00 +0100)
are available in the git repository at:
git://git.kraxel.org/qemutags/pull-ui-20160928-1for you to fetch changes up to
d9d2663c336b4ff7af9528f2cd3736791f4c0da5:ui/vnc-enc-tight: remove switch and have single return (2016-09-28 12:55:09 +0200)
----------------------------------------------------------------
ui: console+vnc fixes, switch spice to pure opengl with gl=on.----------------------------------------------------------------
Alex Bennée (1):
ui/vnc-enc-tight: remove switch and have single return
Quoted 6 lines
Gerd Hoffmann (2):
console: trackgl_blockstate in QemuConsole spice/gl: render DisplaySurface via openglMarc-André Lureau (1):
console: skip same-size resize
Applied, thanks.
-- PMM