6. EFL ์ค๊ธ๊ธฐ๋ฅํ์ฉ 6.1 Elementary Theme 6.2 3D Visual Effect 6.3 Integrate with OpenGL ES 6.4 Multi-Threaded EFL App
6.1 Elementary Theme - Theme Change - Theme Extension
6.1 Elementary Theme - Theme Change Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 3
6.1 Elementary Theme - Theme Change Theme ์ํตํด์์ ฏ์ Look & Feel ์๊ฒฐ์ ์์คํ ๊ธฐ๋ฐ์ Theme ์ ๊ณต์ถ๊ฐ Theme ์๋ํ๋์ Theme ๋ณ๊ฒฝ๊ฐ๋ฅ Theme ํ์ฅ์ํตํ์์ ฏ Customizing ๊ฐ๋ฅ tizen-black elm_widget widget style (look & feel) widget body (functionality) tizen-white widget style (look & feel) Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 4
6.1 Elementary Theme - Theme Change 1. Theme ํ์ผ์์น default tizen-hd /usr/local/share/elementary/themes/default.edj /usr/local/share/elementary/themes/tizen-hd.edj 2. ํ์ฌ Theme ์ ๋ณด์์น elm_config PROFILE ์๋ฐ๋ผํด๋๊ฐ๋ค๋ฆ ex) default, mobile /usr/local/share/elementary/config/mobile/base.cfg 3. ํ๊ฒฝ๋ณ์ ELM_THEME=theme01:theme02:elementary elementary/config/mobile/base.src 4. Theme ์์ํด๊ฒฐ์ ๋๋์์ฑ - Image, Color, Layouting, String, Font - Transition, Programs Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 5
6.1 Elementary Theme - Theme Change 4. ๊ฐ์ ํ๋ฆฌ์ผ์ด์ ์ elementary config ํ์ผ์ reload 3. X ์๋ฒ๋ root ์๋์ฐ์ property ๋ณ๊ฒฝ์๋ํ์ด๋ฒคํธ๋ฅผ๊ฐ์ ํ๋ฆฌ์ผ์ด์ ์ broadcasting 1. ๊ฐ Elementary ์ ํ๋ฆฌ์ผ์ด์ ์ elm_init() ๋จ๊ณ์์ root ์๋์ฐ์ property( ELM_CONFIG_mobile ) ์ property ๋ณ๊ฒฝ์๋ํ handler ๋ฅผ์ถ๊ฐ X server root window property name: ELM_CONFIG_mobile ex) Setting App. 2. ํน์ ์ ํ๋ฆฌ์ผ์ด์ ์์ Theme ๋ณ๊ฒฝํ root ์๋์ฐ์ property ๋ฅผ๋ณ๊ฒฝ - elm_theme_set() - elm_config_all_flush() Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 6
6.1 Elementary Theme - Theme Change Elementary Theme Change ์์ source: advanced_samples/theme_change.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 7
6.1 Elementary Theme - Theme Extension ํน์ ์ ํ๋ฆฌ์ผ์ด์ ์์์ ํ๋ฆฌ์ผ์ด์ ์ํนํ๋์์ ฏ Look & Feel ์์ ์ฉํ๊ณ ์ํ ๋์์ ฏ Customizing ์์ด์ฉ elm_theme_extension_add(null, /usr/apps/org.tizen.app/data/app_theme.edj ); elm_object_style_set(button, new_style ); ์ ํ๋ฆฌ์ผ์ด์ ์์์ ์ํ๋ฒํผ์คํ์ผ app-theme Extension Theme: /usr/apps/org.tizen.app/data/app_theme.edj ๊ธฐ๋ณธํ ๋ง์์์ ๊ณตํ๋๋ฒํผ์คํ์ผ tizen-hd Basic Themes: /usr/share/elementary/themes/tizen-hd.edj Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 8
6.1 Elementary Theme - Theme Change Elementary ๋ด๋ถ์ ์ผ๋ก๋ฆฌ์คํธ๋ฅผ๊ตฌ์ถํ์ฌ Theme ์ ์ฉ์์๋ฅผ์ ํจ Theme ๋ฆฌ์คํธ๋ฅผ๊ตฌ์ถํ๋๋ฐฉ๋ฒ ์์คํ ๊ธฐ๋ฐ Theme (Basic Themes) Elementary Config ์๋ช ์๋ Theme ์ด๋ฆ์ผ๋ก๊ฒฐ์ ELM_THEME ํ๊ฒฝ๋ณ์๋ก๊ฒฐ์ - ex) ELM_THEME=tizen - ex) ELM_THEME=tizen:tizen2:tizen3 ( ์ต๋ 3 ๊ฐ์ง์ ๊ฐ๋ฅ ) ์ ํ๋ฆฌ์ผ์ด์ ๊ธฐ๋ฐ Theme Overlay Themes Basic Theme ๋ณด๋ค๋์์์ elm_theme_overlay_add(); elm_theme_overlay_del(); Extension Themes Basic Theme ๋ณด๋ค๋ฎ์์์ elm_theme_extension_add(); Custom Themes Overlay 2...... Overlay 1 Pantheon tizen Default Extension 1...... Extension 1 Extension 2 Basic Themes elm_theme_extension_del(); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 9
6.1 Elementary Theme - Theme Extension Widget Customizing ์ค์ต source: sample/data/edc/theme_ext.edc Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 10
6.1 Elementary Theme - Theme Extension Widget Customizing ์ค์ต 1. elm_theme_extension_add() ์ผ๋ก extension theme ํ์ผ์ง์ 2. Left Arrow, Right Arrow Button ์ sample ์คํ์ผ์ ์ฉ source: kakaotalk/src/main.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 11
6.1 Elementary Theme - Theme Extension Widget Customizing ์ค์ต 1. ๋ฒํผํ ๋งํ์ผ์ ํ๋ฆฌ์ผ์ด์ ์๋ณต์ฌ (efl/efl/elementary/data/theme/widget/button.edc -> sample/data/edc/theme_ext.edc) 2. theme_ext.edc ๋ฅผ์ปดํ์ผํ๋๋ก Makefile ์์ 3. ๋ณต์ฌํ button group ์์ด๋ฆ๋ณ๊ฒฝ (default -> sample) 4. ๋ฒํผ์๋ฐฐ๊ฒฝ์ด๋ฏธ์ง invisible ํ๊ฒ๋ณ๊ฒฝ source: sample/data/edc/theme_ext.edc Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 12
6.2 3D Visual Effect - Evas Map - Proxy Object - EDC Map - Elm Transition
6.2 3D Visual Effect ์์ด์ ๊ตฌํ๋ฐฉ๋ฒ : Evas_Map 3D Rendering Interface ์๋์ ์ผ๋ก๊ตฌํ์ด์ด๋ ค์ฐ๋ flexible ํจ ์คํฌ๋ฆฝํธ๊ธฐ๋ฐ๊ตฌํ๋ฐฉ๋ฒ : EDC map Evas_Map ์คํฌ๋ฆฝํธ wrapping EDC ๋ด Part ์์ดํํธ๋ฅผ์ ์ฉํ ๋์ ํฉ ๋น ๋ฅด๊ณ ๊ฐ๋จํ๊ตฌํ๋ฐฉ๋ฒ : Elm_Transit Predefined Effects Helper Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 14
6.2 3D Visual Effect Evas Map Evas Map - Evas Map์์ด์ฉํ๋ฉด Object ๋จ์๋ก์ํ๋๋น์ฃผ์ผ๋ณํ์ด๊ฐ๋ฅ - ํ๋์ Evas Map์ 4 ๊ฐ์์ ์ ์ผ๋ก๊ตฌ์ฑ - UV ๋งคํ์์ด์ฉํ์ฌํ ์ค์ฒ์์น๊ฒฐ์ - ์ ์ ๋จ์๋ก๊ด์, ์์์ ์ฉ๊ฐ๋ฅ - Rotation, Zoom, 3D Perspective ๊ณผ๊ฐ์๊ธฐ๋ฅ์ ๊ณต Evas Map 3D Effects Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 15
6.2 3D Visual Effect Evas Map Texture Mapping Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 16
6.2 3D Visual Effect Evas Map Evas Map Mapping ์์ source: advanced_samples/evas_map_mapping.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 17
6.2 3D Visual Effect Evas Map Evas Map Util APIs // ํ์ฌ์ค๋ธ์ ํธ์์์น์ํฌ๊ธฐ๋ฅผ Evas Map ์ Point ์ UV ์์ ์ฉ void evas_map_util_points_populate_from_object_full (Evas_Map *m, const Evas_Object *obj, Evas_Coord z); void evas_map_util_zoom (Evas_Map *m, double zoomx, double zoomy, Evas_Coord cx, Evas_Coord cy); void evas_map_util_rotate (Evas_Map *m, double degree, Evas_Coord cx, Evas_Coord cy); void evas_map_util_3d_rotate (Evas_Map *m, double dx, double dy, double dz, Evas_Coord cx, Evas_Coord cy, Evas_Coord cz); // ์๊ทผํจ๊ณผ๋ฅผ์ฃผ๊ธฐ์ํ์นด๋ฉ๋ผ์์น๋ฐ์ด์ ์ค์ //HINT: Scaling = (FOCAL (rate * FOCAL)) * (1 / rate); void evas_map_util_3d_perspective (Evas_Map *m, Evas_Coord px, Evas_Coord py, Evas_Coord z0, Evas_Coord foc); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 18
6.2 3D Visual Effect Evas Map Evas Map ์์ source: advanced_samples/evas_map_rotation.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 19
6.2 3D Visual Effect Proxy Object Proxy Object ํ๋์์ค๋ธ์ ํธ๋ฅผ์ฌ๋ฌ์์น์์ถ๋ ฅํ๊ณ ์ํ ๋์ด์ฉ Evas Object Image๋ฅผ์ด์ฉํ์ฌ Proxy ์ค๋ธ์ ํธ๊ตฌํ๋ฆฌ์์ค๋์๋ณธ์ค๋ธ์ ํธ๋ง๋ณด์ ํ๋ฏ๋ก๋ฆฌ์์ค์ ์ฝ์ด๊ฐ๋ฅ Proxy APIs // ํ๋ก์์๋์ (Source) ์์ง์ void evas_object_image_source_set (Evas_Object *proxy, Evas_Object *source); // ์์ค์ค๋ธ์ ํธ์ visibility ์ค์ void evas_object_image_visible_set (Evas_Object *proxy, Eina_Bool visible); // ํ๋ก์๋ฅผํตํด์์ค์ค๋ธ์ ํธ๊ฐ์ด๋ฒคํธ๋ฅผ์ ๋ฌ๋ฐ์์ง๊ฒฐ์ void evas_object_image_source_events_set (Evas_Object *proxy, Eina_Bool source_events); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 20
6.2 3D Visual Effect Proxy Object Proxy Object ์์ source: advanced_samples/proxy.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 21
6.2 3D Visual Effect EDC Map EDC Map ์์ด์ฉํ 3D ํจ๊ณผ๊ตฌํํ๊ธฐ EDC์ํน์ Part์์ดํํธ๋ฅผ์ ์ฉํ๊ธฐ์ํ๋ฐฉ๋ฒ Evas Map์๊ธฐ๋ฅ๊ณผ๋์ผ EDC์ map ์ธํฐํ์ด์ค๋์ข๋์ ์ฝ์ ์ collections.group.parts.part.description.map.perspective collections.group.parts.part.description.map.light collections.group.parts.part.description.map.rotation.center collections.group.parts.part.description.map.rotation.x collections.group.parts.part.description.map.rotation.y collections.group.parts.part.description.map.rotation.z collections.group.parts.part.description.map.on collections.group.parts.part.description.map.smooth collections.group.parts.part.description.map.perspective.zplane collections.group.parts.part.description.map.perspective.focal Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 22
6.2 3D Visual Effect EDC Map EDC Map ์์ source: sample/data/edc/layout.edc Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 23
6.2 3D Visual Effect Elm Transit Elm Transit ๋ฏธ๋ฆฌ์ ์๋์ด์๋์ดํํธํ์ ๋ฐ์ฌ์ฉ์์ ์์ดํํธ๋ฅผ์ด์ฉํ์ฌํจ๊ณผ๊ตฌํ Contain ๋์ค๋ธ์ ํธ๊ฐ์๋, ๋ ๋ฆฝ์ค๋ธ์ ํธ์์ดํํธ์ ์ฉ์์ ์ฉ ์ดํํธ๊ตฌํ๋ถ๊ฐํ๋ก๊ทธ๋จ๋ฐ์ด๋๋ฆฌ์ํฌํจ๋๋ฏ๋ก theme changeable ํ์ง์์ ์๋์ขํ, ์ค์ผ์ผ์๊ณ ๋ คํด์ฃผ์ด์ผํจ ์ ๊ณตํ๋์ดํํธํ์ Translation Resizing Zoom Flip Resizable Flip Wipe Fade Blend Rotation Image Animation Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 24
6.2 3D Visual Effect Elm Transit Use Case 1. Create Transit (elm_transit_add) 2. Add Objects in Transit (elm_transit_object_add) 2. Add Effects in Transit (elm_transit_effect_add) 3. Set attributes on Transit (elm_transit_del_cb_set) : ์ดํํธ๋๋ ์ํธ์ถ๋๋์ฌ์ฉ์์ฝ๋ฐฑํจ์์ง์ (elm_transit_repeat_times_set) : ์ดํํธ๋ฐ๋ณตํ์์ง์ (elm_transit_tween_mode_set) : ๊ฐ์์คํ์ผ์ง์ ( ์ ํ, ๊ฐ์, ๊ฐ์, ๊ฐ์ํ๊ฐ์๋ฑ ) (elm_transit_event_enabled_set) : ์ดํํธ๋์คํฐ์น์ ๋ ฅ๋ฐฉ์ง์ฌ๋ถ์ค์ (elm_transit_auto_reverse_set) : ํจ๊ณผ๋๊ฐ๊ธฐ๊ธฐ๋ฅ 4. Run Transit (elm_transit_go) Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 25
6.2 3D Visual Effect Elm Transit ํ๋์ Transit ์์ฌ๋ฌ๊ฐ์์ดํํธ๋ฅผ๋ณตํฉ๊ฐ๋ฅ Rotation Color Translation elm_transit_effect_rotation_add elm_transit_effect_color elm_transit_effect_translation_add Elm_Transit RUN ALL ADDED EFFECTS! * ์ ์ฌํ์์ฑ์์ดํํธ๋ํฉ์ฑ๋ ์์์ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 26
6.2 3D Visual Effect Elm Transit Elm Transit ์์ source: advanced_samples/transit.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 27
6.2 3D Visual Effect Elm Transit Elm Transit ์ค์ต source: sample/src/main.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 28
6.3 Integrate with OpenGL ES - Rendering Backened System - Image Object Native Surface - Evas GL - Elm GLView
6.3 Integrate with OpenGL ES Rendering Backened System Rendering on Software Backened Elementary Edje Ecore Ecore X Evas Evas software backend xlib LCD controller X shared Mem. X Server Update window areas Frame buffer 60Hz Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 30
6.3 Integrate with OpenGL ES Rendering Backened System Rendering on GLES Backened Elementary Evas Evas OpenGL ES backend Edje Ecore Ecore X OpenGL ES EGL for X OpenGL ES H/W xlib LCD controller back front Double buffer X Server Update window area Frame buffer /dev/fb1 60Hz Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 31
6.3 Integrate with OpenGL ES Image Native Surface evas_object_image_native_surface_set() Evas_Object_Rect Evas Runtime Hello World! Hello World! Evas_Object_Text GL Rendering Engine X11 Output Evas Engine Module Output Evas_Object_Image SW Rendering Engine Buffer Output X11 Rendering Engine SDL Output OpenGL App (surface_a ie. Pixmap or texture) Evas_Object_Image (img_obj_a) evas_object_image_native_surface_set(img_obj_a, surface_a) Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 32
6.3 Integrate with OpenGL ES Image Native Surface Name: evas_object_image_native_surface_set () Parameters:. Evas_Object *obj. Evas_Native_Surface *surf Description: ์ด๋ฏธ์ง์ค๋ธ์ ํธ์์์ด๋ฏธ์ง์์ค๋ก์ด์ฉํ surface ์ค์ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 33
6.3 Integrate with OpenGL ES Evas GL Evas_GL evas_object_image_native_surface_set() ์์ฌ์ฉํ๊ธฐ๊ฐ๋ณต์กํจ Native surface ์ฒ๋ฆฌ๋ฌธ์ (i.e. X Pixmap) GLX, WGL๋ฑ์์์กด์ฑ๋ฌธ์ Evas_GL ์ Evas ์ OpenGL ๊ฐ์ Glue Layer ๋ฅผ์ ๊ณต Surface ์์ฑ Context ์์ฑ Evas_GL_API ๊ตฌ์กฐ์ฒด๋ก๋ชจ๋ GLES 2.0 ํจ์๋ค์๋ํ GL ์์กด์ฑ์์ ํ๋ฆฌ์ผ์ด์ ์ด์๋ํ๋ซํผ๋ ๋ฒจ๋ก์ํ (Desktop GL vs GLES) ์ ํ๋ฆฌ์ผ์ด์ ์์๋ Evas_GL_API ๋ฅผ์ด์ฉํ์ฌ GL ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก๋ถํฐ๋ํ๋์ํด์ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 34
6.3 Integrate with OpenGL ES Evas GL Evas_GL APIs Evas_GL void *evas_gl_new (Evas *e); evas_gl_free (Evas_GL *evas_gl); Evas_GL_Surface *evas_gl_surface_create (Evas_GL *evas_gl, Evas_GL_Config *cfg, int w, int h); void evas_gl_surface_destroy (Evas_GL *evas_gl, Evas_GL_Surface *surf); Evas_GL_Context *evas_gl_context_create (Evas_GL *evas_gl, Evas_GL_Context *share_ctx); void Eina_Bool evas_gl_context_destroy (Evas_GL *evas_gl, Evas_GL_Context *ctx); evas_gl_make_current (Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_GL_Context *ctx); Evas_GL_API *evas_gl_api_get (Evas_GL *evas_gl); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 35
6.3 Integrate with OpenGL ES Evas GL Evas surface ๋๋ค์๊ณผ๊ฐ์์์ฑ๋ค์๊ฐ์ง Color RGB or RGBA ์ฑ๋๋น 8 ๋นํธ or ์ฑ๋๋น 32 ๋นํธ ( ๋ชจ๋ฐ์ผํ๊ฒ์์๋์ง์์๋จ ) Depth 8 ~ 32 bits Stencil 1 ~ 16 bits Evas GL surface format ๊ตฌ์กฐ์ฒด ์ฌ์ฉ์๊ฐ์ง์ ํ๊ฒ๊ณผ์ค์ Evas ๊ฐ์ฌ์ฉํ๋ํฌ๋งท์๋ค๋ฅผ์๋์์ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 36
6.3 Integrate with OpenGL ES Evas GL Evas_GL Surface Creation / Deletion ์ฌ์ฉ์๊ฐ์ค์ ์ผ๋ก Surface ์์ฑ Evas๋ Surface ์์ฑ์์ํด๋ด๋ถ์ ์ผ๋ก FBO์ Render Buffers๋ฅผ์ด์ฉ Evas_GL_Surface *evas_gl_surface_create (Evas_GL *evas_gl, Evas_GL_Config *cfg, int w, int h); void evas_gl_surface_destroy (Evas_GL *evas_gl, Evas_GL_Surface *surf); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 37
6.3 Integrate with OpenGL ES Evas GL Context creation/ deletion Context ๋ฆฌ์์ค๋ OpenGL ๋ช ์ธ์์๋ฐ๋ผ๊ณต์ ๋ ์์์๋๋ผ์ด๋ฒ๊ตฌํ์์์กด Evas_GL_Context *evas_gl_context_create (Evas_GL *evas_gl, Evas_GL_Context *share_ctx); void Eina_Bool evas_gl_context_destroy (Evas_GL *evas_gl, Evas_GL_Context *ctx); evas_gl_make_current (Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_GL_Context *ctx); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 38
6.3 Integrate with OpenGL ES Evas GL Evas GL APIs ๋ค๋ฅธ๋ฒ์ ์ GL ์์กด์ฑํผํ๊ธฐ์ํ๋ฐฉ๋ฒ Evas_GL_API *evas_gl_api_get (Evas_GL *evas_gl); #define EVAS_GL_API_VERSION 1 struct _Evas_GL_API { int version; /* version 1: */ void (*glactivetexture) (GLenum texture); void (*glattachshader) (GLuint program, GLuint shader); void (*glbindattriblocation) (GLuint program, GLuint index, const char* name); void (*glbindbuffer) (GLenum target, GLuint buffer); void (*glbindframebuffer) (GLenum target, GLuint framebuffer);... void (*glviewport) (GLint x, GLint y, GLsizei width, GLsizei height); /* Extensions */ void (*glgetprogrambinary) (GLuint program, GLsizei bufsize, GLsizei *length, GLenum *binaryformat, void *binary); } /* future calls will be added down here for expansion */ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 39
6.3 Integrate with OpenGL ES Evas GL Evas GL ์์ ์ด๋ฏธ์ง์ค๋ธ์ ํธ๊ฐ๊ฐ๋ ค์ก์ด๋ GL ๋ ๋๋ง์ํ๋๋ฌธ์ ๊ฐ์์ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 40
6.3 Integrate with OpenGL ES Evas GL evas_object_image_pixels_get_callback_set() ์ด๋ฏธ์ง์ค๋ธ์ ํธ๋ฅผ update ํ๊ธฐ์ํด dirty ์ฌ๋ถ๋ง์ค์ ํ๋๋ฐฉ๋ฒ pixel get callback ์์ค์ ๋ก์ด๋ฏธ์ง์ค๋ธ์ ํธ๊ฐ๋ณด์ผ๋์๋งํธ์ถ๋จ GL ๋ ๋๋ง์ดํ์์์๋์๋ํธ์ถ๋์ง์์๋ถํ์ํ CPU ์ฌ์ดํด์๋ฐฉ์ง Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 41
6.3 Integrate with OpenGL ES Evas GL ์์ ๋ถํ์ํ๋ ๋๋ง์๋ฐฉ์งํ ์์์ผ๋๋ถํ์ํ์ปจํ ์คํธ์ค์์นญ์ด๋ฐ์ํ ์์์. ์ปจํ ์คํธ์ค์์นญ์ด์ค๋ฒํค๋์ด์๊ฐ๋๋ฉด animator ์์๋ ๋๋งํ๋๋ฐฉ์์์ด์ฉํ ๊ฒ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 42
6.3 Integrate with OpenGL ES Evas GL ํ์ฌ Evas_GL ์ gl_x11 backened ์์๋ง๋์ Evas is not MT safe! gl_x11 backend ์์๋, Evas ๋ด๋ถ์ ์ผ๋ก Canvas Composition ์์ํด OpenGL ์์ด์ฉ ์ฌ์ฉ์๋ GL ์ปค๋งจ๋๋ฅผ์ฌ์ฉํ๊ธฐ์ ์๋งค๋ฒ evas_gl_make_current() ๋ฅผํธ์ถํด์ฃผ์ด์ผํจ ์ค๋ ๋๋๊ธฐํ๋์ฌ์ฉ์์๋ชซ Evas_GL surface format Evas_GL ์๋ด๋ถ์ ์ผ๋ก FBO ๋ฅผ์ด์ฉํ๋ฏ๋ก๋๋ผ์ด๋ฒ์๋ฐ๋ผ์ด์ฉ๊ฐ๋ฅํํฌ๋งท์ด๋ค๋ฅผ์์์ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 43
6.3 Integrate with OpenGL ES Evas GL Evas_GL ์์ด์ฉํ๋ ๋๋ง์ค์ต source: advanced_samples/evas_gl.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 44
6.3 Integrate with OpenGL ES Elm GLView elm_glview GL ๋ ๋๋ง๋ชฉ์ ์ Elementary ์์ ฏ Elementary ์ปจ์ ์ํธ์์ฑ API๋ฅผ์ ๊ณต Evas_Object void void Evas_GL_API Eina_Bool Eina_Bool Eina_Bool void void void void void *elm_glview_add(evas_object *parent); elm_glview_size_set(evas_object *obj, Evas_Coord width, Evas_Coord height); elm_glview_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height); *elm_glview_gl_api_get(const Evas_Object *obj); elm_glview_mode_set(evas_object *obj, Elm_GLView_Mode mode); elm_glview_scale_policy_set(evas_object *obj, Elm_GLView_Resize_Policy policy); elm_glview_render_policy_set(evas_object *obj, Elm_GLView_Render_Policy policy); elm_glview_init_func_set(evas_object *obj, Elm_GLView_Func func); elm_glview_del_func_set(evas_object *obj, Elm_GLView_Func func); elm_glview_resize_func_set(evas_object *obj, Elm_GLView_Func func); elm_glview_render_func_set(evas_object *obj, Elm_GLView_Func func); elm_glview_changed_set(evas_object *obj); : Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 45
6.3 Integrate with OpenGL ES Elm GLView elm_glview Use Case Typical GLView Flow: Example: Add an ELM_GLView gl = elm_glview_add (win); Set the GLView Mode (Enable Alpha, Depth, Stencil) elm_glview_mode_set (gl, ELM_GLVIEW_ALPHA ELM_GLVIEW_DEPTH); Set the Resize/ Render Policies elm_glview_resize_policy_set (gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE); elm_glview_render_policy_set (gl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND); Set the GL Drawing Function Callbacks (Init, Del, Resize, Render) elm_glview_init_func_set (gl, _init_gl); elm_glview_del_func_set (gl, _del_gl); elm_glview_resize_func_set (gl, _resize_gl); elm_glview_render_func_set (gl, _draw_gl); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 46
6.3 Integrate with OpenGL ES Elm GLView ์์ ฏ์ถ๊ฐํจ์ Evas_Object *elm_glview_add(evas_object *parent); GLView ํฌ๊ธฐ์ง์ void elm_glview_size_set(evas_object *obj, Evas_Coord width, Evas_Coord height); void elm_glview_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height); GLView Mode- 4 ๊ฐ์ง์ง์ ELM_GLVIEW_APLHA ELM_GLVIEW_DEPTH ELM_GLVIEW_STENCIL ELM_GLVIEW_DIRECT Eina_Bool elm_glview_mode_set(evas_object *obj, Elm_GLView_Mode mode); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 47
6.3 Integrate with OpenGL ES Elm GLView RESIZE POLICY - RESIZE ๋ฐ์์์๋์ฌ๋ถ๋ฅผ๊ฒฐ์ ELM_GLVIEW_RESIZE_POLICY_RECREATE (default) ์๋ก์ดํฌ๊ธฐ๋ก surface ์ฌ์์ฑ ELM_GLVIEW_RESIZE_POLICY_SCALE ๊ธฐ์กด surface ๋ฅผ scaling ํ์ฌ์ถ๋ ฅ Eina_Bool elm_glview_resize_policy_set(evas_object *obj, Elm_GLView_Resize_Policy policy); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 48
6.3 Integrate with OpenGL ES Elm GLView RENDER_POLICY - ๋ ๋๋ง๋ฐฉ์์๊ฒฐ์ ํ๋๋ฐฉ๋ฒ ELM_GLVIEW_RENDER_POLICY_ON_DEMAND GLView ๊ฐ๋ณด์ผ๋๋ง๋ ๋๋ง์ํ (default) ELM_GLVIEW_RENDER_POLICY_ALWAYS ๋งค๋ฃจํ๋ง๋ค๋ฌด์กฐ๊ฑด๋ ๋๋ง Eina_Bool elm_glview_render_policy_set(evas_object *obj, Elm_GLView_Render_Policy policy); Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 49
6.3 Integrate with OpenGL ES Elm GLView Init/Del ์ฝ๋ฐฑ init_func : ๋ ๋๋ฃจํ์์ํ๋ฒ๋งํธ์ถ del_func : glview ์ค๋ธ์ ํธ๊ฐ์ญ์ ๋ ์ํธ์ถ void void elm_glview_init_func_set (Evas_Object *obj, Elm_GLView_Func func); elm_glview_del_func_set (Evas_Object *obj, Elm_GLView_Func func); Resize ์ฝ๋ฐฑ ๋ณดํต๋งคํธ๋ฆญ์ค๋ฐ๋ทฐํฌํธ์ค์ ์์ํ void elm_glview_resize_func_set(evas_object *obj, Elm_GLView_Func func); Render ์ฝ๋ฐฑ void elm_glview_render_func_set(evas_object *obj, Elm_GLView_Func func); Note ๋ชจ๋ GL ์ปค๋งจ๋๋์์ฝ๋ฐฑ์์์ํํด์ผํจ ์ฌ์ฉ์๋ make_current ๋ฅผํ์ง์์๋๋จ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 50
6.3 Integrate with OpenGL ES Elm GLView elm_glview_changed_set() glview๊ฐ๋ณ๊ฒฝ๋์๋ค๋์ฌ์ค์์๋ฆผ๋ณดํต animation ์ฝ๋ฐฑ์์ํธ์ถ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 51
6.3 Integrate with OpenGL ES Elm GLView elm_glview ์์ source: advanced_samples/glview.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 52
6.4 Multi-Threaded EFL App - Critical Section - Ecore Thread
6.4 Multi-Threaded EFL App Critical Section Ecore_Thread, ecore_pipe_write() ๋ฑ๋ช API ๋ฅผ์ ์ธํ๊ธฐ๋ณธ EFL API ๋ Thread Safe ํ์ง์์. ์ฌ์ฉ์๋ EFL Mainloop ์์ ํ๋ฆฌ์ผ์ด์ ์ค๋ ๋๊ฐ์๋๊ธฐํ / ์ํธ๋ฐฐ์ ๋ฅผ๊ณ ๋ คํ์ฌ์ ํ๋ฆฌ์ผ์ด์ ์๋์์ธํด์ผํจ. Object Race Condition! evas_object_move(obj, x, y); evas_object_resize(obj, w, h);... evas_render() { smart_calculate(obj); }... App Thread Main Loop Time Line Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 54
6.4 Multi-Threaded EFL App Ecore Thread Thread Pool Library CPU APP ํ์คํฌ ํ์คํฌ์ค์ผ์ค๋ฌ ํ์คํฌ๋ฆฌ์คํธ a b c ํ์คํฌ๋ฆฌ์คํธ d e f ์ค๋ ๋ํ ์ค๋ ๋ํ T1 T2 T1 T2 core 1 core 2 ํ์คํฌ๋ฆฌ์คํธ s t u ์ค๋ ๋ํ T3 T3 core 3 ํ์คํฌ๋ฆฌ์คํธ v w x ์ค๋ ๋ํ T4 T4 core 4 T ๋ ผ๋ฆฌ์ค๋ ๋ T ๋ฌผ๋ฆฌ์ค๋ ๋ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 55
6.4 Multi-Threaded EFL App Critical Section Critical Section ecore_thread_main_loop_begin(), ecore_thread_main_loop_end() ecore_main_loop_thread_safe_call_sync() ecore_main_loop_thread_safe_call_async() Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 56
6.4 Multi-Threaded EFL App Critical Section ecore_thread_main_loop_begin(), ecore_thread_main_loop_end() Main Loop ์์ค๋ ๋๊ฐ Critical Section ์์ง์ ํ๋๋ฐฉ๋ฒ Critical Section ๋ด์์๋ EAPI ํธ์ถ๊ฐ๋ฅ ecore_thread_main_loop_begin() ํธ์ถ์์ ์๋ main loop ๋ด๋ถ์ ์ผ๋ก thread ๋๊ธฐํ์์ ์ด์ํ๋๋ฏ๋ก๋๊ธฐ๊ฐ๋ฐ์ํ ์์์ ๊ฐ๋ฅํ์ต์ํ์ํธ์ถ๋ก๊ณผ๋ถํ๋ฅผ๋ฐฉ์งํ ๊ฒ ecore_main_loop_thread_safe_call_sync() ๋๋์ผํ๊ธฐ๋ฅ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 57
6.4 Multi-Threaded EFL App Critical Section ecore_thread_main_loop_begin/end() ์์ source: advanced_samples/ecore_thread_main_loop.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 58
6.4 Multi-Threaded EFL App Critical Section ecore_main_loop_thread_safe_call_sync() ์์ source: advanced_samples/ecore_main_loop_thread_safe_call_sync.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 59
6.4 Multi-Threaded EFL App Critical Section Critical Section ์ฒ๋ฆฌ์์ Critical Section ์ฒ๋ฆฌ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 60
6.4 Multi-Threaded EFL App Critical Section ecore_main_loop_thread_safe_call_async() Main Loop ์์ค๋ ๋๊ฐ Critical Section ์์ง์ ํ๋๋ฐฉ๋ฒ Fire and Forgot ๋ฐฉ์์ผ๋ก API ํธ์ถ์๋ฐ๋ก API ๋ฐํ ecore_main_loop_thread_safe_call_sync() ํธ์ถ์์ ์๋ main loop ๋ด๋ถ์ ์ผ๋ก thread ๋๊ธฐํ์์ ์ด์ํ๋๋ฏ๋ก๋๊ธฐ๊ฐ๋ฐ์ํ ์์์ผ๋, async() ๋ callback ํจ์๋ฅผ queue ์์ถ๊ฐํ๋น๋๊ธฐ์ ์ผ๋ก์ํ๋์ด Thread ๋๊ธฐ๋ฅผํผํ ์์์ 2 void *sync_cb() { } ecore_main_loop_iterate 3 void async_cb() { } 1 void *thread_run() { 1 void *thread_run() { ecore_main_loop_thread_saf e_call_sync(sync_cb, ); ecore_main_loop_thread_saf e_call_async(async_cb, ); 3 usleep(1000); 2 usleep(1000); ๋๊ธฐ๊ตฌ๊ฐ file descriptor handling } } App Thread(sync) App Thread(async) Time Line Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 61
6.4 Multi-Threaded EFL App Critical Section ecore_main_loop_thread_safe_call_async() ์์ source: advanced_samples/ecore_main_loop_thread_safe_call_async.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 62
6.4 Multi-Threaded EFL App Ecore Thread Ecore_Thread - ๋ณด๋ค์ง๊ด์ ์ด๊ณ ๋จ์ํ๊ณ ํจ์จ์ ์ธ thread ์ฒ๋ฆฌ๊ฐ๊ฐ๋ฅ ecore_thread_feedback_run(), ecore_thread_run() ์ํตํ parallel ์์ ์ฒ๋ฆฌ ๋ด๋ถ์ ์ผ๋ก Threading Pool ๊ธฐ๋ฐ์ผ๋ก์์ ์ค๋ ๋๋ค์์ค์ผ์ค๋งํ๋ฏ๋ก์ค๋ ๋๊ณผ๋ถํ๋ฑ์๋ถ๋ด์ํผํ ์์์ผ๋ฉฐ scalable ํ processing ํน์ฑ์์ง๋ ( ๊ธฐ๋ณธ์ผ๋ก์ค๋ ๋์ต๋๊ฐ์๋ CPU ๊ฐฏ์๋ก์ ํํจ ) ecore ๋น๋์ thread option ์๋ฐ๋ผ thread ์ฒ๋ฆฌ๊ฐ parallel ๋๋ serial ๋ก๋์ฒ EFL API ๋ฅผ parallel ํ๊ฒํธ์ถํด์ผํ ๊ฒฝ์ฐ ecore_thread_feedback_run(), ๊ทธ๋ ์ง์์ผ๋ฉด ecore_thread_run() ์์ด์ฉ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 63
6.4 Multi-Threaded EFL App Ecore Thread Name: ecore_thread_run () Parameters: Ecore_Thread_Cb Ecore_Thread_Cb Ecore_Thread_Cb const void func_blocking func_end func_cancel *data Return: Ecore_Thread * Description: func_blocking ์์ํํ worker thread ๋ฅผ์์ฑ. ๋ง์ฝ์ค๋ ๋๊ฐ์๊ฐ maximum ์ผ๊ฒฝ์ฐ์๋๊ธฐ์กด์ค๋ ๋๊ฐ available ํ ๋๊น์ง pending ํ์ฒ๋ฆฌ thread ์ข ๋ฃ์ func_end or func_cancel ์ดํธ์ถ๋๋ฉฐ์ด๋ค์ main thread ์์ํด์ฒ๋ฆฌ๋๋ฏ๋ก EFL API ํธ์ถ๊ฐ๋ฅ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 64
6.4 Multi-Threaded EFL App Ecore Thread ecore_thread_run () Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 65
6.4 Multi-Threaded EFL App Ecore Thread ecore_thread_run () ์ค์ต source: advanced_samples/ecore_thread_run.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 66
6.4 Multi-Threaded EFL App Ecore Thread Name: ecore_thread_feedback_run () Parameters: Ecore_Thread_Cb Ecore_Thread_Cb Ecore_Thread_Cb Ecore_Thread_Cb const void Eina_Bool func_heavy func_notify func_end func_cancel *data try_no_queue Return: Ecore_Thread * Description: func_heavy ๋ฅผ์ํํ worker thread ๋ฅผ์์ฑ. ๋ง์ฝ์ค๋ ๋๊ฐ์๊ฐ maximum ์ผ๊ฒฝ์ฐ์๋๊ธฐ์กด์ค๋ ๋๊ฐ available ํ ๋๊น์ง pending ํ์ฒ๋ฆฌ. try_no_queue ์ EINA_TRUE ๋ฅผ์ ๋ฌํ ์, Maximum ์ค๋ ๋์์๊ด์์ด์ค๋ ๋์์๋ฐ๋ก์์ ์ด์ํ๋จ. EFL API ๋ฅผ access ํ๊ธฐ์ํด์๋ func_notify ์ฝ๋ฐฑ์์์ด๋ฅผ์ฒ๋ฆฌ Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 67
6.4 Multi-Threaded EFL App Ecore Thread ecore_thread_feedback_run () Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 68
6.4 Multi-Threaded EFL App Ecore Thread ecore_thread_feedback_run () ์์ source: advanced_samples/ecore_thread_feedback_run.c Copyright 2013 Samsung Electronics, Co., Ltd. All rights reserved. 69
๊ฐ์ฌํฉ๋๋ค!