evas-gl-common: Remove cserve2 support

ref T7226

Depends on D6927
This commit is contained in:
Chris Michael 2018-08-30 13:38:15 +09:00 committed by Hermet Park
parent e800139953
commit 4e2287ecaf
3 changed files with 18 additions and 148 deletions

View File

@ -1,21 +1,11 @@
#include "evas_gl_private.h" #include "evas_gl_private.h"
#ifdef EVAS_CSERVE2
#include "evas_cs2_private.h"
#endif
void void
evas_gl_common_image_alloc_ensure(Evas_GL_Image *im) evas_gl_common_image_alloc_ensure(Evas_GL_Image *im)
{ {
if (!im->im) return; if (!im->im) return;
#ifdef EVAS_CSERVE2 im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry,
if (evas_cache2_image_cached(&im->im->cache_entry)) im->w, im->h);
im->im = (RGBA_Image *)evas_cache2_image_size_set(&im->im->cache_entry,
im->w, im->h);
else
#endif
im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry,
im->w, im->h);
} }
EAPI void EAPI void
@ -27,14 +17,7 @@ evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc)
EINA_LIST_FOREACH(gc->shared->images, l, im) EINA_LIST_FOREACH(gc->shared->images, l, im)
{ {
if (im->im) if (im->im)
{ evas_cache_image_unload_data(&im->im->cache_entry);
#ifdef EVAS_CSERVE2
if (evas_cache2_image_cached(&im->im->cache_entry))
evas_cache2_image_unload_data(&im->im->cache_entry);
else
#endif
evas_cache_image_unload_data(&im->im->cache_entry);
}
if (im->tex) if (im->tex)
{ {
if (!im->tex->pt->dyn.img) if (!im->tex->pt->dyn.img)
@ -250,12 +233,7 @@ evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *
im = calloc(1, sizeof(Evas_GL_Image)); im = calloc(1, sizeof(Evas_GL_Image));
if (!im) if (!im)
{ {
#ifdef EVAS_CSERVE2 evas_cache_image_drop(&(im_im->cache_entry));
if (evas_cache2_image_cached(&im_im->cache_entry))
evas_cache2_image_close(&(im_im->cache_entry));
else
#endif
evas_cache_image_drop(&(im_im->cache_entry));
if (error) *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; if (error) *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
return NULL; return NULL;
} }
@ -308,26 +286,6 @@ evas_gl_common_image_mmap(Evas_Engine_GL_Context *gc, Eina_File *f, const char *
{ {
RGBA_Image *im_im; RGBA_Image *im_im;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get() && !eina_file_virtual(f))
{
im_im = (RGBA_Image *) evas_cache2_image_open
(evas_common_image_cache2_get(), eina_file_filename_get(f), key, lo, error);
if (im_im)
{
*error = evas_cache2_image_open_wait(&im_im->cache_entry);
if ((*error != EVAS_LOAD_ERROR_NONE)
&& im_im->cache_entry.animated.animated)
{
evas_cache2_image_close(&im_im->cache_entry);
im_im = NULL;
}
else
return evas_gl_common_image_new_from_rgbaimage(gc, im_im, lo, error);
}
}
#endif
im_im = evas_common_load_image_from_mmap(f, key, lo, error); im_im = evas_common_load_image_from_mmap(f, key, lo, error);
if (!im_im) return NULL; if (!im_im) return NULL;
@ -526,12 +484,7 @@ evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha)
im->alpha = alpha; im->alpha = alpha;
if (!im->im) return im; if (!im->im) return im;
evas_gl_common_image_alloc_ensure(im); evas_gl_common_image_alloc_ensure(im);
#ifdef EVAS_CSERVE2 evas_cache_image_load_data(&im->im->cache_entry);
if (evas_cache2_image_cached(&im->im->cache_entry))
evas_cache2_image_load_data(&im->im->cache_entry);
else
#endif
evas_cache_image_load_data(&im->im->cache_entry);
im->im->cache_entry.flags.alpha = alpha ? 1 : 0; im->im->cache_entry.flags.alpha = alpha ? 1 : 0;
if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE); if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE);
@ -566,12 +519,7 @@ evas_gl_common_image_native_enable(Evas_GL_Image *im)
} }
if (im->im) if (im->im)
{ {
#ifdef EVAS_CSERVE2 evas_cache_image_drop(&im->im->cache_entry);
if (evas_cache2_image_cached(&im->im->cache_entry))
evas_cache2_image_close(&im->im->cache_entry);
else
#endif
evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL; im->im = NULL;
} }
if (im->tex) if (im->tex)
@ -590,12 +538,7 @@ evas_gl_common_image_native_disable(Evas_GL_Image *im)
{ {
if (im->im) if (im->im)
{ {
#ifdef EVAS_CSERVE2 evas_cache_image_drop(&im->im->cache_entry);
if (!evas_cache2_image_cached(&im->im->cache_entry))
evas_cache2_image_close(&im->im->cache_entry);
else
#endif
evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL; im->im = NULL;
} }
if (im->tex) if (im->tex)
@ -664,12 +607,7 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
} }
if (im->im) if (im->im)
{ {
#ifdef EVAS_CSERVE2 evas_cache_image_drop(&im->im->cache_entry);
if (evas_cache2_image_cached(&im->im->cache_entry))
evas_cache2_image_close(&im->im->cache_entry);
else
#endif
evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL; im->im = NULL;
} }
if (im->tex) if (im->tex)
@ -684,12 +622,7 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
{ {
if (im->im) if (im->im)
{ {
#ifdef EVAS_CSERVE2 evas_cache_image_drop(&im->im->cache_entry);
if (evas_cache2_image_cached(&im->im->cache_entry))
evas_cache2_image_close(&im->im->cache_entry);
else
#endif
evas_cache_image_drop(&im->im->cache_entry);
im->im = NULL; im->im = NULL;
} }
if (im->tex) if (im->tex)
@ -758,14 +691,7 @@ evas_gl_common_image_free(Evas_GL_Image *im)
} }
if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE); if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE);
if (im->im) if (im->im)
{ evas_cache_image_drop(&im->im->cache_entry);
#ifdef EVAS_CSERVE2
if (evas_cache2_image_cached(&im->im->cache_entry))
evas_cache2_image_close(&im->im->cache_entry);
else
#endif
evas_cache_image_drop(&im->im->cache_entry);
}
free(im); free(im);
} }
@ -825,12 +751,7 @@ evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, un
if (im->im) if (im->im)
{ {
evas_gl_common_image_alloc_ensure(im); evas_gl_common_image_alloc_ensure(im);
#ifdef EVAS_CSERVE2 im->im = (RGBA_Image *)evas_cache_image_dirty(&im->im->cache_entry, x, y, w, h);
if (evas_cache2_image_cached(&im->im->cache_entry))
im->im = (RGBA_Image *)evas_cache2_image_dirty(&im->im->cache_entry, x, y, w, h);
else
#endif
im->im = (RGBA_Image *)evas_cache_image_dirty(&im->im->cache_entry, x, y, w, h);
} }
im->dirty = 1; im->dirty = 1;
} }
@ -890,37 +811,15 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
if ((im->tex) && if ((im->tex) &&
((im->dirty) || (ie->animated.animated) || (ie->flags.updated_data))) ((im->dirty) || (ie->animated.animated) || (ie->flags.updated_data)))
{ {
#ifdef EVAS_CSERVE2 evas_cache_image_load_data(ie);
if (evas_cache2_image_cached(ie)) evas_gl_common_texture_update(im->tex, im->im);
{ evas_cache_image_unload_data(ie);
evas_cache2_image_load_data(ie);
evas_gl_common_texture_update(im->tex, im->im);
evas_cache2_image_unload_data(ie);
}
else
#endif
{
evas_cache_image_load_data(ie);
evas_gl_common_texture_update(im->tex, im->im);
evas_cache_image_unload_data(ie);
}
} }
else if (!im->tex && !ie->load_error) else if (!im->tex && !ie->load_error)
{ {
#ifdef EVAS_CSERVE2 evas_cache_image_load_data(ie);
if (evas_cache2_image_cached(ie)) im->tex = evas_gl_common_texture_new(gc, im->im, im->disable_atlas);
{ evas_cache_image_unload_data(ie);
evas_cache2_image_load_data(ie);
im->tex = evas_gl_common_texture_new(gc, im->im, im->disable_atlas);
evas_cache2_image_unload_data(ie);
}
else
#endif
{
evas_cache_image_load_data(ie);
im->tex = evas_gl_common_texture_new(gc, im->im, im->disable_atlas);
evas_cache_image_unload_data(ie);
}
} }
ie->flags.updated_data = EINA_FALSE; ie->flags.updated_data = EINA_FALSE;
im->dirty = 0; im->dirty = 0;

View File

@ -1,9 +1,5 @@
#include "evas_gl_private.h" #include "evas_gl_private.h"
#ifdef EVAS_CSERVE2
#include "evas_cs2_private.h"
#endif
static Eina_Thread async_loader_thread; static Eina_Thread async_loader_thread;
static Eina_Condition async_loader_cond; static Eina_Condition async_loader_cond;
static Eina_Lock async_loader_lock; static Eina_Lock async_loader_lock;
@ -56,11 +52,6 @@ evas_gl_preload_pop(Evas_GL_Texture *tex)
if (running) evas_gl_preload_render_lock(tmp_cb, tmp_data); if (running) evas_gl_preload_render_lock(tmp_cb, tmp_data);
evas_gl_common_texture_free(current->tex, EINA_FALSE); evas_gl_common_texture_free(current->tex, EINA_FALSE);
#ifdef EVAS_CSERVE2
if (evas_cache2_image_cached(&current->im->cache_entry))
evas_cache2_image_close(&current->im->cache_entry);
else
#endif
evas_cache_image_drop(&current->im->cache_entry); evas_cache_image_drop(&current->im->cache_entry);
free(current); free(current);
@ -75,12 +66,7 @@ evas_gl_preload_pop(Evas_GL_Texture *tex)
async_loader_tex = eina_list_remove_list(async_loader_tex, l); async_loader_tex = eina_list_remove_list(async_loader_tex, l);
evas_gl_common_texture_free(async->tex, EINA_FALSE); evas_gl_common_texture_free(async->tex, EINA_FALSE);
#ifdef EVAS_CSERVE2 evas_cache_image_drop(&async->im->cache_entry);
if (evas_cache2_image_cached(&async->im->cache_entry))
evas_cache2_image_close(&async->im->cache_entry);
else
#endif
evas_cache_image_drop(&async->im->cache_entry);
free(async); free(async);
break; break;
@ -122,11 +108,6 @@ _evas_gl_preload_main_loop_wakeup(void)
evas_gl_common_texture_free(async->tex, EINA_FALSE); evas_gl_common_texture_free(async->tex, EINA_FALSE);
} }
#ifdef EVAS_CSERVE2
if (evas_cache2_image_cached(&async->im->cache_entry))
evas_cache2_image_close(&async->im->cache_entry);
else
#endif
evas_cache_image_drop(&async->im->cache_entry); evas_cache_image_drop(&async->im->cache_entry);
free(async); free(async);
} }

View File

@ -1523,11 +1523,6 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
async->tex = tex; async->tex = tex;
async->tex->references++; async->tex->references++;
async->im = im; async->im = im;
#ifdef EVAS_CSERVE2
if (evas_cache2_image_cached(&async->im->cache_entry))
evas_cache2_image_ref(&async->im->cache_entry);
else
#endif
evas_cache_image_ref(&async->im->cache_entry); evas_cache_image_ref(&async->im->cache_entry);
async->unpack_row_length = tex->gc->shared->info.unpack_row_length; async->unpack_row_length = tex->gc->shared->info.unpack_row_length;
@ -1536,11 +1531,6 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
// Failed to start asynchronous upload, likely due to preload not being supported by the backend // Failed to start asynchronous upload, likely due to preload not being supported by the backend
async->tex->references--; async->tex->references--;
#ifdef EVAS_CSERVE2
if (evas_cache2_image_cached(&async->im->cache_entry))
evas_cache2_image_close(&async->im->cache_entry);
else
#endif
evas_cache_image_drop(&async->im->cache_entry); evas_cache_image_drop(&async->im->cache_entry);
free(async); free(async);