jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f020171bf2fca0c2f30199904798b79dba929c65

commit f020171bf2fca0c2f30199904798b79dba929c65
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Wed Mar 4 17:11:26 2015 +0900

    Evas GL common: Disable evas gl preload by default
    
    Unfortunately, this "feature" has many problems and does not really
    fix those it was supposed to address:
    
    - Elm Photocam becomes horrible to use (the transition from
      low-res to high-res tiles triggers this miniature path).
    
    - Evas async preload callback is called before the full image
      is ready (ie. the texture is not uploaded yet), when really
      the preload callback should be triggered only once the image
      is 100% ready. (TODO)
    
    - Sometimes the miniature image keeps being used even though the
      main image has been uploaded (eg. with E background). Maybe the
      object image is not redrawn when it should.
    
    - This uses a separate thread for the upload, which is both a good
      and bad idea because we need to do a make current. Also, this does
      not upload the full-res image tile by tile, but only in one pass,
      thus blocking the render loop until finished.
    
    This patch changes the env var from "EVAS_GL_NOPRELOAD" to
    "EVAS_GL_PRELOAD" (and only "1" will enable).
    
    Sorry Cedric, we can talk later about how to improve this.
---
 src/modules/evas/engines/gl_common/evas_gl_common.h  |  5 +++--
 src/modules/evas/engines/gl_common/evas_gl_preload.c | 12 ++++++++++--
 src/modules/evas/engines/gl_common/evas_gl_texture.c |  5 ++++-
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h 
b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 3602319..24e926f 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -659,8 +659,9 @@ EAPI void         
evas_gl_common_image_native_disable(Evas_GL_Image *im);
 EAPI void         evas_gl_common_image_free(Evas_GL_Image *im);
 EAPI void         evas_gl_common_image_native_enable(Evas_GL_Image *im);
 
-EAPI int evas_gl_preload_init(void);
-EAPI int evas_gl_preload_shutdown(void);
+EAPI int          evas_gl_preload_init(void);
+EAPI int          evas_gl_preload_shutdown(void);
+EAPI Eina_Bool    evas_gl_preload_enabled(void);
 
 EAPI Evas_Engine_GL_Context  *evas_gl_common_context_new(void);
 
diff --git a/src/modules/evas/engines/gl_common/evas_gl_preload.c 
b/src/modules/evas/engines/gl_common/evas_gl_preload.c
index 17836c2..5344473 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_preload.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_preload.c
@@ -351,7 +351,8 @@ evas_gl_preload_target_unregister(Evas_GL_Texture *tex, Eo 
*target)
 EAPI int
 evas_gl_preload_init(void)
 {
-   if (getenv("EVAS_GL_NOPRELOAD")) return 0;
+   const char *s = getenv("EVAS_GL_PRELOAD");
+   if (!s || (atoi(s) != 1)) return 0;
    if (async_loader_init++) return async_loader_init;
 
    eina_lock_new(&async_loader_lock);
@@ -368,7 +369,8 @@ evas_gl_preload_init(void)
 EAPI int
 evas_gl_preload_shutdown(void)
 {
-   if (getenv("EVAS_GL_NOPRELOAD")) return 0;
+   const char *s = getenv("EVAS_GL_PRELOAD");
+   if (!s || (atoi(s) != 1)) return 0;
    if (--async_loader_init) return async_loader_init;
 
    async_loader_exit = EINA_TRUE;
@@ -381,3 +383,9 @@ evas_gl_preload_shutdown(void)
 
    return async_loader_init;
 }
+
+EAPI Eina_Bool
+evas_gl_preload_enabled(void)
+{
+   return (async_loader_init >= 1);
+}
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c 
b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index 6c3b034..4f0c0b3 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -1267,7 +1267,10 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, 
RGBA_Image *im)
      }
 
    // if preloaded, then async push it in after uploading a miniature of it
-   if (im->cache_entry.flags.preload_done && tex->w > 2 * EVAS_GL_TILE_SIZE && 
tex->h > 2 * EVAS_GL_TILE_SIZE)
+   if (im->cache_entry.flags.preload_done
+       && (tex->w > (2 * EVAS_GL_TILE_SIZE))
+       && (tex->h > (2 * EVAS_GL_TILE_SIZE))
+       && evas_gl_preload_enabled())
      {
         Evas_GL_Texture_Async_Preload *async;
         unsigned char *in;

-- 


Reply via email to