After digging further, I have some questions about how rendering works.
At 1st, it seems the lack of refresh when dragging things is because the refresh priority (for calling idle function) is lower than the mouse event priority. This is consistent with the behavior of refresh working only when you move the mouse slowly.
I tried changing UPDATE_PRIORITY in sp-canvas.cpp to high, but it didn't help since idle_handler() & SPCanvas::paint() are being called frequently when when dragging rapidly. But why don't the changes show on the screen? Is it drawing to an off screen buffer?
I noticed there's a call to gdk_widget_queue_draw_area() that's not in 0.92. What does that do? The documentation says it will generate an expose event for that invalidated area, but that doesn't make sense because why would you invalidate the region right after drawing it.
I just need to know where the screen is actually updated.
thanks, -yale
On Wed, Jan 3, 2018 at 12:34 AM, Yale Zhang <yzhang1985@...400...> wrote:
Correct, the slow refresh when dragging objects is still there. I'm looking into it next since it also kills my productivity. But for now at least, pen & calligraphy responsiveness matches that in 0.92. I use the Wacom pen all the time and with event compression it simply could not keep up with something like signing your name.
I've had lots of experience debugging CPU throughput bottlenecks (I've used Linux perf, gprof, Zoom, VTune), but not *latency* ones. Validating real time & parallel behavior is a lot hard from what I heard.
I've approached this rather amateurishly so far with good old printf() debugging :) I just recorded the time stamps of a GdkEvent throughout its life cycle from creation, dispatch, and to when it's handled. You could plot all the events on parallel time lines (like in NVIDIA's CUDA profiler) to get a big picture and spot any anomalies (I've made a web app that generates parallel timelines in SVG) but that will probably take too long to study.
On Tue, Jan 2, 2018 at 4:07 PM, Eduard Braun <eduard.braun2@...173...> wrote:
Hi Yale,
great to see somebody looking into this!
I was looking into motion event compression before and it certainly sounds like something that could improve responsiveness of certain tools in Inkscape.
Unfortunately it does not noticeably improve redraw performance in relation to the cited bug for me - as mentioned in the bug report it becomes extremely noticeable with increasing window size and happens for "simple" tasks like moving a rect on canvas. For a 2560x1440 window redrawing basically stops for me while moving the mouse and only resumes once I stop movement of the mouse pointer...
I hope we can figure out the source - you certainly seem to be more experienced with profiling tasks (maybe you can give me some pointers on your workflow?) eventually...
Best Regards, Eduard
Am 31.12.2017 um 10:52 schrieb Yale Zhang:
OK, I got developer access now. That was fast.
I've created a merge request https://gitlab.com/inkscape/inkscape/merge_requests/169
On Sun, Dec 31, 2017 at 4:08 AM, Yale Zhang <yzhang1985@...400...> wrote:
Hi, I've identified why drawing is lagging with GTK+3. https://bugs.launchpad.net/inkscape/+bug/1723247
It's because of GTK3's motion event compression: https://bugzilla.gnome.org/show_bug.cgi?id=702392
Adding a * gdk_window_set_event_compression (window, FALSE);* in SPCanvas::handle_realize() makes things much smoother.
At 1st I thought it was because the events were sitting in the queue for too long. So I added some timing code to measure the latency between when a motion event was generated in GDK to when SPCanvas::paint() is called. Actually, I detect bursts of mouse moves or redraws and only use the 1st for latency measurements since there might not be a 1 to 1 relation between motion events and redraws. I was seeing a 4 to 10ms latency for head (GTK3) but only 0.5 ms for 0.92 (GTK2).
I thought I was on to something, but this mislead me for a while. Finally, I saw that the # motion events and redraws were 10x higher for GTK2.
I haven't stayed up to date with the GitLab migration. I tried to push a patch to my branch simdgenius_inkscape, migrated from Bazaar, but access is denied. I just requested project access, so appreciate it if someone grants it.
-Yale
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Inkscape-devel mailing listInkscape-devel@...1901...://lists.sourceforge.net/lists/listinfo/inkscape-devel