evas-common: Remove cserve2 support

ref T7226

Depends on D6934
This commit is contained in:
Chris Michael 2018-08-30 13:46:41 +09:00 committed by Hermet Park
parent d05ddaba62
commit 3862b304b0
10 changed files with 11 additions and 345 deletions

View File

@ -1,9 +1,5 @@
#include "evas_font_private.h"
#ifdef EVAS_CSERVE2
# include "../cserve2/evas_cs2_private.h"
#endif
// XXX:
// XXX: adapt cserve2 to this!
// XXX:

View File

@ -8,10 +8,6 @@
#include "evas_font_ot.h"
#include "draw.h"
#ifdef EVAS_CSERVE2
#include "../cserve2/evas_cs2_private.h"
#endif
struct _Evas_Glyph
{
RGBA_Font_Glyph *fg;
@ -36,26 +32,12 @@ _evas_font_image_new(RGBA_Font_Glyph *fg, int alpha, Evas_Colorspace cspace)
src_w = fg->glyph_out->bitmap.width;
src_h = fg->glyph_out->bitmap.rows;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
Evas_Cache2 *cache = evas_common_image_cache2_get();
return evas_cache2_image_data(cache, src_w, src_h, image_data, alpha, cspace);
}
#endif
return evas_cache_image_data(evas_common_image_cache_get(), src_w, src_h, image_data, alpha, cspace);
}
static void
_evas_font_image_free(void *image)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get() && evas_cache2_image_cached(image))
{
evas_cache2_image_close(image);
return;
}
#endif
evas_cache_image_drop(image);
}
@ -73,10 +55,6 @@ _evas_font_image_draw(void *context, void *surface, void *image, RGBA_Font_Glyph
#ifdef BUILD_PIPE_RENDER
if ((eina_cpu_count() > 1))
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_load_data(&im->cache_entry);
#endif
evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im),
surface, context, smooth,
0, 0, src_w, src_h,
@ -203,19 +181,6 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
void
evas_common_font_glyphs_ref(Evas_Glyph_Array *array)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get() && !array->refcount)
{
Eina_Iterator *iter;
Evas_Glyph *glyph;
iter = eina_inarray_iterator_new(array->array);
EINA_ITERATOR_FOREACH(iter, glyph)
evas_cserve2_font_glyph_ref(glyph->fg->glyph_out, EINA_TRUE);
eina_iterator_free(iter);
}
#endif
array->refcount++;
}
@ -224,19 +189,6 @@ evas_common_font_glyphs_unref(Evas_Glyph_Array *array)
{
if (--array->refcount) return;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
Eina_Iterator *iter;
Evas_Glyph *glyph;
iter = eina_inarray_iterator_new(array->array);
EINA_ITERATOR_FOREACH(iter, glyph)
evas_cserve2_font_glyph_ref(glyph->fg->glyph_out, EINA_FALSE);
eina_iterator_free(iter);
}
#endif
eina_inarray_free(array->array);
evas_common_font_int_unref(array->fi);
free(array);
@ -278,18 +230,6 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props)
if (text_props->len < unit) unit = text_props->len;
if (text_props->glyphs && text_props->glyphs->refcount == 1)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
Eina_Iterator *iter;
Evas_Glyph *glyph;
iter = eina_inarray_iterator_new(text_props->glyphs->array);
EINA_ITERATOR_FOREACH(iter, glyph)
evas_cserve2_font_glyph_ref(glyph->fg->glyph_out, EINA_FALSE);
eina_iterator_free(iter);
}
#endif
glyphs = text_props->glyphs->array;
glyphs->len = 0;
reused_glyphs = EINA_TRUE;
@ -326,11 +266,6 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props)
goto error;
}
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cserve2_font_glyph_ref(fg->glyph_out, EINA_TRUE);
#endif
glyph = eina_inarray_grow(glyphs, 1);
if (!glyph) goto error;

View File

@ -14,10 +14,6 @@
#include <ft2build.h>
#include FT_TRUETYPE_TABLES_H /* Freetype2 OS/2 font table. */
#ifdef EVAS_CSERVE2
# include "../cserve2/evas_cs2_private.h"
#endif
extern FT_Library evas_ft_lib;
static int font_cache_usage = 0;
@ -103,9 +99,6 @@ _evas_common_font_int_free(RGBA_Font_Int *fi)
fonts_use_usage -= fi->usage;
fi->usage = 0;
}
#ifdef EVAS_CSERVE2
evas_cserve2_font_free(fi->cs2_handler);
#endif
free(fi);
}
@ -360,21 +353,6 @@ evas_common_font_int_memory_load(const char *source, const char *name, int size,
_evas_common_font_int_cache_init(fi);
fi = evas_common_font_int_load_init(fi);
evas_common_font_int_load_complete(fi);
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
fi->cs2_handler = evas_cserve2_font_load(source, name, size, font_dpi_h,
wanted_rend);
if (fi->cs2_handler)
{
if (evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler) != 0)
{
evas_cserve2_font_free(fi->cs2_handler);
fi->cs2_handler = NULL;
}
}
}
#endif
return fi;
}
@ -413,21 +391,6 @@ evas_common_font_int_load(const char *name, int size,
fi->bitmap_scalable = bitmap_scalable;
_evas_common_font_int_cache_init(fi);
fi = evas_common_font_int_load_init(fi);
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
fi->cs2_handler = evas_cserve2_font_load(NULL, name, size, font_dpi_h,
wanted_rend);
if (fi->cs2_handler)
{
if (evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler) != 0)
{
evas_cserve2_font_free(fi->cs2_handler);
fi->cs2_handler = NULL;
}
}
}
#endif
// evas_common_font_int_load_complete(fi);
return fi;
}

View File

@ -1,10 +1,6 @@
#include "evas_font_private.h"
#include "evas_font_draw.h"
#ifdef EVAS_CSERVE2
# include "../cserve2/evas_cs2_private.h"
#endif
#include FT_OUTLINE_H
#include FT_SYNTHESIS_H
#include FT_BITMAP_H
@ -535,24 +531,7 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx)
fg = _fash_gl_find(fi->fash, idx);
if (fg == (void *)(-1)) return NULL;
else if (fg)
{
#ifdef EVAS_CSERVE2
if (fi->cs2_handler)
{
if (evas_cserve2_font_glyph_used(fi->cs2_handler, idx,
fi->hinting))
return fg;
else
{
_glyph_free(fg);
_fash_gl_add(fi->fash, idx, NULL);
}
}
else return fg;
#else
return fg;
#endif
}
return fg;
}
// fg = eina_hash_find(fi->glyphs, &hindex);
// if (fg) return fg;
@ -623,11 +602,6 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx)
if (!fi->fash) fi->fash = _fash_gl_new();
if (fi->fash) _fash_gl_add(fi->fash, idx, fg);
#ifdef EVAS_CSERVE2
if (fi->cs2_handler)
evas_cserve2_font_glyph_request(fi->cs2_handler, idx, fi->hinting);
#endif
// eina_hash_direct_add(fi->glyphs, &fg->index, fg);
return fg;
}
@ -640,23 +614,6 @@ evas_common_font_int_cache_glyph_render(RGBA_Font_Glyph *fg)
RGBA_Font_Int *fi = fg->fi;
FT_BitmapGlyph fbg;
#ifdef EVAS_CSERVE2
if (fi->cs2_handler)
{
fg->glyph_out = evas_cserve2_font_glyph_bitmap_get(fi->cs2_handler,
fg->index,
fg->fi->hinting);
if (!fg->glyph_out)
{
if (!fi->fash) fi->fash = _fash_gl_new();
if (fi->fash) _fash_gl_add(fi->fash, fg->index, (void *)(-1));
free(fg);
return EINA_FALSE;
}
return EINA_TRUE;
}
#endif
/* no cserve2 case */
if (fg->glyph_out)
return EINA_TRUE;

View File

@ -21,9 +21,6 @@ EAPI void evas_common_image_set_alpha_sparse (Image_Entry
/* EAPI RGBA_Image *evas_common_image_create (int w, int h); */
EAPI RGBA_Image *evas_common_image_new (unsigned int w, unsigned int h, unsigned int alpha);
EAPI Evas_Cache_Image *evas_common_image_cache_get (void);
#ifdef EVAS_CSERVE2
EAPI Evas_Cache2 *evas_common_image_cache2_get (void);
#endif
EAPI void evas_common_image_set_cache (unsigned int size);
EAPI int evas_common_image_get_cache (void);

View File

@ -9,9 +9,6 @@
#include "evas_common_private.h"
#include "evas_private.h"
//#include "evas_cs.h"
#ifdef EVAS_CSERVE2
#include "evas_cs2_private.h"
#endif
struct ext_loader_s
{
@ -274,11 +271,6 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
struct evas_image_foreach_loader_data fdata;
Eina_Bool skip;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get() && evas_cache2_image_cached(ie))
CRI("This function shouldn't be called anymore!");
#endif
skip = ie->load_opts.skip_head;
if (ie->f)
{
@ -406,11 +398,6 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
if ((ie->flags.loaded) && (!ie->animated.animated)) return EVAS_LOAD_ERROR_GENERIC;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get() && evas_cache2_image_cached(ie))
CRI("This function shouldn't be called anymore!");
#endif
if (!ie->info.module)
{
ie->load_failed = 1;

View File

@ -24,10 +24,6 @@
//#define SURFDBG 1
static Evas_Cache_Image *eci = NULL;
#ifdef EVAS_CSERVE2
#define EVAS_CSERVE2_SCALE_CACHE_SIZE (4 * 1024 * 1024)
static Evas_Cache2 *eci2 = NULL;
#endif
static int reference = 0;
static int evas_image_no_mmap = -1;
@ -81,23 +77,6 @@ static const Evas_Cache_Image_Func _evas_common_image_func =
NULL // _evas_common_rgba_image_debug
};
#ifdef EVAS_CSERVE2
static const Evas_Cache2_Image_Func _evas_common_image_func2 =
{
_evas_common_rgba_image_surface_alloc,
_evas_common_rgba_image_surface_delete,
_evas_common_rgba_image_surface_pixels,
NULL, // _evas_common_rgba_image_dirty_region,
NULL, // _evas_common_rgba_image_dirty,
evas_common_rgba_image_size_set,
evas_common_rgba_image_from_copied_data,
evas_common_rgba_image_from_data,
NULL, // evas_common_rgba_image_colorspace_set,
_evas_common_rgba_image_ram_usage,
NULL // _evas_common_rgba_image_debug
};
#endif
EAPI int
_evas_common_rgba_image_surface_size(unsigned int w, unsigned int h,
Evas_Colorspace cspace,
@ -455,9 +434,6 @@ EAPI void
evas_common_image_init(void)
{
if (!eci) eci = evas_cache_image_init(&_evas_common_image_func);
#ifdef EVAS_CSERVE2
if (!eci2) eci2 = evas_cache2_init(&_evas_common_image_func2);
#endif
reference++;
evas_common_scalecache_init();
@ -486,10 +462,6 @@ evas_common_image_shutdown(void)
// ENABLE IT AGAIN, hope it is fixed. Gustavo @ January 22nd, 2009.
evas_cache_image_shutdown(eci);
eci = NULL;
#ifdef EVAS_CSERVE2
evas_cache2_shutdown(eci2);
eci2 = NULL;
#endif
}
evas_common_scalecache_shutdown();
}
@ -534,11 +506,6 @@ _evas_common_rgba_image_delete(Image_Entry *ie)
}
evas_common_rgba_image_scalecache_shutdown(&im->cache_entry);
if (ie->info.module) evas_module_unref((Evas_Module *)ie->info.module);
#ifdef EVAS_CSERVE2
if (ie->data1)
ERR("Shouldn't reach this point since we are using cache2: '%s' '%s'",
ie->file, ie->key);
#endif
if (ie->animated.frames)
{
@ -575,15 +542,6 @@ evas_common_rgba_image_unload_real(Image_Entry *ie)
}
im->cs.data = NULL;
#ifdef EVAS_CSERVE2
if (ie->data1)
{
ERR("Shouldn't reach this point since we are using cache2.");
ie->flags.preload_done = 0;
return;
}
#endif
if (im->image.data && !im->image.no_free)
{
evas_common_rgba_image_surface_munmap(im->image.data,
@ -733,9 +691,6 @@ _evas_common_rgba_image_surface_alloc(Image_Entry *ie,
RGBA_Image *im = (RGBA_Image *) ie;
int l = 0, r = 0, t = 0, b = 0;
#ifdef EVAS_CSERVE2
if (ie->data1) return 0;
#endif
if (im->image.no_free) return 0;
if (im->image.data)
@ -848,9 +803,6 @@ _evas_common_rgba_image_dirty_region(Image_Entry* ie,
{
RGBA_Image *im = (RGBA_Image *) ie;
#ifdef EVAS_CSERVE2
if (ie->data1) ERR("Shouldn't reach this point since we are using cache2.");
#endif
im->flags |= RGBA_IMAGE_IS_DIRTY;
evas_common_rgba_image_scalecache_dirty(&im->cache_entry);
}
@ -871,17 +823,9 @@ _evas_common_rgba_image_dirty(Image_Entry *ie_dst, const Image_Entry *ie_src)
src->cache_entry.w,
src->cache_entry.h))
{
#ifdef EVAS_CSERVE2
if (ie_src->data1)
ERR("Shouldn't reach this point since we are using cache2.");
#endif
return 1;
}
}
#ifdef EVAS_CSERVE2
if (ie_src->data1)
ERR("Shouldn't reach this point since we are using cache2.");
#endif
evas_common_image_colorspace_normalize(src);
evas_common_image_colorspace_normalize(dst);
return 0;
@ -899,11 +843,7 @@ _evas_common_rgba_image_ram_usage(Image_Entry *ie)
if (im->image.data)
{
#ifdef EVAS_CSERVE2
if ((!im->image.no_free) || (ie->data1))
#else
if ((!im->image.no_free))
#endif
size += im->cache_entry.w * im->cache_entry.h * sizeof(DATA32);
}
size += evas_common_rgba_image_scalecache_usage_get(&im->cache_entry);
@ -973,10 +913,6 @@ evas_common_image_colorspace_normalize(RGBA_Image *im)
case EVAS_COLORSPACE_AGRY88:
if (im->image.data != im->cs.data)
{
#ifdef EVAS_CSERVE2
if (((Image_Entry *)im)->data1)
ERR("Shouldn't reach this point since we are using cache2.");
#endif
if (!im->image.no_free)
{
evas_common_rgba_image_surface_munmap
@ -1060,10 +996,6 @@ evas_common_image_set_cache(unsigned int size)
{
if (eci)
evas_cache_image_set(eci, size);
#ifdef EVAS_CSERVE2
if (eci2)
evas_cache2_limit_set(eci2, size + EVAS_CSERVE2_SCALE_CACHE_SIZE);
#endif
}
EAPI int
@ -1096,14 +1028,6 @@ evas_common_image_cache_get(void)
return eci;
}
#ifdef EVAS_CSERVE2
EAPI Evas_Cache2*
evas_common_image_cache2_get(void)
{
return eci2;
}
#endif
EAPI RGBA_Image *
evas_common_image_line_buffer_obtain(int len)
{

View File

@ -8,9 +8,6 @@
#include <assert.h>
#ifdef EVAS_CSERVE2
#include "evas_cs2_private.h"
#endif
#include "evas_common_private.h"
#include "evas_private.h"
#include "evas_image_private.h"
@ -663,14 +660,7 @@ evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
if ((src_region_w == dst_region_w) && (src_region_h == dst_region_h))
{
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
evas_cache2_image_load_data(&im->cache_entry);
else
#endif
evas_cache_image_load_data(&im->cache_entry);
}
evas_cache_image_load_data(&im->cache_entry);
evas_common_image_colorspace_normalize(im);
// noscales++;
@ -692,14 +682,7 @@ evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
if (!sci)
{
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_load_data(&im->cache_entry);
else
#endif
evas_cache_image_load_data(&im->cache_entry);
}
evas_cache_image_load_data(&im->cache_entry);
evas_common_image_colorspace_normalize(im);
// misses++;
@ -762,25 +745,6 @@ evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
}
}
#ifdef EVAS_CSERVE2
if (sci->populate_me && (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
&& evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
{
RGBA_Image *im2 = (RGBA_Image *) evas_cache2_image_scale_load
(&im->cache_entry, src_region_x, src_region_y,
src_region_w, src_region_h, dst_region_w, dst_region_h, smooth);
SLKL(cache_lock);
if (im2 != im)
{
sci->im = im2;
sci->populate_me = 0;
cache_list = eina_inlist_append(cache_list, (Eina_Inlist *)sci);
didpop = 1;
}
SLKU(cache_lock);
}
#endif
if (sci->populate_me)
{
// INF("##! populate!");
@ -807,14 +771,7 @@ evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
SLKL(cache_lock);
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_load_data(&im->cache_entry);
else
#endif
evas_cache_image_load_data(&im->cache_entry);
}
evas_cache_image_load_data(&im->cache_entry);
SLKU(cache_lock);
SLKL(im->cache.lock);
@ -913,24 +870,15 @@ evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
{
if ((dounload) ||
((im->cache_entry.flags.loaded) &&
((!im->cs.no_free)
#ifdef EVAS_CSERVE2
|| (ie->data1)
#endif
) &&
((!im->cs.no_free)) &&
(im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)))
{
if ((dounload) || (im->cache.orig_usage <
(im->cache.newest_usage / 20)))
{
//FIXME: imagedataunload - inform owners
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_unload_data(&im->cache_entry);
else
#endif
/* FIXME: must be the _cache version, no? */
evas_common_rgba_image_unload(&im->cache_entry);
/* FIXME: must be the _cache version, no? */
evas_common_rgba_image_unload(&im->cache_entry);
}
}
}
@ -939,14 +887,7 @@ evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
{
SLKU(im->cache.lock);
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_load_data(&im->cache_entry);
else
#endif
evas_cache_image_load_data(&im->cache_entry);
}
evas_cache_image_load_data(&im->cache_entry);
evas_common_image_colorspace_normalize(im);
// misses++;
if (im->image.data)
@ -973,14 +914,7 @@ evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
RGBA_Image *im = (RGBA_Image *)ie;
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_load_data(&im->cache_entry);
else
#endif
evas_cache_image_load_data(&im->cache_entry);
}
evas_cache_image_load_data(&im->cache_entry);
evas_common_image_colorspace_normalize(im);
if (im->image.data)
{

View File

@ -1,9 +1,6 @@
#include "evas_common_private.h"
#include "evas_private.h"
#include "evas_blend_private.h"
#ifdef EVAS_CSERVE2
#include "evas_cs2_private.h"
#endif
#ifdef BUILD_NEON
#include <arm_neon.h>
#endif
@ -757,14 +754,7 @@ evas_common_map_rgba_cb(RGBA_Image *src, RGBA_Image *dst,
int i;
if (src->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_load_data(&src->cache_entry);
else
#endif
evas_cache_image_load_data(&src->cache_entry);
}
evas_cache_image_load_data(&src->cache_entry);
evas_common_image_colorspace_normalize(src);
if ((!src->image.data) || (!dst->image.data)) return;
@ -804,14 +794,7 @@ evas_common_map_thread_rgba_cb(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Conte
Eina_Bool ret = EINA_FALSE;
if (src->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
{
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
evas_cache2_image_load_data(&src->cache_entry);
else
#endif
evas_cache_image_load_data(&src->cache_entry);
}
evas_cache_image_load_data(&src->cache_entry);
evas_common_image_colorspace_normalize(src);

View File

@ -451,10 +451,6 @@ typedef void (*Gfx_Func_Convert) (DATA32 *src, DATA8 *dst, int src_jump, int dst
typedef void (*Evas_Render_Done_Cb)(void *);
#include "../cache/evas_cache.h"
#ifdef EVAS_CSERVE2
#include "../cache2/evas_cache2.h"
#endif
#include "../common/evas_font_draw.h"
/*****************************************************************************/
@ -580,9 +576,6 @@ struct _Image_Entry
int magic;
Evas_Cache_Image *cache;
#ifdef EVAS_CSERVE2
Evas_Cache2 *cache2;
#endif
const char *cache_key;
@ -643,9 +636,6 @@ struct _Image_Entry
Image_Entry_Flags flags;
Evas_Image_Scale_Hint scale_hint;
void *data1, *data2;
#ifdef EVAS_CSERVE2
unsigned int open_rid, load_rid, preload_rid;
#endif
int server_id;
int connect_num;
int channel;