After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765238 - gtktexthandle should avoid connecting to GtkWidget::draw
gtktexthandle should avoid connecting to GtkWidget::draw
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-04-18 22:13 UTC by Christian Hergert
Modified: 2016-04-19 19:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Hergert 2016-04-18 22:13:56 UTC
Using ::draw() on the textview causes draw dispatch to hit the slow path (using signal emission).

Instead of relying on signals, we should add plumbing to dispatch to the texthandle directly.
Comment 1 Carlos Garnacho 2016-04-19 10:55:45 UTC
(In reply to Christian Hergert from comment #0)
> Using ::draw() on the textview causes draw dispatch to hit the slow path
> (using signal emission).

Maybe I'm missing something, but... We do connect to ::draw on the eventbox we're creating as the text handle (We should probably have an internal widget impl for this though). Nowadays text handles are "popovers" (as seen by GtkWindows), so their drawing is dispatched right from gtk_window_draw().

Is this something you've seen high in profiles?
Comment 2 Carlos Garnacho 2016-04-19 10:56:45 UTC
Forgot to reference the code:
https://git.gnome.org/browse/gtk+/tree/gtk/gtktexthandle.c#n288
Comment 3 Christian Hergert 2016-04-19 13:06:33 UTC
What I did was add a g_print() for the fallback case in gtk_widget_draw_internal(). What I noticed was that after touching the textview that we immediately, and forever more, hit the fallback path not only for the GtkEventBox, but also the GtkTextView too.

That made the scrolling case even more choppy. (We still have probably ~5 more things to optimize to get scrolling back into good shape on larger framebuffer sizes, but this is just one of the items I saw). Everything helps.

Being that it's via signal emission, its really hard to quantify the exact offender other than by "feel". Still working on a more scientific way to progress on that front. One way to do so might be similar to my GdkFrameClock patches yesterday, that would introduce an intermediate function for the fallback case which would show up in profiles (and therefore get some counts/cost associated with it).
Comment 4 Matthias Clasen 2016-04-19 19:13:50 UTC
it is actually the magnifier that connects to ::draw, and never lets go of it again