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 598695 - [timeoverlay] use much CPU ressource compare to previous version
[timeoverlay] use much CPU ressource compare to previous version
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.25
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: cairo_font_face_t
Blocks:
 
 
Reported: 2009-10-16 15:18 UTC by Benjamin Gaignard
Modified: 2012-06-18 16:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
callgrind file (987.54 KB, application/octet-stream)
2009-10-19 08:15 UTC, Benjamin Gaignard
Details
callgrind traces (180.33 KB, application/x-gzip)
2009-10-19 08:23 UTC, Benjamin Gaignard
Details

Description Benjamin Gaignard 2009-10-16 15:18:58 UTC
timeoverlay (0.10.25) use much CPU than a previous version 0.10.18.
On my PC add timeoverlay in a graph add +10% of CPU usage. With version 0.10.18 it is only 1 or 2% of CPU usage.
Comment 1 Sebastian Dröge (slomo) 2009-10-16 15:50:44 UTC
Could you check where it takes that long, for example with callgrind. This could in theory be a result of switching from pango-ft2 to pango-cairo... but (also in theory) cairo should be faster.
Comment 2 Benjamin Gaignard 2009-10-19 08:15:12 UTC
Created attachment 145768 [details]
callgrind file

callgrind trace for version 0.10.24 of gst-plugins-base
Comment 3 Benjamin Gaignard 2009-10-19 08:23:34 UTC
Created attachment 145769 [details]
callgrind traces

callgrind traces for gst-plugins-base 0.10.25
Comment 4 Benjamin Gaignard 2009-10-19 08:39:53 UTC
a quick analyze in callgrind show that gst_text_overlay_render_text takes 55% process time in version 0.10.25 mainly by calling cairo_stroke function.
Comment 5 Benjamin Gaignard 2009-10-19 09:45:10 UTC
After test I seem that CPU charge is related to the dash style selected in gsttextoverlay. with double dash = 2.0; cairo_set_dash (cr_shadow, &dash, 1, 0.0);
the CPU usage stay in correct values.
I not to happy to fix that like that, so maybe we can add a property to set the dash style, or add a property "low-CPU" to have a configuration for small CPU.
Comment 6 Sebastian Dröge (slomo) 2009-10-22 07:47:56 UTC
I can't confirm what you said about dashing, it's both slow.

The problem here is, that pango_cairo_show_layout() internally does all kinds of caching and optimizations that are lost when just converting the pango layout to a cairo path and filling/stroking that.

The cairo developers said, that the solution would be to use user fonts, unfortunately pango has no support for them yet. Idea would be, to draw shadow/outlint in the render_glyph_func. Pango bug for this is #347237.
Comment 7 Benjamin Otte (Company) 2009-10-22 16:09:23 UTC
In my cairo stuff, I've been calling pango_cairo_show_layout() twice, once drawing it in black as a shadow with some pixel(s) offset and once drawing it in white. This avoids having to stroke the text and is also quick with acceleration. I'm not sure if people would consider it visible enough. I certainly do.
Comment 8 Sebastian Dröge (slomo) 2009-10-24 14:02:48 UTC
That's not the intended effect though, what we really want is a black outline (and additionally the shadow).

For normal subtitles all this should be no problem btw, only for timeoverlay and clockoverlay or anything else that has text changes very often.

As suggested elsewhere the solution for timeoverlay/clockoverlay would be to cache the few characters a single time (whenever the font/etc changes) and then only copy them onto the buffer. Not sure how to do it properly though, especially the correct spacing of characters. Any ideas?

Also the way the pango plugin works needs to be changed for this
Comment 9 Tim-Philipp Müller 2012-03-06 18:26:52 UTC
I'm tempted to WONTFIX this unless someone is willing to work on that.