From d00f3636c3c5338e5635e6fd4ad8d4fde419da0e Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Jun 2019 17:56:04 +0900 Subject: [PATCH 01/16] [1/4]wayland-egl-priv: Changed the name of 'private' to be same as uptream. Change-Id: Ie9b44ab73354547e9867cb8d02cae855171fafaf Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl.c | 6 +++--- src/tpl_wayland_egl_thread.c | 10 +++++----- src/wayland-egl/wayland-egl-priv.h | 4 +++- src/wayland-egl/wayland-egl-tizen.c | 8 ++++---- src/wayland-egl/wayland-egl.c | 14 +++++++------- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 80a2812..19b06b3 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -366,7 +366,7 @@ __tpl_wayland_egl_display_get_window_info(tpl_display_t *display, /* Wayland-egl window doesn't have native format information. It is fixed from 'EGLconfig' when called eglCreateWindowSurface(). So we use the tpl_surface format instead. */ - tpl_surface_t *surface = wl_egl_window->private; + tpl_surface_t *surface = wl_egl_window->driver_private; if (surface) *format = surface->format; else { if (a_size == 8) *format = TBM_FORMAT_ARGB8888; @@ -613,7 +613,7 @@ __tpl_wayland_egl_surface_init(tpl_surface_t *surface) surface->rotation = wl_egl_window->rotation; surface->rotation_capability = TPL_FALSE; - wl_egl_window->private = surface; + wl_egl_window->driver_private = surface; wl_egl_window->resize_callback = (void *)__cb_client_window_resize_callback; wl_egl_window->rotate_callback = (void *)__cb_client_window_rotate_callback; wl_egl_window->get_rotation_capability = (void *) @@ -693,7 +693,7 @@ __tpl_wayland_egl_surface_fini(tpl_surface_t *surface) TPL_ASSERT(wl_egl_window); /* TPL_ASSERT(wl_egl_window->surface); */ /* to be enabled once evas/gl patch is in place */ - wl_egl_window->private = NULL; + wl_egl_window->driver_private = NULL; wl_egl_window->resize_callback = NULL; wl_egl_window->rotate_callback = NULL; wl_egl_window->get_rotation_capability = NULL; diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 767dba7..ccac3f6 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -1089,7 +1089,7 @@ __cb_destroy_callback(void *private) TPL_LOG_T(BACKEND, "[DESTROY_CB] wl_egl_window(%p) surf_source(%p)", surf_source->wl_egl_window, surf_source); g_mutex_lock(&surf_source->surf_mutex); - surf_source->wl_egl_window->private = NULL; + surf_source->wl_egl_window->driver_private = NULL; surf_source->wl_egl_window = NULL; surf_source->surf = NULL; surf_source->is_destroying = TPL_TRUE; @@ -2336,7 +2336,7 @@ _twe_thread_wl_surf_source_destroy(void *source) surf_source->wl_egl_window->resize_callback = NULL; surf_source->wl_egl_window->rotate_callback = NULL; surf_source->wl_egl_window->get_rotation_capability = NULL; - surf_source->wl_egl_window->private = NULL; + surf_source->wl_egl_window->driver_private = NULL; surf_source->wl_egl_window = NULL; surf_source->surf = NULL; } @@ -2447,7 +2447,7 @@ twe_surface_add(twe_thread* thread, struct wl_egl_window *wl_egl_window = (struct wl_egl_window *)native_handle; - wl_egl_window->private = (void *)source; + wl_egl_window->driver_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; @@ -3270,8 +3270,8 @@ twe_get_native_window_info(tpl_handle_t window, int *width, int *height, if (width) *width = wl_egl_window->width; if (height) *height = wl_egl_window->height; if (format) { - if (wl_egl_window->private) { - twe_wl_surf_source *surf_source = (twe_wl_surf_source *)wl_egl_window->private; + if (wl_egl_window->driver_private) { + twe_wl_surf_source *surf_source = (twe_wl_surf_source *)wl_egl_window->driver_private; *format = surf_source->format; } else { if (a_size == 8) diff --git a/src/wayland-egl/wayland-egl-priv.h b/src/wayland-egl/wayland-egl-priv.h index b37d9e2..40cbd5b 100644 --- a/src/wayland-egl/wayland-egl-priv.h +++ b/src/wayland-egl/wayland-egl-priv.h @@ -29,13 +29,15 @@ struct wl_egl_window { int attached_width; int attached_height; + void *driver_private; + + /* Tizen specific datas */ wl_egl_window_rotation rotation; int frontbuffer_mode; int transform; int window_transform; unsigned int serial; - void *private; void (*destroy_window_callback)(void *); void (*resize_callback)(struct wl_egl_window *, void *); void (*rotate_callback)(struct wl_egl_window *, void *); diff --git a/src/wayland-egl/wayland-egl-tizen.c b/src/wayland-egl/wayland-egl-tizen.c index b44004a..238d450 100644 --- a/src/wayland-egl/wayland-egl-tizen.c +++ b/src/wayland-egl/wayland-egl-tizen.c @@ -66,7 +66,7 @@ wl_egl_window_tizen_set_rotation(struct wl_egl_window *egl_window, egl_window->rotation = rotation; if (egl_window->rotate_callback) - egl_window->rotate_callback(egl_window, egl_window->private); + egl_window->rotate_callback(egl_window, egl_window->driver_private); } int @@ -79,7 +79,7 @@ wl_egl_window_tizen_get_capabilities(struct wl_egl_window *egl_window) } if (egl_window->get_rotation_capability) - capabilities = egl_window->get_rotation_capability(egl_window, egl_window->private); + capabilities = egl_window->get_rotation_capability(egl_window, egl_window->driver_private); else capabilities = WL_EGL_WINDOW_CAPABILITY_ROTATION_UNKNOWN; @@ -117,7 +117,7 @@ wl_egl_window_tizen_set_frontbuffer_mode(struct wl_egl_window *egl_window, egl_window->frontbuffer_mode = set; if (egl_window->set_frontbuffer_callback) - egl_window->set_frontbuffer_callback(egl_window, egl_window->private, + egl_window->set_frontbuffer_callback(egl_window, egl_window->driver_private, set); } @@ -161,6 +161,6 @@ wl_egl_window_tizen_set_window_serial(struct wl_egl_window *egl_window, } if (egl_window->set_window_serial_callback) - egl_window->set_window_serial_callback(egl_window, egl_window->private, + egl_window->set_window_serial_callback(egl_window, egl_window->driver_private, serial); } \ No newline at end of file diff --git a/src/wayland-egl/wayland-egl.c b/src/wayland-egl/wayland-egl.c index 05b726a..6a8e9ec 100644 --- a/src/wayland-egl/wayland-egl.c +++ b/src/wayland-egl/wayland-egl.c @@ -67,7 +67,7 @@ wl_egl_window_resize(struct wl_egl_window *egl_window, egl_window->height = height; if (egl_window->resize_callback) - egl_window->resize_callback(egl_window, egl_window->private); + egl_window->resize_callback(egl_window, egl_window->driver_private); WL_EGL_LOG(2, "egl_win:%10p WxH:%dx%d dx:%d dy:%d rsz_cb:%10p", egl_window, width, height, egl_window->dx, egl_window->dy, @@ -110,14 +110,14 @@ wl_egl_window_create(struct wl_surface *surface, egl_window->window_transform = 0; egl_window->serial = 0; - egl_window->private = NULL; + egl_window->driver_private = NULL; egl_window->rotate_callback = NULL; egl_window->get_rotation_capability = NULL; egl_window->destroy_window_callback = NULL; WL_EGL_LOG(2, "surf:%10p WxH:%dx%d egl_win:%10p priv:%10p", - surface, width, height, egl_window, egl_window->private); + surface, width, height, egl_window, egl_window->driver_private); return egl_window; } @@ -131,7 +131,7 @@ wl_egl_window_destroy(struct wl_egl_window *egl_window) } if (egl_window->destroy_window_callback) - egl_window->destroy_window_callback(egl_window->private); + egl_window->destroy_window_callback(egl_window->driver_private); WL_EGL_LOG(2, "egl_win:%10p", egl_window); @@ -170,7 +170,7 @@ wl_egl_window_set_rotation(struct wl_egl_window *egl_window, egl_window->rotation = rotation; if (egl_window->rotate_callback) - egl_window->rotate_callback(egl_window, egl_window->private); + egl_window->rotate_callback(egl_window, egl_window->driver_private); } WL_EGL_EXPORT void @@ -202,7 +202,7 @@ wl_egl_window_get_capabilities(struct wl_egl_window *egl_window) } if (egl_window->get_rotation_capability) - capabilities = egl_window->get_rotation_capability(egl_window, egl_window->private); + capabilities = egl_window->get_rotation_capability(egl_window, egl_window->driver_private); else capabilities = WL_EGL_WINDOW_CAPABILITY_ROTATION_UNKNOWN; @@ -221,7 +221,7 @@ wl_egl_window_set_frontbuffer_mode(struct wl_egl_window *egl_window, egl_window->frontbuffer_mode = set; if (egl_window->set_frontbuffer_callback) - egl_window->set_frontbuffer_callback(egl_window, egl_window->private, + egl_window->set_frontbuffer_callback(egl_window, egl_window->driver_private, set); } -- 2.7.4 From 59be89060e620150f7ec64ca6369e9175cba0af5 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 1 Jul 2019 13:32:03 +0900 Subject: [PATCH 02/16] [2/4]wayland-egl-tizen-priv: Added new header to support tizen specific feature. Change-Id: Icb1e4afa47597cb2bc7c6e9467e5a6ec0e547dfb Signed-off-by: Joonbum Ko --- src/wayland-egl/wayland-egl-tizen-priv.h | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/wayland-egl/wayland-egl-tizen-priv.h diff --git a/src/wayland-egl/wayland-egl-tizen-priv.h b/src/wayland-egl/wayland-egl-tizen-priv.h new file mode 100644 index 0000000..5b65a70 --- /dev/null +++ b/src/wayland-egl/wayland-egl-tizen-priv.h @@ -0,0 +1,52 @@ +#ifndef _WAYLAND_EGL_TIZEN_PRIV_H +#define _WAYLAND_EGL_TIZEN_PRIV_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +struct tizen_private { + int rotation; + int frontbuffer_mode; + int transform; + int window_transform; + unsigned int serial; + + void *data; + + void (*rotate_callback)(struct wl_egl_window *, void *); + 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); +}; + +static struct tizen_private* tizen_private_create() +{ + struct tizen_private *private = NULL; + private = (struct tizen_private *)calloc(1, sizeof(struct tizen_private)); + if (private) { + private->rotation = 0; + private->frontbuffer_mode = 0; + private->transform = 0; + private->window_transform = 0; + private->serial = 0; + + private->data = NULL; + private->rotate_callback = NULL; + private->get_rotation_capability = NULL; + private->set_window_serial_callback = NULL; + private->set_frontbuffer_callback = NULL; + } + + return private; +} + +#ifdef __cplusplus +} +#endif + +#endif -- 2.7.4 From d5b748d0b086f74e44c7dabc2d4cdf3c8b056aa2 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 1 Jul 2019 13:48:45 +0900 Subject: [PATCH 03/16] [3/4]wayland-egl*: Implemented to use 'tizen_private' structure in wl_egl_window. - The structure, tizen_private has tizen specific status, variables, callback functions. - Changed the usage of wl_egl_window->driver_private. Before : wl_egl_window->driver_private = (void *)surface pointer of each wayland backend. From now : wl_egl_window->driver_private = (void *)tizen_private - Changed tizen specific callback functions to register in tizen_private. ex) Before : wl_egl_window->set_window_serial_callback = callback From now : tizen_private->set_window_serial_callback = callback - This fix is to stop using wayland-egl-priv.h and use wayland-egl-backend.h provided by wayland. Change-Id: I34d80f00ec444ed49c527c9d15d94e11d7bbb6cd Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl.c | 146 ++++++++++++++++++++++++++++-------- src/tpl_wayland_egl_thread.c | 132 +++++++++++++++++++++++--------- src/wayland-egl/wayland-egl-tizen.c | 131 ++++++++++++++++++++++++++------ 3 files changed, 319 insertions(+), 90 deletions(-) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 19b06b3..1ded597 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -3,6 +3,7 @@ #include #include "wayland-egl/wayland-egl-priv.h" +#include "wayland-egl/wayland-egl-tizen-priv.h" #undef inline @@ -90,6 +91,15 @@ __tpl_wayland_egl_surface_buffer_flusher_fini(tpl_surface_t *surface); static void __tpl_wayland_egl_buffer_free(tpl_wayland_egl_buffer_t *wayland_egl_buffer); +static struct tizen_private * +_get_tizen_private(struct wl_egl_window * wl_egl_window) +{ + if (wl_egl_window && wl_egl_window->driver_private) + return (struct tizen_private *)wl_egl_window->driver_private; + + return NULL; +} + static TPL_INLINE tpl_wayland_egl_buffer_t * __tpl_wayland_egl_get_wayland_buffer_from_tbm_surface(tbm_surface_h surface) { @@ -361,14 +371,16 @@ __tpl_wayland_egl_display_get_window_info(tpl_display_t *display, TPL_ASSERT(window); struct wl_egl_window *wl_egl_window = (struct wl_egl_window *)window; + struct tizen_private *tizen_private = _get_tizen_private(wl_egl_window); if (format) { /* Wayland-egl window doesn't have native format information. It is fixed from 'EGLconfig' when called eglCreateWindowSurface(). So we use the tpl_surface format instead. */ - tpl_surface_t *surface = wl_egl_window->driver_private; - if (surface) *format = surface->format; - else { + if (tizen_private && tizen_private->data) { + tpl_surface_t *surface = (tpl_surface_t *)tizen_private->data; + *format = surface->format; + } else { if (a_size == 8) *format = TBM_FORMAT_ARGB8888; else if (a_size == 0) *format = TBM_FORMAT_XRGB8888; } @@ -422,6 +434,9 @@ __cb_client_window_resize_callback(struct wl_egl_window *wl_egl_window, void *private); static void +__cb_client_window_destroy_callback(void *private); + +static void __cb_client_window_rotate_callback(struct wl_egl_window *wl_egl_window, void *private); @@ -504,6 +519,7 @@ __tpl_wayland_egl_surface_init(tpl_surface_t *surface) tpl_wayland_egl_display_t *wayland_egl_display; tpl_wayland_egl_surface_t *wayland_egl_surface; struct wl_egl_window *wl_egl_window; + struct tizen_private *tizen_private = NULL; tbm_bufmgr bufmgr = NULL; unsigned int capability; int flags = TBM_BO_DEFAULT; @@ -537,7 +553,6 @@ __tpl_wayland_egl_surface_init(tpl_surface_t *surface) wayland_egl_surface->vblank_done = TPL_TRUE; wayland_egl_surface->is_activated = TPL_FALSE; wayland_egl_surface->current_buffer = NULL; - wayland_egl_surface->latest_transform = wl_egl_window->transform; wayland_egl_surface->set_serial_is_used = TPL_FALSE; wayland_egl_surface->serial = 0; @@ -608,19 +623,35 @@ __tpl_wayland_egl_surface_init(tpl_surface_t *surface) goto add_reset_cb_fail; } + + if (wl_egl_window->driver_private) + tizen_private = _get_tizen_private(wl_egl_window); + else { + tizen_private = tizen_private_create(); + wl_egl_window->driver_private = (void *)tizen_private; + } + + if (!tizen_private) { + TPL_ERR("Failed to create tizen_private for wl_egl_window(%p)", wl_egl_window); + goto tizen_private_create_fail; + } + surface->width = wl_egl_window->width; surface->height = wl_egl_window->height; - surface->rotation = wl_egl_window->rotation; + surface->rotation = tizen_private->rotation; surface->rotation_capability = TPL_FALSE; - wl_egl_window->driver_private = surface; + wayland_egl_surface->latest_transform = tizen_private->transform; wl_egl_window->resize_callback = (void *)__cb_client_window_resize_callback; - wl_egl_window->rotate_callback = (void *)__cb_client_window_rotate_callback; - wl_egl_window->get_rotation_capability = (void *) + wl_egl_window->destroy_window_callback = (void *)__cb_client_window_destroy_callback; + + tizen_private->data = (void *)surface; + tizen_private->rotate_callback = (void *)__cb_client_window_rotate_callback; + tizen_private->get_rotation_capability = (void *) __cb_client_window_get_rotation_capability; - wl_egl_window->set_frontbuffer_callback = (void *) + tizen_private->set_frontbuffer_callback = (void *) __cb_client_window_set_frontbuffer_mode; - wl_egl_window->set_window_serial_callback = (void *) + tizen_private->set_window_serial_callback = (void *) __cb_client_window_set_window_serial_callback; /* tdm_vblank object decide to be maintained every tpl_wayland_egl_surface @@ -649,6 +680,7 @@ __tpl_wayland_egl_surface_init(tpl_surface_t *surface) return TPL_ERROR_NONE; +tizen_private_create_fail: create_vblank_fail: tbm_surface_queue_remove_reset_cb(wayland_egl_surface->tbm_queue, __cb_tbm_surface_queue_reset_callback, @@ -688,17 +720,25 @@ __tpl_wayland_egl_surface_fini(tpl_surface_t *surface) if (surface->type == TPL_SURFACE_TYPE_WINDOW) { struct wl_egl_window *wl_egl_window = (struct wl_egl_window *) surface->native_handle; + struct tizen_private *tizen_private = _get_tizen_private(wl_egl_window); int lock_res = 0; TPL_ASSERT(wl_egl_window); /* TPL_ASSERT(wl_egl_window->surface); */ /* to be enabled once evas/gl patch is in place */ + if (tizen_private) { + tizen_private->data = NULL; + tizen_private->rotate_callback = NULL; + tizen_private->get_rotation_capability = NULL; + tizen_private->set_frontbuffer_callback = NULL; + tizen_private->set_window_serial_callback = NULL; + free(tizen_private); + tizen_private = NULL; + } + wl_egl_window->driver_private = NULL; wl_egl_window->resize_callback = NULL; - wl_egl_window->rotate_callback = NULL; - wl_egl_window->get_rotation_capability = NULL; - wl_egl_window->set_frontbuffer_callback = NULL; - wl_egl_window->set_window_serial_callback = NULL; + wl_egl_window->destroy_window_callback = NULL; __tpl_wayland_egl_surface_buffer_flusher_fini(surface); @@ -1185,10 +1225,13 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou struct wl_proxy *wl_proxy = NULL; struct wl_egl_window *wl_egl_window = (struct wl_egl_window *)surface->native_handle; + struct tizen_private *tizen_private = _get_tizen_private(wl_egl_window); tbm_surface_queue_error_e tsq_err = 0; int is_activated = 0; int lock_res = 0; + TPL_ASSERT(tizen_private); + if (sync_fence) *sync_fence = -1; @@ -1281,16 +1324,16 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wayland_egl_buffer->width = wl_egl_window->width; wayland_egl_buffer->height = wl_egl_window->height; - if (wayland_egl_buffer->window_transform != wl_egl_window->window_transform) { - wayland_egl_buffer->window_transform = wl_egl_window->window_transform; + if (wayland_egl_buffer->window_transform != tizen_private->window_transform) { + wayland_egl_buffer->window_transform = tizen_private->window_transform; wayland_egl_buffer->w_rotated = TPL_TRUE; } else { wayland_egl_buffer->w_rotated = TPL_FALSE; } - if (wayland_egl_surface->latest_transform != wl_egl_window->transform) { - wayland_egl_surface->latest_transform = wl_egl_window->transform; - wayland_egl_buffer->transform = wl_egl_window->transform; + if (wayland_egl_surface->latest_transform != tizen_private->transform) { + wayland_egl_surface->latest_transform = tizen_private->transform; + wayland_egl_buffer->transform = tizen_private->transform; wayland_egl_buffer->rotated = TPL_TRUE; } else { wayland_egl_buffer->rotated = TPL_FALSE; @@ -1355,8 +1398,8 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou if (wayland_egl_surface->set_serial_is_used) { wayland_egl_buffer->serial = wayland_egl_surface->serial; } else { - ++wl_egl_window->serial; - wayland_egl_buffer->serial = wl_egl_window->serial; + ++tizen_private->serial; + wayland_egl_buffer->serial = tizen_private->serial; } wayland_egl_buffer->dx = wl_egl_window->dx; @@ -1367,18 +1410,18 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wayland_egl_buffer->wl_proxy = wl_proxy; wayland_egl_buffer->bo = tbm_surface_internal_get_bo(tbm_surface, 0); wayland_egl_buffer->wayland_egl_surface = wayland_egl_surface; - wayland_egl_buffer->transform = wl_egl_window->transform; + wayland_egl_buffer->transform = tizen_private->transform; wayland_egl_buffer->rotated = TPL_TRUE; - if (wayland_egl_buffer->window_transform != wl_egl_window->window_transform) { - wayland_egl_buffer->window_transform = wl_egl_window->window_transform; + if (wayland_egl_buffer->window_transform != tizen_private->window_transform) { + wayland_egl_buffer->window_transform = tizen_private->window_transform; wayland_egl_buffer->w_rotated = TPL_TRUE; } else { wayland_egl_buffer->w_rotated = TPL_FALSE; } - if (wayland_egl_surface->latest_transform != wl_egl_window->transform) { - wayland_egl_surface->latest_transform = wl_egl_window->transform; + if (wayland_egl_surface->latest_transform != tizen_private->transform) { + wayland_egl_surface->latest_transform = tizen_private->transform; wayland_egl_buffer->rotated = TPL_TRUE; } else { wayland_egl_buffer->rotated = TPL_FALSE; @@ -1570,14 +1613,46 @@ static const struct wl_buffer_listener buffer_release_listener = { }; static void +__cb_client_window_destroy_callback(void *private) +{ + struct tizen_private *tizen_private = (struct tizen_private *)private; + tpl_surface_t *surface = NULL; + struct wl_egl_window *wl_egl_window = NULL; + + if (!tizen_private) { + TPL_WARN("[DESTROY_CB] Already destroyed surface"); + return; + } + + surface = (tpl_surface_t *)tizen_private->data; + if (surface) { + TPL_LOG_B("WL_EGL", "[DESTROY_CB] wl_egl_window(%p) tpl_surface(%p)", + surface->native_handle, surface); + wl_egl_window = (struct wl_egl_window *)surface->native_handle; + + wl_egl_window->driver_private = NULL; + surface->native_handle = NULL; + } + + tizen_private->set_window_serial_callback = NULL; + tizen_private->rotate_callback = NULL; + tizen_private->get_rotation_capability = NULL; + tizen_private->set_frontbuffer_callback = NULL; + tizen_private->data = NULL; + free(tizen_private); + tizen_private = NULL; +} + +static void __cb_client_window_resize_callback(struct wl_egl_window *wl_egl_window, - void *private) + void *private) { TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); int cur_w, cur_h, req_w, req_h; - tpl_surface_t *surface = (tpl_surface_t *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; + tpl_surface_t *surface = (tpl_surface_t *)tizen_private->data; tpl_wayland_egl_surface_t *wayland_egl_surface = (tpl_wayland_egl_surface_t *)surface->backend.data; @@ -1602,9 +1677,10 @@ __cb_client_window_rotate_callback(struct wl_egl_window *wl_egl_window, TPL_ASSERT(wl_egl_window); int rotation; - tpl_surface_t *surface = (tpl_surface_t *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; + tpl_surface_t *surface = (tpl_surface_t *)tizen_private->data; - rotation = wl_egl_window->rotation; + rotation = tizen_private->rotation; TPL_LOG_B("WL_EGL", "[ROTATE_CB] wl_egl_window(%p) (%d) -> (%d)", wl_egl_window, surface->rotation, rotation); @@ -1619,7 +1695,9 @@ __cb_client_window_get_rotation_capability(struct wl_egl_window *wl_egl_window, int rotation_capability = WL_EGL_WINDOW_CAPABILITY_NONE; TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); - tpl_surface_t *surface = (tpl_surface_t *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; + tpl_surface_t *surface = (tpl_surface_t *)tizen_private->data; + if (TPL_TRUE == surface->rotation_capability) rotation_capability = WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED; else @@ -1634,7 +1712,8 @@ __cb_client_window_set_frontbuffer_mode(struct wl_egl_window *wl_egl_window, { TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); - tpl_surface_t *surface = (tpl_surface_t *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; + tpl_surface_t *surface = (tpl_surface_t *)tizen_private->data; if (set) surface->is_frontbuffer_mode = TPL_TRUE; @@ -1649,7 +1728,8 @@ __cb_client_window_set_window_serial_callback(struct wl_egl_window *wl_egl_windo TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); - tpl_surface_t *surface = (tpl_surface_t *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; + tpl_surface_t *surface = (tpl_surface_t *)tizen_private->data; TPL_ASSERT(surface->backend.data); diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index ccac3f6..442c158 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -13,6 +13,7 @@ #include "tpl_utils.h" #include "tpl_internal.h" #include "wayland-egl/wayland-egl-priv.h" +#include "wayland-egl/wayland-egl-tizen-priv.h" #include "tpl_wayland_egl_thread.h" #include "wayland-vulkan/wayland-vulkan-client-protocol.h" #include "tpl_utils.h" @@ -200,6 +201,8 @@ static void __cb_buffer_remove_from_list(void *data); static tpl_result_t _twe_surface_wait_vblank(twe_wl_surf_source *surf_source); +static struct tizen_private * +_get_tizen_private(struct wl_egl_window *); static gpointer _twe_thread_loop(gpointer data) @@ -1079,12 +1082,27 @@ twe_display_get_present_mode(twe_display_h display, return TPL_ERROR_NONE; } +static struct tizen_private * +_get_tizen_private(struct wl_egl_window * wl_egl_window) +{ + if (wl_egl_window && wl_egl_window->driver_private) + return (struct tizen_private *)wl_egl_window->driver_private; + + return NULL; +} static void __cb_destroy_callback(void *private) { - twe_wl_surf_source *surf_source = (twe_wl_surf_source *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; + twe_wl_surf_source *surf_source = NULL; + + if (!tizen_private) { + TPL_LOG_T(BACKEND, "[DESTROY_CB] Already destroyed surface"); + return; + } + surf_source = (twe_wl_surf_source *)tizen_private->data; if (surf_source) { TPL_LOG_T(BACKEND, "[DESTROY_CB] wl_egl_window(%p) surf_source(%p)", surf_source->wl_egl_window, surf_source); @@ -1093,8 +1111,24 @@ __cb_destroy_callback(void *private) surf_source->wl_egl_window = NULL; surf_source->surf = NULL; surf_source->is_destroying = TPL_TRUE; + + tizen_private->set_window_serial_callback = NULL; + tizen_private->rotate_callback = NULL; + tizen_private->get_rotation_capability = NULL; + tizen_private->data = NULL; + free(tizen_private); + tizen_private = NULL; g_mutex_unlock(&surf_source->surf_mutex); } + + if (tizen_private) { + tizen_private->set_window_serial_callback = NULL; + tizen_private->rotate_callback = NULL; + tizen_private->get_rotation_capability = NULL; + tizen_private->data = NULL; + free(tizen_private); + tizen_private = NULL; + } } static void @@ -1103,9 +1137,13 @@ __cb_resize_callback(struct wl_egl_window *wl_egl_window, void *private) TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); - twe_wl_surf_source *source = (twe_wl_surf_source *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; int cur_w, cur_h, req_w, req_h, format; + TPL_ASSERT(tizen_private->data); + + twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data; + format = tbm_surface_queue_get_format(source->tbm_queue); cur_w = tbm_surface_queue_get_width(source->tbm_queue); cur_h = tbm_surface_queue_get_height(source->tbm_queue); @@ -1128,8 +1166,11 @@ __cb_rotate_callback(struct wl_egl_window *wl_egl_window, void *private) TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); - int rotation = wl_egl_window->rotation; - twe_wl_surf_source *source = (twe_wl_surf_source *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; + twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data; + int rotation = tizen_private->rotation; + + TPL_ASSERT(source); TPL_LOG_T(BACKEND, "[ROTATE_CB] wl_egl_window(%p) (%d) -> (%d)", wl_egl_window, source->rotation, rotation); @@ -1306,6 +1347,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, { twe_wl_buffer_info *buf_info = NULL; struct wl_egl_window *wl_egl_window = NULL; + struct tizen_private *tizen_private = NULL; if (!surf_source || g_source_is_destroyed(&surf_source->gsource)) { TPL_ERR("Invalid parameter. twe_surface(%p)", surf_source); @@ -1313,6 +1355,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, } wl_egl_window = surf_source->wl_egl_window; + tizen_private = _get_tizen_private(wl_egl_window); if (!tbm_surface || !tbm_surface_internal_is_valid(tbm_surface)) { TPL_ERR("Invalid parameter. tbm_surface(%p)", tbm_surface); @@ -1323,25 +1366,25 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, (void **)&buf_info); /* If buf_info is already existed, reuse it. */ if (buf_info) { - if (wl_egl_window) { - if (buf_info->w_transform != wl_egl_window->window_transform) { - buf_info->w_transform = wl_egl_window->window_transform; + if (tizen_private) { + if (buf_info->w_transform != tizen_private->window_transform) { + buf_info->w_transform = tizen_private->window_transform; buf_info->w_rotated = TPL_TRUE; } - if (surf_source->latest_transform != wl_egl_window->transform) { - surf_source->latest_transform = wl_egl_window->transform; + if (surf_source->latest_transform != tizen_private->transform) { + surf_source->latest_transform = tizen_private->transform; buf_info->rotated = TPL_TRUE; } - buf_info->transform = wl_egl_window->transform; + buf_info->transform = tizen_private->transform; buf_info->dx = wl_egl_window->dx; buf_info->dy = wl_egl_window->dy; if (surf_source->set_serial_is_used) { buf_info->serial = surf_source->serial; } else { - ++wl_egl_window->serial; - buf_info->serial = wl_egl_window->serial; + ++tizen_private->serial; + buf_info->serial = tizen_private->serial; } } @@ -1390,29 +1433,29 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, return; } - if (wl_egl_window) { + if (wl_egl_window && tizen_private) { buf_info->dx = wl_egl_window->dx; buf_info->dy = wl_egl_window->dy; buf_info->width = wl_egl_window->width; buf_info->height = wl_egl_window->height; - if (buf_info->w_transform != wl_egl_window->window_transform) { - buf_info->w_transform = wl_egl_window->window_transform; + if (buf_info->w_transform != tizen_private->window_transform) { + buf_info->w_transform = tizen_private->window_transform; buf_info->w_rotated = TPL_TRUE; } - if (surf_source->latest_transform != wl_egl_window->transform) { - surf_source->latest_transform = wl_egl_window->transform; + if (surf_source->latest_transform != tizen_private->transform) { + surf_source->latest_transform = tizen_private->transform; buf_info->rotated = TPL_TRUE; } - buf_info->transform = wl_egl_window->transform; + buf_info->transform = tizen_private->transform; if (surf_source->set_serial_is_used) { buf_info->serial = surf_source->serial; } else { - ++wl_egl_window->serial; - buf_info->serial = wl_egl_window->serial; + ++tizen_private->serial; + buf_info->serial = tizen_private->serial; } if (surf_source->in_use_buffers) { @@ -2329,13 +2372,20 @@ _twe_thread_wl_surf_source_destroy(void *source) surf_source->rotate_cb = NULL; if (surf_source->wl_egl_window) { + struct tizen_private *tizen_private = NULL; TPL_LOG_T(BACKEND, "twe_surface(%p) wl_egl_window(%p) wl_surface(%p)", surf_source, surf_source->wl_egl_window, surf_source->surf); - surf_source->wl_egl_window->set_window_serial_callback = NULL; + tizen_private = _get_tizen_private(surf_source->wl_egl_window); + if (tizen_private) { + tizen_private->set_window_serial_callback = NULL; + tizen_private->rotate_callback = NULL; + tizen_private->get_rotation_capability = NULL; + tizen_private->data = NULL; + free(tizen_private); + } + surf_source->wl_egl_window->destroy_window_callback = NULL; surf_source->wl_egl_window->resize_callback = NULL; - surf_source->wl_egl_window->rotate_callback = NULL; - surf_source->wl_egl_window->get_rotation_capability = NULL; surf_source->wl_egl_window->driver_private = NULL; surf_source->wl_egl_window = NULL; surf_source->surf = NULL; @@ -2446,20 +2496,31 @@ twe_surface_add(twe_thread* thread, if (!disp_source->is_vulkan_dpy) { struct wl_egl_window *wl_egl_window = (struct wl_egl_window *)native_handle; + struct tizen_private *private = NULL; - wl_egl_window->driver_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; - wl_egl_window->set_window_serial_callback = (void *) - __cb_set_window_serial_callback; + if (wl_egl_window->driver_private) + private = (struct tizen_private *)wl_egl_window->driver_private; + else { + private = tizen_private_create(); + wl_egl_window->driver_private = (void *)private; + } + + if (private) { + private->data = (void *)source; + private->rotate_callback = (void *)__cb_rotate_callback; + private->get_rotation_capability = (void *) + __cb_get_rotation_capability; + private->set_window_serial_callback = (void *) + __cb_set_window_serial_callback; + + source->latest_transform = private->transform; + + wl_egl_window->destroy_window_callback = (void *)__cb_destroy_callback; + wl_egl_window->resize_callback = (void *)__cb_resize_callback; + } source->wl_egl_window = wl_egl_window; source->surf = wl_egl_window->surface; - source->latest_transform = wl_egl_window->transform; - source->vblank_waiting_buffers = __tpl_list_alloc(); } else { @@ -3270,8 +3331,9 @@ twe_get_native_window_info(tpl_handle_t window, int *width, int *height, if (width) *width = wl_egl_window->width; if (height) *height = wl_egl_window->height; if (format) { - if (wl_egl_window->driver_private) { - twe_wl_surf_source *surf_source = (twe_wl_surf_source *)wl_egl_window->driver_private; + struct tizen_private *tizen_private = _get_tizen_private(wl_egl_window); + if (tizen_private && tizen_private->data) { + twe_wl_surf_source *surf_source = (twe_wl_surf_source *)tizen_private->data; *format = surf_source->format; } else { if (a_size == 8) diff --git a/src/wayland-egl/wayland-egl-tizen.c b/src/wayland-egl/wayland-egl-tizen.c index 238d450..acf728b 100644 --- a/src/wayland-egl/wayland-egl-tizen.c +++ b/src/wayland-egl/wayland-egl-tizen.c @@ -1,6 +1,7 @@ #include #include "wayland-egl-tizen.h" #include "wayland-egl-priv.h" +#include "wayland-egl-tizen-priv.h" #define WL_EGL_DEBUG 1 #if WL_EGL_DEBUG @@ -52,34 +53,61 @@ void wl_egl_window_tizen_set_rotation(struct wl_egl_window *egl_window, int rotation) { + struct tizen_private *private = NULL; if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); return; } - if (egl_window->rotation == rotation) { + if (!egl_window->driver_private) { + private = tizen_private_create(); + if (!private) { + WL_EGL_ERR("Failed to create tizen_private."); + return; + } + + egl_window->driver_private = (void *)private; + } else { + private = (struct tizen_private *)egl_window->driver_private; + } + + if (private->rotation == rotation) { WL_EGL_LOG(2, "rotation(%d) egl_window->rotation(%d) already rotated", - rotation, egl_window->rotation); + rotation, private->rotation); return; } - egl_window->rotation = rotation; + private->rotation = rotation; - if (egl_window->rotate_callback) - egl_window->rotate_callback(egl_window, egl_window->driver_private); + if (private->rotate_callback) + private->rotate_callback(egl_window, egl_window->driver_private); } int wl_egl_window_tizen_get_capabilities(struct wl_egl_window *egl_window) { + struct tizen_private *private = NULL; int capabilities = WL_EGL_WINDOW_CAPABILITY_NONE; + if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); - return capabilities; + return -1; } - if (egl_window->get_rotation_capability) - capabilities = egl_window->get_rotation_capability(egl_window, egl_window->driver_private); + if (!egl_window->driver_private) { + private = tizen_private_create(); + if (!private) { + WL_EGL_ERR("Failed to create tizen_private."); + return -1; + } + + egl_window->driver_private = (void *)private; + } else { + private = (struct tizen_private *)egl_window->driver_private; + } + + if (private->get_rotation_capability) + capabilities = private->get_rotation_capability(egl_window, egl_window->driver_private); else capabilities = WL_EGL_WINDOW_CAPABILITY_ROTATION_UNKNOWN; @@ -90,77 +118,136 @@ void wl_egl_window_tizen_set_buffer_transform(struct wl_egl_window *egl_window, int wl_output_transform) { + struct tizen_private *private = NULL; if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); return; } - if (egl_window->transform == wl_output_transform) { + if (!egl_window->driver_private) { + private = tizen_private_create(); + if (!private) { + WL_EGL_ERR("Failed to create tizen_private."); + return; + } + + egl_window->driver_private = (void *)private; + } else { + private = (struct tizen_private *)egl_window->driver_private; + } + + if (private->transform == wl_output_transform) { WL_EGL_LOG(2, - "wl_output_transform(%d) egl_window->transform(%d) already rotated", - wl_output_transform, egl_window->transform); + "wl_output_transform(%d) private->transform(%d) already rotated", + wl_output_transform, private->transform); return; } - egl_window->transform = wl_output_transform; + private->transform = wl_output_transform; } void wl_egl_window_tizen_set_frontbuffer_mode(struct wl_egl_window *egl_window, int set) { + struct tizen_private *private = NULL; if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); return; } - egl_window->frontbuffer_mode = set; + if (!egl_window->driver_private) { + private = tizen_private_create(); + if (!private) { + WL_EGL_ERR("Failed to create tizen_private."); + return; + } + + egl_window->driver_private = (void *)private; + } else { + private = (struct tizen_private *)egl_window->driver_private; + } + + private->frontbuffer_mode = set; - if (egl_window->set_frontbuffer_callback) - egl_window->set_frontbuffer_callback(egl_window, egl_window->driver_private, - set); + if (private->set_frontbuffer_callback) + private->set_frontbuffer_callback(egl_window, egl_window->driver_private, + set); } void wl_egl_window_tizen_set_window_transform(struct wl_egl_window *egl_window, int window_transform) { + struct tizen_private *private = NULL; if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); return; } - if (egl_window->window_transform == window_transform) { + if (!egl_window->driver_private) { + private = tizen_private_create(); + if (!private) { + WL_EGL_ERR("Failed to create tizen_private."); + return; + } + + egl_window->driver_private = (void *)private; + } else { + private = (struct tizen_private *)egl_window->driver_private; + } + + if (private->window_transform == window_transform) { WL_EGL_LOG(2, "window_transform(%d) already rotated", window_transform); return; } - egl_window->window_transform = window_transform; + private->window_transform = window_transform; } unsigned int wl_egl_window_tizen_get_window_serial(struct wl_egl_window *egl_window) { + struct tizen_private *private = NULL; if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); return 0; } - return egl_window->serial; + if (!egl_window->driver_private) { + private = tizen_private_create(); + if (!private) { + WL_EGL_ERR("Failed to create tizen_private."); + return 0; + } + + egl_window->driver_private = (void *)private; + } else { + private = (struct tizen_private *)egl_window->driver_private; + } + + return private->serial; } void wl_egl_window_tizen_set_window_serial(struct wl_egl_window *egl_window, unsigned int serial) { + struct tizen_private *private = NULL; if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); return; } - if (egl_window->set_window_serial_callback) - egl_window->set_window_serial_callback(egl_window, egl_window->driver_private, - serial); + private = egl_window->driver_private; + if (private == NULL) { + WL_EGL_ERR("wl_egl_window(%p) dirver_private is NULL", egl_window); + return; + } + + if (private->set_window_serial_callback) + private->set_window_serial_callback(egl_window, egl_window->driver_private, + serial); } \ No newline at end of file -- 2.7.4 From a6df35ffa6abfa41a163f323db19a7a7389c6fb5 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 1 Jul 2019 16:39:21 +0900 Subject: [PATCH 04/16] [4/4]wayland-egl: Modified to not offer libwayland-egl in the future. - libwayland-egl and its devel packages will be provided by wayland. - Removed what existed to build wayland-egl. - wayland-egl-priv.h is replaced to wayland-egl-backend.h which provided by wayland. Change-Id: I29a669f06b4d3502b0da2472de61639a9873418c Signed-off-by: Joonbum Ko --- configure.ac | 3 +- packaging/libtpl-egl.spec | 48 +------ packaging/libwayland-egl.manifest | 5 - pkgconfig/Makefile.am | 2 +- pkgconfig/wayland-egl.pc.in | 11 -- src/tpl_wayland_egl.c | 10 +- src/tpl_wayland_egl_thread.c | 9 +- src/wayland-egl/Makefile.am | 20 --- src/wayland-egl/wayland-egl-priv.h | 53 -------- src/wayland-egl/wayland-egl-tizen.c | 6 +- src/wayland-egl/wayland-egl.c | 245 ------------------------------------ 11 files changed, 18 insertions(+), 394 deletions(-) delete mode 100644 packaging/libwayland-egl.manifest delete mode 100644 pkgconfig/wayland-egl.pc.in delete mode 100644 src/wayland-egl/wayland-egl-priv.h delete mode 100644 src/wayland-egl/wayland-egl.c diff --git a/configure.ac b/configure.ac index 07b3094..8a4f706 100644 --- a/configure.ac +++ b/configure.ac @@ -60,7 +60,7 @@ AC_ARG_WITH([wayland], [with_wayland=yes]) AS_IF([test "${with_wayland}" = "yes" || test "${with_wayland}" = "1"], - [PKG_CHECK_MODULES([TPL_WL], [libtdm-client wayland-tbm-client wayland-tbm-server tizen-surface-client glib-2.0]) + [PKG_CHECK_MODULES([TPL_WL], [libtdm-client wayland-tbm-client wayland-tbm-server tizen-surface-client glib-2.0 wayland-egl wayland-egl-backend]) TPL_CFLAGS+="$TPL_WL_CFLAGS" TPL_CFLAGS+=" -DTPL_WINSYS_WL=1 " TPL_LIBS+="$TPL_WL_LIBS"], @@ -215,7 +215,6 @@ AC_CONFIG_FILES([ src/wayland-egl/Makefile pkgconfig/Makefile pkgconfig/tpl-egl.pc - pkgconfig/wayland-egl.pc pkgconfig/wayland-egl-tizen.pc ]) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index 340ca71..4459432 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -23,12 +23,6 @@ %define ENABLE_TPL_TEST 0 %define ENABLE_TPL_TEST_GCOV 0 -#WAYLAND-EGL VERSION MACROS -%define WL_EGL_VERSION_MAJOR 1 -%define WL_EGL_VERSION_MINOR 2 -%define WL_EGL_VERSION_PATCH 4 -%define WL_EGL_VERSION %{WL_EGL_VERSION_MAJOR}.%{WL_EGL_VERSION_MINOR}.%{WL_EGL_VERSION_PATCH} - #WAYLAND-EGL-TIZEN VERSION MACROS %define WL_EGL_TIZEN_VERSION_MAJOR 1 %define WL_EGL_TIZEN_VERSION_MINOR 0 @@ -83,6 +77,8 @@ BuildRequires: pkgconfig(wayland-tbm-client) BuildRequires: pkgconfig(wayland-tbm-server) BuildRequires: pkgconfig(tizen-surface-client) BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(wayland-egl) +BuildRequires: pkgconfig(wayland-egl-backend) %endif %if "%{ENABLE_TTRACE}" == "1" @@ -103,39 +99,19 @@ The following window systems are supported: Summary: Development files for TPL Group: System/Libraries Requires: %{name} = %{version}-%{release} -%if "%{TPL_WINSYS}" == "WL" -Requires: libwayland-egl-devel -%endif %description devel This package contains the development libraries and header files needed by the GPU Vendor DDK's EGL. %if "%{TPL_WINSYS}" == "WL" -%package -n libwayland-egl -Version: %{WL_EGL_VERSION} -Release: 0 -Summary: Wayland EGL backend - -%description -n libwayland-egl -Wayland EGL backend - -%package -n libwayland-egl-devel -Version: %{WL_EGL_VERSION} -Release: 0 -Summary: Development header files for use with Wayland protocol -Requires: libwayland-egl - -%description -n libwayland-egl-devel -Development header files for use with Wayland protocol - %package -n libwayland-egl-tizen Version: %{WL_EGL_TIZEN_VERSION} Release: 0 Summary: Wayland EGL TIZEN backend %description -n libwayland-egl-tizen -This package provides tizen specific extension fo wayland-egl. +This package provides tizen specific extension of wayland-egl. %package -n libwayland-egl-tizen-devel Version: %{WL_EGL_TIZEN_VERSION} @@ -164,10 +140,6 @@ export TPL_VERSION_MAJOR=%{TPL_VERSION_MAJOR} export TPL_VERSION_MINOR=%{TPL_VERSION_MINOR} export TPL_VERSION_PATCH=%{TPL_VERSION_PATCH} -export WL_EGL_VERSION_MAJOR=%{WL_EGL_VERSION_MAJOR} -export WL_EGL_VERSION_MINOR=%{WL_EGL_VERSION_MINOR} -export WL_EGL_VERSION_PATCH=%{WL_EGL_VERSION_PATCH} - export WL_EGL_TIZEN_VERSION_MAJOR=%{WL_EGL_TIZEN_VERSION_MAJOR} export WL_EGL_TIZEN_VERSION_MINOR=%{WL_EGL_TIZEN_VERSION_MINOR} export WL_EGL_TIZEN_VERSION_PATCH=%{WL_EGL_TIZEN_VERSION_PATCH} @@ -205,8 +177,6 @@ rm -rf %{buildroot} %postun -p /sbin/ldconfig %if "%{TPL_WINSYS}" == "WL" -%post -n libwayland-egl -p /sbin/ldconfig -%postun -n libwayland-egl -p /sbin/ldconfig %post -n libwayland-egl-tizen -p /sbin/ldconfig %postun -n libwayland-egl-tizen -p /sbin/ldconfig %endif @@ -225,18 +195,6 @@ rm -rf %{buildroot} %{_libdir}/libtpl-egl.so %if "%{TPL_WINSYS}" == "WL" -%files -n libwayland-egl -%manifest packaging/libwayland-egl.manifest -%license COPYING -%defattr(-,root,root,-) -%{_libdir}/libwayland-egl.so* - -%files -n libwayland-egl-devel -%defattr(-,root,root,-) -%{_includedir}/wayland-egl-tizen.h -%{_libdir}/libwayland-egl.so -%{_libdir}/pkgconfig/wayland-egl.pc - %files -n libwayland-egl-tizen %manifest packaging/libwayland-egl-tizen.manifest %license COPYING diff --git a/packaging/libwayland-egl.manifest b/packaging/libwayland-egl.manifest deleted file mode 100644 index 97e8c31..0000000 --- a/packaging/libwayland-egl.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am index ac2f380..fa9867b 100644 --- a/pkgconfig/Makefile.am +++ b/pkgconfig/Makefile.am @@ -1,3 +1,3 @@ pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = tpl-egl.pc wayland-egl.pc wayland-egl-tizen.pc +pkgconfig_DATA = tpl-egl.pc wayland-egl-tizen.pc diff --git a/pkgconfig/wayland-egl.pc.in b/pkgconfig/wayland-egl.pc.in deleted file mode 100644 index 529d543..0000000 --- a/pkgconfig/wayland-egl.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/@LIB@ -includedir=${prefix}/include - -Name: wayland-egl -Description: Wayland EGL Protocol for TIZEN (from Mesa) -Version: 10.2.0 -Requires: wayland-client -Libs: -L${libdir} -lwayland-egl -Cflags: -I${includedir} diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 1ded597..54f9402 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -1,8 +1,8 @@ #define inline __inline__ #include - -#include "wayland-egl/wayland-egl-priv.h" +#include +#include "wayland-egl/wayland-egl-tizen.h" #include "wayland-egl/wayland-egl-tizen-priv.h" #undef inline @@ -1692,16 +1692,16 @@ static int __cb_client_window_get_rotation_capability(struct wl_egl_window *wl_egl_window, void *private) { - int rotation_capability = WL_EGL_WINDOW_CAPABILITY_NONE; + int rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_NONE; TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); struct tizen_private *tizen_private = (struct tizen_private *)private; tpl_surface_t *surface = (tpl_surface_t *)tizen_private->data; if (TPL_TRUE == surface->rotation_capability) - rotation_capability = WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED; + rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED; else - rotation_capability = WL_EGL_WINDOW_CAPABILITY_ROTATION_UNSUPPORTED; + rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_UNSUPPORTED; return rotation_capability; } diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 442c158..1714b38 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -9,10 +9,11 @@ #include #include #include +#include #include "tpl_utils.h" #include "tpl_internal.h" -#include "wayland-egl/wayland-egl-priv.h" +#include "wayland-egl/wayland-egl-tizen.h" #include "wayland-egl/wayland-egl-tizen-priv.h" #include "tpl_wayland_egl_thread.h" #include "wayland-vulkan/wayland-vulkan-client-protocol.h" @@ -1188,12 +1189,12 @@ __cb_get_rotation_capability(struct wl_egl_window *wl_egl_window, TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); - int rotation_capability = WL_EGL_WINDOW_CAPABILITY_NONE; + int rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_NONE; twe_wl_surf_source *source = (twe_wl_surf_source *)private; if (source->rotation_capability == TPL_TRUE) - rotation_capability = WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED; + rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED; else - rotation_capability = WL_EGL_WINDOW_CAPABILITY_ROTATION_UNSUPPORTED; + rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_UNSUPPORTED; return rotation_capability; } diff --git a/src/wayland-egl/Makefile.am b/src/wayland-egl/Makefile.am index 626fa7e..f08f23d 100644 --- a/src/wayland-egl/Makefile.am +++ b/src/wayland-egl/Makefile.am @@ -1,20 +1,3 @@ -libwayland_egl_la_LTLIBRARIES = libwayland-egl.la -libwayland_egl_ladir = $(libdir) - -libwayland_egl_lainclude_HEADERS = wayland-egl-tizen.h -libwayland_egl_laincludedir = $(includedir) - -libwayland_egl_la_CFLAGS = -I$(srcdir) \ - @WL_EGL_CFLAGS@ - -if ENABLE_GCOV -libwayland_egl_la_CFLAGS += -DTIZEN_TEST_GCOV -endif - -libwayland_egl_la_LIBADD = @WL_EGL_LIBS@ -libwayland_egl_la_LDFLAGS = -version-number @WL_EGL_VERSION_MAJOR@:@WL_EGL_VERSION_MINOR@:@WL_EGL_VERSION_PATCH@ -libwayland_egl_la_SOURCES = wayland-egl.c - libwayland_egl_tizen_la_LTLIBRARIES = libwayland-egl-tizen.la libwayland_egl_tizen_ladir = $(libdir) @@ -23,9 +6,6 @@ libwayland_egl_tizen_laincludedir = $(includedir) libwayland_egl_tizen_la_CFLAGS = -I$(srcdir) \ @WL_EGL_TIZEN_CFLAGS@ -if ENABLE_GCOV -libwayland_egl_la_CFLAGS += -DTIZEN_TEST_GCOV -endif libwayland_egl_tizen_la_LIBADD = @WL_EGL_TIZEN_LIBS@ libwayland_egl_tizen_la_LDFLAGS = -version-number @WL_EGL_TIZEN_VERSION_MAJOR@:@WL_EGL_TIZEN_VERSION_MINOR@:@WL_EGL_TIZEN_VERSION_PATCH@ diff --git a/src/wayland-egl/wayland-egl-priv.h b/src/wayland-egl/wayland-egl-priv.h deleted file mode 100644 index 40cbd5b..0000000 --- a/src/wayland-egl/wayland-egl-priv.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef _WAYLAND_EGL_PRIV_H -#define _WAYLAND_EGL_PRIV_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* GCC visibility */ -#if defined(__GNUC__) && __GNUC__ >= 4 -#define WL_EGL_EXPORT __attribute__ ((visibility("default"))) -#else -#define WL_EGL_EXPORT -#endif - -#include -#include - -#define WL_EGL_WINDOW_VERSION 3 - -struct wl_egl_window { - const intptr_t version; - struct wl_surface *surface; - - int width; - int height; - int dx; - int dy; - - int attached_width; - int attached_height; - - void *driver_private; - - /* Tizen specific datas */ - wl_egl_window_rotation rotation; - int frontbuffer_mode; - int transform; - int window_transform; - unsigned int serial; - - void (*destroy_window_callback)(void *); - void (*resize_callback)(struct wl_egl_window *, void *); - void (*rotate_callback)(struct wl_egl_window *, void *); - 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); -}; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/wayland-egl/wayland-egl-tizen.c b/src/wayland-egl/wayland-egl-tizen.c index acf728b..4c127bc 100644 --- a/src/wayland-egl/wayland-egl-tizen.c +++ b/src/wayland-egl/wayland-egl-tizen.c @@ -1,6 +1,6 @@ #include +#include #include "wayland-egl-tizen.h" -#include "wayland-egl-priv.h" #include "wayland-egl-tizen-priv.h" #define WL_EGL_DEBUG 1 @@ -87,7 +87,7 @@ int wl_egl_window_tizen_get_capabilities(struct wl_egl_window *egl_window) { struct tizen_private *private = NULL; - int capabilities = WL_EGL_WINDOW_CAPABILITY_NONE; + int capabilities = WL_EGL_WINDOW_TIZEN_CAPABILITY_NONE; if (egl_window == NULL) { WL_EGL_ERR("egl_window is NULL"); @@ -109,7 +109,7 @@ wl_egl_window_tizen_get_capabilities(struct wl_egl_window *egl_window) if (private->get_rotation_capability) capabilities = private->get_rotation_capability(egl_window, egl_window->driver_private); else - capabilities = WL_EGL_WINDOW_CAPABILITY_ROTATION_UNKNOWN; + capabilities = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_UNKNOWN; return capabilities; } diff --git a/src/wayland-egl/wayland-egl.c b/src/wayland-egl/wayland-egl.c deleted file mode 100644 index 6a8e9ec..0000000 --- a/src/wayland-egl/wayland-egl.c +++ /dev/null @@ -1,245 +0,0 @@ -#include - -#include "wayland-egl-tizen.h" -#include "wayland-egl-priv.h" - -#define WL_EGL_DEBUG 1 -#if WL_EGL_DEBUG - -#include -#include -#include -#include -#include - -unsigned int wl_egl_log_level; - -/* WL-EGL Log Level - 0:unintialized, 1:initialized(no logging), 2:min log, 3:more log */ -#define WL_EGL_LOG(lvl, f, x...) { \ - if (wl_egl_log_level == 1) { \ - } \ - else if (wl_egl_log_level > 1) { \ - if (wl_egl_log_level <= lvl) \ - WL_EGL_LOG_PRINT(f, ##x) \ - } \ - else { \ - char *env = getenv("WL_EGL_LOG_LEVEL"); \ - if (env == NULL) \ - wl_egl_log_level = 1; \ - else \ - wl_egl_log_level = atoi(env); \ - \ - if (wl_egl_log_level > 1 && wl_egl_log_level <= lvl)\ - WL_EGL_LOG_PRINT(f, ##x) \ - } \ - } - -#define WL_EGL_LOG_PRINT(fmt, args...) { \ - printf("[\x1b[32mWL-EGL\x1b[0m %d:%d|\x1b[32m%s\x1b[0m|%d] " fmt "\n", \ - getpid(), (int)syscall(SYS_gettid), __func__, __LINE__, ##args); \ - } - -#define WL_EGL_ERR(f, x...) { \ - printf("[\x1b[31mWL-EGL_ERR\x1b[0m %d:%d|\x1b[31m%s\x1b[0m|%d] " f "\n",\ - getpid(), (int)syscall(SYS_gettid), __func__, __LINE__, ##x); \ - } - -#else -#define WL_EGL_LOG(lvl, f, x...) -#endif - -WL_EGL_EXPORT void -wl_egl_window_resize(struct wl_egl_window *egl_window, - int width, int height, - int dx, int dy) -{ - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - egl_window->dx = dx; - egl_window->dy = dy; - - if ((egl_window->width == width) && (egl_window->height == height)) return; - - egl_window->width = width; - egl_window->height = height; - - if (egl_window->resize_callback) - egl_window->resize_callback(egl_window, egl_window->driver_private); - - WL_EGL_LOG(2, "egl_win:%10p WxH:%dx%d dx:%d dy:%d rsz_cb:%10p", - egl_window, width, height, egl_window->dx, egl_window->dy, - egl_window->resize_callback); -} - -WL_EGL_EXPORT struct wl_egl_window * -wl_egl_window_create(struct wl_surface *surface, - int width, int height) -{ - struct wl_egl_window *egl_window; - - if (width <= 0 || height <= 0) - return NULL; - if (!surface) - return NULL; - - egl_window = malloc(sizeof *egl_window); - if (!egl_window) { - WL_EGL_ERR("failed to allocate memory for egl_window"); - return NULL; - } - intptr_t *version = (intptr_t *)&egl_window->version; - *version = WL_EGL_WINDOW_VERSION; - - egl_window->surface = surface; - - egl_window->width = width; - egl_window->height = height; - - egl_window->resize_callback = NULL; - wl_egl_window_resize(egl_window, width, height, 0, 0); - - egl_window->attached_width = 0; - egl_window->attached_height = 0; - - egl_window->rotation = ROTATION_0; - egl_window->frontbuffer_mode = 0; - egl_window->transform = 0; - egl_window->window_transform = 0; - egl_window->serial = 0; - - egl_window->driver_private = NULL; - egl_window->rotate_callback = NULL; - egl_window->get_rotation_capability = NULL; - - egl_window->destroy_window_callback = NULL; - - WL_EGL_LOG(2, "surf:%10p WxH:%dx%d egl_win:%10p priv:%10p", - surface, width, height, egl_window, egl_window->driver_private); - - return egl_window; -} - -WL_EGL_EXPORT void -wl_egl_window_destroy(struct wl_egl_window *egl_window) -{ - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - if (egl_window->destroy_window_callback) - egl_window->destroy_window_callback(egl_window->driver_private); - - WL_EGL_LOG(2, "egl_win:%10p", egl_window); - - free(egl_window); -} - -WL_EGL_EXPORT void -wl_egl_window_get_attached_size(struct wl_egl_window *egl_window, - int *width, int *height) -{ - if (width) - *width = egl_window->attached_width; - if (height) - *height = egl_window->attached_height; - - WL_EGL_LOG(2, "egl_win:%10p w:%10p h:%10p att_w:%d att_h:%d", - egl_window, width, height, egl_window->attached_width, - egl_window->attached_height); -} - -WL_EGL_EXPORT void -wl_egl_window_set_rotation(struct wl_egl_window *egl_window, - wl_egl_window_rotation rotation) -{ - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - if (egl_window->rotation == rotation) { - WL_EGL_LOG(2, "rotation(%d) egl_window->rotation(%d) already rotated", - rotation, egl_window->rotation); - return; - } - - egl_window->rotation = rotation; - - if (egl_window->rotate_callback) - egl_window->rotate_callback(egl_window, egl_window->driver_private); -} - -WL_EGL_EXPORT void -wl_egl_window_set_buffer_transform(struct wl_egl_window *egl_window, - int wl_output_transform) -{ - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - if (egl_window->transform == wl_output_transform) { - WL_EGL_LOG(2, - "wl_output_transform(%d) egl_window->transform(%d) already rotated", - wl_output_transform, egl_window->transform); - return; - } - - egl_window->transform = wl_output_transform; -} - -WL_EGL_EXPORT int -wl_egl_window_get_capabilities(struct wl_egl_window *egl_window) -{ - int capabilities = WL_EGL_WINDOW_CAPABILITY_NONE; - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return capabilities; - } - - if (egl_window->get_rotation_capability) - capabilities = egl_window->get_rotation_capability(egl_window, egl_window->driver_private); - else - capabilities = WL_EGL_WINDOW_CAPABILITY_ROTATION_UNKNOWN; - - return capabilities; -} - -WL_EGL_EXPORT void -wl_egl_window_set_frontbuffer_mode(struct wl_egl_window *egl_window, - int set) -{ - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - egl_window->frontbuffer_mode = set; - - if (egl_window->set_frontbuffer_callback) - egl_window->set_frontbuffer_callback(egl_window, egl_window->driver_private, - set); -} - -WL_EGL_EXPORT void -wl_egl_window_set_window_transform(struct wl_egl_window *egl_window, - int window_transform) -{ - if (egl_window == NULL) { - WL_EGL_ERR("egl_window is NULL"); - return; - } - - if (egl_window->window_transform == window_transform) { - WL_EGL_LOG(2, - "window_transform(%d) already rotated", - window_transform); - return; - } - - egl_window->window_transform = window_transform; -} -- 2.7.4 From 3c977ece07f513cbc50957cc22eaabb3012a7f16 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 1 Jul 2019 17:03:56 +0900 Subject: [PATCH 05/16] Package version up to 1.6.5 - This fix has dependencies on wayland egl: Changed to flag EGL_PACKAGE to 1 to build wayland-egl. - If there are no any problems, EGL_PACKAGE flag will be deprecated. - This fix has dependencies on libtpl-egl-1.6.5 Change-Id: I318ed83009038c2b66e6db05247e21fec75b14f4 Signed-off-by: Joonbum Ko Change-Id: I61bd6c540d48874bc61de4e80688465a66ec0e2e Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index 4459432..e34294a 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 6 -%define TPL_VERSION_PATCH 4 +%define TPL_VERSION_PATCH 5 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From a6b024ec58c087cda1245bc58f6a4580f2c9d2bc Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 22 Jul 2019 13:20:45 +0900 Subject: [PATCH 06/16] tpl_wayland_egl_thread: Fixed referencing the wrong pointer. Change-Id: I89705ebaa38092bb925b2d2599df3854c174b5f6 Signed-off-by: Joonbum Ko --- src/tpl_wayland_egl_thread.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 1714b38..f3c361f 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -1190,11 +1190,15 @@ __cb_get_rotation_capability(struct wl_egl_window *wl_egl_window, TPL_ASSERT(wl_egl_window); int rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_NONE; - twe_wl_surf_source *source = (twe_wl_surf_source *)private; - if (source->rotation_capability == TPL_TRUE) - rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED; - else - rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_UNSUPPORTED; + struct tizen_private *tizen_private = (struct tizen_private *)private; + + if (tizen_private->data) { + twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data; + if (source->rotation_capability == TPL_TRUE) + rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED; + else + rotation_capability = WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_UNSUPPORTED; + } return rotation_capability; } @@ -1206,12 +1210,17 @@ __cb_set_window_serial_callback(struct wl_egl_window *wl_egl_window, TPL_ASSERT(private); TPL_ASSERT(wl_egl_window); - twe_wl_surf_source *source = (twe_wl_surf_source *)private; + struct tizen_private *tizen_private = (struct tizen_private *)private; + + if (tizen_private->data) { + twe_wl_surf_source *source = (twe_wl_surf_source *)tizen_private->data; - source->set_serial_is_used = TPL_TRUE; - source->serial = serial; + source->set_serial_is_used = TPL_TRUE; + source->serial = serial; + } } + static void __cb_tss_flusher_flush_callback(void *data, struct tizen_surface_shm_flusher *tss_flusher) { -- 2.7.4 From e93b7019e5fba5d380452cccb7f692dd41f65ce7 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 22 Jul 2019 13:21:41 +0900 Subject: [PATCH 07/16] Package version up to 1.6.6 Change-Id: Ib1690eb50809450737712921399323d95e941177 Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index e34294a..d7e8824 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 6 -%define TPL_VERSION_PATCH 5 +%define TPL_VERSION_PATCH 6 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 6593a751e6c9c48c93eb2470374c485af3627e21 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 26 Jul 2019 17:28:19 +0900 Subject: [PATCH 08/16] add pc flies instead of the wayland-devel at BuildRequires Change-Id: I06e58c92e9cb7fc4e7e4b540752f3b4493b73c4a --- packaging/libtpl-egl.spec | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index d7e8824..a943cea 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -71,14 +71,15 @@ BuildRequires: pkgconfig(libdrm) %if "%{TPL_WINSYS}" == "WL" BuildRequires: libtool -BuildRequires: wayland-devel BuildRequires: pkgconfig(libtdm-client) +BuildRequires: pkgconfig(wayland-client) +BuildRequires: pkgconfig(wayland-server) +BuildRequires: pkgconfig(wayland-egl) +BuildRequires: pkgconfig(wayland-egl-backend) BuildRequires: pkgconfig(wayland-tbm-client) -BuildRequires: pkgconfig(wayland-tbm-server) -BuildRequires: pkgconfig(tizen-surface-client) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(wayland-egl) -BuildRequires: pkgconfig(wayland-egl-backend) +BuildRequires: pkgconfig(wayland-tbm-server) +BuildRequires: pkgconfig(tizen-surface-client) +BuildRequires: pkgconfig(glib-2.0) %endif %if "%{ENABLE_TTRACE}" == "1" -- 2.7.4 From 23169352aa55eb0237b09787583c6fed51a08417 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 26 Jul 2019 17:30:07 +0900 Subject: [PATCH 09/16] Package version up to 1.6.7 Change-Id: Ifa0c8fbbddd64e071234116a86ed1e8fea4637b4 --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index a943cea..f8de9fe 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 6 -%define TPL_VERSION_PATCH 6 +%define TPL_VERSION_PATCH 7 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From c255a0a2f270c3094e3e1556f7d84b3dc081d395 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 23 Jul 2019 17:15:46 +0900 Subject: [PATCH 10/16] tbm: Added reset callback for validate checking Change-Id: If17acc9a41c589dadb4d15800d799380334c9ee7 Signed-off-by: Joonbum Ko --- src/tpl_tbm.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/tpl_tbm.c b/src/tpl_tbm.c index 33dd453..43dee96 100644 --- a/src/tpl_tbm.c +++ b/src/tpl_tbm.c @@ -37,6 +37,8 @@ struct _tpl_tbm_surface { tpl_bool_t need_worker_clear; int present_mode; + + tpl_bool_t need_reset; }; struct _tpl_tbm_buffer { @@ -429,6 +431,22 @@ __tpl_tbm_surface_destroy_swapchain(tpl_surface_t *surface) return TPL_ERROR_NONE; } +static void +__cb_tbm_queue_reset_callback(tbm_surface_queue_h tbm_queue, + void *data) +{ + tpl_tbm_surface_t *tpl_tbm_surface = (tpl_tbm_surface_t *)data; + + if (!tpl_tbm_surface) { + TPL_ERR("Invalid parameter. tpl_tbm_surface(%p)", tpl_tbm_surface); + return; + } + + TPL_LOG_B("TBM", "tbm_queue(%p) has been reset!", tbm_queue); + + tpl_tbm_surface->need_reset = TPL_TRUE; +} + static tpl_result_t __tpl_tbm_surface_init(tpl_surface_t *surface) { @@ -443,6 +461,8 @@ __tpl_tbm_surface_init(tpl_surface_t *surface) surface->backend.data = (void *)tpl_tbm_surface; + tpl_tbm_surface->need_reset = TPL_FALSE; + if (surface->type == TPL_SURFACE_TYPE_WINDOW) { if (__tpl_tbm_display_get_window_info(surface->display, surface->native_handle, &surface->width, @@ -456,6 +476,11 @@ __tpl_tbm_surface_init(tpl_surface_t *surface) __tpl_tbm_surface_queue_notify_cb, surface); + /* Set reset_callback to tbm_queue */ + tbm_surface_queue_add_reset_cb((tbm_surface_queue_h)surface->native_handle, + __cb_tbm_queue_reset_callback, + (void *)tpl_tbm_surface); + TPL_LOG_B("TBM", "[INIT] tpl_surface(%p) tpl_tbm_surface_t(%p) tbm_surface_queue(%p)", surface, tpl_tbm_surface, surface->native_handle); @@ -633,9 +658,12 @@ __tpl_tbm_surface_enqueue_buffer(tpl_surface_t *surface, static tpl_bool_t __tpl_tbm_surface_validate(tpl_surface_t *surface) { - TPL_IGNORE(surface); + tpl_tbm_surface_t *tpl_tbm_surface = (tpl_tbm_surface_t *)surface->backend.data; + tpl_bool_t ret = TPL_TRUE; + + ret = !tpl_tbm_surface->need_reset; - return TPL_TRUE; + return ret; } static tbm_surface_h @@ -646,6 +674,7 @@ __tpl_tbm_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, tbm_surface_queue_h tbm_queue = NULL; tbm_surface_queue_error_e tsq_err = TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE; tpl_tbm_buffer_t *tpl_tbm_buffer = NULL; + tpl_tbm_surface_t *tpl_tbm_surface = (tpl_tbm_surface_t *)surface->backend.data; TPL_ASSERT(surface); TPL_ASSERT(surface->native_handle); @@ -684,6 +713,8 @@ __tpl_tbm_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, /* It will be dec when before tbm_surface_queue_enqueue called */ tbm_surface_internal_ref(tbm_surface); + tpl_tbm_surface->need_reset = TPL_FALSE; + TPL_LOG_B("TBM", "[DEQ] tpl_surface(%p) tbm_queue(%p) tbm_surface(%p) bo(%d)", surface, tbm_queue, tbm_surface, tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0))); -- 2.7.4 From 53501ba5df9a6ce5ecbdad983e7371287b342f6f Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 13 Aug 2019 20:38:03 +0900 Subject: [PATCH 11/16] Package version up to 1.6.8 Change-Id: Ib8adc572ea1692e36bb623f0bde4f685170b0e76 --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index f8de9fe..1c5433c 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 6 -%define TPL_VERSION_PATCH 7 +%define TPL_VERSION_PATCH 8 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 631f0f8b3764746b14e5a03012412ac823ec96ef Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 1 Nov 2019 13:25:26 +0900 Subject: [PATCH 12/16] package version up to 1.7.0 tizen 6.0 starts here. Change-Id: I607119bcfac5f8d3e1438bbe5e784475025ff319 --- packaging/libtpl-egl.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index 1c5433c..a06d7ae 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -3,8 +3,8 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 -%define TPL_VERSION_MINOR 6 -%define TPL_VERSION_PATCH 8 +%define TPL_VERSION_MINOR 7 +%define TPL_VERSION_PATCH 0 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4 From 30f807920870e70360bffaa3a135e09d8b5ea34d Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 26 Aug 2019 11:48:59 +0900 Subject: [PATCH 13/16] tpl_wayland_egl: set need_to_release flag before commit it is possible that get release event before need_to_rlease flag is set Change-Id: I2010350256cbaa90eaa9f506acd1748f1bd247b6 --- src/tpl_wayland_egl.c | 3 ++- src/tpl_wayland_egl_thread.c | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 54f9402..70e37a5 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -929,10 +929,11 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface, wayland_tbm_client_set_buffer_serial(wayland_egl_display->wl_tbm_client, (void *)wayland_egl_buffer->wl_proxy, wayland_egl_buffer->serial); - wl_surface_commit(wl_egl_window->surface); wayland_egl_buffer->need_to_release = TPL_TRUE; + wl_surface_commit(wl_egl_window->surface); + wl_display_flush(wayland_egl_display->wl_dpy); TPL_LOG_B("WL_EGL", diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index f3c361f..1c5d5bf 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -1810,6 +1810,10 @@ _twe_thread_wl_vk_surface_commit(twe_wl_surf_source *surf_source, } } } + + /* Dependent on wl_buffer release event. */ + buf_info->need_to_release = TPL_TRUE; + wl_surface_commit(wl_surface); TRACE_MARK("[COMMIT] BO(%d)", @@ -1847,10 +1851,6 @@ _twe_thread_wl_vk_surface_commit(twe_wl_surf_source *surf_source, TPL_ERR("Failed to release tbm_surface(%p) when vk_surface_commit.", tbm_surface); } - - /* Dependent on wl_buffer release event. */ - buf_info->need_to_release = TPL_TRUE; - } static void @@ -1928,13 +1928,15 @@ _twe_thread_wl_surface_commit(twe_wl_surf_source *surf_source, wayland_tbm_client_set_buffer_serial(disp_source->wl_tbm_client, (void *)buf_info->wl_buffer, buf_info->serial); + + buf_info->need_to_release = TPL_TRUE; + wl_surface_commit(wl_surface); TRACE_ASYNC_BEGIN((int)tbm_surface, "[COMMIT ~ RELEASE] BO(%d)", tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0))); buf_info->need_to_commit = TPL_FALSE; - buf_info->need_to_release = TPL_TRUE; TPL_LOG_T(BACKEND, "[COMMIT] wl_buffer(%p) tbm_surface(%p) bo(%d)", buf_info->wl_buffer, tbm_surface, -- 2.7.4 From 514d363d7e82fe829dce3b2774d5e503be38d561 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 26 Aug 2019 12:51:30 +0900 Subject: [PATCH 14/16] tpl_wayland_egl: check latest_transform in surface_commit if rotated buffer is canceled dequeue, wl_surface_set_buffer_transform isn't called Change-Id: I19e9b363bf21a532ae05aa6bd0dd7644e88a72ab --- src/tpl_wayland_egl.c | 32 +++++++++----------------------- src/tpl_wayland_egl_thread.c | 29 +++++++++++------------------ 2 files changed, 20 insertions(+), 41 deletions(-) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 70e37a5..71f90c7 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -63,7 +63,6 @@ struct _tpl_wayland_egl_buffer { int window_transform; tbm_bo bo; tpl_bool_t w_rotated; /* TRUE if need to call wayland_tbm_client_set_buffer_transform */ - tpl_bool_t rotated; /* TRUE if need to call wl_surface_set_buffer_transform */ tpl_bool_t is_new; /* for frontbuffer mode */ tpl_bool_t need_to_release; /* for checking need release */ struct wl_proxy *wl_proxy; /* wl_buffer proxy */ @@ -878,10 +877,10 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface, wayland_egl_buffer->w_rotated = TPL_FALSE; } - if (wayland_egl_buffer->rotated == TPL_TRUE) { + if (wayland_egl_surface->latest_transform != wayland_egl_buffer->transform) { + wayland_egl_surface->latest_transform = wayland_egl_buffer->transform; wl_surface_set_buffer_transform(wl_egl_window->surface, wayland_egl_buffer->transform); - wayland_egl_buffer->rotated = TPL_FALSE; } wl_surface_attach(wl_egl_window->surface, (void *)wayland_egl_buffer->wl_proxy, @@ -1324,6 +1323,7 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wayland_egl_buffer->dy = wl_egl_window->dy; wayland_egl_buffer->width = wl_egl_window->width; wayland_egl_buffer->height = wl_egl_window->height; + wayland_egl_buffer->transform = tizen_private->transform; if (wayland_egl_buffer->window_transform != tizen_private->window_transform) { wayland_egl_buffer->window_transform = tizen_private->window_transform; @@ -1332,14 +1332,6 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wayland_egl_buffer->w_rotated = TPL_FALSE; } - if (wayland_egl_surface->latest_transform != tizen_private->transform) { - wayland_egl_surface->latest_transform = tizen_private->transform; - wayland_egl_buffer->transform = tizen_private->transform; - wayland_egl_buffer->rotated = TPL_TRUE; - } else { - wayland_egl_buffer->rotated = TPL_FALSE; - } - if (wayland_egl_surface->is_activated != is_activated) wayland_egl_buffer->is_new = TPL_TRUE; @@ -1360,10 +1352,11 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wayland_egl_buffer->wl_proxy, tbm_surface, tbm_bo_export(wayland_egl_buffer->bo)); TPL_LOG_B("WL_EGL", - "[DEQ] size(%dx%d) transform(%d) rotated(%s)", + "[DEQ] size(%dx%d) transform(%d) w_transform(%d) w_rotated(%s)", wayland_egl_buffer->width, wayland_egl_buffer->height, wayland_egl_buffer->transform, - wayland_egl_buffer->rotated ? "[TRUE]" : "[FALSE]"); + wayland_egl_buffer->window_transform, + wayland_egl_buffer->w_rotated ? "[TRUE]" : "[FALSE]"); if (lock_res == 0) pthread_mutex_unlock(&wayland_egl_display->wl_event_mutex); return tbm_surface; @@ -1412,7 +1405,6 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wayland_egl_buffer->bo = tbm_surface_internal_get_bo(tbm_surface, 0); wayland_egl_buffer->wayland_egl_surface = wayland_egl_surface; wayland_egl_buffer->transform = tizen_private->transform; - wayland_egl_buffer->rotated = TPL_TRUE; if (wayland_egl_buffer->window_transform != tizen_private->window_transform) { wayland_egl_buffer->window_transform = tizen_private->window_transform; @@ -1421,13 +1413,6 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wayland_egl_buffer->w_rotated = TPL_FALSE; } - if (wayland_egl_surface->latest_transform != tizen_private->transform) { - wayland_egl_surface->latest_transform = tizen_private->transform; - wayland_egl_buffer->rotated = TPL_TRUE; - } else { - wayland_egl_buffer->rotated = TPL_FALSE; - } - /* 'is_new' flag is to check wheter it is a new buffer need to commit * in frontbuffer mode. */ wayland_egl_buffer->is_new = TPL_TRUE; @@ -1448,10 +1433,11 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou tbm_bo_export(wayland_egl_buffer->bo)); TPL_LOG_B("WL_EGL", - "[DEQ] size(%dx%d) transform(%d) rotated(%s)", + "[DEQ] size(%dx%d) transform(%d) w_transform(%d) w_rotated(%s)", wayland_egl_buffer->width, wayland_egl_buffer->height, wayland_egl_buffer->transform, - wayland_egl_buffer->rotated ? "[TRUE]" : "[FALSE]"); + wayland_egl_buffer->window_transform, + wayland_egl_buffer->w_rotated ? "[TRUE]" : "[FALSE]"); if (wayland_egl_surface->dequeued_buffers) { TPL_OBJECT_LOCK(&wayland_egl_surface->base); diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c index 1c5d5bf..99b36b2 100644 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -145,7 +145,6 @@ struct _twe_wl_buffer_info { tpl_bool_t w_rotated; /* for wl_surface_set_buffer_transform */ int transform; - tpl_bool_t rotated; /* for damage region */ int num_rects; int *rects; @@ -1382,11 +1381,6 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, buf_info->w_rotated = TPL_TRUE; } - if (surf_source->latest_transform != tizen_private->transform) { - surf_source->latest_transform = tizen_private->transform; - buf_info->rotated = TPL_TRUE; - } - buf_info->transform = tizen_private->transform; buf_info->dx = wl_egl_window->dx; buf_info->dy = wl_egl_window->dy; @@ -1419,10 +1413,12 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0))); TPL_LOG_T(BACKEND, - "[REUSE_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) transform(%d)", + "[REUSE_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) " + "transform(%d) w_transform(%d)", buf_info, tbm_surface, tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)), - buf_info->width, buf_info->height, buf_info->transform); + buf_info->width, buf_info->height, + buf_info->transform, buf_info->w_transform); return; } @@ -1454,11 +1450,6 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, buf_info->w_rotated = TPL_TRUE; } - if (surf_source->latest_transform != tizen_private->transform) { - surf_source->latest_transform = tizen_private->transform; - buf_info->rotated = TPL_TRUE; - } - buf_info->transform = tizen_private->transform; if (surf_source->set_serial_is_used) { @@ -1481,7 +1472,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, buf_info->height = surf_source->swapchain_properties.height; buf_info->w_transform = 0; buf_info->w_rotated = TPL_FALSE; - buf_info->rotated = TPL_FALSE; + buf_info->transform = 0; buf_info->serial = 0; } @@ -1522,10 +1513,12 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source, TRACE_MARK("[SET_BUFFER_INFO] BO(%d)", tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0))); TPL_LOG_T(BACKEND, - "[NEW_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) transform(%d)", + "[NEW_BUF] buf_info(%p) tbm_surface(%p) bo(%d) (%dx%d) " + "transform(%d) w_transform(%d)", buf_info, tbm_surface, tbm_bo_export(tbm_surface_internal_get_bo(tbm_surface, 0)), - buf_info->width, buf_info->height, buf_info->transform); + buf_info->width, buf_info->height, + buf_info->transform, buf_info->w_transform); } static void @@ -1881,9 +1874,9 @@ _twe_thread_wl_surface_commit(twe_wl_surf_source *surf_source, buf_info->w_rotated = TPL_FALSE; } - if (buf_info->rotated == TPL_TRUE) { + if (surf_source->latest_transform != buf_info->transform) { + surf_source->latest_transform = buf_info->transform; wl_surface_set_buffer_transform(wl_surface, buf_info->transform); - buf_info->rotated = TPL_FALSE; } if (wl_egl_window) { -- 2.7.4 From 16c88f212c6ec2642e6308f9baf77a12771495de Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 6 Aug 2019 19:53:07 +0900 Subject: [PATCH 15/16] tpl_surface: set post_interval in tdm_client_vblank_wait Change-Id: Ib936a993439f0bb3ab4c2d5049204305da013142 --- src/tpl_internal.h | 1 + src/tpl_surface.c | 19 +++++++++++++++++-- src/tpl_wayland_egl.c | 2 +- src/tpl_wayland_egl_thread.c | 23 ++++++++++++++++++++++- src/tpl_wayland_egl_thread.h | 2 ++ src/tpl_wl_egl_thread.c | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/tpl_internal.h mode change 100644 => 100755 src/tpl_surface.c mode change 100644 => 100755 src/tpl_wayland_egl.c mode change 100644 => 100755 src/tpl_wayland_egl_thread.c mode change 100644 => 100755 src/tpl_wayland_egl_thread.h mode change 100644 => 100755 src/tpl_wl_egl_thread.c diff --git a/src/tpl_internal.h b/src/tpl_internal.h old mode 100644 new mode 100755 index 6dff22f..ba161c9 --- a/src/tpl_internal.h +++ b/src/tpl_internal.h @@ -110,6 +110,7 @@ struct _tpl_surface_backend { 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 { diff --git a/src/tpl_surface.c b/src/tpl_surface.c old mode 100644 new mode 100755 index 8c14e82..994aec3 --- a/src/tpl_surface.c +++ b/src/tpl_surface.c @@ -243,16 +243,29 @@ tpl_surface_validate(tpl_surface_t *surface) 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 @@ -269,6 +282,8 @@ tpl_surface_get_post_interval(tpl_surface_t *surface) interval = surface->post_interval; TPL_OBJECT_UNLOCK(surface); + TPL_LOG_F("tpl_surface_t(%p) post_interval(%d)", surface, interval); + return interval; } diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c old mode 100644 new mode 100755 index 71f90c7..69b34de --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -962,7 +962,7 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface, 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 */ diff --git a/src/tpl_wayland_egl_thread.c b/src/tpl_wayland_egl_thread.c old mode 100644 new mode 100755 index 99b36b2..13a6a14 --- a/src/tpl_wayland_egl_thread.c +++ b/src/tpl_wayland_egl_thread.c @@ -134,6 +134,8 @@ struct _twe_wl_surf_source { GMutex sub_thread_mutex; GCond sub_thread_cond; int draw_done_count; + + int post_interval; }; struct _twe_wl_buffer_info { @@ -1739,7 +1741,7 @@ _twe_surface_wait_vblank(twe_wl_surf_source *surf_source) } 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); @@ -2498,6 +2500,8 @@ twe_surface_add(twe_thread* thread, 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; @@ -3371,3 +3375,20 @@ twe_get_native_buffer_from_pixmap(tpl_handle_t pixmap) 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; +} diff --git a/src/tpl_wayland_egl_thread.h b/src/tpl_wayland_egl_thread.h old mode 100644 new mode 100755 index 6cb9116..067def1 --- a/src/tpl_wayland_egl_thread.h +++ b/src/tpl_wayland_egl_thread.h @@ -110,3 +110,5 @@ twe_get_native_window_info(tpl_handle_t window, int *width, int *height, tbm_for 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); diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c old mode 100644 new mode 100755 index 4ebe168..980c599 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -477,6 +477,36 @@ __tpl_wl_egl_surface_set_rotation_capability(tpl_surface_t *surface, } 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, int num_rects, const int *rects, tbm_fd sync_fence) @@ -805,5 +835,7 @@ __tpl_surface_init_backend_wl_egl_thread(tpl_surface_backend_t *backend) 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; } -- 2.7.4 From 1192f77560a082299b777867cc143ae5463963d5 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 8 Nov 2019 13:30:39 +0900 Subject: [PATCH 16/16] Package version up to 1.7.1 Change-Id: Ifa18b79ce7d511e8d294fe59ab0713e36123b111 Signed-off-by: Joonbum Ko --- packaging/libtpl-egl.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtpl-egl.spec b/packaging/libtpl-egl.spec index a06d7ae..7b4b3eb 100644 --- a/packaging/libtpl-egl.spec +++ b/packaging/libtpl-egl.spec @@ -4,7 +4,7 @@ #TPL VERSION MACROS %define TPL_VERSION_MAJOR 1 %define TPL_VERSION_MINOR 7 -%define TPL_VERSION_PATCH 0 +%define TPL_VERSION_PATCH 1 %define TPL_VERSION %{TPL_VERSION_MAJOR}.%{TPL_VERSION_MINOR}.%{TPL_VERSION_PATCH} #TPL WINDOW SYSTEM DEFINITION -- 2.7.4