From 115ebb65c80ebce7ea47f5d2363e47c4907300ba Mon Sep 17 00:00:00 2001 From: "joonbum.ko" Date: Thu, 16 Mar 2017 09:13:32 +0900 Subject: [PATCH] tpl_wayland_egl: Added geometry information of the client window to tpl_wayland_egl_buffer_t. - Store the native window information when the wayland client do dequeue buffer in tpl_wayland_egl_buffer_t. - By using the information remaining in the tpl_wayland_egl_buffer_t which rendering job end, do commit to server. - This change will be able to inform accurate information of client window to server. Change-Id: I4a7c4646cfc8ab3f39c8755f7c1193b33992a1ed Signed-off-by: joonbum.ko --- src/tpl_wayland_egl.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index f24bdc4..4f9cb12 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -57,6 +57,9 @@ struct _tpl_wayland_egl_surface { struct _tpl_wayland_egl_buffer { tpl_wayland_egl_display_t *display; tpl_wayland_egl_surface_t *wayland_egl_surface; + int dx, dy; + int width, height; + int rotation; tbm_bo bo; tpl_bool_t reset; /* TRUE if queue reseted by external */ struct wl_proxy *wl_proxy; /* wl_buffer proxy */ @@ -723,15 +726,15 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface, TPL_IMAGE_DUMP(tbm_surface, surface->width, surface->height); wl_surface_attach(wl_egl_window->surface, (void *)wayland_egl_buffer->wl_proxy, - wl_egl_window->dx, wl_egl_window->dy); + wayland_egl_buffer->dx, wayland_egl_buffer->dy); - wl_egl_window->attached_width = wl_egl_window->width; - wl_egl_window->attached_height = wl_egl_window->height; + wl_egl_window->attached_width = wayland_egl_buffer->width; + wl_egl_window->attached_height = wayland_egl_buffer->height; if (num_rects < 1 || rects == NULL) { wl_surface_damage(wl_egl_window->surface, - wl_egl_window->dx, wl_egl_window->dy, - wl_egl_window->width, wl_egl_window->height); + wayland_egl_buffer->dx, wayland_egl_buffer->dy, + wayland_egl_buffer->width, wayland_egl_buffer->height); } else { int i; @@ -741,7 +744,7 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface, * WINDOW(Top-left) coord like below. * y = [WINDOW.HEIGHT] - (RECT.Y + RECT.HEIGHT) */ int inverted_y = - wl_egl_window->height - (rects[i * 4 + 1] + rects[i * 4 + 3]); + wayland_egl_buffer->height - (rects[i * 4 + 1] + rects[i * 4 + 3]); wl_surface_damage(wl_egl_window->surface, rects[i * 4 + 0], inverted_y, rects[i * 4 + 2], rects[i * 4 + 3]); @@ -753,9 +756,10 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface, wl_display_flush(wayland_egl_display->wl_dpy); TPL_LOG_B("WL_EGL", - "[COMMIT] wl_surface(%p) wl_egl_window(%p)(%dx%d) wl_buffer(%p)", + "[COMMIT] wl_surface(%p) wl_egl_window(%p) wl_buffer(%p)(%dx%d)", wl_egl_window->surface, wl_egl_window, - wl_egl_window->width, wl_egl_window->height, wayland_egl_buffer->wl_proxy); + wayland_egl_buffer->wl_proxy, + wayland_egl_buffer->width, wayland_egl_buffer->height); if (wayland_egl_surface->attached_buffers) { TPL_OBJECT_LOCK(&wayland_egl_surface->base); @@ -999,6 +1003,8 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou tpl_wayland_egl_display_t *wayland_egl_display = (tpl_wayland_egl_display_t *)surface->display->backend.data; struct wl_proxy *wl_proxy = NULL; + struct wl_egl_window *wl_egl_window = + (struct wl_egl_window *)surface->native_handle; tbm_surface_queue_error_e tsq_err = 0; if (sync_fence) @@ -1006,8 +1012,6 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou /* Check whether the surface was resized by wayland_egl */ if (wayland_egl_surface->resized == TPL_TRUE) { - struct wl_egl_window *wl_egl_window = - (struct wl_egl_window *)surface->native_handle; int width, height, format; width = wl_egl_window->width; height = wl_egl_window->height; @@ -1047,6 +1051,12 @@ __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)); + wayland_egl_buffer->dx = wl_egl_window->dx; + 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->rotation = wl_egl_window->rotation; + wayland_egl_buffer->reset = TPL_FALSE; wayland_egl_surface->reset = TPL_FALSE; @@ -1084,6 +1094,11 @@ __tpl_wayland_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeou wl_display_flush(wayland_egl_display->wl_dpy); + wayland_egl_buffer->dx = wl_egl_window->dx; + 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->rotation = wl_egl_window->rotation; wayland_egl_buffer->display = wayland_egl_display; wayland_egl_buffer->wl_proxy = wl_proxy; wayland_egl_buffer->bo = tbm_surface_internal_get_bo(tbm_surface, 0); -- 2.7.4