}
}
- /* FIXME: vblank has performance problem so replace all present mode to MAILBOX */
- present_mode = TPL_DISPLAY_PRESENT_MODE_MAILBOX;
-
- surf_source->tbm_queue = tbm_surface_queue_create(buffer_count,
- width,
- height,
- TBM_FORMAT_ARGB8888,
- 0);
+ surf_source->tbm_queue = wayland_tbm_client_create_surface_queue(
+ disp_source->wl_tbm_client,
+ surf_source->surf,
+ buffer_count,
+ width, height,
+ TBM_FORMAT_ARGB8888);
+
+ if (tbm_surface_queue_add_reset_cb(surf_source->tbm_queue,
+ __cb_tbm_queue_reset_callback,
+ NULL) != TBM_SURFACE_QUEUE_ERROR_NONE) {
+ TPL_ERR("Failed to register reset callback to tbm_surface_queue(%p)",
+ surf_source->tbm_queue);
+ tbm_surface_queue_destroy(surf_source->tbm_queue);
+ return TPL_ERROR_INVALID_OPERATION;
+ }
+
if (!surf_source->tbm_queue) {
TPL_ERR("TBM surface queue creation failed!");
return TPL_ERROR_OUT_OF_MEMORY;
twe_surface_h twe_surface;
tbm_surface_queue_h tbm_queue;
int buffer_count;
+ tpl_bool_t is_activated;
+ tpl_bool_t reset;
};
static tpl_result_t __tpl_wl_vk_wsi_surface_destroy_swapchain(
TPL_ASSERT(surface);
TPL_ASSERT(surface->backend.data);
- return TPL_TRUE;
+ tpl_wayland_vk_wsi_surface_t *wayland_vk_wsi_surface =
+ (tpl_wayland_vk_wsi_surface_t *)surface->backend.data;
+
+ return !(wayland_vk_wsi_surface->reset);
}
static tbm_surface_h
return ret;
}
+static void
+__cb_tbm_surface_queue_reset_callback(tbm_surface_queue_h surface_queue,
+ void *data)
+{
+ tpl_surface_t *surface = NULL;
+ tpl_wayland_vk_wsi_surface_t *wayland_vk_wsi_surface = NULL;
+ tpl_bool_t is_activated = TPL_FALSE;
+
+ surface = (tpl_surface_t *)data;
+ TPL_CHECK_ON_NULL_RETURN(surface);
+
+ wayland_vk_wsi_surface = (tpl_wayland_vk_wsi_surface_t *)surface->backend.data;
+ TPL_CHECK_ON_NULL_RETURN(wayland_vk_wsi_surface);
+
+ /* When queue_reset_callback is called, if is_activated is different from
+ * its previous state change the reset flag to TPL_TRUE to get a new buffer
+ * with the changed state(ACTIVATED/DEACTIVATED) at the next frame. */
+ is_activated = twe_surface_check_activated(wayland_vk_wsi_surface->twe_surface);
+ if (wayland_vk_wsi_surface->is_activated != is_activated) {
+ if (is_activated) {
+ TPL_LOG_T("WL_EGL",
+ "[ACTIVATED_CB] wayland_vk_wsi_surface(%p) tbm_queue(%p)",
+ wayland_vk_wsi_surface, surface_queue);
+ } else {
+ TPL_LOG_T("WL_EGL",
+ "[DEACTIVATED_CB] wayland_vk_wsi_surface(%p) tbm_queue(%p)",
+ wayland_vk_wsi_surface, surface_queue);
+ }
+ wayland_vk_wsi_surface->reset = TPL_TRUE;
+ }
+
+ if (surface->reset_cb)
+ surface->reset_cb(surface->reset_data);
+}
+
static tpl_result_t
__tpl_wl_vk_wsi_surface_create_swapchain(tpl_surface_t *surface,
tbm_format format, int width,
wayland_vk_wsi_surface->tbm_queue = twe_surface_get_tbm_queue(
wayland_vk_wsi_surface->twe_surface);
+
+ /* Set reset_callback to tbm_queue */
+ if (tbm_surface_queue_add_reset_cb(wayland_vk_wsi_surface->tbm_queue,
+ __cb_tbm_surface_queue_reset_callback,
+ (void *)surface)) {
+ TPL_ERR("TBM surface queue add reset cb failed!");
+ twe_surface_destroy_swapchain(wayland_vk_wsi_surface->twe_surface);
+ wayland_vk_wsi_surface->tbm_queue = NULL;
+ return TPL_ERROR_INVALID_OPERATION;
+ }
+
wayland_vk_wsi_surface->buffer_count = buffer_count;
+ wayland_vk_wsi_surface->reset = TPL_FALSE;
return TPL_ERROR_NONE;
}