Upload
enlightenmentproject
View
79
Download
1
Tags:
Embed Size (px)
Citation preview
1 © 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Vector graphics with a retained mode API
Cedric BAIL – Senior Open Source Engineer
Samsung Research America (Silicon Valley)
2
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Needs :A shape objects (could implement line, polygon and more object with it)
Reintroduction of a gradient object
Text drawing following a path helper
Logic to manipulate them for animation on top of those new object
Helper for importing designer recommendation into those description
3
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Let's have some unrealistic goal :Animation at 60fps
No battery penalty
No memory penalty
Should be done yesterday
4
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Drawing vector graphism
5
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Main difference :Immediate rendering API: Skia, Cairo
Retained rendering API: Enesim
Retained vs Immediate :Remember information between frame (span computation, ...)
Can do damage region (reduce amount of pixels to screen)
Can compute some of the information at the same time as evas_render
Basically one is nice for a scenegraph, the other are not
Retained mode vector graphics have inherently more optimization that can be done and that can be used by a scene graph
For dynamic User interface using vector graphics, especially in the embedded world, retained API is the only futur proof solution for a scene graph
6
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
7
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Cost of vector graphics :Computing span lines → heavy CPU, low memory → scale !
No idea about cut out until span lines are computed → scene graph cut out optimization difficult
Antialiasing complex shape are required
Logic to merge shape together into one texture is complex
Increase of the number of objects on the canvas
Logic for drawing a span is :
• Pick a generator function and a blitting function
• Generate the span content
• Blit the span content on the destination surface
8
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
9
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Existing solution :Cairo
Skia
Enesim
10
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
CairoWell known and stable API
Big community
Good build system
Well tested
Known problem
Performance (slower than skia in some case, and not retained)
Problematic API that require backend specific code
Cairo link with all possible backend library
11
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
SkiaSometimes better performance than Cairo
Known issueNot retained mode
No community
Shitty as hell build system
No concept of stable API (and don't even talk about ABI)
Skia link with all possible backend library
12
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Enesim :Retained mode API
Good software rasterizer
Extensible
API with some customisation usable by a scenegraph
Known issue :No community
Link with all possible backend library (No module)
Broken GL rendering (and backend need complete rewrite)
Lack a lot of feature that are already in Evas
Lack of optimization
13
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Solution ?
14
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
None usable for EFL needs as it
Huge amount of work needed in all scenario
Need to do our own work to fit scenegraph needs
No fast path to get usable result
Will require help and team work to get it done
Still a lot of open question and research necessary
15
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Proposal for implementation :Use code from Enesim rasterizer inside Evas (LGPL v2.1 code)
Make GL backend use software backend to generate a texture with the polygon as first step
Add shape objects to Evas (make all object inherit from it)
Add tests to expedite
Add “tesselation” code and make a GL backend
Optimize until usable (hope to have a long life)
16
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Anti-aliasing issue !
17
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Solution for antialiasing :MSAA → What other vector graphics librairies do. Heavy and costly (2x
resolution)
Add manually a transparent starter and finish span to go 100% alpha → require to have a smooth rendering logic, doesn't work well with contiguous object
FXAA → Idea is to detect and mark border area and run a precalculated blur filter on those pixels, need a post processing phase
CMAA → An evolution of FXAA concept, a little bit more costly, but less blurry
18
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
19
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Auto grouping object into a texture :Usefull for scrolling
Usefull for older computer where geometry are super costly
Usefull to reduce rendering cost of the same area again and again
Solution :None automatic solution good yet
Currently pushed back in the upper layer with Evas_Map
Need to investigate how web browser do
Maybe group object based on a “virtual” layer and a speed vector
20
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Handling increased number of object :Evas_Render linearly walk all object of the scenegraph... a few times !
Especially bad is the “active” object array, that is generated by walking all object on the canvas and then walked over for every object drawn on scren !
Removing active array and using a walk through bounding box seems doable and should reduce the massive number of walk.
Should enable evas to scale to a bigger number of objects
21
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Handling vector cut out and precomputing span linesSpan lines computing should be started as soon as possible
Can be offloaded to as many CPU as available as it is a CPU intensive task and not a memory bound one
Maybe some of the computation can be offloaded to GPU using OpenCL (Need serious investigation of pro and cons)
Evas needs cut out information... but can't wait for them !
If span lines computation is not done, assume fully transparent
If span lines computation is done, provide a set of tile information(empty, with alpha, no alpha) assembled at the uper layer
Remember those information for next frame
22
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Conclusion
23
© 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Vector graphics for EFL
Current state of affair for vector graphics in 2014 is quite shameful and surprising that nobody did really adress it in a generic and efficient way (If you look at who does implement a scenegraph, you do understand...).
A lot of work is required to get something useful → do not expect usable result by tomorrow nor end of the year.
Expect impact on CPU usage → expect performance to be always below (If you are in a scenario currently below 60fps, it wont get better)
Expect impact on memory usage.
Expect impact on battery usage.
24 © 2014 SAMSUNG Electronics Co.Open Source Group – Silicon Valley
Thank you.