Increment/decrement a counter around EGL calls

This is in preparation for a change that will hibernate the underlying
EGL when idle. Instead of a bare egl_display_t*, get_display() now
returns a egl_display_ptr, which acts like a smart pointer. The
"wakecount" counter managed by the smart pointer isn't used for
anything in this change. It will be used to make sure we don't
hibernate when any thread is in an EGL call, without having to hold a
mutex for the duration of the call.

Change-Id: Iee52f3549a51162efc3800e1195d3f76bba2f2ce
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index e8a14d8..b658240 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -203,27 +203,27 @@
 
 // ----------------------------------------------------------------------------
 
-egl_display_t* validate_display(EGLDisplay dpy) {
-    egl_display_t * const dp = get_display(dpy);
+egl_display_ptr validate_display(EGLDisplay dpy) {
+    egl_display_ptr dp = get_display(dpy);
     if (!dp)
-        return setError(EGL_BAD_DISPLAY, (egl_display_t*)NULL);
+        return setError(EGL_BAD_DISPLAY, egl_display_ptr(NULL));
     if (!dp->isReady())
-        return setError(EGL_NOT_INITIALIZED, (egl_display_t*)NULL);
+        return setError(EGL_NOT_INITIALIZED, egl_display_ptr(NULL));
 
     return dp;
 }
 
-egl_connection_t* validate_display_config(EGLDisplay dpy, EGLConfig,
-        egl_display_t const*& dp) {
-    dp = validate_display(dpy);
+egl_display_ptr validate_display_connection(EGLDisplay dpy,
+        egl_connection_t*& cnx) {
+    cnx = NULL;
+    egl_display_ptr dp = validate_display(dpy);
     if (!dp)
-        return (egl_connection_t*) NULL;
-
-    egl_connection_t* const cnx = &gEGLImpl;
+        return dp;
+    cnx = &gEGLImpl;
     if (cnx->dso == 0) {
-        return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
+        return setError(EGL_BAD_CONFIG, egl_display_ptr(NULL));
     }
-    return cnx;
+    return dp;
 }
 
 // ----------------------------------------------------------------------------