tpl_wayland_egl: Implement related to window rotation 27/135727/1
authorjoonbum.ko <joonbum.ko@samsung.com>
Mon, 26 Jun 2017 06:42:32 +0000 (15:42 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Mon, 26 Jun 2017 06:47:30 +0000 (15:47 +0900)
 - Only wayland_tbm_client_set_buffer_transform is called for buffers
  that need to be updated after window rotation occurs.

Change-Id: I2905fdf34536bd55eebdf943165ac364aa21d9d7
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl.c
src/tpl_wayland_egl_thread.c

index c5ad096..8f090f2 100644 (file)
@@ -61,7 +61,9 @@ struct _tpl_wayland_egl_buffer {
        int dx, dy;
        int width, height;
        int transform;
+       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 reset; /* TRUE if queue reseted by external */
        tpl_bool_t is_new; /* for frontbuffer mode */
@@ -738,9 +740,18 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface,
 
        version = wl_proxy_get_version((struct wl_proxy *)wl_egl_window->surface);
 
+       if (wayland_egl_buffer->w_rotated == TPL_TRUE) {
+               wayland_tbm_client_set_buffer_transform(
+                               wayland_egl_display->wl_tbm_client,
+                               (void *)wayland_egl_buffer->wl_proxy,
+                               wayland_egl_buffer->window_transform);
+               wayland_egl_buffer->w_rotated = TPL_FALSE;
+       }
+
        if (wayland_egl_buffer->rotated == TPL_TRUE) {
                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,
@@ -1195,6 +1206,13 @@ __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;
+                       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;
@@ -1266,6 +1284,13 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou
        wayland_egl_buffer->wayland_egl_surface = wayland_egl_surface;
        wayland_egl_buffer->transform = wl_egl_window->transform;
 
+       if (wayland_egl_buffer->window_transform != wl_egl_window->window_transform) {
+               wayland_egl_buffer->window_transform = wl_egl_window->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->rotated = TPL_TRUE;
index c2642c1..4e1c907 100644 (file)
@@ -82,6 +82,9 @@ struct _twe_wl_buffer_info {
        struct wl_proxy *wl_buffer;
        int dx, dy;
        int width, height;
+       /* for wayland_tbm_client_set_buffer_transform */
+       int w_transform;
+       tpl_bool_t w_rotated;
        /* for wl_surface_set_buffer_transform */
        int transform;
        tpl_bool_t rotated;
@@ -853,6 +856,11 @@ static void __cb_tbm_queue_trace_callback(tbm_surface_queue_h tbm_queue,
                                                                           (void **)&buf_info);
        /* If buf_info is already existed, reuse it. */
        if (buf_info) {
+               if (buf_info->w_transform != wl_egl_window->window_transform) {
+                       buf_info->w_transform = wl_egl_window->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;
                        buf_info->rotated = TPL_TRUE;
@@ -910,10 +918,17 @@ static void __cb_tbm_queue_trace_callback(tbm_surface_queue_h tbm_queue,
        buf_info->num_rects = 0;
        buf_info->rects = NULL;
        buf_info->need_to_commit = TPL_TRUE;
+
+       if (buf_info->w_transform != wl_egl_window->window_transform) {
+               buf_info->w_transform = wl_egl_window->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;
                buf_info->rotated = TPL_TRUE;
        }
+
        buf_info->transform = wl_egl_window->rotation;
 
        wl_buffer_add_listener((void *)buf_info->wl_buffer,
@@ -981,8 +996,17 @@ _twe_thread_wl_surface_commit(twe_wl_surf_source *surf_source,
 
        version = wl_proxy_get_version((struct wl_proxy *)wl_surface);
 
+       if (buf_info->w_rotated == TPL_TRUE) {
+               wayland_tbm_client_set_buffer_transform(
+                               surf_source->disp_source->wl_tbm_client,
+                               (void *)buf_info->wl_buffer,
+                               buf_info->w_transform);
+               buf_info->w_rotated = TPL_FALSE;
+       }
+
        if (buf_info->rotated == TPL_TRUE) {
                wl_surface_set_buffer_transform(wl_surface, buf_info->transform);
+               buf_info->rotated = TPL_FALSE;
        }
 
        wl_egl_window->attached_width = buf_info->width;