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

Unified Diff: src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp

Issue 1733323002: Clean up EGL thread state at thread exit in nanobench and DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix main thread usage also 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 | « src/gpu/gl/angle/SkANGLEGLContext.cpp ('k') | src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp
diff --git a/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp b/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp
index cf9da9365b195a43775305e8f0f98d08d3511eef..9b95203dad97a1ab8a3a35ec54afa625003f4089 100644
--- a/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp
+++ b/src/gpu/gl/command_buffer/SkCommandBufferGLContext.cpp
@@ -54,7 +54,7 @@ typedef void (*__eglMustCastToProperFunctionPointerType)(void);
typedef EGLDisplay (*GetDisplayProc)(EGLNativeDisplayType display_id);
typedef EGLBoolean (*InitializeProc)(EGLDisplay dpy, EGLint *major, EGLint *minor);
-typedef EGLBoolean (*TerminateProc)(EGLDisplay dpy);
+typedef EGLBoolean (*ReleaseThreadProc)();
typedef EGLBoolean (*ChooseConfigProc)(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config);
typedef EGLBoolean (*GetConfigAttrib)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value);
typedef EGLSurface (*CreateWindowSurfaceProc)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint* attrib_list);
@@ -68,7 +68,7 @@ typedef __eglMustCastToProperFunctionPointerType (*GetProcAddressProc)(const cha
static GetDisplayProc gfGetDisplay = nullptr;
static InitializeProc gfInitialize = nullptr;
-static TerminateProc gfTerminate = nullptr;
+static ReleaseThreadProc gfReleaseThread = nullptr;
static ChooseConfigProc gfChooseConfig = nullptr;
static GetConfigAttrib gfGetConfigAttrib = nullptr;
static CreateWindowSurfaceProc gfCreateWindowSurface = nullptr;
@@ -95,7 +95,7 @@ static void load_command_buffer_functions() {
if (gLibrary) {
gfGetDisplay = (GetDisplayProc)GetProcedureAddress(gLibrary, "eglGetDisplay");
gfInitialize = (InitializeProc)GetProcedureAddress(gLibrary, "eglInitialize");
- gfTerminate = (TerminateProc)GetProcedureAddress(gLibrary, "eglTerminate");
+ gfReleaseThread = (ReleaseThreadProc)GetProcedureAddress(gLibrary, "eglReleaseThread");
gfChooseConfig = (ChooseConfigProc)GetProcedureAddress(gLibrary, "eglChooseConfig");
gfGetConfigAttrib = (GetConfigAttrib)GetProcedureAddress(gLibrary, "eglGetConfigAttrib");
gfCreateWindowSurface = (CreateWindowSurfaceProc)GetProcedureAddress(gLibrary, "eglCreateWindowSurface");
@@ -107,7 +107,7 @@ static void load_command_buffer_functions() {
gfSwapBuffers = (SwapBuffersProc)GetProcedureAddress(gLibrary, "eglSwapBuffers");
gfGetProcAddress = (GetProcAddressProc)GetProcedureAddress(gLibrary, "eglGetProcAddress");
- gfFunctionsLoadedSuccessfully = gfGetDisplay && gfInitialize && gfTerminate &&
+ gfFunctionsLoadedSuccessfully = gfGetDisplay && gfInitialize && gfReleaseThread &&
gfChooseConfig && gfCreateWindowSurface &&
gfCreatePbufferSurface && gfDestroySurface &&
gfCreateContext && gfDestroyContext && gfMakeCurrent &&
@@ -284,7 +284,6 @@ void SkCommandBufferGLContext::destroyGLContext() {
fSurface = EGL_NO_SURFACE;
}
- gfTerminate(fDisplay);
fDisplay = EGL_NO_DISPLAY;
}
}
@@ -337,3 +336,10 @@ int SkCommandBufferGLContext::getSampleCount() {
gfGetConfigAttrib(fDisplay, static_cast<EGLConfig>(fConfig), EGL_SAMPLES, &result);
return result;
}
+
+void SkCommandBufferGLContext::ReleaseGpuAPIsInThread() {
+ if (!gfFunctionsLoadedSuccessfully) {
+ return;
+ }
+ gfReleaseThread();
+}
« no previous file with comments | « src/gpu/gl/angle/SkANGLEGLContext.cpp ('k') | src/gpu/gl/egl/SkCreatePlatformGLContext_egl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698