surf_source->swapchain_properties.height);
wl_surface_commit(wl_surface);
+ buf_info->sync_timestamp++;
+
if (surf_source->swapchain_properties.present_mode
== TPL_DISPLAY_PRESENT_MODE_FIFO_RELAXED) {
if (_twe_surface_wait_vblank(surf_source) != TPL_ERROR_NONE)
}
buf_info->draw_done_fence = sync_fd;
-
buf_info->fence_waiting_thread = g_thread_new("fence_waiting_thread",
_twe_sync_fence_waiting,
buf_info);
return TPL_ERROR_NONE;
}
+tbm_fd
+twe_surface_create_sync_fd(tbm_surface_h tbm_surface)
+{
+ twe_wl_buffer_info *buf_info = NULL;
+ tbm_fd sync_fd = -1;
+
+ tbm_surface_internal_get_user_data(tbm_surface, KEY_BUFFER_INFO,
+ (void **)&buf_info);
+
+ if (buf_info) {
+ if (buf_info->sync_timestamp) {
+ /* first return -1 */
+ char name[32];
+ snprintf(name, 32, "%d",
+ tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)));
+ sync_fd = tbm_sync_fence_create(buf_info->sync_timeline,
+ name,
+ buf_info->sync_timestamp);
+ if (sync_fd == -1) {
+ char buf[1024];
+ strerror_r(errno, buf, sizeof(buf));
+ TPL_ERR("Failed to create TBM sync fence: %d(%s)", errno, buf);
+ }
+ }
+ }
+
+ return sync_fd;
+}
+
tpl_result_t
twe_surface_wait_dequeueable(twe_surface_h twe_surface, uint64_t timeout_ns)
{