twe_wl_disp_source *disp_source;
twe_del_source *surf_del_source;
- tbm_fd render_sync_timeline;
- int render_sync_timestamp;
- unsigned int render_sync_fence_number;
+ tbm_fd commit_sync_timeline;
+ int commit_sync_timestamp;
+ unsigned int commit_sync_fence_number;
tbm_fd presentation_sync_timeline;
int presentation_sync_timestamp;
}
static int
-__cb_create_render_sync_fd(struct wl_egl_window *wl_egl_window, void *private)
+__cb_create_commit_sync_fd(struct wl_egl_window *wl_egl_window, void *private)
{
TPL_ASSERT(private);
TPL_ASSERT(wl_egl_window);
struct tizen_private *tizen_private = (struct tizen_private *)private;
twe_wl_surf_source *surf_source = NULL;
- tbm_fd render_sync_fd = -1;
+ tbm_fd commit_sync_fd = -1;
surf_source = (twe_wl_surf_source *)tizen_private->data;
if (!surf_source) {
return -1;
}
- if (surf_source->render_sync_timeline != -1) {
+ if (surf_source->commit_sync_timeline != -1) {
char name[32];
- snprintf(name, 32, "%u", surf_source->render_sync_fence_number++);
- render_sync_fd = tbm_sync_fence_create(surf_source->render_sync_timeline,
+ snprintf(name, 32, "%u", surf_source->commit_sync_fence_number++);
+ commit_sync_fd = tbm_sync_fence_create(surf_source->commit_sync_timeline,
name,
- surf_source->render_sync_timestamp + 1);
- TPL_DEBUG("[RENDER_SYNC] surf_source(%p) timeline(%d) timestamp(%d) name(%s) sync_fence(%d)",
- surf_source, surf_source->render_sync_timeline, surf_source->render_sync_timestamp,
- name, render_sync_fd);
+ surf_source->commit_sync_timestamp + 1);
+ TPL_DEBUG("[COMMIT_SYNC] surf_source(%p) timeline(%d) timestamp(%d) name(%s) sync_fence(%d)",
+ surf_source, surf_source->commit_sync_timeline, surf_source->commit_sync_timestamp,
+ name, commit_sync_fd);
- TRACE_ASYNC_BEGIN(surf_source->render_sync_timestamp + 1, "[SYNC_FENCE]");
+ TRACE_ASYNC_BEGIN(surf_source->commit_sync_timestamp + 1, "[SYNC_FENCE]");
- return render_sync_fd;
+ return commit_sync_fd;
}
return -1;
return -1;
}
- if (surf_source->render_sync_timeline == -1 &&
+ if (surf_source->commit_sync_timeline == -1 &&
surf_source->presentation_sync_timeline == -1) {
TPL_ERR("There is no timeline for any sync fd in surf_source(%p)", surf_source);
return -1;
return;
}
- if (surf_source->render_sync_timeline != -1) {
-
- surf_source->render_sync_timestamp++;
- TRACE_ASYNC_END(surf_source->render_sync_timestamp, "[SYNC_FENCE]");
-
- TPL_DEBUG("[RENDER_SYNC][INC] surf_source(%p) timeline(%d) timestamp(%d)",
- surf_source, surf_source->render_sync_timeline, surf_source->render_sync_timestamp);
- if (!tbm_sync_timeline_inc(surf_source->render_sync_timeline, 1)) {
- TPL_ERR("Failed to increase timeline(%d)", surf_source->render_sync_timeline);
- }
- }
-
if (surf_source->in_use_buffers) {
g_mutex_lock(&surf_source->surf_mutex);
/* Stop tracking of this canceled tbm_surface */
if (surf_source->committed_buffers) {
__tpl_list_push_back(surf_source->committed_buffers, tbm_surface);
}
+
+ if (surf_source->commit_sync_timeline != -1) {
+ surf_source->commit_sync_timestamp++;
+ TRACE_ASYNC_END(surf_source->commit_sync_timestamp, "[SYNC_FENCE]");
+
+ TPL_DEBUG("[COMMIT_SYNC][INC] surf_source(%p) timeline(%d) timestamp(%d)",
+ surf_source, surf_source->commit_sync_timeline, surf_source->commit_sync_timestamp);
+ if (!tbm_sync_timeline_inc(surf_source->commit_sync_timeline, 1)) {
+ TPL_ERR("Failed to increase timeline(%d)", surf_source->commit_sync_timeline);
+ }
+ }
}
/* The following function _twe_thread_wl_surface_acquire_and_commit can be
source->post_interval = 1;
- source->render_sync_timeline = tbm_sync_timeline_create();
- source->render_sync_timestamp = 0;
- source->render_sync_fence_number = 0;
+ source->commit_sync_timeline = tbm_sync_timeline_create();
+ source->commit_sync_timestamp = 0;
+ source->commit_sync_fence_number = 0;
source->presentation_sync_timeline = tbm_sync_timeline_create();
source->presentation_sync_timestamp = 0;
__cb_get_rotation_capability;
private->set_window_serial_callback = (void *)
__cb_set_window_serial_callback;
- private->create_render_sync_fd = (void *)__cb_create_render_sync_fd;
+ private->create_commit_sync_fd = (void *)__cb_create_commit_sync_fd;
private->create_presentation_sync_fd = (void *)__cb_create_presentation_sync_fd;
private->merge_sync_fds = (void *)__cb_merge_sync_fds;
int (*get_rotation_capability)(struct wl_egl_window *, void *);
void (*set_frontbuffer_callback)(struct wl_egl_window *, void *, int);
void (*set_window_serial_callback)(struct wl_egl_window *, void *, unsigned int);
- int (*create_render_sync_fd)(struct wl_egl_window *, void *);
+ int (*create_commit_sync_fd)(struct wl_egl_window *, void *);
int (*create_presentation_sync_fd)(struct wl_egl_window *, void *);
int (*merge_sync_fds)(void *, int, int);
};
private->get_rotation_capability = NULL;
private->set_window_serial_callback = NULL;
private->set_frontbuffer_callback = NULL;
- private->create_render_sync_fd = NULL;
+ private->create_commit_sync_fd = NULL;
private->create_presentation_sync_fd = NULL;
private->merge_sync_fds = NULL;
}
/* temporary APIs for testing sync feature */
/**
- * Create a sync fence fd that can tell render done.
+ * Create a sync fence fd that can tell wl_surface_commit done.
*
* If eglSwapBuffers works async, it returns fd which tells
- * when the render job is finished.
+ * when wl_surface_commit called.
* This fd can wait asynchronously via poll or select.
*
* Important *
* This requires the following premise:
- * - After ddk calls libplpl-egl's tpl_surface_dequeue_buffer to get the buffer,
- * and until it calls tpl_surface_enqueue_buffer,
- * it is called the gpu rendering job interval.
- * - Therefore, when using the dma_buf implicit fence,
- * there is no guarantee that the rendering job is finished
- * with the fence obtained through this API.
+ * - If the user wants to know the render done using EGLSyncKHR,
+ * tpl_surface_dequeue_buffer, tpl_surface_enqueue_buffer and
+ * wl_surface_commit occur at similar moments.
+ * Therefore, it only tells when wl_surface_commit is done,
+ * but does not guarantee render done.
+ * - If EGLSyncKHR or dma_buf implicit fence is not used,
+ * render done can be guaranteed.
*
* The fence_fd obtained through this function is one-time available,
* can not be reused, so caller must close it when finished using it.
* @return sync fd on success, -1 on failure.
*/
int
-wl_egl_window_tizen_create_render_sync_fd(struct wl_egl_window *egl_window);
+wl_egl_window_tizen_create_commit_sync_fd(struct wl_egl_window *egl_window);
/**
* Create a sync fence fd that can tell presentation done.