wayland_egl: Added new APIs related with serial 92/186992/7
authorJuyeon Lee <juyeonne.lee@samsung.com>
Fri, 17 Aug 2018 05:11:23 +0000 (14:11 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Tue, 11 Sep 2018 01:37:21 +0000 (10:37 +0900)
- once dequeue, increase serial number and assign it both on
wl_egl_window and twe_wl_buffer_info.

- at the same time of wl_surface_commit, deliver the serial to wayland-tbm server
by using wayland_tbm_client_set_buffer_serial

- New wayland_egl API:
unsigned int wl_egl_window_tizen_get_window_serial(struct wl_egl_window *egl_window)
egl_window cannot be NULL

Change-Id: I8a607be8c44b2a37e8ba90cceae3e3962a128ec9

src/tpl_wayland_egl.c
src/tpl_wayland_egl_thread.c
src/wayland-egl/wayland-egl-priv.h
src/wayland-egl/wayland-egl-tizen.c
src/wayland-egl/wayland-egl-tizen.h
src/wayland-egl/wayland-egl.c

index e2d8924..01be90d 100644 (file)
@@ -64,6 +64,7 @@ struct _tpl_wayland_egl_buffer {
        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 */
+       unsigned int serial; /* increase while dequeue */
 };
 
 static tpl_list_t *committed_wl_buffers = NULL;
@@ -851,6 +852,9 @@ __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;
@@ -1310,6 +1314,9 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
 
        wl_display_flush(wayland_egl_display->wl_dpy);
 
+       ++wl_egl_window->serial;
+       wayland_egl_buffer->serial = wl_egl_window->serial;
+
        wayland_egl_buffer->dx = wl_egl_window->dx;
        wayland_egl_buffer->dy = wl_egl_window->dy;
        wayland_egl_buffer->width = wl_egl_window->width;
index 24b74c3..7f5808b 100644 (file)
@@ -165,6 +165,9 @@ struct _twe_wl_buffer_info {
        tbm_surface_h tbm_surface;
 
        twe_wl_surf_source *surf_source;
+
+       /* for wayland_tbm_client_set_buffer_serial */
+       unsigned int serial;
 };
 
 struct _vk_sync_draw_source {
@@ -1314,6 +1317,8 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                        buf_info->transform = wl_egl_window->transform;
                        buf_info->dx = wl_egl_window->dx;
                        buf_info->dy = wl_egl_window->dy;
+                       ++wl_egl_window->serial;
+                       buf_info->serial = wl_egl_window->serial;
                }
 
                if (buf_info->rects) {
@@ -1378,6 +1383,8 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                }
 
                buf_info->transform = wl_egl_window->transform;
+               ++wl_egl_window->serial;
+               buf_info->serial = wl_egl_window->serial;
        } else {
                buf_info->dx = 0;
                buf_info->dy = 0;
@@ -1386,6 +1393,7 @@ _twe_surface_set_wl_buffer_info(twe_wl_surf_source *surf_source,
                buf_info->w_transform = 0;
                buf_info->w_rotated = TPL_FALSE;
                buf_info->rotated = TPL_FALSE;
+               buf_info->serial = 0;
        }
 
        buf_info->sync_timestamp = 0;
@@ -1842,7 +1850,9 @@ _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);
        wl_surface_commit(wl_surface);
 
        TRACE_ASYNC_BEGIN((int)tbm_surface, "[COMMIT ~ RELEASE] BO(%d)",
index 3e1f08a..0f87713 100644 (file)
@@ -30,6 +30,7 @@ struct wl_egl_window {
        int frontbuffer_mode;
        int transform;
        int window_transform;
+       unsigned int serial;
 
        void *private;
        void (*destroy_window_callback)(void *);
index a342cca..d3af986 100644 (file)
@@ -139,3 +139,14 @@ wl_egl_window_tizen_set_window_transform(struct wl_egl_window *egl_window,
 
        egl_window->window_transform = window_transform;
 }
+
+unsigned int
+wl_egl_window_tizen_get_window_serial(struct wl_egl_window *egl_window)
+{
+       if (egl_window == NULL) {
+               WL_EGL_ERR("egl_window is NULL");
+               return 0;
+       }
+
+       return egl_window->serial;
+}
\ No newline at end of file
index cbc03f6..6c76177 100644 (file)
@@ -66,6 +66,9 @@ void
 wl_egl_window_tizen_set_window_transform(struct wl_egl_window *egl_window,
                                                                                 int window_transform);
 
+unsigned int
+wl_egl_window_tizen_get_window_serial(struct wl_egl_window *egl_window);
+
 #ifdef  __cplusplus
 }
 #endif
index 5c16bcf..cdb8b6a 100644 (file)
@@ -106,6 +106,7 @@ wl_egl_window_create(struct wl_surface *surface,
        egl_window->frontbuffer_mode = 0;
        egl_window->transform = 0;
        egl_window->window_transform = 0;
+       egl_window->serial = 0;
 
        egl_window->private = NULL;
        egl_window->rotate_callback = NULL;
@@ -240,4 +241,3 @@ wl_egl_window_set_window_transform(struct wl_egl_window *egl_window,
 
        egl_window->window_transform = window_transform;
 }
-