egl: Enable eglGetPlatformDisplay on Android Platform
authorrenchenglei <chenglei.ren@intel.com>
Fri, 28 Jun 2019 07:21:08 +0000 (15:21 +0800)
committerEric Engestrom <eric.engestrom@intel.com>
Sat, 29 Jun 2019 11:20:17 +0000 (12:20 +0100)
This helps to add eglGetPlatformDisplay support on Android
Platform.
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/egl/main/eglapi.c
src/egl/main/egldisplay.c
src/egl/main/egldisplay.h

index cffa756365eee1caea6d4a47a227edf3860e7376..7c9d2c92a0f5456f599240bb73a4e01b1c6581fd 100644 (file)
@@ -405,6 +405,11 @@ _eglGetPlatformDisplayCommon(EGLenum platform, void *native_display,
    case EGL_PLATFORM_SURFACELESS_MESA:
       disp = _eglGetSurfacelessDisplay(native_display, attrib_list);
       break;
+#endif
+#ifdef HAVE_ANDROID_PLATFORM
+   case EGL_PLATFORM_ANDROID_KHR:
+      disp = _eglGetAndroidDisplay(native_display, attrib_list);
+      break;
 #endif
    case EGL_PLATFORM_DEVICE_EXT:
       disp = _eglGetDeviceDisplay(native_display, attrib_list);
index acb0405822fbd0b023958ff24c7d58efaa49cb42..193443e056c646ccac50454fce26a0a3d6c26265 100644 (file)
@@ -568,6 +568,22 @@ _eglGetSurfacelessDisplay(void *native_display,
 }
 #endif /* HAVE_SURFACELESS_PLATFORM */
 
+#ifdef HAVE_ANDROID_PLATFORM
+_EGLDisplay*
+_eglGetAndroidDisplay(void *native_display,
+                          const EGLAttrib *attrib_list)
+{
+
+   /* This platform recognizes no display attributes. */
+   if (attrib_list != NULL && attrib_list[0] != EGL_NONE) {
+      _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
+      return NULL;
+   }
+
+   return _eglFindDisplay(_EGL_PLATFORM_ANDROID, native_display,
+                          attrib_list);
+}
+#endif /* HAVE_ANDROID_PLATFORM */
 
 _EGLDisplay*
 _eglGetDeviceDisplay(void *native_display,
index f73ff99fbeef09c4c6dd0ae42807d79214f9069f..02ac4fb9a9dc2ada68321d1fb5c5572d6bec5f08 100644 (file)
@@ -315,6 +315,12 @@ _eglGetSurfacelessDisplay(void *native_display,
                           const EGLAttrib *attrib_list);
 #endif
 
+#ifdef HAVE_ANDROID_PLATFORM
+_EGLDisplay*
+_eglGetAndroidDisplay(void *native_display,
+                         const EGLAttrib *attrib_list);
+#endif
+
 _EGLDisplay*
 _eglGetDeviceDisplay(void *native_display,
                      const EGLAttrib *attrib_list);