3.0 Porting Guide/Graphics and UI/libtpl-egl

From Tizen Wiki
Jump to: navigation, search

Description

  • This document describes the essential elements of Tizen's "platform-level graphics architecture which is related with OpenGLES/EGL, and how it is used by the application framework and Display server. The focus is on how buffers of graphical data move through the system.
  • Tizen platform requires OpenGL ES Driver for the acceleration of display server (E20) and clien (wayland-egl client).
  • And this platform demands OpenGL ES / EGL driver which is implemented by Tizen EGL Porting Layer.

Overview

Tizen Porting Layer(TPL) Architecture

  • TPL is an abstraction layer for surface and buffer management on Tizen platform

Overview tpl.png

Tizen EGL Porting Layer

  • TPL is abbreviation of Tizen Porting Layer. TPL is an abstraction layer for surface and buffer management on Tizen platform aimed to implement the EGL porting layer of OpenGLES driver over various display protocols.
  • Why tizen uses Tizen EGL Porting Layer?
    • Prevents burdens of EGL porting on various window system protocols.
    • Makes GPU GL Driver’s Window System Porting Layer functions treat only TPL-EGL APIs.
  • TPL provides object-oriented interfaces. Every TPL object can be represented as generic tpl_object_t which is reference-counted and provides common functions. Currently, three types of TPL objects are provided: Display, Surface. Display, like normal display, represents a display system which is usually used for connection to the server. Surface corresponds to a native surface like wl_surface. A surface might be configured to use N-buffers, usually double-buffered or triple-buffered. Buffer is actually something we can render on it, usually a set of pixels or block of memory. For these two objects, Wayland, GBM, TBM backend are defined, and they are corresponding to their own window system. So, users don’t need to care about window system.
  • Supported Backend: Wayland , gbm , tbm

TPL Core Object

Tizen Porting Layer Core

TPL Object
Base class for all TPL objects
TPL Display
Encapsulate native display object (Display *, wl_display)
TPL Surface
Encapsulate native drawable object (Window, Pixmap, wl_surface)


Relationship between TPL objects and corresponding EGL objects

width=1200

GLES Drawing API Flow

GLES API FLOW.png


Wayland Architecture (Buffer Creation/ Render)

  • Tizen Platform uses wayland client server model as window system and this figure shows simple flow of buffer creation and gl rendering on tizen.

Tpl wayland buffer flow architecture.png

Overall Buffer Flow between Server (E20) and Client (wayland-egl)

  • Tizen platform uses Enlightenment as wayland display server and this figure explains buffer flow between server and client in detail.

Overall buffer flow.png

Buffer Flow in detail ( GBM )

  • This figure shows flow of buffer on tpl-egl's gbm backend which is used by wayland display server.

Tbm surface queue on gbm.png

Buffer Flow in detail ( Wayland-egl )

  • This figure shows flow of buffer on tpl-egl's wayland-egl backend which is used by wayland-egl client.

Tbm surface queue on wayland egl.png

TPL Frontend API ( tpl_object )

TPL Object

Base class for all TPL objects
Provide common functionalities of all TPL objects
API Description
tpl_object_reference Increase reference count of the given TPL object
tpl_object_unreference Decrease reference count and destroy it if it becomes 0
tpl_object_get_reference Get reference count of the given TPL object
tpl_object_get_type Get type of the object (display, surface or buffer)
tpl_object_set_user_data Set user data and free callback for destruction
tpl_object_get_user_data Get user data

TPL Frontend API ( tpl_display )

TPL Display

Encapsulate native display object (Display *, wl_display)
Any other objects are created from TPL Display and inherits backend type of it
API Description
tpl_display_get Retrieve the TPL display for the given native display handle
tpl_display_get_native_handle Get native handle of the given display
tpl_display_query_config Query pixel format information
tpl_display_get_native_window_info Query information on the given native window.
tpl_display_get_native_pixmap_info Query information on the given native pixmap.
tpl_display_get_buffer_from_native_pixmap Get native buffer from the given native pixmap.

TPL Frontend API ( tpl_surface )

TPL Surface

Encapsulate native drawable object (Window, Pixmap, wl_surface)
Main Features
  • Retrieve buffer for a frame
  • Post the surface to a screen
API Description
tpl_surface_create Create a TPL surface for the given native drawable
tpl_surface_get_display Get display of the given surface
tpl_surface_get_native_handle Get native handle of the given surface
tpl_surface_get_type Get type of the given surface (Window or Pixmap)
tpl_surface_get_size Get size of the given surface
tpl_surface_dequeue_buffer Get buffer (as TBM_SURFACE) of the current frame for the given surface
tpl_surface_validate Check current buffer is valid
tpl_surface_set_post_interval Set post interval
tpl_surface_get_post_interval Get post interval
tpl_surface_enqueue_buffer Post to screen

TBM_Surface Life cycle

When is the TBM_Surface_Queue Created

  • gbm_tbm_surface_create()
  • _tpl_wayland_surface_init()


When is the TBM_Surface allocated? (Real buffer allocation)

  • tbm_surface_queue_dequeue
  • When the get_buffer() is called by GL Driver (tpl-egl) and tbm_surface is not allocated yet internally.


Driver Install Directory

  • CoreGL ( An injection layer of OpenGL ES ) loads manufacturer's OpenglES driver from /usr/lib/driver.
  • CoreGL provides libEGL.so ,libGLESv1_CM.so and libGLESvs.so over /usr/lib.
LIBRARY PATH FILES
/usr/lib/driver libEGL.so

libGLESv1_CM.so

libGLESv2.so

Project Git Repository

Project Repository Description
libtpl-egl platform/core/uifw/libtpl-egl Tizen Porting Layer for EGL
libtbm platform/core/uifw/libtbm The library for Tizen Buffer Manager.
coregl platform/core/uifw/coregl An injection layer of OpenGL ES / EGL
wayland-tbm platform/core/uifw/wayland-tbm Wayland tbm is a protocol for graphics memory management for TIZEN
emulator-yagl platform/adaptation/emulator/emulator-yagl OpenGLES / EGL Driver for emulator.


Reference Driver for libtpl-egl

  • Emulator YAGL (OpenGLES / EGL Driver for emulator) is implemented by libtpl-egl.


Howto Test and Verify OpenGLES Driver

  • Khronos OpenGLES CTS supports wayland-egl