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(); |
+} |