summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-08-30 13:26:06 +0900
committerHermet Park <hermetpark@gmail.com>2018-08-30 13:26:06 +0900
commit54f2a554dab13890ee9daf7b332442c79f58c6a0 (patch)
tree2d0ac2c917affcc07e969595cdca8251a8eef0cb /src/modules/evas/engines
parentad9e13ea5657c845491cad7ba627dd93717c7d1b (diff)
evas cache: refactor internal logic.
Summary: Adding cache targets in other modules are inproper. This can't be managed by cache module inside. One representive scenario is, when preload cancel is triggered, preload canceling sequence can't be performed properly because cache targets implicitly were increased by backend modules. And then, Cache itself couldn't get notified it. see this condition. if ((!ie->targets) && (ie->preload) && (!ie->flags.pending)) in _evas_cache_image_entry_preload_remove() Consequently, I move preloaded callbacks to sync with adding cache targets, not to add by backed engines themselves. This will bring Cache to manage cache targets properly. Reviewers: #committers, raster Subscribers: cedric, #reviewers, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6912
Diffstat (limited to 'src/modules/evas/engines')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c25
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c5
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c4
4 files changed, 9 insertions, 27 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 7ae78a799d..06cdbbf6cf 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -735,7 +735,7 @@ Evas_GL_Image *evas_gl_common_image_mmap(Evas_Engine_GL_Context *gc, Eina_Fil
735Evas_GL_Image *evas_gl_common_image_new_from_copied_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, Evas_Colorspace cspace); 735Evas_GL_Image *evas_gl_common_image_new_from_copied_data(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, Evas_Colorspace cspace);
736Evas_GL_Image *evas_gl_common_image_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_Colorspace cspace); 736Evas_GL_Image *evas_gl_common_image_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_Colorspace cspace);
737Evas_GL_Image *evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *im, Evas_Image_Load_Opts *lo, int *error); 737Evas_GL_Image *evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *im, Evas_Image_Load_Opts *lo, int *error);
738void evas_gl_common_image_preload_watch(Evas_GL_Image *im); 738void evas_gl_common_image_preload_done(void *data /*Evas_GL_Image *im*/);
739void evas_gl_common_image_preload_unwatch(Evas_GL_Image *im); 739void evas_gl_common_image_preload_unwatch(Evas_GL_Image *im);
740Evas_GL_Image *evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha); 740Evas_GL_Image *evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha);
741void evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint); 741void evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index 2716f58387..22cce55ab8 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -150,8 +150,8 @@ _evas_gl_cspace_list_fill(Evas_Engine_GL_Context *gc)
150 CS_APPEND(EVAS_COLORSPACE_ARGB8888); 150 CS_APPEND(EVAS_COLORSPACE_ARGB8888);
151} 151}
152 152
153static void 153void
154preload_done(void *data) 154evas_gl_common_image_preload_done(void *data)
155{ 155{
156 Evas_GL_Image *im = data; 156 Evas_GL_Image *im = data;
157 157
@@ -192,26 +192,9 @@ found_cspace:
192 im->w = im->im->cache_entry.w; 192 im->w = im->im->cache_entry.w;
193 im->h = im->im->cache_entry.h; 193 im->h = im->im->cache_entry.h;
194 } 194 }
195 evas_gl_common_image_preload_unwatch(im);
196}
197
198void
199evas_gl_common_image_preload_watch(Evas_GL_Image *im)
200{
201 Evas_Cache_Target *tg;
202
203 if (!im->im) return;
204 tg = calloc(1, sizeof(Evas_Cache_Target));
205 if (tg)
206 {
207 tg->preloaded_cb = preload_done;
208 tg->preloaded_data = im;
209 im->im->cache_entry.targets = (Evas_Cache_Target *)
210 eina_inlist_append(EINA_INLIST_GET(im->im->cache_entry.targets),
211 EINA_INLIST_GET(tg));
212 }
213} 195}
214 196
197//FIXME: This is a hacky way. Need an proper interface...
215void 198void
216evas_gl_common_image_preload_unwatch(Evas_GL_Image *im) 199evas_gl_common_image_preload_unwatch(Evas_GL_Image *im)
217{ 200{
@@ -221,7 +204,7 @@ evas_gl_common_image_preload_unwatch(Evas_GL_Image *im)
221 if (!im->im) return; 204 if (!im->im) return;
222 EINA_INLIST_FOREACH_SAFE(im->im->cache_entry.targets, l2, tg) 205 EINA_INLIST_FOREACH_SAFE(im->im->cache_entry.targets, l2, tg)
223 { 206 {
224 if ((tg->preloaded_cb != preload_done) || (tg->preloaded_data != im)) 207 if ((tg->preloaded_cb != evas_gl_common_image_preload_done) || (tg->preloaded_data != im))
225 continue; 208 continue;
226 tg->delete_me = EINA_TRUE; 209 tg->delete_me = EINA_TRUE;
227 break; 210 break;
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 1749dc1025..ec29b19cdc 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1132,13 +1132,12 @@ eng_image_data_preload_request(void *engine EINA_UNUSED, void *image, const Eo *
1132 im = (RGBA_Image *)gim->im; 1132 im = (RGBA_Image *)gim->im;
1133 if (!im) return; 1133 if (!im) return;
1134 1134
1135 evas_gl_common_image_preload_watch(gim);
1136#ifdef EVAS_CSERVE2 1135#ifdef EVAS_CSERVE2
1137 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry)) 1136 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
1138 evas_cache2_image_preload_data(&im->cache_entry, target); 1137 evas_cache2_image_preload_data(&im->cache_entry, target, evas_gl_common_image_preload_done, gim);
1139 else 1138 else
1140#endif 1139#endif
1141 evas_cache_image_preload_data(&im->cache_entry, target); 1140 evas_cache_image_preload_data(&im->cache_entry, target, evas_gl_common_image_preload_done, gim);
1142} 1141}
1143 1142
1144static void 1143static void
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 2a833e1a69..7276e64d60 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -2339,11 +2339,11 @@ eng_image_data_preload_request(void *data EINA_UNUSED, void *image, const Eo *ta
2339#ifdef EVAS_CSERVE2 2339#ifdef EVAS_CSERVE2
2340 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry)) 2340 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
2341 { 2341 {
2342 evas_cache2_image_preload_data(&im->cache_entry, target); 2342 evas_cache2_image_preload_data(&im->cache_entry, target, NULL, NULL);
2343 return; 2343 return;
2344 } 2344 }
2345#endif 2345#endif
2346 evas_cache_image_preload_data(&im->cache_entry, target); 2346 evas_cache_image_preload_data(&im->cache_entry, target, NULL, NULL);
2347} 2347}
2348 2348
2349static void 2349static void