Enlightenment Foundation Libraries (Overview)

40
1 Samsung Open Source Group Cedric Bail Senior Graphics Developer Samsung Open Source Group [email protected] Enlightenment Foundation Libraries An UI Toolkit Designed for the Embedded World

Transcript of Enlightenment Foundation Libraries (Overview)

Page 1: Enlightenment Foundation Libraries (Overview)

1Samsung Open Source Group

Cedric BailSenior Graphics Developer

Samsung Open Source Group [email protected]

Enlightenment Foundation Libraries

An UI Toolkit Designed for the Embedded World

Page 2: Enlightenment Foundation Libraries (Overview)

2Samsung Open Source Group

● What are the Enlightenment Foundation Libraries?

● Where are they used?

● Where it is going?

● Questions?

Page 3: Enlightenment Foundation Libraries (Overview)

3Samsung Open Source Group

What is EFL?

Page 4: Enlightenment Foundation Libraries (Overview)

4Samsung Open Source Group

EFL: A Toolkit Created for Enlightenment 17

Page 5: Enlightenment Foundation Libraries (Overview)

5Samsung Open Source Group

Enlightenment 17

– Enlightenment project started in 1997

– Windows Manager

– First Windows Manager of GNOME

– Full rewrite started in 2001

– Primary belief is there will never be “a year of the Linux desktop”

– Designed with the embedded world in mind…

– … and needed a toolkit !

Page 6: Enlightenment Foundation Libraries (Overview)

6Samsung Open Source Group

Enlightenment

– 17 was just the version number, we are now at 19!

– Use EFL scenegraph and main loop

– Not different from any other EFL application

– Composite and Window Manager

– Wayland client support

– Multiple backend (X, FB, DRM, …)

– Highly customizable (Profiles, modules and themes)

Page 7: Enlightenment Foundation Libraries (Overview)

7Samsung Open Source Group

Enlightenment Community

● The Enlightenment community

– 60 uniq contributors per release (10 cores)

– 1000 users that build from source

– 2 distributions based on Enlightenment (Bodhi and Elive)

● The Enlightenment community expected Linux to takeoff in the embedded world, not on the desktop

● The values shared by this community:

● Customizable● Scalable

● Fast● Light● Feature Rich

Page 8: Enlightenment Foundation Libraries (Overview)

8Samsung Open Source Group

Enlightenment Foundation Libraries (EFL)

● Spent a decade writing a modern graphic toolkit

● Licensed under a mix of LGPL and BSD license

● Focus on embedded devices

● First release on January 2011

● Stable, long term API/ABI

● In the process of releasing version 1.13

● 3 month release cycle

Page 9: Enlightenment Foundation Libraries (Overview)

9Samsung Open Source Group

State of EFL

● Designed for creating a Windows Manager (WM), now used for any type of

application

● Has its own scene graph and rendering library

● Optimized to reduce CPU, GPU, memory and battery usage

● Supports international language requirements (LTR/RTL, UTF8)

● Supports all variations of screens and input devices (scale factor)

● Fully Themable (layout of the application included)

● Supports profiles

● Can take up as little as 8MB of space with a minimal set of dependencies

● Has a modular design

Page 10: Enlightenment Foundation Libraries (Overview)

10Samsung Open Source Group

Why We Care About Optimization

● Moore's law doesn't apply to battery and memory bandwidth

● Most rendering operations are limited directly by memory bandwidth

● Many embedded devices have less available memory than a low end phone

– Refrigerator, oven, dish washer, washing machine, home automation…

● Even a low end phone doesn't have much memory to space once you run a browser!

● GL context at best consumes 10MB, usually more around 40MB; this is bad

for multitasking!

Page 11: Enlightenment Foundation Libraries (Overview)

11Samsung Open Source Group

Current State of Optimization

● Application runtime memory use is mostly driven by screen size

● EFL can fit in 8MB on disk (static compilation with minimal dependencies)

● No hard requirement on the GPU

● Enlightenment + Arch Linux combined :

– 48 MB RAM

– 300 Mhz (1024 x 768)

– Yes, for a desktop profile!

Page 12: Enlightenment Foundation Libraries (Overview)

12Samsung Open Source Group

Under the Hood

Page 13: Enlightenment Foundation Libraries (Overview)

13Samsung Open Source Group

Bird's Eye View of EFL

X11

OpenGL

EINAMEMPOOL

EVAS

JPEG

PNG

GIF

TIFF

EET

SVG

MORE...

XRENDER

OPENGL/ES

X11 (SOFTWARE)

FB (SOFTWARE)

MORE...

EET

EMBRYO

EDJE

ELEMENTARY E-DBUS DBUS

ECOREFILE

X11

CON

IPC

FB

EVAS

QUARTZ

INPUT

JOB

SDL

WIN32/CE

MORE...

EFREET

MEMORY (RAM) (DATA STRUCTURES)

DATA IN STORAGE (DISK/FLASH ETC.)

PIXELS ON A DISPLAY

IMAGE FILES IN STORAGE

OTHER APPLICATIONS AND SERVICES

USER INTERACTION AND FEEDBACK

INPUT DEVICES AND OTHER SYSTEM SERVICES AND COMPONENTS

ABSTRACTED UI COMPONENTS FROM STORAGE

FREEDESKTOP.ORG STANDARDS LAYER

FAST VIRTUAL MACHINE FOR LOGIC AUGMENTATION

Page 14: Enlightenment Foundation Libraries (Overview)

14Samsung Open Source Group

EET: Serialization of C Structure

● Something very specific to EFL

● Fast serialization library for file storage and network communication

● Store image, sounds, font

● Reduces overhead when loading the same data across multiple applications

● Provides tools to convert from and to a human readable form

● Configurations and themes are built with this library

Page 15: Enlightenment Foundation Libraries (Overview)

15Samsung Open Source Group

Evas: Scene Graph Canvas

● The brain of EFL

● Has its own scene graph and rendering library with more than 10 years of optimization work

● Provides glitch-free rendering

● Reduces overdrawing

● Deduplicates as much as possible to reduce memory waste

● Offers compressed glyph rendering

● Is portable (SDL, X11, Wayland, FB, DRM, Windows, Mac OS X, ...)

● Has an optimized software renderer (MMX, SSE*, Neon)

● Optimized use of GPU (optional)

– Supports partial updates (assuming the driver does)

– Reduces context and texture switches as much as possible

– Reduces memory overhead

Page 16: Enlightenment Foundation Libraries (Overview)

16Samsung Open Source Group

Scene Graph

Container

Container Container

Container Container

Example scene graph

Page 17: Enlightenment Foundation Libraries (Overview)

17Samsung Open Source Group

Evas: Scene Graph

● A basic scene graph rendering ascends from the bottom to the top of the tree

● Possible optimizations

– Reorder GL operations to limit Texture and Shader changes

– Partial updates

– Cutout opaque areas

– Complete drawing operations in another thread

– Efficiently cache costly CPU operations between frames

– Deduplicate objects

Page 18: Enlightenment Foundation Libraries (Overview)

18Samsung Open Source Group

Evas: Frame Delta

Computation of previous and current frame with cutout

Page 19: Enlightenment Foundation Libraries (Overview)

19Samsung Open Source Group

Evas: Rendering Pipeline

Current and future rendering pipeline for Evas

Page 20: Enlightenment Foundation Libraries (Overview)

20Samsung Open Source Group

Evas: Learned Experience From Our Scene Graph

● After initial startup... it's mostly bound to the memory

● Vector graphics and smooth scaled images are bound to the CPU

● It's important to optimize memory usage for both GL and software

● Deduplication of strings, images and text makes a major difference

● The compressed glyph (software) and image (GL) also make a difference

Page 21: Enlightenment Foundation Libraries (Overview)

21Samsung Open Source Group

Evas: Issue With Design of Future Pipeline

● CPU and memory frequency are very important

● Evas was created when dual core CPU's were found only on high end servers

● It's slowly evolving to take advantage of more cores

● The Linux Kernel handles it poorly on embedded devices

● Typical scenario :

1. Long periods of IO bound operations (Main loop)

2. Followed by a short need for all cores to be up and running

3. Processes are then limited by memory speed

● In this scenario, it's not capable of running at the right speed with the right number of cores

● A lot of work is needed in the kernel before we can totally benefit from it

Page 22: Enlightenment Foundation Libraries (Overview)

22Samsung Open Source Group

Edje: Theme and Layout Engine

● The heart of EFL

● Theme and layout engine

● Descriptive language

● Uses Evas for rendering logic (fully independent from the system)

● Doesn't require a FPU

● Optimizes load time (time to first frame) and run time

● Reduces memory fragmentation

Page 23: Enlightenment Foundation Libraries (Overview)

23Samsung Open Source Group

Edje in Action

Page 24: Enlightenment Foundation Libraries (Overview)

24Samsung Open Source Group

Elementary: Widgets Set

● Widgets toolkit

● Based on EFL infrastructure, uses Edje & Evas

● Screen and input independence achieved through :

– Scale factor

– Finger size

● Profile support (define configuration on a per Window basis)

● Fully themable

● Supports touchscreens

Page 25: Enlightenment Foundation Libraries (Overview)

25Samsung Open Source Group

Many Other Useful Components

● Eina: C data types library and various system helper

● Ecore: main loop, events, network and threads infrastructure

● Eio: asynchronous Input/Output

● Emotion: video component integration

● Eeze: hot plug and device detection

● Eldbus: dbus integration library

● Efreet: Freedesktop library

● Eo: safe, fast and light object infrastructure

● Eolian: compilation time introspection infrastructure

● Elocation: geoclue integration

Page 26: Enlightenment Foundation Libraries (Overview)

26Samsung Open Source Group

Bindings for all Sorts of Languages

● C++11 modern binding (RAII, lambda, …)

● Lua

● Python

● JS

● Ocaml (see http://win-builds.org)

Page 27: Enlightenment Foundation Libraries (Overview)

27Samsung Open Source Group

Where is EFL Used?

Page 28: Enlightenment Foundation Libraries (Overview)

28Samsung Open Source Group

First Tizen Device: Camera

Samsung NX300

Page 29: Enlightenment Foundation Libraries (Overview)

29Samsung Open Source Group

Smart Watch: Gear Series

Samsung Gear 2 Samsung Gear S

Page 30: Enlightenment Foundation Libraries (Overview)

30Samsung Open Source Group

Smart Phone: Z1

Samsung Z1

Page 31: Enlightenment Foundation Libraries (Overview)

31Samsung Open Source Group

Smart TV

Samsung TV

Page 32: Enlightenment Foundation Libraries (Overview)

32Samsung Open Source Group

Many Other Products

● Fridge

● Printer

● Medical device

● Set top box

● Home automation

● Navigation system

● More to come...

Page 33: Enlightenment Foundation Libraries (Overview)

33Samsung Open Source Group

Where is EFL Going?

Page 34: Enlightenment Foundation Libraries (Overview)

34Samsung Open Source Group

Improving Performance

● Faster, lighter, better

● Better support for systems without MMU

● Improve speed of software renderer (more colorspace support)

● Slowly roll in threads for CPU intensive tasks

● Improve speed of GPU renderer (more efficient packing)

● Speed up animation filter (Dedicated assembler and shader)

● Efficiently share data across processes

● Experiment with new memory layouts for Eo object

Page 35: Enlightenment Foundation Libraries (Overview)

35Samsung Open Source Group

Improve Functionality

● Improve 3D scene graph inside Evas canvas (3D world, Effect, …)

● Add SVG scene graph and Vector graphics API in Evas

● Animated filters

● Improve portability (Windows, Mac OS X)

● Keep it always up to date (C++, Lua, Python, JS, Ocaml)

● Improve tests and automatic build system to improve quality

● Improve documentation

Page 36: Enlightenment Foundation Libraries (Overview)

36Samsung Open Source Group

Animated Filter !

Animated bump map filter effect on an image

Page 37: Enlightenment Foundation Libraries (Overview)

37Samsung Open Source Group

3D Scene Graph

Example of using current Evas 3D scene graph

Page 38: Enlightenment Foundation Libraries (Overview)

38Samsung Open Source Group

The Future of Enlightenment

● X11 will be made optional by serving as a KMS/DRM Wayland Compositor

● Incorporate Elementary widgets set

● Differentiate from Qt logic to provide a library to do your own compositor→ Enlightenment is the base to put your module in for your specific needs

● Improve support for HiDPI

● Improve modularity

● Support more upstream profiles (Tiling, mobile, TV, ...)

Page 39: Enlightenment Foundation Libraries (Overview)

39Samsung Open Source Group

EFL Cheat Sheet

● Fast release cycle: 3 months

● Used in Tizen

● Will always support systems with no GPU and limited resources

● Continuous EFL benchmarking to make sure that each release improves on the last

● Majority is licensed under LGPL

● Backend is covered under MIT license

● World wide community

Page 40: Enlightenment Foundation Libraries (Overview)

40Samsung Open Source Group

Questions?

Twitter: @SamsungOSGEmail: [email protected]

Slides: http://www.slideshare.net/SamsungOSG

We're Hiring!