summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-08-19 16:06:39 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-08-19 16:06:39 +0200
commit7c83af2ae3c83d82b23e73115db1aad7f19bcecc (patch)
tree76997136ba8ad212804468a44ca4140a347fa2a7
parent35ae391d644275e0e84a0e1f039d2eea7898f5a4 (diff)
evas: fix ref/unref of ector renderer to always happen in the main loop.
-rw-r--r--src/lib/evas/canvas/evas_object_vg.c29
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c3
2 files changed, 24 insertions, 8 deletions
diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/evas_object_vg.c
index abf12c3c5c..bdda637004 100644
--- a/src/lib/evas/canvas/evas_object_vg.c
+++ b/src/lib/evas/canvas/evas_object_vg.c
@@ -22,6 +22,8 @@ struct _Evas_VG_Data
22 Eina_Rectangle fill; 22 Eina_Rectangle fill;
23 23
24 unsigned int width, height; 24 unsigned int width, height;
25
26 Eina_Array cleanup;
25}; 27};
26 28
27static void evas_object_vg_render(Evas_Object *eo_obj, 29static void evas_object_vg_render(Evas_Object *eo_obj,
@@ -116,23 +118,25 @@ _evas_vg_eo_base_constructor(Eo *eo_obj, Evas_VG_Data *pd)
116 pd->root = eo_add(EFL_VG_ROOT_NODE_CLASS, eo_obj); 118 pd->root = eo_add(EFL_VG_ROOT_NODE_CLASS, eo_obj);
117 eo_ref(pd->root); 119 eo_ref(pd->root);
118 120
121 eina_array_step_set(&pd->cleanup, sizeof(pd->cleanup), 8);
122
119 return eo_obj; 123 return eo_obj;
120} 124}
121 125
122static void 126static void
123_evas_vg_render(Evas_Object_Protected_Data *obj, 127_evas_vg_render(Evas_Object_Protected_Data *obj, Evas_VG_Data *vd,
124 void *output, void *context, void *surface, Efl_VG *n, 128 void *output, void *context, void *surface, Efl_VG *n,
125 Eina_Array *clips, Eina_Bool do_async) 129 Eina_Array *clips, Eina_Bool do_async)
126{ 130{
127 Efl_VG_Container_Data *vd = eo_data_scope_get(n, EFL_VG_CONTAINER_CLASS); 131 Efl_VG_Container_Data *vc = eo_data_scope_get(n, EFL_VG_CONTAINER_CLASS);
128 132
129 if (eo_isa(n, EFL_VG_CONTAINER_CLASS)) 133 if (eo_isa(n, EFL_VG_CONTAINER_CLASS))
130 { 134 {
131 Efl_VG *child; 135 Efl_VG *child;
132 Eina_List *l; 136 Eina_List *l;
133 137
134 EINA_LIST_FOREACH(vd->children, l, child) 138 EINA_LIST_FOREACH(vc->children, l, child)
135 _evas_vg_render(obj, 139 _evas_vg_render(obj, vd,
136 output, context, surface, child, 140 output, context, surface, child,
137 clips, do_async); 141 clips, do_async);
138 } 142 }
@@ -143,6 +147,9 @@ _evas_vg_render(Evas_Object_Protected_Data *obj,
143 nd = eo_data_scope_get(n, EFL_VG_BASE_CLASS); 147 nd = eo_data_scope_get(n, EFL_VG_BASE_CLASS);
144 148
145 obj->layer->evas->engine.func->ector_renderer_draw(output, context, surface, nd->renderer, clips, do_async); 149 obj->layer->evas->engine.func->ector_renderer_draw(output, context, surface, nd->renderer, clips, do_async);
150
151 if (do_async)
152 eina_array_push(&vd->cleanup, eo_ref(nd->renderer));
146 } 153 }
147} 154}
148 155
@@ -182,7 +189,9 @@ evas_object_vg_render(Evas_Object *eo_obj EINA_UNUSED,
182 obj->layer->evas->engine.func->ector_begin(output, context, surface, 189 obj->layer->evas->engine.func->ector_begin(output, context, surface,
183 obj->cur->geometry.x + x, obj->cur->geometry.y + y, 190 obj->cur->geometry.x + x, obj->cur->geometry.y + y,
184 do_async); 191 do_async);
185 _evas_vg_render(obj, output, context, surface, vd->root, NULL, 192 _evas_vg_render(obj, vd,
193 output, context, surface,
194 vd->root, NULL,
186 do_async); 195 do_async);
187 obj->layer->evas->engine.func->ector_end(output, context, surface, do_async); 196 obj->layer->evas->engine.func->ector_end(output, context, surface, do_async);
188} 197}
@@ -325,8 +334,13 @@ evas_object_vg_render_pre(Evas_Object *eo_obj,
325static void 334static void
326evas_object_vg_render_post(Evas_Object *eo_obj, 335evas_object_vg_render_post(Evas_Object *eo_obj,
327 Evas_Object_Protected_Data *obj EINA_UNUSED, 336 Evas_Object_Protected_Data *obj EINA_UNUSED,
328 void *type_private_data EINA_UNUSED) 337 void *type_private_data)
329{ 338{
339 Evas_VG_Data *vd = type_private_data;
340 Eo *renderer;
341 Eina_Array_Iterator iterator;
342 unsigned int i;
343
330 /* this moves the current data to the previous state parts of the object */ 344 /* this moves the current data to the previous state parts of the object */
331 /* in whatever way is safest for the object. also if we don't need object */ 345 /* in whatever way is safest for the object. also if we don't need object */
332 /* data anymore we can free it if the object deems this is a good idea */ 346 /* data anymore we can free it if the object deems this is a good idea */
@@ -334,6 +348,9 @@ evas_object_vg_render_post(Evas_Object *eo_obj,
334 evas_object_clip_changes_clean(eo_obj); 348 evas_object_clip_changes_clean(eo_obj);
335 /* move cur to prev safely for object data */ 349 /* move cur to prev safely for object data */
336 evas_object_cur_prev(eo_obj); 350 evas_object_cur_prev(eo_obj);
351 /* unref all renderer and may also destroy them async */
352 EINA_ARRAY_ITER_NEXT((&vd->cleanup), i, renderer, iterator)
353 eo_unref(renderer);
337} 354}
338 355
339static unsigned int 356static unsigned int
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 3b50c4f1be..cdaba07a71 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -3532,7 +3532,6 @@ _draw_thread_ector_cleanup(Evas_Thread_Command_Ector *ector)
3532 while ((r = eina_array_pop(ector->clips))) 3532 while ((r = eina_array_pop(ector->clips)))
3533 eina_rectangle_free(r); 3533 eina_rectangle_free(r);
3534 eina_array_free(ector->clips); 3534 eina_array_free(ector->clips);
3535 eo_unref(ector->r);
3536 3535
3537 if (ector->free_it) 3536 if (ector->free_it)
3538 eina_mempool_free(_mp_command_ector, ector); 3537 eina_mempool_free(_mp_command_ector, ector);
@@ -3605,7 +3604,7 @@ eng_ector_renderer_draw(void *data EINA_UNUSED, void *context, void *surface, Ec
3605 if (eina_array_count(c) == 0) 3604 if (eina_array_count(c) == 0)
3606 eina_array_push(c, eina_rectangle_new(clip.x, clip.y, clip.w, clip.h)); 3605 eina_array_push(c, eina_rectangle_new(clip.x, clip.y, clip.w, clip.h));
3607 3606
3608 ector.r = eo_ref(renderer); 3607 ector.r = renderer; // This has already been refcounted by Evas_Object_VG
3609 ector.clips = c; 3608 ector.clips = c;
3610 ector.render_op = _evas_render_op_to_ector_rop(dc->render_op); 3609 ector.render_op = _evas_render_op_to_ector_rop(dc->render_op);
3611 ector.mul_col = ector_color_multiply(dc->mul.use ? dc->mul.col : 0xffffffff, 3610 ector.mul_col = ector_color_multiply(dc->mul.use ? dc->mul.col : 0xffffffff,