summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-07-07 21:29:31 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-07-07 21:38:21 +0900
commitec6ddf59e221b1a35543c0be9d09122567c1d4f7 (patch)
tree12deff115a292b1e7cdbf84fcd13df210853e12a /src/lib/evas/common
parent9183ba954671d21c0ff80451c138c8200a3b4e86 (diff)
evas - image core - fix unloading of images to work again
i think this has been disabled for a while. image unloading is broken - esp with gl enigne as due to async move it was effectively disabled. this re-enables it. unloading is deferred with a managed list of things needing unloading and then when any async sw renders are not busy any more - do the unload then in the mainloop of all pending/flagged images to unload @fix
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_image.h5
-rw-r--r--src/lib/evas/common/evas_image_main.c117
2 files changed, 81 insertions, 41 deletions
diff --git a/src/lib/evas/common/evas_image.h b/src/lib/evas/common/evas_image.h
index 3eecfee..a625bba 100644
--- a/src/lib/evas/common/evas_image.h
+++ b/src/lib/evas/common/evas_image.h
@@ -6,7 +6,10 @@ EAPI void evas_common_image_init (void);
6EAPI void evas_common_image_shutdown (void); 6EAPI void evas_common_image_shutdown (void);
7 7
8EAPI void evas_common_image_image_all_unload (void); 8EAPI void evas_common_image_image_all_unload (void);
9 9
10EAPI void evas_common_rgba_pending_unloads_cleanup (void);
11EAPI void evas_common_rgba_pending_unloads_remove (Image_Entry *ie);
12
10EAPI void evas_common_rgba_image_free (Image_Entry *ie); 13EAPI void evas_common_rgba_image_free (Image_Entry *ie);
11EAPI void evas_common_rgba_image_unload (Image_Entry *ie); 14EAPI void evas_common_rgba_image_unload (Image_Entry *ie);
12EAPI void evas_common_image_colorspace_normalize (RGBA_Image *im); 15EAPI void evas_common_image_colorspace_normalize (RGBA_Image *im);
diff --git a/src/lib/evas/common/evas_image_main.c b/src/lib/evas/common/evas_image_main.c
index 3cb2044..eb0d509 100644
--- a/src/lib/evas/common/evas_image_main.c
+++ b/src/lib/evas/common/evas_image_main.c
@@ -332,50 +332,11 @@ _evas_common_rgba_image_delete(Image_Entry *ie)
332 free(im); 332 free(im);
333} 333}
334 334
335EAPI void
336evas_common_rgba_image_free(Image_Entry *ie)
337{
338 if (ie->references > 0) return;
339
340 _evas_common_rgba_image_surface_delete(ie);
341 _evas_common_rgba_image_delete(ie);
342}
343
344#ifdef SURFDBG
345static Eina_List *surfs = NULL;
346
347static void 335static void
348surf_debug(void) 336evas_common_rgba_image_unload_real(Image_Entry *ie)
349{
350 Eina_List *l;
351 Image_Entry *ie;
352 RGBA_Image *im;
353 int i = 0;
354
355 printf("----SURFS----\n");
356 EINA_LIST_FOREACH(surfs, l, ie)
357 {
358 im = ie;
359 printf("%i - %p - %ix%i [%s][%s]\n",
360 i, im->image.data, ie->allocated.w, ie->allocated.h,
361 ie->file, ie->key
362 );
363 i++;
364 }
365}
366#endif
367
368EAPI void
369evas_common_rgba_image_unload(Image_Entry *ie)
370{ 337{
371 RGBA_Image *im = (RGBA_Image *) ie; 338 RGBA_Image *im = (RGBA_Image *) ie;
372 339
373 if (!ie->flags.loaded) return;
374 if ((!ie->info.module) && (!ie->data1)) return;
375 if (!ie->file && !ie->f) return;
376 if ((evas_cache_async_frozen_get() == 0) &&
377 (ie->references > 0)) return;
378
379 ie->flags.loaded = 0; 340 ie->flags.loaded = 0;
380 341
381 if ((im->cs.data) && (im->image.data)) 342 if ((im->cs.data) && (im->image.data))
@@ -424,6 +385,82 @@ evas_common_rgba_image_unload(Image_Entry *ie)
424#endif 385#endif
425} 386}
426 387
388static Eina_List *pending_unloads = NULL;
389
390EAPI void
391evas_common_rgba_pending_unloads_cleanup(void)
392{
393 Image_Entry *ie;
394
395 EINA_LIST_FREE(pending_unloads, ie)
396 {
397 if ((ie->need_unload) && (!ie->preload))
398 evas_common_rgba_image_unload_real(ie);
399 }
400}
401
402EAPI void
403evas_common_rgba_pending_unloads_remove(Image_Entry *ie)
404{
405 if (!ie->preload) return;
406 ie->preload = 0;
407 pending_unloads = eina_list_remove(pending_unloads, ie);
408}
409
410EAPI void
411evas_common_rgba_image_free(Image_Entry *ie)
412{
413 if (ie->references > 0) return;
414 evas_common_rgba_pending_unloads_remove(ie);
415 _evas_common_rgba_image_surface_delete(ie);
416 _evas_common_rgba_image_delete(ie);
417}
418
419#ifdef SURFDBG
420static Eina_List *surfs = NULL;
421
422static void
423surf_debug(void)
424{
425 Eina_List *l;
426 Image_Entry *ie;
427 RGBA_Image *im;
428 int i = 0;
429
430 printf("----SURFS----\n");
431 EINA_LIST_FOREACH(surfs, l, ie)
432 {
433 im = ie;
434 printf("%i - %p - %ix%i [%s][%s]\n",
435 i, im->image.data, ie->allocated.w, ie->allocated.h,
436 ie->file, ie->key
437 );
438 i++;
439 }
440}
441#endif
442
443EAPI void
444evas_common_rgba_image_unload(Image_Entry *ie)
445{
446 RGBA_Image *im = (RGBA_Image *) ie;
447
448 if (!ie->flags.loaded) return;
449 if ((!ie->info.module) && (!ie->data1)) return;
450 if (!ie->file && !ie->f) return;
451 if ((evas_cache_async_frozen_get() == 0) &&
452 (ie->references > 0))
453 {
454 if (!ie->need_unload)
455 {
456 pending_unloads = eina_list_append(pending_unloads, ie);
457 ie->need_unload = 1;
458 }
459 return;
460 }
461 evas_common_rgba_image_unload_real(ie);
462}
463
427void 464void
428_evas_common_rgba_image_post_surface(Image_Entry *ie) 465_evas_common_rgba_image_post_surface(Image_Entry *ie)
429{ 466{