From 90b601fa8d5c6ca10aca7b3ebb50c02400cb0049 Mon Sep 17 00:00:00 2001 From: Yogesh Gole Date: Wed, 17 Oct 2018 16:51:19 +0530 Subject: [PATCH] Terminate EGL display after use Previously function getDefaultEglConfigList destroyed native display but did not terminate the EGL display. It may happen that next create call will allocate native display at same address as previous and as per spec multiple calls made to eglGetPlatformDisplayEXT with the same and will return the same EGLDisplay handle. But returned EGLDisplay will have references to stale data. To fix this destroy the EGL Display along with native display. Affects: CTS-Configs.* Components: OpenGL and Framework VK-GL-CTS Issue: 1426 Change-Id: I8e4c7d693d26bd9be6d7f892d0b5162d9b2b245c --- external/openglcts/modules/common/glcConfigListEGL.cpp | 1 + framework/egl/egluUtil.cpp | 5 +++++ framework/egl/egluUtil.hpp | 1 + 3 files changed, 7 insertions(+) diff --git a/external/openglcts/modules/common/glcConfigListEGL.cpp b/external/openglcts/modules/common/glcConfigListEGL.cpp index 727b683..2c5311c 100644 --- a/external/openglcts/modules/common/glcConfigListEGL.cpp +++ b/external/openglcts/modules/common/glcConfigListEGL.cpp @@ -152,6 +152,7 @@ static void getDefaultEglConfigList(tcu::Platform& eglPlatform, glu::ApiType typ isFloatType ? EXCLUDEREASON_FLOAT : EXCLUDEREASON_YUV)); } } + eglu::terminateDisplay(library, display); } void getConfigListEGL(tcu::Platform& platform, glu::ApiType type, ConfigList& configList) diff --git a/framework/egl/egluUtil.cpp b/framework/egl/egluUtil.cpp index a774f47..e7c13fb 100644 --- a/framework/egl/egluUtil.cpp +++ b/framework/egl/egluUtil.cpp @@ -276,6 +276,11 @@ EGLDisplay getAndInitDisplay (NativeDisplay& nativeDisplay, Version* version) return display; } +void terminateDisplay(const Library& egl, EGLDisplay display) +{ + EGLU_CHECK_CALL(egl, terminate(display)); +} + //! Create EGL window surface using eglCreateWindowSurface() or eglCreatePlatformWindowSurfaceEXT() EGLSurface createWindowSurface (NativeDisplay& nativeDisplay, NativeWindow& window, EGLDisplay display, EGLConfig config, const EGLAttrib* attribList) { diff --git a/framework/egl/egluUtil.hpp b/framework/egl/egluUtil.hpp index 1fe322a..c216a8d 100644 --- a/framework/egl/egluUtil.hpp +++ b/framework/egl/egluUtil.hpp @@ -77,6 +77,7 @@ tcu::IVec2 getSurfaceResolution (const eglw::Library& egl, eglw::EGLDispla eglw::EGLDisplay getDisplay (NativeDisplay& nativeDisplay); eglw::EGLDisplay getAndInitDisplay (NativeDisplay& nativeDisplay, Version* version = DE_NULL); +void terminateDisplay (const eglw::Library& egl, eglw::EGLDisplay display); eglw::EGLSurface createWindowSurface (NativeDisplay& nativeDisplay, NativeWindow& window, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList); eglw::EGLSurface createPixmapSurface (NativeDisplay& nativeDisplay, NativePixmap& pixmap, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList); -- 2.7.4