From 5a7e7034e37b21f765fc7e1467fa4697e6c22f3d Mon Sep 17 00:00:00 2001 From: Hoyub Lee Date: Thu, 18 May 2017 20:36:09 +0900 Subject: [PATCH] wsi: Correct getting tpl_display in vk_get_tpl_display() tpl_display_create() has been changed to [return existing tpl_display] from [return NULL] if there is already existing one. Therefore, this patch applies this behaviour change on vk_get_tpl_display(). Change-Id: I355b251d43e6e0e54b89aa533d43f33ada997017 Signed-off-by: Hoyub Lee --- src/wsi/wsi.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/wsi/wsi.h b/src/wsi/wsi.h index e629922..624623a 100644 --- a/src/wsi/wsi.h +++ b/src/wsi/wsi.h @@ -194,12 +194,16 @@ vk_get_tpl_display(VkIcdSurfaceBase *sfc) return NULL; } - tpl_display_t *display = tpl_display_create(type, native_dpy); - if (display == NULL) { - display = tpl_display_get(native_dpy); + tpl_display_t *display = tpl_display_get(native_dpy); + + if (display != NULL) { tpl_object_reference((tpl_object_t *)display); + return display; + } + else { + display = tpl_display_create(type, native_dpy); + return display; } - return display; }; static inline tpl_handle_t -- 2.7.4