From: Gustavo S. B. <bar...@gm...> - 2007-06-05 04:00:39
|
As you might know I'm working to get Evas running as fast as possible due our desire to use it in embedded systems, to name Nokia N800 and OpenMoko. One of the drawbacks are how fonts are drawn, specially with styles and not cached at all, so every time you move a text around, you go in a long call tree that bails down to: src/lib/engines/common/evas_font_draw.c: evas_common_font_draw() this function, while huge and kind of messy (splitting it into multiple "static inline" with specific purposes would help), is not slow... at least I couldn't spot anything obvious by quick read (no profile or test so far). so, how to speed up text rendering? raster suggested me to create a render cache so scaling, font and etc would be cached and maybe reused in a later point (moving text would have the same cost as moving semi-transparent images)... extending it further we could have images pre-colorized or already multiplied by alpha. Of course this makes sense and would help a lot, except things that changes a lot (you'd never use the cache in these situations)... so we'd need a way to avoid caches for these things. I will leave this problem out for now. What I want your feedback is: - ideas to improve font drawing alone? (evas_font_draw.c) - where to do cache? (and why) 1) evas_common_font_draw() 2) software_generic/eng_font_draw() 3) canvas/evas_object_text_render() 4) canvas/evas_render evas_render_updates_internal() and other callers of obj->render() my understanding so far is that 4 provides "cache everything" without much duplication, but it will be hard (or impossible) to cover every object right, in other words, it would not be as extensible as desired. So my next option would be inside object's render implementation (evas_object_text_render()), just change destination surface to be a object-owned buffer and then use memcpy() or other blit function from this buffer to real output buffer. This would need per-object implementation, but that gives us extensibility... actually few objects need cache, text and non-accelerated scaled images come to mind. At this point we have enough information to check for cache validity and we can also trap setters and getter to invalidate cache as soon as possible... maybe even add specific functions to enable-disable cache (evas_object_text_cache_set(o, 1)). I plan to start profiling and work on possible improvements to evas_font_draw.c on Thursday, then next week to this cache idea, so comments before this date are really appreciated. :-) -- Gustavo Sverzut Barbieri -------------------------------------- Jabber: bar...@gm... MSN: bar...@gm... ICQ#: 17249123 Skype: gsbarbieri Mobile: +55 (81) 9927 0010 |