diff mbox

console: skip same-size resize

Message ID 20160826094711.14470-1-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Aug. 26, 2016, 9:47 a.m. UTC
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.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/console.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Gerd Hoffmann Sept. 7, 2016, 11:10 a.m. UTC | #1
On Fr, 2016-08-26 at 13:47 +0400, Marc-André Lureau wrote:
> virtio-gpu does a set-scanout at each frame (it might be a driver
> regression).

xorg vs wayland maybe?  as far I know only wayland pageflips for each
frame.

> 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.

Does anything break if you simply drop the qemu_console_resize() call
from virgl_cmd_set_scanout?  In theory we should not need a surface in
the first place in scanout mode, but I suspect there is a reason why the
call is there ...

cheers,
  Gerd
Marc-André Lureau Sept. 7, 2016, 1 p.m. UTC | #2
Hi

On Wed, Sep 7, 2016 at 4:10 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> On Fr, 2016-08-26 at 13:47 +0400, Marc-André Lureau wrote:
> > virtio-gpu does a set-scanout at each frame (it might be a driver
> > regression).
>
> xorg vs wayland maybe?  as far I know only wayland pageflips for each
> frame.
>

Don't know, I am using Xorg


>
> > 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.
>
> Does anything break if you simply drop the qemu_console_resize() call
> from virgl_cmd_set_scanout?  In theory we should not need a surface in
> the first place in scanout mode, but I suspect there is a reason why the
> call is there ...
>
>
Isn't it there to resize the display window too? In any case, isn't this
patch good to have?
diff mbox

Patch

diff --git a/ui/console.c b/ui/console.c
index c24bfe4..2407b48 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2100,6 +2100,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);
 }