evas - unload/scalecache self-feeding loop unload/reload fix

i was runing perf top and noticed that evas_image_load_file_data_eet(0
was being called. in fact - it was #1 on the list of functions being
called. why? it didn't make sense. i found out. just a blinking cursor
in terminology was causing the background to be unloaded and
re-loaded. the new "actually unload" changes for 1.15 made this happen
and thus we kept sucking in new data all the time even if the
scalecache already had the data - and that was the problem.

so now calcecache prepare tells you if you don't have cached data and
if you likely then have to ensure the data is loaded. this cuts down
quite a bit of work.

while i'm at it... we definitely need to clean house on the internals
of evas. a decade+ of features, mess, optimizations needs to be fixed.
i mean really house-cleaned. rewritten clenl;y re-using existing code
where appropriate.
This commit is contained in:
Carsten Haitzler 2015-07-12 13:17:08 +09:00
parent 8b3c3b5a7f
commit 59db1cd0e2
3 changed files with 20 additions and 19 deletions

View File

@ -46,7 +46,7 @@ EAPI unsigned int evas_common_rgba_image_scalecache_size_get(void);
EAPI void evas_common_rgba_image_scalecache_flush(void);
EAPI void evas_common_rgba_image_scalecache_dump(void);
EAPI void evas_common_rgba_image_scalecache_prune(void);
EAPI void
EAPI Eina_Bool
evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst,
RGBA_Draw_Context *dc, int smooth,
int src_region_x, int src_region_y,

View File

@ -497,7 +497,7 @@ evas_common_rgba_image_scalecache_flush(void)
#endif
}
EAPI void
EAPI Eina_Bool
evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_UNUSED,
RGBA_Draw_Context *dc, int smooth,
int src_region_x, int src_region_y,
@ -510,9 +510,9 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
Eina_Lock_Result ret;
RGBA_Image *im = (RGBA_Image *)ie;
Scaleitem *sci;
if (!im->image.data) return;
if ((dst_region_w == 0) || (dst_region_h == 0) ||
(src_region_w == 0) || (src_region_h == 0)) return;
(src_region_w == 0) || (src_region_h == 0)) return EINA_TRUE;
// was having major lock issues here - SLKL was deadlocking. what was
// going on? it may have been an eina treads badness but this will stay here
// for now for debug
@ -563,7 +563,7 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
im->cache.orig_usage++;
im->cache.usage_count = use_counter;
if (locked) SLKU(im->cache.lock);
return;
return EINA_FALSE;
}
if ((!im->cache_entry.flags.alpha) && (!smooth))
{
@ -572,7 +572,7 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
im->cache.orig_usage++;
im->cache.usage_count = use_counter;
if (locked) SLKU(im->cache.lock);
return;
return EINA_FALSE;
}
SLKL(cache_lock);
sci = _sci_find(im, dc, smooth,
@ -582,7 +582,7 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
{
SLKU(cache_lock);
if (locked) SLKU(im->cache.lock);
return;
return EINA_FALSE;
}
// INF("%10i | %4i %4i %4ix%4i -> %4i %4i %4ix%4i | %i",
// (int)use_counter,
@ -620,6 +620,8 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
// INF(" -------------- used %8i#, %8i@", (int)sci->usage, (int)sci->usage_count);
if (locked) SLKU(im->cache.lock);
#endif
if ((!im->image.data) && (sci->populate_me)) return EINA_FALSE;
return EINA_TRUE;
}
#ifdef SCALECACHE

View File

@ -1857,22 +1857,21 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
if (do_async)
{
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
if (!evas_common_rgba_image_scalecache_prepare(image, surface, context, smooth,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h))
{
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
{
#if EVAS_CSERVE2
if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
evas_cache2_image_load_data(&im->cache_entry);
else
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);
if (!im->cache_entry.flags.loaded) return EINA_FALSE;
evas_cache_image_load_data(&im->cache_entry);
if (!im->cache_entry.flags.loaded) return EINA_FALSE;
}
}
evas_common_rgba_image_scalecache_prepare(image, surface, context, smooth,
src_x, src_y, src_w, src_h,
dst_x, dst_y, dst_w, dst_h);
return evas_common_rgba_image_scalecache_do_cbs(image, surface,
context, smooth,
src_x, src_y, src_w, src_h,