http://bugs.winehq.org/show_bug.cgi?id=28604
Bug #: 28604 Summary: [regression]2gis laggy map redraw Product: Wine Version: 1.3.29 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: oleaut32 AssignedTo: wine-bugs@winehq.org ReportedBy: thunder_8888@mail.ru Classification: Unclassified
Created attachment 36757 --> http://bugs.winehq.org/attachment.cgi?id=36757 Log
This regression appears after this commit:
oleaut32: Get rid of duplicated condition check.author Nikolay Sivov nsivov@codeweavers.com Sun, 21 Aug 2011 09:40:32 +0000 (13:40 +0400) committer Alexandre Julliard julliard@winehq.org Mon, 22 Aug 2011 14:21:01 +0000 (16:21 +0200) commit e800158ab0e0b33577c2c063f2bd145c1beb2adb tree ca098a7a41883bfc2a3d0048ba7205135263d549 parent c69be3bfb9e0ea749b5e6185be380ba925c50541
2gis working very slow(one redraw may take more than 1 minute)
http://bugs.winehq.org/show_bug.cgi?id=28604
Anton Yarth thunder_8888@mail.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |http://nsk.2gis.ru/how-get/ | |linux/
http://bugs.winehq.org/show_bug.cgi?id=28604
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression CC| |bunglehead@gmail.com Summary|[regression]2gis laggy map |2gis laggy map redraw |redraw | Regression SHA1| |e800158ab0e0b33577c2c063f2b | |d145c1beb2adb
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com 2011-10-07 13:03:41 CDT --- Did you try to revert it? Patch itself has no functional changes, it just replaces bunch of similar condition checks and puts it in one place.
http://bugs.winehq.org/show_bug.cgi?id=28604
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download CC| |mstefani@redhat.com
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #2 from Anton Yarth thunder_8888@mail.ru 2011-10-07 23:08:02 CDT --- I maked bisect, but may do it twice.
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #3 from Anton Yarth thunder_8888@mail.ru 2011-10-08 08:24:11 CDT --- Oh, excuse me Nikolay, real regression in(looks like i used one version twice): c6f6c3f727556734905a5bbf4fe1b59079e37bf5 is the first bad commit commit c6f6c3f727556734905a5bbf4fe1b59079e37bf5 Author: Huw Davies huw@codeweavers.com Date: Fri Aug 19 16:26:19 2011 +0100
gdi32: Implement Polyline and PolyPolyline in the dib driver.
:040000 040000 33b178ecafaa1bd7848008ca024ec7da25ebdd25 2b1394ab249ef06c775d11b35e9c2d31e1fc9b19 M dlls
http://bugs.winehq.org/show_bug.cgi?id=28604
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|bunglehead@gmail.com |huw@codeweavers.com Regression SHA1|e800158ab0e0b33577c2c063f2b |c6f6c3f727556734905a5bbf4fe |d145c1beb2adb |1b59079e37bf5
http://bugs.winehq.org/show_bug.cgi?id=28604
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|oleaut32 |gdi32 Severity|normal |minor
http://bugs.winehq.org/show_bug.cgi?id=28604
Yuri Khan yurivkhan@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |yurivkhan@gmail.com
--- Comment #4 from Yuri Khan yurivkhan@gmail.com 2011-10-25 12:49:56 CDT --- I confirm the regression, and my bisection also points to commit c6f6c3f727556734905a5bbf4fe1b59079e37bf5 by Huw Davies.
When I reverse-apply that patch over wine-1.3.31 and rebuild, the problem no longer persists.
http://bugs.winehq.org/show_bug.cgi?id=28604
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #5 from Michael Stefaniuc mstefani@redhat.com 2011-10-25 13:13:50 CDT --- Confirming as per comment 4.
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #6 from Yuri Khan yurivkhan@gmail.com 2011-11-12 09:57:49 CST --- I have investigated the issue further and here’s what I found.
I added trace output to dibdrv_Polyline, logging the number of points and the time it took to draw. I get values like 45ms per polyline; the most popular point count is 5 (suggesting a quadrangle).
The time is mostly spent actually drawing lines, in calls to solid_pen_lines which calls solid_pen_line which handles clipping to the current region and calls bres_line_with_bias which implements the Bresenham line drawing algorithm and for each pixel calls the callback function solid_pen_line_callback which calls solid_rects for a single-pixel rectangle. (Which looks like a lot of function-call overhead which also cannot be optimized out by inlining because of the callback.)
I also tried bypassing the whole function, by adding a “return TRUE;” at the top. The slowdown no longer reproduced, and the only part of functionality that suffered was the railroads — the white sections were not painted.
So it seems to me that the alternative way (which, if I understand correctly, involves round-tripping to the X server) is faster than Wine’s Bresenham. (This also explains the similar slowness when running 2gis over ssh with X forwarding. When the X server is on the local machine (including ssh -Y localhost), round-tripping is fast; on another machine on the same 100Mbit switch it is slow.)
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #7 from Yuri Khan yurivkhan@gmail.com 2011-11-13 10:53:17 CST --- OK, some more accurate statistics.
On my machine, on a fresh start, 2gis draws about 20000 lines, each on average being 16px long (for a total of 322000 pixels). This takes 135 seconds (measured by adding up the differences of GetTickCount() at start and end of bres_line_with_bias). Dividing, we get average speed of 2380 pixels per second on this Core2 Duo E6850 @ 3GHz, which doesn’t exactly strike me as reasonable line drawing performance.
Next I’m going to dump this as MoveTo/LineTo calls and compare the performance on Windows vs Wine.
Also, I tried to restructure the algorithm to reduce the number of calls to solid_rects, by consolidating sequential pixels with the same Y coordinate into a single rect, and this didn’t have any effect on the performance.
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #8 from Huw Davies huw@codeweavers.com 2011-11-13 11:03:16 CST --- (In reply to comment #7)
Also, I tried to restructure the algorithm to reduce the number of calls to solid_rects, by consolidating sequential pixels with the same Y coordinate into a single rect, and this didn’t have any effect on the performance.
I plan on moving the Bresenham algorithm down to the primitives, which should help a lot.
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #9 from Huw Davies huw@codeweavers.com 2011-11-18 10:58:37 CST --- Created attachment 37522 --> http://bugs.winehq.org/attachment.cgi?id=37522 Care to see if this patch helps?
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #10 from Yuri Khan yurivkhan@gmail.com 2011-11-20 02:44:50 CST --- Sadly, no noticeable effect on productivity. Rendering the same map extent (266K pixels, 16658 lines) twice on program startup seems to take 105 s in bres_line_with_bias on 1.3.33, 106s in solid_line_32 on 1.3.33 with patch. Measuring with a stopwatch, I get 3 minutes since I click the Next button on the startup screen until the CPU meter drops to near zero.
Maybe my measurements are not quite sound because of timer accuracy. Here’s how I do it. At the top of function to profile, I add this:
static DWORD time_total = 0, length_total = 0; DWORD time_once = GetTickCount(), length_once = /*suitable code*/;
At the end:
time_once = GetTickCount() - time_once; time_total += time_once; length_total += length_once; TRACE_(dib_profile)("Spent %d ms for %d px, total %d ms for %d px\n", time_once, length_once, time_total, length_total);
and run with WINEDEBUG=+dib_profile, redirecting all output to a file. The resulting file has many lines with spent time = 0 ms and some lines where spent time is about 45 ms. I assume it all statistically adds up to roughly the correct total in the end.
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #11 from Huw Davies huw@codeweavers.com 2011-11-21 03:44:13 CST --- I suspect the slow (45ms) cases are because the dib driver has previously forwarded a graphics operation to the winex11 (because it doesn't yet handle that op), so before it can draw the line it needs to copy the bits back from the X11 side. It would be interesting to know which operation is being forwarded. Could you produce a +relay,+tid,+seh,+bitmap,+dib,+x11drv log ?
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #12 from Yuri Khan yurivkhan@gmail.com 2011-11-21 11:11:12 CST --- (In reply to comment #11)
Could you produce a +relay,+tid,+seh,+bitmap,+dib,+x11drv log ?
A log this detailed shows a lot of things happen and is too big to attach here. I have trimmed the log to trace the lifetime of a single DC into which the polylines are drawn: http://wine.centaur.ath.cx/grym.20111121.fragment.log.gz (9.2M, 278'663'397 bytes uncompressed). If needed, the original untrimmed log is at http://wine.centaur.ath.cx/grym.20111121.orig.log.gz (19M, 543'355'952 bytes uncompressed).
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #13 from Huw Davies huw@codeweavers.com 2011-11-22 03:32:54 CST --- Thanks for the log.
The problem is the PolyPolygon calls that interleave the Polyline()s. These are currently not handled by the dib driver to so forwarded to winex11.drv, which means the dib bits are copied back and fore between the client and the XServer.
The polygon stuff should happen reasonably soon.
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #14 from Yuri Khan yurivkhan@gmail.com 2011-11-22 12:06:51 CST --- Nice to know. Thank you for taking the time to investigate this.
So, before the implementation of polylines, all work happened on the X11 server side, and after polygons all work will be done on the application side, but for now they polylines are drawn app-side and polygons server-side, causing lots of roundtrips.
And, I can immediately imagine a reason why polylines might be interleaved with polygons: Railroads are drawn as strings of almost rectangular sections, one solid, one hollow, repeating for the whole length of the railroad.
http://bugs.winehq.org/show_bug.cgi?id=28604
Dionysius iliotropion2006@yandex.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |iliotropion2006@yandex.ru
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #15 from Yuri Khan yurivkhan@gmail.com 2011-12-06 08:04:48 CST --- As a stopgap measure, I build packages for Ubuntu without the offending commit and publish them at https://launchpad.net/~yurivkhan/+archive/ubuntu-wine .
http://bugs.winehq.org/show_bug.cgi?id=28604
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sas.mib@yandex.ru
--- Comment #16 from Dmitry Timoshkov dmitry@baikal.ru 2011-12-06 22:37:26 CST --- *** Bug 29258 has been marked as a duplicate of this bug. ***
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #17 from Anton Yarth thunder_8888@mail.ru 2012-01-04 03:42:12 CST --- looks like 2gis runs normal(or near that) on 1.3.36
http://bugs.winehq.org/show_bug.cgi?id=28604
--- Comment #18 from Yuri Khan yurivkhan@gmail.com 2012-01-04 06:17:13 CST --- I confirm — with 1.3.36, the problem no longer seems to persist on my machine.
http://bugs.winehq.org/show_bug.cgi?id=28604
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #19 from Dmitry Timoshkov dmitry@baikal.ru 2012-01-04 06:42:57 CST --- Reported fixed.
http://bugs.winehq.org/show_bug.cgi?id=28604
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #20 from Alexandre Julliard julliard@winehq.org 2012-01-13 13:51:30 CST --- Closing bugs fixed in 1.3.37.