buf_info->rotated = TPL_FALSE;
}
- wl_egl_window->attached_width = buf_info->width;
- wl_egl_window->attached_height = buf_info->height;
+ if (wl_egl_window) {
+ wl_egl_window->attached_width = buf_info->width;
+ wl_egl_window->attached_height = buf_info->height;
+ }
wl_surface_attach(wl_surface, (void *)buf_info->wl_buffer,
buf_info->dx, buf_info->dy);
static tbm_surface_queue_h
_twe_surface_create_tbm_queue(twe_wl_surf_source *source,
struct wayland_tbm_client *wl_tbm_client,
- struct wl_egl_window* wl_egl_window,
+ tpl_handle_t native_handle,
int format)
{
tbm_surface_queue_h tbm_queue = NULL;
+ struct wl_egl_window *wl_egl_window = (struct wl_egl_window *)native_handle;
if (!wl_tbm_client || !wl_egl_window) {
TPL_ERR("Invalid parameters. wl_tbm_client(%p) wl_egl_window(%p)",
surf_source->wl_egl_window->private = NULL;
surf_source->wl_egl_window = NULL;
surf_source->surf = NULL;
- } else {
- TPL_LOG_T("WL_EGL",
- "twe_surface(%p) native window is already destroyed",
- surf_source);
}
TPL_OBJECT_UNLOCK(&disp_source->obj);
twe_surface_h
twe_surface_add(twe_thread* thread,
twe_display_h twe_display,
- struct wl_egl_window *wl_egl_window,
+ tpl_handle_t native_handle,
int format)
{
twe_thread_context *ctx = thread->ctx;
twe_wl_disp_source *disp_source = (twe_wl_disp_source *)twe_display;
GIOChannel *event_channel = NULL;
gboolean is_destroyed = FALSE;
- struct wl_surface *surface = wl_egl_window->surface;
tbm_surface_queue_h tbm_queue = NULL;
if (!twe_display ||
return NULL;
}
- if (!(tbm_queue = _twe_surface_create_tbm_queue(source,
+ if (!disp_source->is_vulkan_dpy &&
+ !(tbm_queue = _twe_surface_create_tbm_queue(source,
disp_source->wl_tbm_client,
- wl_egl_window,
+ native_handle,
format))) {
TPL_ERR("Failed to create tbm_surface_queue.");
g_source_unref(&source->gsource);
return NULL;
}
- /* TODO : surface source will be listed in twe_wl_disp_source */
-
source->tag = g_source_add_unix_fd(&source->gsource,
source->event_fd,
G_IO_IN);
- source->surf = surface;
- source->wl_egl_window = wl_egl_window;
source->tbm_queue = tbm_queue;
source->disp_source = (twe_wl_disp_source *)twe_display;
- source->latest_transform = wl_egl_window->transform;
+ source->latest_transform = 0;
source->rotation = 0;
source->rotation_capability = TPL_FALSE;
source->vblank = NULL;
source->format = format;
__tpl_object_init(&source->obj, TPL_OBJECT_SURFACE, NULL);
- _twe_surface_buffer_flusher_init(source);
- wl_egl_window->private = (void *)source;
- wl_egl_window->destroy_window_callback = (void *)__cb_destroy_callback;
- wl_egl_window->resize_callback = (void *)__cb_resize_callback;
- wl_egl_window->rotate_callback = (void *)__cb_rotate_callback;
- wl_egl_window->get_rotation_capability = (void *)
+ if (!disp_source->is_vulkan_dpy) {
+ struct wl_egl_window *wl_egl_window =
+ (struct wl_egl_window *)native_handle;
+
+ wl_egl_window->private = (void *)source;
+ wl_egl_window->destroy_window_callback = (void *)__cb_destroy_callback;
+ wl_egl_window->resize_callback = (void *)__cb_resize_callback;
+ wl_egl_window->rotate_callback = (void *)__cb_rotate_callback;
+ wl_egl_window->get_rotation_capability = (void *)
__cb_get_rotation_capability;
+ source->wl_egl_window = wl_egl_window;
+ source->surf = wl_egl_window->surface;
+ source->latest_transform = wl_egl_window->transform;
+
+ _twe_surface_buffer_flusher_init(source);
+ } else {
+ struct wl_surface *wl_surf = (struct wl_surface *)native_handle;
+ source->wl_egl_window = NULL;
+ source->surf = wl_surf;
+ }
+
source->surf_del_source = _twe_del_source_init(ctx, source);
if (source->surf_del_source) {
source->surf_del_source->destroy_target_source_func
= _twe_thread_wl_surf_source_destroy;
}
- g_source_set_callback(&source->gsource, NULL, surface, NULL);
g_source_attach(&source->gsource, g_main_loop_get_context(ctx->twe_loop));
TPL_LOG_T("WL_EGL",
- "gsource(%p) wl_egl_window(%p) wl_surface(%p) event_fd(%d)",
- source, wl_egl_window, surface, source->event_fd);
+ "gsource(%p) native_handle(%p) wl_surface(%p) event_fd(%d)",
+ source, native_handle, source->surf, source->event_fd);
return (twe_surface_h)source;
}