From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf58q-0007l0-Qb for qemu-devel@nongnu.org; Wed, 31 Aug 2016 09:01:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bf58k-00064B-Ox for qemu-devel@nongnu.org; Wed, 31 Aug 2016 09:01:19 -0400 Received: from indium.canonical.com ([91.189.90.7]:38422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bf58k-00063t-G9 for qemu-devel@nongnu.org; Wed, 31 Aug 2016 09:01:14 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1bf58i-00061z-Kp for ; Wed, 31 Aug 2016 13:01:12 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 091B72EA014 for ; Wed, 31 Aug 2016 13:01:12 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 31 Aug 2016 12:53:00 -0000 From: vans163 Reply-To: Bug 1618122 <1618122@bugs.launchpad.net> Sender: bounces@canonical.com References: <20160829160030.27613.81837.malonedeb@gac.canonical.com> Message-Id: <20160831125300.12384.24915.launchpad@chaenomeles.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1618122] Re: qemu-monitor screendump very slow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ** Description changed: qemu-monitor screendump often using 10-20% cpu usage of one core to take a small capture. = Most of the CPU usage seems to come from libpixman. There were many reports of libpixman becoming 8 times slower in newer releases. = https://github.com/qemu/qemu/blob/0c56c6ab68902281094c7aac6305e2321c34c18= 7/ui/console.c#L285 = Simple Valgrind Ir report. = -------------------------------------------------------------------------= ------- =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Ir -------------------------------------------------------------------------= ------- 9,994,313,959 PROGRAM TOTALS = -------------------------------------------------------------------------= ------- =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Ir fil= e:function -------------------------------------------------------------------------= ------- 4,883,603,360 /usr/src/debug/pixman-0.34.0/pixman/pixman-access.c:store_= scanline_b8g8r8 [/usr/lib64/libpixman-1.so.0.34.0] =C2=A0=C2=A0282,312,800 /usr/src/debug/pixman-0.34.0/pixman/pixman-imple= mentation.c:_pixman_implementation_iter_init [/usr/lib64/libpixman-1.so.0.3= 4.0] =C2=A0=C2=A0267,394,160 /usr/src/debug/pixman-0.34.0/pixman/pixman-sse2.= c:sse2_fetch_x8r8g8b8 [/usr/lib64/libpixman-1.so.0.34.0] =C2=A0=C2=A0256,761,600 /usr/src/debug/pixman-0.34.0/pixman/pixman-priva= te.h:store_scanline_b8g8r8 =C2=A0=C2=A0254,676,199 ???:0x0000000000011f40 [/usr/lib64/libjemalloc.s= o.2] =C2=A0=C2=A0199,990,526 ???:0x0000000000011a10 [/usr/lib64/libjemalloc.s= o.2] = Calls to there start from. qemu_pixman_linebuf_fill pixman_image_composite ???? pixman_image_composite32 general_composite_rect = - = - I tried taking a look on how to fix this, but it seems pixman is deeply e= nrooted inside the monitor. I wanted to try to simply take whats on the di= splay and memcpy it into .ppm format manually creating the file header, but= I cant figure out where the raw display buffer/image is gotten from. + I tried taking a look on how to fix this, but it seems pixman is deeply + enrooted inside the monitor. I wanted to try to simply take whats on + the display and memcpy it into .ppm format manually creating the file + header, but the image is all broken with colors being off or its + smeared. = For example this is DisplaySurface: = struct DisplaySurface { =C2=A0=C2=A0=C2=A0=C2=A0pixman_format_code_t format; =C2=A0=C2=A0=C2=A0=C2=A0pixman_image_t *image; =C2=A0=C2=A0=C2=A0=C2=A0uint8_t flags; #ifdef CONFIG_OPENGL =C2=A0=C2=A0=C2=A0=C2=A0GLenum glformat; =C2=A0=C2=A0=C2=A0=C2=A0GLenum gltype; =C2=A0=C2=A0=C2=A0=C2=A0GLuint texture; #endif }; = - Which as you can see already has the pixman_image_t. Maybe I should just - work with that pixman_image_t? = - The most effective solution IMO seems to just memcpy from the display - into a premade header for a .ppm or .bmp file assuming 24 or 32 bpp. No - need for libpixman. + It appears graphic_hw_update(con) renders the vram to a pixman_image. Th= en ppm_save(filename, surface, errp) goes over it yet again, mutates the by= tes in an expensive way to another pixman_image, and saves that row by row = to a ppm. + = + Using sdl graphics (the default) the drawing starts in + https://github.com/qemu/qemu/blob/7fa124b273acd22a808e742ead78c065ccd9b4c= 4/hw/display/vga.c#L1466 -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1618122 Title: qemu-monitor screendump very slow Status in QEMU: New Bug description: qemu-monitor screendump often using 10-20% cpu usage of one core to take a small capture. Most of the CPU usage seems to come from libpixman. There were many reports of libpixman becoming 8 times slower in newer releases. https://github.com/qemu/qemu/blob/0c56c6ab68902281094c7aac6305e2321c34c18= 7/ui/console.c#L285 Simple Valgrind Ir report. -------------------------------------------------------------------------= ------- =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Ir -------------------------------------------------------------------------= ------- 9,994,313,959 PROGRAM TOTALS -------------------------------------------------------------------------= ------- =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Ir fil= e:function -------------------------------------------------------------------------= ------- 4,883,603,360 /usr/src/debug/pixman-0.34.0/pixman/pixman-access.c:store_= scanline_b8g8r8 [/usr/lib64/libpixman-1.so.0.34.0] =C2=A0=C2=A0282,312,800 /usr/src/debug/pixman-0.34.0/pixman/pixman-imple= mentation.c:_pixman_implementation_iter_init [/usr/lib64/libpixman-1.so.0.3= 4.0] =C2=A0=C2=A0267,394,160 /usr/src/debug/pixman-0.34.0/pixman/pixman-sse2.= c:sse2_fetch_x8r8g8b8 [/usr/lib64/libpixman-1.so.0.34.0] =C2=A0=C2=A0256,761,600 /usr/src/debug/pixman-0.34.0/pixman/pixman-priva= te.h:store_scanline_b8g8r8 =C2=A0=C2=A0254,676,199 ???:0x0000000000011f40 [/usr/lib64/libjemalloc.s= o.2] =C2=A0=C2=A0199,990,526 ???:0x0000000000011a10 [/usr/lib64/libjemalloc.s= o.2] Calls to there start from. qemu_pixman_linebuf_fill pixman_image_composite ???? pixman_image_composite32 general_composite_rect I tried taking a look on how to fix this, but it seems pixman is deeply enrooted inside the monitor. I wanted to try to simply take whats on the display and memcpy it into .ppm format manually creating the file header, but the image is all broken with colors being off or its smeared. For example this is DisplaySurface: struct DisplaySurface { =C2=A0=C2=A0=C2=A0=C2=A0pixman_format_code_t format; =C2=A0=C2=A0=C2=A0=C2=A0pixman_image_t *image; =C2=A0=C2=A0=C2=A0=C2=A0uint8_t flags; #ifdef CONFIG_OPENGL =C2=A0=C2=A0=C2=A0=C2=A0GLenum glformat; =C2=A0=C2=A0=C2=A0=C2=A0GLenum gltype; =C2=A0=C2=A0=C2=A0=C2=A0GLuint texture; #endif }; = It appears graphic_hw_update(con) renders the vram to a pixman_image. Th= en ppm_save(filename, surface, errp) goes over it yet again, mutates the by= tes in an expensive way to another pixman_image, and saves that row by row = to a ppm. Using sdl graphics (the default) the drawing starts in https://github.com/qemu/qemu/blob/7fa124b273acd22a808e742ead78c065ccd9b4c= 4/hw/display/vga.c#L1466 To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1618122/+subscriptions