summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-07-12 13:17:08 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-07-12 13:17:08 +0900
commit59db1cd0e25e830dd49013489bfc0d7527126b9c (patch)
treef1bc33012c85ba2f0d91b2fe9e4566500666680a
parent8b3c3b5a7fbefb15c846a99b58af4a4336f387be (diff)
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.
-rw-r--r--src/lib/evas/common/evas_image.h2
-rw-r--r--src/lib/evas/common/evas_image_scalecache.c14
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c23
3 files changed, 20 insertions, 19 deletions
diff --git a/src/lib/evas/common/evas_image.h b/src/lib/evas/common/evas_image.h
index a625bbaf3f..f21cd6c2fe 100644
--- a/src/lib/evas/common/evas_image.h
+++ b/src/lib/evas/common/evas_image.h
@@ -46,7 +46,7 @@ EAPI unsigned int evas_common_rgba_image_scalecache_size_get(void);
46EAPI void evas_common_rgba_image_scalecache_flush(void); 46EAPI void evas_common_rgba_image_scalecache_flush(void);
47EAPI void evas_common_rgba_image_scalecache_dump(void); 47EAPI void evas_common_rgba_image_scalecache_dump(void);
48EAPI void evas_common_rgba_image_scalecache_prune(void); 48EAPI void evas_common_rgba_image_scalecache_prune(void);
49EAPI void 49EAPI Eina_Bool
50 evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst, 50 evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst,
51 RGBA_Draw_Context *dc, int smooth, 51 RGBA_Draw_Context *dc, int smooth,
52 int src_region_x, int src_region_y, 52 int src_region_x, int src_region_y,
diff --git a/src/lib/evas/common/evas_image_scalecache.c b/src/lib/evas/common/evas_image_scalecache.c
index 1a8229f604..16c4451423 100644
--- a/src/lib/evas/common/evas_image_scalecache.c
+++ b/src/lib/evas/common/evas_image_scalecache.c
@@ -497,7 +497,7 @@ evas_common_rgba_image_scalecache_flush(void)
497#endif 497#endif
498} 498}
499 499
500EAPI void 500EAPI Eina_Bool
501evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_UNUSED, 501evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_UNUSED,
502 RGBA_Draw_Context *dc, int smooth, 502 RGBA_Draw_Context *dc, int smooth,
503 int src_region_x, int src_region_y, 503 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_
510 Eina_Lock_Result ret; 510 Eina_Lock_Result ret;
511 RGBA_Image *im = (RGBA_Image *)ie; 511 RGBA_Image *im = (RGBA_Image *)ie;
512 Scaleitem *sci; 512 Scaleitem *sci;
513 if (!im->image.data) return; 513
514 if ((dst_region_w == 0) || (dst_region_h == 0) || 514 if ((dst_region_w == 0) || (dst_region_h == 0) ||
515 (src_region_w == 0) || (src_region_h == 0)) return; 515 (src_region_w == 0) || (src_region_h == 0)) return EINA_TRUE;
516 // was having major lock issues here - SLKL was deadlocking. what was 516 // was having major lock issues here - SLKL was deadlocking. what was
517 // going on? it may have been an eina treads badness but this will stay here 517 // going on? it may have been an eina treads badness but this will stay here
518 // for now for debug 518 // for now for debug
@@ -563,7 +563,7 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
563 im->cache.orig_usage++; 563 im->cache.orig_usage++;
564 im->cache.usage_count = use_counter; 564 im->cache.usage_count = use_counter;
565 if (locked) SLKU(im->cache.lock); 565 if (locked) SLKU(im->cache.lock);
566 return; 566 return EINA_FALSE;
567 } 567 }
568 if ((!im->cache_entry.flags.alpha) && (!smooth)) 568 if ((!im->cache_entry.flags.alpha) && (!smooth))
569 { 569 {
@@ -572,7 +572,7 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
572 im->cache.orig_usage++; 572 im->cache.orig_usage++;
573 im->cache.usage_count = use_counter; 573 im->cache.usage_count = use_counter;
574 if (locked) SLKU(im->cache.lock); 574 if (locked) SLKU(im->cache.lock);
575 return; 575 return EINA_FALSE;
576 } 576 }
577 SLKL(cache_lock); 577 SLKL(cache_lock);
578 sci = _sci_find(im, dc, smooth, 578 sci = _sci_find(im, dc, smooth,
@@ -582,7 +582,7 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
582 { 582 {
583 SLKU(cache_lock); 583 SLKU(cache_lock);
584 if (locked) SLKU(im->cache.lock); 584 if (locked) SLKU(im->cache.lock);
585 return; 585 return EINA_FALSE;
586 } 586 }
587// INF("%10i | %4i %4i %4ix%4i -> %4i %4i %4ix%4i | %i", 587// INF("%10i | %4i %4i %4ix%4i -> %4i %4i %4ix%4i | %i",
588// (int)use_counter, 588// (int)use_counter,
@@ -620,6 +620,8 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
620// INF(" -------------- used %8i#, %8i@", (int)sci->usage, (int)sci->usage_count); 620// INF(" -------------- used %8i#, %8i@", (int)sci->usage, (int)sci->usage_count);
621 if (locked) SLKU(im->cache.lock); 621 if (locked) SLKU(im->cache.lock);
622#endif 622#endif
623 if ((!im->image.data) && (sci->populate_me)) return EINA_FALSE;
624 return EINA_TRUE;
623} 625}
624 626
625#ifdef SCALECACHE 627#ifdef SCALECACHE
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 9e3a011b54..acbf9884a2 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -1857,22 +1857,21 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
1857 1857
1858 if (do_async) 1858 if (do_async)
1859 { 1859 {
1860 if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888) 1860 if (!evas_common_rgba_image_scalecache_prepare(image, surface, context, smooth,
1861 src_x, src_y, src_w, src_h,
1862 dst_x, dst_y, dst_w, dst_h))
1861 { 1863 {
1864 if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
1865 {
1862#if EVAS_CSERVE2 1866#if EVAS_CSERVE2
1863 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry)) 1867 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
1864 evas_cache2_image_load_data(&im->cache_entry); 1868 evas_cache2_image_load_data(&im->cache_entry);
1865 else 1869 else
1866#endif 1870#endif
1867 evas_cache_image_load_data(&im->cache_entry); 1871 evas_cache_image_load_data(&im->cache_entry);
1868 1872 if (!im->cache_entry.flags.loaded) return EINA_FALSE;
1869 if (!im->cache_entry.flags.loaded) return EINA_FALSE; 1873 }
1870 } 1874 }
1871
1872 evas_common_rgba_image_scalecache_prepare(image, surface, context, smooth,
1873 src_x, src_y, src_w, src_h,
1874 dst_x, dst_y, dst_w, dst_h);
1875
1876 return evas_common_rgba_image_scalecache_do_cbs(image, surface, 1875 return evas_common_rgba_image_scalecache_do_cbs(image, surface,
1877 context, smooth, 1876 context, smooth,
1878 src_x, src_y, src_w, src_h, 1877 src_x, src_y, src_w, src_h,