Release EGL resources in CTS worker threads
authorMichael Chock <mchock@nvidia.com>
Wed, 26 Jul 2017 17:07:16 +0000 (10:07 -0700)
committerMika Isojarvi <misojarvi@google.com>
Fri, 4 Aug 2017 19:28:27 +0000 (19:28 +0000)
For worker threads in multithreaded EGL tests, call eglReleaseThread
before thread termination.

Affects:

dEQP-EGL.functional.color_clears.multi_thread.*
dEQP-EGL.functional.multithread.*
dEQP-EGL.functional.render.multi_thread.*
dEQP-EGL.functional.thread_cleanup.*
dEQP-EGL.performance.gles2_shared_render.*

Change-Id: I1e47fae1b9a3d1f148a80215c1c2baa0b684c57e

modules/egl/teglColorClearCase.cpp
modules/egl/teglGLES2SharedRenderingPerfTests.cpp
modules/egl/teglMultiThreadTests.cpp
modules/egl/teglRenderTests.cpp
modules/egl/teglThreadCleanUpTests.cpp

index 8ae8b4c..92cbd8f 100644 (file)
@@ -310,6 +310,7 @@ public:
                        // Signal completion.
                        packetIter->signal->increment();
                }
+               m_egl.releaseThread();
        }
 
 private:
index bc13aad..7d334c9 100644 (file)
@@ -717,7 +717,7 @@ void TestContext::render (void)
 class TestThread : de::Thread
 {
 public:
-                                       TestThread              (const vector<TestContext*> contexts);
+                                       TestThread              (const vector<TestContext*> contexts, const Library& egl);
                                        ~TestThread             (void);
 
        void                    start                   (void);
@@ -727,6 +727,7 @@ public:
 
 private:
        vector<TestContext*>    m_contexts;
+       const Library&                  m_egl;
        bool                                    m_isOk;
        string                                  m_errorString;
 
@@ -746,8 +747,9 @@ private:
                                        TestThread      (const TestThread&);
 };
 
-TestThread::TestThread (const vector<TestContext*> contexts)
+TestThread::TestThread (const vector<TestContext*> contexts, const Library& egl)
        : m_contexts            (contexts)
+       , m_egl                         (egl)
        , m_isOk                        (false)
        , m_errorString         ("")
        , m_beginTimeUs         (0)
@@ -800,6 +802,8 @@ void TestThread::run (void)
                m_isOk                  = false;
                m_errorString   = "Got unknown exception";
        }
+
+       m_egl.releaseThread();
 }
 
 class SharedRenderingPerfCase : public TestCase
@@ -879,7 +883,7 @@ void SharedRenderingPerfCase::deinit (void)
 namespace
 {
 
-void createThreads (vector<TestThread*>& threads, int threadCount, int perThreadContextCount, vector<TestContext*>& contexts)
+void createThreads (vector<TestThread*>& threads, int threadCount, int perThreadContextCount, vector<TestContext*>& contexts, const Library& egl)
 {
        DE_ASSERT(threadCount * perThreadContextCount == (int)contexts.size());
        DE_ASSERT(threads.empty());
@@ -891,7 +895,7 @@ void createThreads (vector<TestThread*>& threads, int threadCount, int perThread
                for (int contextNdx = 0; contextNdx < perThreadContextCount; contextNdx++)
                        threadContexts.push_back(contexts[threadNdx * perThreadContextCount + contextNdx]);
 
-               threads.push_back(new TestThread(threadContexts));
+               threads.push_back(new TestThread(threadContexts, egl));
 
                threadContexts.clear();
        }
@@ -1036,7 +1040,7 @@ TestCase::IterateResult SharedRenderingPerfCase::iterate (void)
        if (m_results.empty())
                logTestConfig(m_testCtx.getLog(), m_config);
 
-       createThreads(threads, m_config.threadCount, m_config.perThreadContextCount, m_contexts);
+       createThreads(threads, m_config.threadCount, m_config.perThreadContextCount, m_contexts, m_eglTestCtx.getLibrary());
 
        beginTimeUs = deGetMicroseconds();
 
index 21952a9..3a5f13f 100644 (file)
@@ -210,6 +210,8 @@ void TestThread::run (void)
        {
                getLog() << ThreadLog::BeginMessage << "Unknown exception" << ThreadLog::EndMessage;
        }
+
+       getLibrary().releaseThread();
 }
 
 bool MultiThreadedTest::execTest (TestThread& thread)
index 8b5b5c2..be012e3 100644 (file)
@@ -868,6 +868,7 @@ public:
                        // Signal completion.
                        packetIter->signal->increment();
                }
+               m_egl.releaseThread();
        }
 
 private:
index ffe3913..a3f64cb 100644 (file)
@@ -120,6 +120,8 @@ public:
                {
                        m_error = error;
                }
+
+               m_egl.releaseThread();
        }
 
 private: