tpl_result_t (*destroy_swapchain)(tpl_surface_t *surface);
tpl_result_t (*set_rotation_capability)(tpl_surface_t *surface,
tpl_bool_t set);
+ tpl_result_t (*set_post_interval)(tpl_surface_t *surface, int post_interval);
};
struct _tpl_object {
tpl_result_t
tpl_surface_set_post_interval(tpl_surface_t *surface, int interval)
{
+ tpl_result_t ret = TPL_ERROR_NONE;
+
if (!surface || (surface->type != TPL_SURFACE_TYPE_WINDOW)) {
TPL_ERR("Invalid surface!");
return TPL_ERROR_INVALID_PARAMETER;
}
+ if (interval <= 0)
+ return TPL_ERROR_NONE;
+
TPL_OBJECT_LOCK(surface);
- surface->post_interval = interval;
+
+ if (surface->backend.set_post_interval)
+ ret = surface->backend.set_post_interval(surface, interval);
+
+ if (ret == TPL_ERROR_NONE)
+ surface->post_interval = interval;
+
TPL_OBJECT_UNLOCK(surface);
- return TPL_ERROR_NONE;
+ TPL_LOG_F("tpl_surface_t(%p) post_interval(%d)", surface, surface->post_interval);
+
+ return ret;
}
int
interval = surface->post_interval;
TPL_OBJECT_UNLOCK(surface);
+ TPL_LOG_F("tpl_surface_t(%p) post_interval(%d)", surface, interval);
+
return interval;
}
if (wayland_egl_display->tdm_client) {
int tdm_lock_res = pthread_mutex_lock(&wayland_egl_display->tdm_mutex);
tdm_err = tdm_client_vblank_wait(wayland_egl_surface->tdm_vblank,
- 1, /* interval */
+ surface->post_interval, /* interval */
__cb_tdm_client_wait_vblank, /* handler */
surface->backend.data); /* user_data */
GMutex sub_thread_mutex;
GCond sub_thread_cond;
int draw_done_count;
+
+ int post_interval;
};
struct _twe_wl_buffer_info {
}
tdm_err = tdm_client_vblank_wait(surf_source->vblank,
- 1, /* TODO: interval */
+ surf_source->post_interval, /* TODO: interval */
__cb_tdm_client_wait_vblank,
(void *)surf_source);
source->set_serial_is_used = TPL_FALSE;
source->serial = 0;
+ source->post_interval = 1;
+
if (!disp_source->is_vulkan_dpy) {
struct wl_egl_window *wl_egl_window =
(struct wl_egl_window *)native_handle;
return tbm_surface;
}
+tpl_result_t
+twe_surface_set_post_interval(twe_surface_h twe_surface, int post_interval)
+{
+ twe_wl_surf_source *surf_source = (twe_wl_surf_source *)twe_surface;
+
+ if (!surf_source || g_source_is_destroyed(&surf_source->gsource)) {
+ TPL_ERR("Invalid parameter. surf_source(%p)", surf_source);
+ return TPL_ERROR_INVALID_PARAMETER;
+ }
+
+ surf_source->post_interval = post_interval;
+
+ TPL_LOG_T(BACKEND, "surf_source(%p) post_interval(%d)",
+ surf_source, surf_source->post_interval);
+
+ return TPL_ERROR_NONE;
+}
tbm_surface_h
twe_get_native_buffer_from_pixmap(tpl_handle_t pixmap);
+tpl_result_t
+twe_surface_set_post_interval(twe_surface_h twe_surface, int post_interval);
return TPL_ERROR_NONE;
}
+static tpl_result_t
+__tpl_wl_egl_surface_set_post_interval(tpl_surface_t *surface,
+ int post_interval)
+{
+ tpl_wayland_egl_surface_t *wayland_egl_surface = NULL;
+
+ if (!surface) {
+ TPL_ERR("Invalid parameter. tpl_surface(%p)", surface);
+ return TPL_ERROR_INVALID_PARAMETER;
+ }
+
+ wayland_egl_surface = (tpl_wayland_egl_surface_t *)surface->backend.data;
+ if (!wayland_egl_surface) {
+ TPL_ERR("Invalid parameter. wayland_egl_surface(%p)",
+ wayland_egl_surface);
+ return TPL_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!wayland_egl_surface->twe_surface) {
+ TPL_ERR("Invalid parameter. wayland_egl_surface(%p) twe_surface(%p)",
+ wayland_egl_surface, wayland_egl_surface->twe_surface);
+ return TPL_ERROR_INVALID_PARAMETER;
+ }
+
+ twe_surface_set_post_interval(wayland_egl_surface->twe_surface,
+ post_interval);
+
+ return TPL_ERROR_NONE;
+}
+
static tpl_result_t
__tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface,
tbm_surface_h tbm_surface,
backend->enqueue_buffer = __tpl_wl_egl_surface_enqueue_buffer;
backend->set_rotation_capability =
__tpl_wl_egl_surface_set_rotation_capability;
+ backend->set_post_interval =
+ __tpl_wl_egl_surface_set_post_interval;
}