sdm: Fix Deinit for GPU WB.
Delete all context dependent resources before destroying context.
Ex: program_id, image buffer ids etc;
CRs-Fixed: 2573023
Change-Id: I675339ce840189b70b74abb2fc4bdcb9d3c240aa
diff --git a/composer/gl_common.cpp b/composer/gl_common.cpp
index c350d47..aa3bc45 100644
--- a/composer/gl_common.cpp
+++ b/composer/gl_common.cpp
@@ -147,12 +147,16 @@
return fd;
}
-void GLCommon::DestroyContext(const GLContext* ctx) {
+void GLCommon::DestroyContext(GLContext* ctx) {
DTRACE_SCOPED();
+
+ // Clear egl image buffers.
+ image_wrapper_.Deinit();
+
+ EGL(DeleteProgram(ctx->program_id));
EGL(eglMakeCurrent(ctx->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
EGL(eglDestroySurface(ctx->egl_display, ctx->egl_surface));
EGL(eglDestroyContext(ctx->egl_display, ctx->egl_context));
- EGL(DeleteProgram(ctx->program_id));
EGL(eglTerminate(ctx->egl_display));
}