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 445626 - Window rendering is sluggish when using lots of animated images
Window rendering is sluggish when using lots of animated images
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: Quartz
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2007-06-08 22:47 UTC by Erik van Pienbroek
Modified: 2018-02-10 03:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase to show the described behaviour (673 bytes, text/x-csrc)
2007-06-08 22:48 UTC, Erik van Pienbroek
  Details
animated image I used (1.83 KB, image/gif)
2007-06-08 22:49 UTC, Erik van Pienbroek
  Details
Throttles flushing (2.47 KB, patch)
2007-07-31 20:34 UTC, Richard Hult
none Details | Review
New attempt (4.23 KB, patch)
2007-08-01 18:30 UTC, Richard Hult
needs-work Details | Review

Description Erik van Pienbroek 2007-06-08 22:47:09 UTC
Hi,

A while ago I reported a case where the use of animated images in a GTK application causes a slowdown ( http://bugzilla.gnome.org/show_bug.cgi?id=427660 ). While the fix for that case improved the performance a lot, there still is room
for more improvement.

In a GTK application I wrote a GtkWindow is created which contains a textview, some normal buttons and around 8 buttons with animated images in them. I've had several reports of users of my program that this window is taking lots of CPU time and isn't very responsive.

When I tried to reproduce the problem on my local box I also encountered this slowdown and I tried to create a seperate testcase to illustrate the bad responsive behaviour. In this testcase I created a 10x10 table in which each cell
contains an animated image. As you can see the rendering of the animated images is taking quite some CPU time and the animation itself is very sluggish.
Comment 1 Erik van Pienbroek 2007-06-08 22:48:46 UTC
Created attachment 89626 [details]
testcase to show the described behaviour
Comment 2 Erik van Pienbroek 2007-06-08 22:49:14 UTC
Created attachment 89627 [details]
animated image I used
Comment 3 Richard Hult 2007-07-16 16:43:00 UTC
The reason is that GtkImage calls gdk_window_process_updates() which calls displayIfNeeded on the view. If this is done too frequently, quartz blocks all other drawing until the next vsync so we need to throttle the updating a bit... I have a patch that fixes the problem but it might have bad side effects so I will test it a bit more (and clean up it).
Comment 4 Richard Hult 2007-07-31 20:34:07 UTC
Created attachment 92818 [details] [review]
Throttles flushing

Could you please try this patch and also run any other test cases you have to see if it breaks anything? I have tried gimp and gossip and gtk-demo.
Comment 5 Richard Hult 2007-07-31 20:37:01 UTC
(My suspicion is that it will make things draw too little sometimes)

Comment 6 Erik van Pienbroek 2007-08-01 09:47:28 UTC
Thanks for your patch.
Apart from testing this myself I'm also going to ask some users of my program if they want to test this and ask if they are noticing any oddities.
Comment 7 Richard Hult 2007-08-01 18:06:52 UTC
Thanks! I have a new patch that takes care of the missed redraws that happened sometimes with the first attempt. 
Comment 8 Richard Hult 2007-08-01 18:30:04 UTC
Created attachment 92874 [details] [review]
New attempt
Comment 9 Erik van Pienbroek 2007-08-01 18:35:00 UTC
Okey, gonna try out with your new patch
Comment 10 Erik van Pienbroek 2007-08-07 21:41:51 UTC
No one of my users has reported any problems with your patch. Just that the performance has improved :D
Comment 11 Richard Hult 2007-08-10 08:17:35 UTC
Thanks :) I will try to finish the patch and get it included. It still needs a bit of cleaning up.
Comment 12 Erik van Pienbroek 2007-10-26 22:00:15 UTC
How come this patch isn't in SVN yet?
Comment 13 Richard Hult 2007-10-26 22:21:32 UTC
There were some problems introduced by it, and it's not clear yet how to solve them. 
Comment 14 Owen Taylor 2008-09-01 14:36:04 UTC
gdk_window_process_updates() is extremely similar to displayIfNeeded() in intent and behavior, and adding a layer to try and shield quartz against application misbehavior strikes me as pretty ugly. I would suggest that the patch to GtkImage from bug 321444 (r14267) is just wrong and should be reverted. 

As a goal, we should be moving to a model where we draw everything that needs to be drawn toplevel in a "frame"; if quartz wants to throttle that framerate to the vblank, that's a good thing, not a bad thing.
Comment 15 Matthias Clasen 2018-02-10 03:45:27 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.