summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-07-22 17:14:10 +0900
committerHermet Park <hermetpark@gmail.com>2019-07-22 17:14:10 +0900
commit2e37d2f30f0e9cee3b71a014908f445c723317aa (patch)
treee70d58484c39ba761db34babc122101a9a432b7a /src/lib/ecore_evas
parentf6729087ca4229e0a7b8779d2470cd1d68f2778f (diff)
ecore_evas buffer: fix a deadlock issue.
We encountered a deadlock case in ecore_evas_image_object in ecore_evas_buffer that only happens if the ecore_evas_buffer has nothing changed to render, though it's triggered to rendering. See this normal scenario that is working fine as our intention. being ecore_evas_render() ... -> ecore_evas_buffer_prepare() -> evas_object_image_data_get() -> increment lock by backend engine. (egl/tbm ...) -> render() -> render_post() -> _ecore_evas_buffer_update_image() -> evas_object_image_data_set() ->decrement lock by backend engine (egl/tbm ...) ... end ecore_evas_render() The problem is, if the ecore_evas_buffer canvas doesn't changed at all, render post will be skipped, it could lose the chance to unlock the image data. Now the host can't render anymore since it's image source lost the lock. @fix
Diffstat (limited to 'src/lib/ecore_evas')
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.c9
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c
index 147e09070b..19422366b6 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -176,14 +176,17 @@ _ecore_evas_buffer_prepare(Ecore_Evas *ee)
176 evas_object_image_size_get(bdata->image, &w, &h); 176 evas_object_image_size_get(bdata->image, &w, &h);
177 if ((w != ee->w) || (h != ee->h)) 177 if ((w != ee->w) || (h != ee->h))
178 _ecore_evas_resize(ee, w, h); 178 _ecore_evas_resize(ee, w, h);
179 bdata->pixels = evas_object_image_data_get(bdata->image, 1); 179 if (evas_changed_get(ee->evas) && !bdata->lock_data)
180 {
181 bdata->pixels = evas_object_image_data_get(bdata->image, 1);
182 bdata->lock_data = EINA_TRUE;
183 }
180 } 184 }
181 else if (bdata->resized) 185 else if (bdata->resized)
182 { 186 {
183 if (ee->func.fn_resize) ee->func.fn_resize(ee); 187 if (ee->func.fn_resize) ee->func.fn_resize(ee);
184 bdata->resized = 0; 188 bdata->resized = 0;
185 } 189 }
186
187 return EINA_TRUE; 190 return EINA_TRUE;
188} 191}
189 192
@@ -200,6 +203,8 @@ _ecore_evas_buffer_update_image(void *data, Evas *e EINA_UNUSED, void *event_inf
200 EINA_LIST_FOREACH(post->updated_area, l, r) 203 EINA_LIST_FOREACH(post->updated_area, l, r)
201 evas_object_image_data_update_add(bdata->image, 204 evas_object_image_data_update_add(bdata->image,
202 r->x, r->y, r->w, r->h); 205 r->x, r->y, r->w, r->h);
206
207 bdata->lock_data = EINA_FALSE;
203} 208}
204 209
205EAPI int 210EAPI int
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.h b/src/lib/ecore_evas/ecore_evas_buffer.h
index 1249c380f4..188072a18e 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.h
+++ b/src/lib/ecore_evas/ecore_evas_buffer.h
@@ -9,7 +9,7 @@ struct _Ecore_Evas_Engine_Buffer_Data {
9 void (*free_func) (void *data, void *pix); 9 void (*free_func) (void *data, void *pix);
10 void *(*alloc_func) (void *data, int size); 10 void *(*alloc_func) (void *data, int size);
11 void *data; 11 void *data;
12 Eina_Bool in_render : 1; 12 Eina_Bool lock_data : 1;
13 Eina_Bool resized : 1; 13 Eina_Bool resized : 1;
14}; 14};
15 15