diff options
author | Hyunil <hyunil46.park@samsung.com> | 2017-04-04 15:54:29 +0900 |
---|---|---|
committer | Hyunil <hyunil46.park@samsung.com> | 2017-04-05 17:56:41 +0900 |
commit | 78b162a4dcc9ee4ae4f031919c1d76e4372b096b (patch) | |
tree | d8e2a84ff7846639fae3da0854cdb18fe857d2cb | |
parent | c814fe38791255e46431c6c56d5f451b142c5dba (diff) | |
download | libmm-evas-renderer-tizen_4.0.m1_release.tar.gz libmm-evas-renderer-tizen_4.0.m1_release.tar.bz2 libmm-evas-renderer-tizen_4.0.m1_release.zip |
Modify destroy func about mutex cleartizen_4.0.m1_releasesubmit/tizen/20170420.053325accepted/tizen/unified/20170420.155230
Change-Id: I464dbede0e2c5ac58a3d098845e26b01d4d789bc
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
-rwxr-xr-x | LICENSE.Apache-2.0 (renamed from LICENSE.APLv2) | 0 | ||||
-rw-r--r-- | packaging/libmm-evas-renderer.spec | 4 | ||||
-rwxr-xr-x | src/mm_evas_renderer.c | 74 |
3 files changed, 39 insertions, 39 deletions
diff --git a/LICENSE.APLv2 b/LICENSE.Apache-2.0 index bbe9d02..bbe9d02 100755 --- a/LICENSE.APLv2 +++ b/LICENSE.Apache-2.0 diff --git a/packaging/libmm-evas-renderer.spec b/packaging/libmm-evas-renderer.spec index 905b396..7bdeb62 100644 --- a/packaging/libmm-evas-renderer.spec +++ b/packaging/libmm-evas-renderer.spec @@ -1,6 +1,6 @@ Name: libmm-evas-renderer Summary: Multimedia Framework Evas Renderer Library -Version: 0.0.17 +Version: 0.0.18 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 @@ -50,7 +50,7 @@ make %{?jobs:-j%jobs} %files %manifest %{name}.manifest -%license LICENSE.APLv2 +%license LICENSE.Apache-2.0 %defattr(-,root,root,-) %{_libdir}/*.so.* diff --git a/src/mm_evas_renderer.c b/src/mm_evas_renderer.c index 7bffc5a..f221d35 100755 --- a/src/mm_evas_renderer.c +++ b/src/mm_evas_renderer.c @@ -62,19 +62,19 @@ } \ } while (0) -#define SET_EVAS_OBJECT_EVENT_CALLBACK(x_evas_image_object, x_usr_data) \ +#define SET_EVAS_OBJECT_EVENT_CALLBACK(evas_image_object, usr_data) \ do { \ - if (x_evas_image_object) { \ + if (evas_image_object) { \ LOGD("object callback add"); \ - evas_object_event_callback_add(x_evas_image_object, EVAS_CALLBACK_RESIZE, _evas_resize_cb, x_usr_data); \ + evas_object_event_callback_add(evas_image_object, EVAS_CALLBACK_RESIZE, _evas_resize_cb, usr_data); \ } \ } while (0) -#define UNSET_EVAS_OBJECT_EVENT_CALLBACK(x_evas_image_object) \ +#define UNSET_EVAS_OBJECT_EVENT_CALLBACK(evas_image_object) \ do { \ - if (x_evas_image_object) { \ + if (evas_image_object) { \ LOGD("object callback del"); \ - evas_object_event_callback_del(x_evas_image_object, EVAS_CALLBACK_RESIZE, _evas_resize_cb); \ + evas_object_event_callback_del(evas_image_object, EVAS_CALLBACK_RESIZE, _evas_resize_cb); \ } \ } while (0) @@ -117,7 +117,7 @@ static int _flush_all_packets(mm_evas_info *evas_info); static int _mm_evas_renderer_create(mm_evas_info **evas_info); static int _mm_evas_renderer_destroy(mm_evas_info **evas_info); static int _mm_evas_renderer_set_info(mm_evas_info *evas_info, Evas_Object *eo); -static int _mm_evas_renderer_reset(mm_evas_info *evas_info); +static int _mm_evas_renderer_reset(mm_evas_info *evas_info, gboolean is_sub_thread); static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info); static int _mm_evas_renderer_retrieve_all_packets(mm_evas_info *evas_info, bool keep_screen); static int _mm_evas_renderer_make_flush_buffer(mm_evas_info *evas_info); @@ -131,8 +131,6 @@ static int _mm_evas_renderer_update_rendering_info(mm_evas_info *evas_info) { MMER_FENTER(); - int ret = MM_ERROR_NONE; - MMEVAS_RETURN_VAL_IF_FAIL(evas_info, MM_ERROR_EVASRENDER_NOT_INITIALIZED); MMEVAS_RETURN_VAL_IF_FAIL(evas_info->eo, MM_ERROR_EVASRENDER_NOT_INITIALIZED); @@ -158,7 +156,7 @@ static int _mm_evas_renderer_update_rendering_info(mm_evas_info *evas_info) evas_object_image_fill_set(evas_info->eo, evas_info->result.x, evas_info->result.y, evas_info->result.w, evas_info->result.h); MMER_FLEAVE(); - return ret; + return MM_ERROR_NONE; } static void _evas_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) @@ -344,7 +342,7 @@ static void _mm_evas_renderer_select_task(mm_evas_info *evas_info, update_info i break; case UPDATE_DESTROY: g_mutex_unlock(&evas_info->mp_lock); - if (_mm_evas_renderer_reset(evas_info) != MM_ERROR_NONE) + if (_mm_evas_renderer_reset(evas_info, TRUE) != MM_ERROR_NONE) LOGE("_mm_evas_renderer_reset is failed"); break; default: @@ -552,7 +550,7 @@ static int _find_empty_index(mm_evas_info *evas_info) } /* must be called after the null surface has been set. */ -static int _destory_all_packets(mm_evas_info *evas_info) +static int _destroy_all_packets(mm_evas_info *evas_info) { MMER_FENTER(); @@ -644,7 +642,7 @@ static int _flush_all_packets(mm_evas_info *evas_info) } LOGD("sent packet %d", evas_info->sent_buffer_cnt); - ret = _destory_all_packets(evas_info); + ret = _destroy_all_packets(evas_info); if (ret == MM_ERROR_NONE) { g_mutex_lock(&evas_info->evas_lock); @@ -747,9 +745,7 @@ static int _mm_evas_renderer_destroy(mm_evas_info **evas_info) int ret = MM_ERROR_NONE; pid_t pid = getpid(); pid_t tid = syscall(SYS_gettid); - gint64 end_time = g_get_monotonic_time() + SIGNAL_TIMEOUT * G_TIME_SPAN_SECOND; mm_evas_info *ptr = (mm_evas_info *)*evas_info; - MMEVAS_RETURN_VAL_IF_FAIL(ptr, MM_ERROR_EVASRENDER_NOT_INITIALIZED); LOGD("finalize evas_info %p", ptr); @@ -757,19 +753,30 @@ static int _mm_evas_renderer_destroy(mm_evas_info **evas_info) /* this API can be call by sub thread */ LOGD("pid [%d], tid [%d]", pid, tid); if (pid == tid) { /* API call by main thread */ - ret = _mm_evas_renderer_reset(ptr); + ret = _mm_evas_renderer_reset(ptr, FALSE); if (ret != MM_ERROR_NONE) LOGE("_mm_evas_renderer_reset is failed"); } else { - ret = _mm_evas_pipe_write(ptr, UPDATE_DESTROY); g_mutex_lock(&ptr->evas_lock); - if (!g_cond_wait_until(&ptr->evas_cond[COND_DESTROY], &ptr->evas_lock, end_time)) { - //timeout - LOGW("timeout: main thread is busy, App need to handle main thread well."); + ret = _mm_evas_pipe_write(ptr, UPDATE_DESTROY); + if ( ret == MM_ERROR_NONE) { + LOGD("Wait for g_cond_signal..."); + g_cond_wait(&ptr->evas_cond[COND_DESTROY], &ptr->evas_lock); + LOGD("get g_cond_signal"); } g_mutex_unlock(&ptr->evas_lock); } + g_mutex_clear(&ptr->mp_lock); + g_mutex_clear(&ptr->idx_lock); + g_mutex_clear(&ptr->write_lock); + g_mutex_clear(&ptr->evas_lock); + g_cond_clear(&ptr->evas_cond[COND_RETRIEVE]); + g_cond_clear(&ptr->evas_cond[COND_DESTROY]); + + g_free(ptr); + ptr = NULL; + MMER_FLEAVE(); return ret; @@ -817,11 +824,12 @@ static int _mm_evas_renderer_set_info(mm_evas_info *evas_info, Evas_Object *eo) return MM_ERROR_NONE; } -static int _mm_evas_renderer_reset(mm_evas_info *evas_info) +static int _mm_evas_renderer_reset(mm_evas_info *evas_info, gboolean is_sub_thread) { MMER_FENTER(); int ret = MM_ERROR_NONE; + MMEVAS_RETURN_VAL_IF_FAIL(evas_info, MM_ERROR_EVASRENDER_NOT_INITIALIZED); MMEVAS_RETURN_VAL_IF_FAIL(evas_info->eo, MM_ERROR_EVASRENDER_NOT_INITIALIZED); @@ -839,7 +847,7 @@ static int _mm_evas_renderer_reset(mm_evas_info *evas_info) _mm_evas_renderer_release_flush_buffer(evas_info); if (!evas_info->flush_all_packets) { - ret = _destory_all_packets(evas_info); + ret = _destroy_all_packets(evas_info); if (ret != MM_ERROR_NONE) { g_mutex_unlock(&evas_info->mp_lock); return MM_ERROR_EVASRENDER_INTERNAL; @@ -857,7 +865,7 @@ static int _mm_evas_renderer_reset(mm_evas_info *evas_info) evas_info->epipe = NULL; } - if (ret == MM_ERROR_NONE) { + if (is_sub_thread) { g_mutex_lock(&evas_info->evas_lock); LOGD("send signal[COND_DESTROY]"); g_cond_signal(&evas_info->evas_cond[COND_DESTROY]); @@ -866,16 +874,6 @@ static int _mm_evas_renderer_reset(mm_evas_info *evas_info) g_mutex_unlock(&evas_info->mp_lock); - g_mutex_clear(&evas_info->mp_lock); - g_mutex_clear(&evas_info->idx_lock); - g_mutex_clear(&evas_info->write_lock); - g_mutex_clear(&evas_info->evas_lock); - g_cond_clear(&evas_info->evas_cond[COND_RETRIEVE]); - g_cond_clear(&evas_info->evas_cond[COND_DESTROY]); - - g_free(evas_info); - evas_info = NULL; - MMER_FLEAVE(); return ret; @@ -1016,11 +1014,13 @@ static int _mm_evas_renderer_retrieve_all_packets(mm_evas_info *evas_info, bool g_mutex_unlock(&evas_info->mp_lock); } else { /* flush all packet */ - ret = _mm_evas_pipe_write(evas_info, UPDATE_FLUSH_BUFFER); g_mutex_lock(&evas_info->evas_lock); - if (!g_cond_wait_until(&evas_info->evas_cond[COND_RETRIEVE], &evas_info->evas_lock, end_time)) { - //timeout - LOGW("timeout: main thread is busy, App need to handle main thread well."); + ret = _mm_evas_pipe_write(evas_info, UPDATE_FLUSH_BUFFER); + if ( ret == MM_ERROR_NONE) { + if (!g_cond_wait_until(&evas_info->evas_cond[COND_RETRIEVE], &evas_info->evas_lock, end_time)) { + //timeout + LOGW("timeout: main thread is busy, App need to handle main thread well."); + } } g_mutex_unlock(&evas_info->evas_lock); } |