diff options
author | joonbum.ko <joonbum.ko@samsung.com> | 2017-12-06 13:13:57 +0900 |
---|---|---|
committer | Jinhyung Jo <jinhyung.jo@samsung.com> | 2017-12-07 08:44:14 +0000 |
commit | 755efc0527a39ee8561e4b2d516a9cfab8416766 (patch) | |
tree | 0032c80aaa9d3ce345ad64cbbcbe42cc0349d760 | |
parent | e87e8ba5c636d06fafa4af19914dbdf450b33ecb (diff) | |
download | emulator-yagl-755efc0527a39ee8561e4b2d516a9cfab8416766.tar.gz emulator-yagl-755efc0527a39ee8561e4b2d516a9cfab8416766.tar.bz2 emulator-yagl-755efc0527a39ee8561e4b2d516a9cfab8416766.zip |
Modified to completely unref the unused GEM memory.
tbm_surface is dequeued from tpl_surface,
but window does not want to use it(window resized or destroyed),
then we have to cancel it to complete destroying using below API.
- tpl_surface_cancel_dequeued_buffer(tpl_surface_t *, tbm_surface_h)
Change-Id: Ib4d5798d29111aa0ef0b74e9e3986abdf2665c4d
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
-rw-r--r-- | EGL/tizen/yagl_tizen_window.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/EGL/tizen/yagl_tizen_window.c b/EGL/tizen/yagl_tizen_window.c index 3a4c80a..0408bb1 100644 --- a/EGL/tizen/yagl_tizen_window.c +++ b/EGL/tizen/yagl_tizen_window.c @@ -86,6 +86,10 @@ static int yagl_tizen_window_get_buffer(struct yagl_native_drawable *drawable, if (window->color_buffers[i].data) { tbm_surface_internal_unref(window->color_buffers[i].data); + /* tbm_surface is dequeued from tpl_surface, + * but this window does not want to use it, + * then we have to cancel it to complete destroying.*/ + tpl_surface_cancel_dequeued_buffer(window->surface, window->color_buffers[i].data); window->color_buffers[i].data = NULL; } @@ -97,6 +101,7 @@ static int yagl_tizen_window_get_buffer(struct yagl_native_drawable *drawable, * * Otherwise, we'll get very obscure resizing bugs. */ + window->color_buffers[i].locked = 0; window->back = NULL; } @@ -249,11 +254,23 @@ static struct yagl_native_image static void yagl_tizen_window_destroy(struct yagl_native_drawable *drawable) { struct yagl_tizen_window *window = (struct yagl_tizen_window *)drawable; + int i = 0; yagl_native_drawable_cleanup(drawable); window->user_data = NULL; + for (i = 0; i < YAGL_TIZEN_MAX_COLOR_BUF; i++) { + if (window->color_buffers[i].data) { + tbm_surface_internal_unref(window->color_buffers[i].data); + /* tbm_surface is dequeued from tpl_surface, + * but this window does not want to use it, + * then we have to cancel it to complete destroying.*/ + tpl_surface_cancel_dequeued_buffer(window->surface, window->color_buffers[i].data); + window->color_buffers[i].data = NULL; + } + } + /* Destroy TPL surface. */ if (window->surface) tpl_object_unreference((tpl_object_t *)window->surface); |