Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: gpu/command_buffer/tests/egl_test.cc

Issue 1714023002: Revert of Only call gles2::Terminate when all Display objects are deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@egl_test_branch
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/gles2_conform_support/egl/display.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/egl_test.cc
diff --git a/gpu/command_buffer/tests/egl_test.cc b/gpu/command_buffer/tests/egl_test.cc
index 4223308563698ff6867a024d84f70f5cc614a9a7..bf7e30e5f81610aafbdf6fa9072756a2f277ea3a 100644
--- a/gpu/command_buffer/tests/egl_test.cc
+++ b/gpu/command_buffer/tests/egl_test.cc
@@ -6,7 +6,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include <EGL/egl.h>
-#include <GLES2/gl2.h>
// This file tests EGL basic interface for command_buffer_gles2, the mode of
// command buffer where the code is compiled as a standalone dynamic library and
@@ -34,108 +33,4 @@
ASSERT_TRUE(success);
}
-class TestContext {
- public:
- TestContext() {
- display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-
- eglInitialize(display_, nullptr, nullptr);
-
- static const EGLint configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_NONE
- };
- EGLint numConfigs;
- EGLConfig config;
- eglChooseConfig(display_, configAttribs, &config, 1, &numConfigs);
-
- static const EGLint surfaceAttribs[] = {
- EGL_WIDTH, 1,
- EGL_HEIGHT, 1,
- EGL_NONE
- };
- surface_ = eglCreatePbufferSurface(display_, config, surfaceAttribs);
-
- static const EGLint contextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
- context_ = eglCreateContext(display_, config, nullptr, contextAttribs);
- }
-
- ~TestContext() {
- eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- eglDestroyContext(display_, context_);
- eglDestroySurface(display_, surface_);
- eglTerminate(display_);
- }
-
- bool IsValid() const {
- return display_ != EGL_NO_DISPLAY &&
- context_ != EGL_NO_CONTEXT &&
- surface_ != EGL_NO_SURFACE;
- }
-
- void TestCallGL() {
- eglMakeCurrent(display_, surface_, surface_, context_);
-
- typedef GL_APICALL void GL_APIENTRY (*glEnableProc)(GLenum);
-
- auto address = eglGetProcAddress("glEnable");
- auto* glEnable = reinterpret_cast<glEnableProc>(address);
- glEnable(GL_BLEND);
- }
-
- private:
- TestContext(const TestContext&) = delete;
- TestContext& operator=(const TestContext&) = delete;
-
- private:
- EGLDisplay display_;
- EGLContext context_;
- EGLSurface surface_;
-};
-
-// Test case for a workaround for an issue in gles2_conform_support.
-//
-// The problem is that every call to eglGetDisplay(EGL_DEFAULT_DISPLAY)
-// returns a new display object and the construction of each display
-// calls to establish a thread local store variable in where to store the
-// current command buffer context.
-// Likewise the destructor of display calls to free the same tls variable.
-//
-// When skia (nanobench) uses multiple instances of command buffer
-// based contexts and one display is destroyed the TLS variable
-// is also destroyed and subsequent command buffer GL calls using another
-// context instance end up accessing free'ed TLS variable.
-//
-// Note that technically there's also a problem in SkCommandBufferContext
-// since it calls eglTerminate for each display, but this is because
-// the current command buffer egl implementation requires this.
-// Overall this functionality is not aligned with the EGL spefication.
-//
-// This testcase tests that we can create multiple command buffer contexts
-// and dispose them without affecting the other.
-TEST(Test, MultipleDisplays) {
- TestContext first;
- ASSERT_TRUE(first.IsValid());
-
- first.TestCallGL();
-
- {
- TestContext second;
- ASSERT_TRUE(second.IsValid());
-
- second.TestCallGL();
- }
-
- first.TestCallGL();
-}
-
-} // namespace gpu
-
+} // namespace gpu
« no previous file with comments | « no previous file | gpu/gles2_conform_support/egl/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698