return;
}
- /* flush will be executed in this callback normally,
- because native_surface_set must be called in main thread */
- if (evas_info->retrieve_packet) {
- g_mutex_lock(&evas_info->idx_lock);
- if (_flush_packets(evas_info) != MM_ERROR_NONE)
- LOGE("flushing packets is failed");
- g_mutex_unlock(&evas_info->idx_lock);
- }
MMER_FLEAVE();
}
LOGD("evas_info : %p, type : %d, evas_info->eo : %p", evas_info, info, evas_info->eo);
- if (info != UPDATE_TBM_SURF && info != UPDATE_VISIBILITY) {
+ if (info != UPDATE_TBM_SURF && info != UPDATE_VISIBILITY && info != UPDATE_FLUSH_BUFFER) {
LOGW("invalid info type : %d", info);
g_mutex_unlock(&evas_info->mp_lock);
return;
}
+ if (info == UPDATE_FLUSH_BUFFER) {
+ if (_flush_packets(evas_info) != MM_ERROR_NONE) {
+ LOGE("flushing packets is failed");
+ }
+ g_mutex_unlock(&evas_info->mp_lock);
+ return;
+ }
+
if (info == UPDATE_VISIBILITY) {
if (!evas_info->visible) {
+ /* surface set must be called by main thread */
evas_object_image_native_surface_set(evas_info->eo, NULL);
evas_object_hide(evas_info->eo);
LOGI("object hide..");
}
}
+ g_mutex_lock(&evas_info->idx_lock);
if ((evas_info->cur_idx == -1) || !evas_info->pkt_info[evas_info->cur_idx].tbm_surf) {
LOGW("cur_idx %d, tbm_surf may be NULL", evas_info->cur_idx);
+ g_mutex_unlock(&evas_info->idx_lock);
g_mutex_unlock(&evas_info->mp_lock);
return;
}
/* perhaps, it is needed to skip setting when state is pause */
- g_mutex_lock(&evas_info->idx_lock);
/* index */
gint cur_idx = evas_info->cur_idx;
gint prev_idx = evas_info->pkt_info[cur_idx].prev;
g_cnt_out++;
#endif
if (evas_info->visible) {
+ /* surface set must be called by main thread */
evas_object_image_native_surface_set(evas_info->eo, &surf);
LOGD("native surface set finish");
} else {
surf.data.tbm.buffer = evas_info->flush_buffer->tbm_surf;
surf.data.tbm.rot = evas_info->rotate_angle;
surf.data.tbm.flip = evas_info->flip;
+ /* surface set must be called by main thread */
evas_object_image_native_surface_set(evas_info->eo, &surf);
LOGD("flush_buffer surf(%p), rotate(%d), flip(%d)", evas_info->flush_buffer->tbm_surf, evas_info->rotate_angle, evas_info->flip);
LOGD("sent packet %d", evas_info->sent_buffer_cnt);
/* destroy all packets */
- g_mutex_lock(&evas_info->mp_lock);
+ g_mutex_lock(&evas_info->idx_lock);
for (i = 0; i < MAX_PACKET_NUM; i++) {
if (evas_info->pkt_info[i].packet) {
LOGD("destroy packet [%p]", evas_info->pkt_info[i].packet);
LOGE("it should be 0 --> [%d]", evas_info->sent_buffer_cnt);
evas_info->sent_buffer_cnt = 0;
evas_info->cur_idx = -1;
- g_mutex_unlock(&evas_info->mp_lock);
+ g_mutex_unlock(&evas_info->idx_lock);
evas_object_image_pixels_dirty_set(evas_info->eo, EINA_TRUE);
- evas_info->retrieve_packet = FALSE;
MMER_FLEAVE();
}
g_mutex_init(&ptr->mp_lock);
g_mutex_init(&ptr->idx_lock);
+ g_mutex_init(&ptr->write_lock);
+
MMER_FLEAVE();
ret = _mm_evas_renderer_reset(ptr);
g_mutex_clear(&ptr->mp_lock);
g_mutex_clear(&ptr->idx_lock);
+ g_mutex_clear(&ptr->write_lock);
+
g_free(ptr);
ptr = NULL;
{
MMER_FENTER();
MM_CHECK_NULL(evas_info);
- g_mutex_lock(&evas_info->idx_lock);
+ g_mutex_lock(&evas_info->mp_lock);
int i;
int ret = MM_ERROR_NONE;
if (evas_info->flush_buffer)
_mm_evas_renderer_release_flush_buffer(evas_info);
- g_mutex_lock(&evas_info->mp_lock);
+ g_mutex_lock(&evas_info->idx_lock);
for (i = 0; i < MAX_PACKET_NUM; i++) {
if (evas_info->pkt_info[i].packet) {
/* destroy all packets */
evas_info->pkt_info[i].prev = -1;
}
}
- g_mutex_unlock(&evas_info->mp_lock);
+ g_mutex_unlock(&evas_info->idx_lock);
if (evas_info->sent_buffer_cnt != 0)
LOGE("it should be 0 --> [%d]", evas_info->sent_buffer_cnt);
evas_info->sent_buffer_cnt = 0;
evas_info->cur_idx = -1;
- g_mutex_unlock(&evas_info->idx_lock);
+ g_mutex_unlock(&evas_info->mp_lock);
MMER_FLEAVE();
LOGD("native surface exists");
surf->data.tbm.rot = evas_info->rotate_angle;
surf->data.tbm.flip = evas_info->flip;
+ /* surface set must be called by main thread */
evas_object_image_native_surface_set(evas_info->eo, surf);
_mm_evas_renderer_update_geometry(evas_info, &result);
pid_t pid = getpid();
pid_t tid = syscall(SYS_gettid);
- /* write and this API can be called at the same time.
- so lock is needed for counting sent_buffer_cnt correctly */
- g_mutex_lock(&evas_info->idx_lock);
+ /* this API can be call by sub thread */
+ LOGD("pid [%d], tid [%d]", pid, tid);
/* make flush buffer */
if (keep_screen)
ret = _mm_evas_renderer_make_flush_buffer(evas_info);
evas_info->keep_screen = keep_screen;
- LOGD("pid [%d], tid [%d]", pid, tid);
- if (pid == tid) {
- /* in this case, we deem it is main thread */
- if (_flush_packets(evas_info) != MM_ERROR_NONE) {
- LOGE("flushing packets is failed");
+ if (evas_info->epipe) {
+ g_mutex_lock(&evas_info->write_lock);
+ ret = ecore_pipe_write(evas_info->epipe, evas_info, UPDATE_FLUSH_BUFFER);
+ if (!ret) {
+ LOGW("fail to ecore_pipe_write() for updating visibility\n");
ret = MM_ERROR_EVASRENDER_INTERNAL;
+ } else {
+ ret = MM_ERROR_NONE;
}
+ g_mutex_unlock(&evas_info->write_lock);
} else {
- /* it will be executed to write flush buffer and destroy media packets in pre_cb */
- evas_info->retrieve_packet = TRUE;
+ LOGW("there is no epipe. we cant update it");
}
- g_mutex_unlock(&evas_info->idx_lock);
MMER_FLEAVE();
handle->sent_buffer_cnt++;
LOGD("sent packet %d", handle->sent_buffer_cnt);
+ g_mutex_lock(&handle->write_lock);
ret = ecore_pipe_write(handle->epipe, handle, UPDATE_TBM_SURF);
if (!ret) {
handle->pkt_info[index].packet = NULL;
handle->cur_idx = handle->pkt_info[index].prev;
handle->sent_buffer_cnt--;
LOGW("Failed to ecore_pipe_write() for updating tbm surf\n");
+ g_mutex_unlock(&handle->write_lock);
goto ERROR;
}
+ g_mutex_unlock(&handle->write_lock);
} else {
LOGW("no tbm_surf");
goto ERROR;
evas_info->visible = visible;
if (evas_info->epipe) {
- ret = ecore_pipe_write(evas_info->epipe, &visible, UPDATE_VISIBILITY);
+ g_mutex_lock(&evas_info->write_lock);
+ ret = ecore_pipe_write(evas_info->epipe, evas_info, UPDATE_VISIBILITY);
if (!ret) {
LOGW("fail to ecore_pipe_write() for updating visibility\n");
ret = MM_ERROR_EVASRENDER_INTERNAL;
} else {
ret = MM_ERROR_NONE;
}
+ g_mutex_unlock(&evas_info->write_lock);
} else {
LOGW("there is no epipe. we cant update it");
}
/* FIXME: pause state only */
if (evas_info->epipe) {
- g_mutex_lock(&evas_info->idx_lock);
+ g_mutex_lock(&evas_info->write_lock);
ret = ecore_pipe_write(evas_info->epipe, evas_info, UPDATE_TBM_SURF);
if (!ret) {
LOGW("fail to ecore_pipe_write() for updating visibility\n");
} else {
ret = MM_ERROR_NONE;
}
- g_mutex_unlock(&evas_info->idx_lock);
+ g_mutex_unlock(&evas_info->write_lock);
}
MMER_FLEAVE();
/* ecore_pipe_write is needed, because of setting ratio for letterbox mode */
/* FIXME: pause state only */
if (evas_info->epipe) {
- g_mutex_lock(&evas_info->idx_lock);
+ g_mutex_lock(&evas_info->write_lock);
ret = ecore_pipe_write(evas_info->epipe, evas_info, UPDATE_TBM_SURF);
if (!ret) {
LOGW("fail to ecore_pipe_write() for updating visibility\n");
} else {
ret = MM_ERROR_NONE;
}
- g_mutex_unlock(&evas_info->idx_lock);
+ g_mutex_unlock(&evas_info->write_lock);
}
MMER_FLEAVE();
/* pipe_write could be needed because ratio can be changed on pause state */
if (evas_info->epipe) {
- g_mutex_lock(&evas_info->idx_lock);
+ g_mutex_lock(&evas_info->write_lock);
ret = ecore_pipe_write(evas_info->epipe, evas_info, UPDATE_TBM_SURF);
if (!ret) {
LOGW("fail to ecore_pipe_write() for updating visibility\n");
} else {
ret = MM_ERROR_NONE;
}
- g_mutex_unlock(&evas_info->idx_lock);
+ g_mutex_unlock(&evas_info->write_lock);
}
MMER_FLEAVE();
/* FIXME: pause state only */
if (evas_info->epipe) {
- g_mutex_lock(&evas_info->idx_lock);
+ g_mutex_lock(&evas_info->write_lock);
ret = ecore_pipe_write(evas_info->epipe, evas_info, UPDATE_TBM_SURF);
if (!ret) {
LOGW("fail to ecore_pipe_write() for updating visibility\n");
} else {
ret = MM_ERROR_NONE;
}
- g_mutex_unlock(&evas_info->idx_lock);
+ g_mutex_unlock(&evas_info->write_lock);
}
MMER_FLEAVE();