efl/legacy/evas/src/modules/engines/gl_common
Carsten Haitzler 5967841988 I'm attaching a patch for the initial version of the GL Fastpath
addition to evas gl backend.

Working on different mobile devices, we've noticed that the cost of context
switch (MakeCurrent) in GL can be very expensive depending on the driver
implementation.  To minimize the poorly written driver's context switch
overhead, I've implemented a state tracking layer on top of the driver
implemented GL.

Essentially, this layer wraps all the GL/Glue(GLX/EGL) APIs and manages its own
state changes.  Internally, only one real GL context is created and logical
contexts are created every time a user requests context creation.  The logical
contexts keep track of its states and sets only the necessary states
(the ones that are different than the current ones)
when there is a MakeCurrent request.  The real MakeCurrent gets called when
there is a Surface/Window change request.

The GL library is dlopened and all the APIs are dlsym'ed and wrapped
accordingly.  All the GL functions are in evas_gl_core.{h,c}.

Here's a very simply flow of the code.
   - all the APIs are exported as function pointers (*glsym_glBegin),
     (*glsm_eglCreatContext), and etc.
   - all the native GL/Glue(GLX/EGL) APIs are dlsym'ed as _sym_glBegin,
     _sym_eglCreateContext, and etc.
   - all the fastpath APIs are implmemnted as fpgl_glBegin,
     fpgl_eglCreateContext, and etc.
   - if faspath is seletected, the exported APIs are set accordingly
     ie. glsym_glBegin = fpgl_glBegin;
   - default mode is the regular gl symbols are directly set.
     ie. glsym_glBegin = _sym_glBegin;
             
I have an Environment variable where you can set it to three different Modes

EVAS_GL_FASTPATH = 0    // Default mode. Regular GL symbols are directly loaded
EVAS_GL_FASTPATH = 1    // Fastpath mode. Takes the path described above.
EVAS_GL_FASTPATH = 2    // Wrapped mode.  All the regular GL functions are
                           wrapped once.  This can be used for various
purposes

Since all the GL symbols are now loaded in this library, I took out all
the gl symbol loading parts in the evas gl backend as you'll see in the patch.
The changes to the engine and the backend itself is pretty minor.

There are still some known issues to hammer out but I thought we're at a good
place for an initial version so that my source doesn't diverge too much.

Known Issues and To Do's
* Current GL Fastpath version doesn't support multiple threads. Instead of
  having one global real context, I would need to do it for each thread. I'll
  get on this soon.
  
  * Issues running Evas GL on certain conditions.  When running the elementary
  test (with gl engine), if you run ELMGLview test that runs in ON_DEMAND mode,
  everything works fine. BUT, when you run the ELMGLView test in ALWAYS
    mode, the subsequent elm tests shows blank screen. When you destroy the
  GLView window, everything else comes on fine.
  
  * Resource protection code.  This actually applies to Evas GL code in general
  as well. Since all the resources are shared among all the contexts that get
  created, I would like to eventually have a resource protecting mechanism that
  prevents access to resources outside of its context unless specifically
  specified.
  
  I'm attaching three files
     - evas_gl_core.h, evas_gl_core.c, fastpath.patch
     
  To get the code running...
     - copy evas_gl_core.{c,h} to src/modules/engine/gl_common/
     - apply the fastpath.patch
     - compile/install evas
     - to run with fastpath GL (ie. % EVAS_GL_FASTPATH=1 ./evasgl_sample1)



SVN revision: 65891
2011-12-05 08:54:14 +00:00
..
shader evas: upload the right texture size whatever rounding the hardware require. 2011-11-13 22:21:58 +00:00
Makefile.am I'm attaching a patch for the initial version of the GL Fastpath 2011-12-05 08:54:14 +00:00
evas_gl_common.h I'm attaching a patch for the initial version of the GL Fastpath 2011-12-05 08:54:14 +00:00
evas_gl_context.c I'm attaching a patch for the initial version of the GL Fastpath 2011-12-05 08:54:14 +00:00
evas_gl_core.c I'm attaching a patch for the initial version of the GL Fastpath 2011-12-05 08:54:14 +00:00
evas_gl_core.h I'm attaching a patch for the initial version of the GL Fastpath 2011-12-05 08:54:14 +00:00
evas_gl_filter.c disable evas filter code. buggy. doesn't work right. 2011-06-02 10:40:43 +00:00
evas_gl_font.c make fonts obey the same cutout rules as images. 2011-09-19 10:48:33 +00:00
evas_gl_image.c Currently, only software engine checks animation flag during rendering. 2011-11-03 15:20:30 +00:00
evas_gl_line.c I'm attaching a patch for the initial version of the GL Fastpath 2011-12-05 08:54:14 +00:00
evas_gl_polygon.c whitespaces-------- 2011-06-17 07:47:28 +00:00
evas_gl_private.h Evas: Check for dlsym and disable gl engines if not found 2011-10-15 09:31:04 +00:00
evas_gl_rectangle.c whitespaces-------- 2011-06-17 07:47:28 +00:00
evas_gl_shader.c I'm attaching a patch for the initial version of the GL Fastpath 2011-12-05 08:54:14 +00:00
evas_gl_texture.c I'm attaching a patch for the initial version of the GL Fastpath 2011-12-05 08:54:14 +00:00