Expose eglCreatePlatformWindowSurfaceEXT and eglCreatePlatformPixmapSurfaceEXT

These entry points are part of EGL_EXT_platform_base but were never returned by
eglGetProcAddress.

BUG=angleproject:2603

Change-Id: I4782df67fa8625a9af29a18df02af7b5fa73d75e
Reviewed-on: https://chromium-review.googlesource.com/1075469
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationEGL.cpp b/src/libANGLE/validationEGL.cpp
index c0e3fe7..4408e8b 100644
--- a/src/libANGLE/validationEGL.cpp
+++ b/src/libANGLE/validationEGL.cpp
@@ -2344,6 +2344,36 @@
     return ValidateGetPlatformDisplayCommon(platform, native_display, attribMap);
 }
 
+Error ValidateCreatePlatformWindowSurfaceEXT(const Display *display,
+                                             const Config *configuration,
+                                             void *nativeWindow,
+                                             const AttributeMap &attributes)
+{
+    if (!Display::GetClientExtensions().platformBase)
+    {
+        return EglBadAccess() << "EGL_EXT_platform_base not supported";
+    }
+
+    ANGLE_TRY(ValidateConfig(display, configuration));
+
+    return EglBadDisplay() << "ValidateCreatePlatformWindowSurfaceEXT unimplemented.";
+}
+
+Error ValidateCreatePlatformPixmapSurfaceEXT(const Display *display,
+                                             const Config *configuration,
+                                             void *nativePixmap,
+                                             const AttributeMap &attributes)
+{
+    if (!Display::GetClientExtensions().platformBase)
+    {
+        return EglBadAccess() << "EGL_EXT_platform_base not supported";
+    }
+
+    ANGLE_TRY(ValidateConfig(display, configuration));
+
+    return EglBadDisplay() << "ValidateCreatePlatformPixmapSurfaceEXT unimplemented.";
+}
+
 Error ValidateProgramCacheGetAttribANGLE(const Display *display, EGLenum attrib)
 {
     ANGLE_TRY(ValidateDisplay(display));
diff --git a/src/libANGLE/validationEGL.h b/src/libANGLE/validationEGL.h
index f0db9d9..2cf86ee 100644
--- a/src/libANGLE/validationEGL.h
+++ b/src/libANGLE/validationEGL.h
@@ -129,6 +129,14 @@
 Error ValidateGetPlatformDisplayEXT(EGLenum platform,
                                     void *native_display,
                                     const EGLint *attrib_list);
+Error ValidateCreatePlatformWindowSurfaceEXT(const Display *display,
+                                             const Config *configuration,
+                                             void *nativeWindow,
+                                             const AttributeMap &attributes);
+Error ValidateCreatePlatformPixmapSurfaceEXT(const Display *display,
+                                             const Config *configuration,
+                                             void *nativePixmap,
+                                             const AttributeMap &attributes);
 
 Error ValidateProgramCacheGetAttribANGLE(const Display *display, EGLenum attrib);
 
diff --git a/src/libEGL/libEGL.cpp b/src/libEGL/libEGL.cpp
index d6be1b6..7ea6822 100644
--- a/src/libEGL/libEGL.cpp
+++ b/src/libEGL/libEGL.cpp
@@ -242,6 +242,22 @@
     return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list);
 }
 
+EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
+                                                         EGLConfig config,
+                                                         void *native_window,
+                                                         const EGLint *attrib_list)
+{
+    return egl::CreatePlatformWindowSurfaceEXT(dpy, config, native_window, attrib_list);
+}
+
+EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
+                                                         EGLConfig config,
+                                                         void *native_pixmap,
+                                                         const EGLint *attrib_list)
+{
+    return egl::CreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap, attrib_list);
+}
+
 EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
 {
     return egl::QueryDisplayAttribEXT(dpy, attribute, value);
diff --git a/src/libEGL/libEGL.def b/src/libEGL/libEGL.def
index c3e83bf..79aaf13 100644
--- a/src/libEGL/libEGL.def
+++ b/src/libEGL/libEGL.def
@@ -63,6 +63,8 @@
     eglProgramCachePopulateANGLE                @69
     eglProgramCacheQueryANGLE                   @70
     eglProgramCacheResizeANGLE                  @71
+    eglCreatePlatformWindowSurfaceEXT           @72
+    eglCreatePlatformPixmapSurfaceEXT           @73
 
     ; 1.5 entry points
     eglCreateSync                               @38
diff --git a/src/libGLESv2/entry_points_egl_ext.cpp b/src/libGLESv2/entry_points_egl_ext.cpp
index 1ef0821..e7e96b6 100644
--- a/src/libGLESv2/entry_points_egl_ext.cpp
+++ b/src/libGLESv2/entry_points_egl_ext.cpp
@@ -164,6 +164,54 @@
     }
 }
 
+EGLSurface EGLAPIENTRY CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
+                                                      EGLConfig config,
+                                                      void *native_window,
+                                                      const EGLint *attrib_list)
+{
+    EVENT(
+        "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, void *native_window = 0x%0.8p, "
+        "const EGLint *attrib_list = 0x%0.8p)",
+        dpy, config, native_window, attrib_list);
+    Thread *thread = GetCurrentThread();
+
+    Display *display        = static_cast<Display *>(dpy);
+    Config *configuration   = static_cast<Config *>(config);
+    AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+    ANGLE_EGL_TRY_RETURN(
+        thread,
+        ValidateCreatePlatformWindowSurfaceEXT(display, configuration, native_window, attributes),
+        EGL_NO_SURFACE);
+
+    thread->setError(EglBadDisplay() << "CreatePlatformWindowSurfaceEXT unimplemented.");
+    return EGL_NO_SURFACE;
+}
+
+EGLSurface EGLAPIENTRY CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
+                                                      EGLConfig config,
+                                                      void *native_pixmap,
+                                                      const EGLint *attrib_list)
+{
+    EVENT(
+        "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, void *native_pixmap = 0x%0.8p, "
+        "const EGLint *attrib_list = 0x%0.8p)",
+        dpy, config, native_pixmap, attrib_list);
+    Thread *thread = GetCurrentThread();
+
+    Display *display        = static_cast<Display *>(dpy);
+    Config *configuration   = static_cast<Config *>(config);
+    AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+    ANGLE_EGL_TRY_RETURN(
+        thread,
+        ValidateCreatePlatformPixmapSurfaceEXT(display, configuration, native_pixmap, attributes),
+        EGL_NO_SURFACE);
+
+    thread->setError(EglBadDisplay() << "CreatePlatformPixmapSurfaceEXT unimplemented.");
+    return EGL_NO_SURFACE;
+}
+
 // EGL_EXT_device_query
 EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value)
 {
diff --git a/src/libGLESv2/entry_points_egl_ext.h b/src/libGLESv2/entry_points_egl_ext.h
index c8a74ae..4cd0a86 100644
--- a/src/libGLESv2/entry_points_egl_ext.h
+++ b/src/libGLESv2/entry_points_egl_ext.h
@@ -24,6 +24,14 @@
 
 // EGL_EXT_platform_base
 ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
+                                                                   EGLConfig config,
+                                                                   void *native_window,
+                                                                   const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
+                                                                   EGLConfig config,
+                                                                   void *native_pixmap,
+                                                                   const EGLint *attrib_list);
 
 // EGL_EXT_device_query
 ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
diff --git a/src/libGLESv2/proc_table_autogen.cpp b/src/libGLESv2/proc_table_autogen.cpp
index 7d085f7..e01e375 100644
--- a/src/libGLESv2/proc_table_autogen.cpp
+++ b/src/libGLESv2/proc_table_autogen.cpp
@@ -40,7 +40,9 @@
     {"eglCreatePbufferSurface", P(egl::CreatePbufferSurface)},
     {"eglCreatePixmapSurface", P(egl::CreatePixmapSurface)},
     {"eglCreatePlatformPixmapSurface", P(egl::CreatePlatformPixmapSurface)},
+    {"eglCreatePlatformPixmapSurfaceEXT", P(egl::CreatePlatformPixmapSurfaceEXT)},
     {"eglCreatePlatformWindowSurface", P(egl::CreatePlatformWindowSurface)},
+    {"eglCreatePlatformWindowSurfaceEXT", P(egl::CreatePlatformWindowSurfaceEXT)},
     {"eglCreateStreamKHR", P(egl::CreateStreamKHR)},
     {"eglCreateStreamProducerD3DTextureANGLE", P(egl::CreateStreamProducerD3DTextureANGLE)},
     {"eglCreateSync", P(egl::CreateSync)},
@@ -1231,5 +1233,5 @@
     {"glWeightPointerOES", P(gl::WeightPointerOES)},
     {"glWeightPointerOESContextANGLE", P(gl::WeightPointerOESContextANGLE)}};
 
-size_t g_numProcs = 1163;
+size_t g_numProcs = 1165;
 }  // namespace egl
diff --git a/src/libGLESv2/proc_table_data.json b/src/libGLESv2/proc_table_data.json
index 639cdd9..a994836 100644
--- a/src/libGLESv2/proc_table_data.json
+++ b/src/libGLESv2/proc_table_data.json
@@ -776,7 +776,9 @@
     ],
 
     "EGL_EXT_platform_base": [
-        "eglGetPlatformDisplayEXT"
+        "eglGetPlatformDisplayEXT",
+        "eglCreatePlatformWindowSurfaceEXT",
+        "eglCreatePlatformPixmapSurfaceEXT"
     ],
 
     "EGL_EXT_device_query": [
diff --git a/src/tests/deqp_support/deqp_egl_test_expectations.txt b/src/tests/deqp_support/deqp_egl_test_expectations.txt
index 0af2c3c..5effbfd 100644
--- a/src/tests/deqp_support/deqp_egl_test_expectations.txt
+++ b/src/tests/deqp_support/deqp_egl_test_expectations.txt
@@ -149,7 +149,6 @@
 1340 WIN : dEQP-EGL.functional.negative_api.swap_interval = FAIL
 2382 WIN : dEQP-EGL.functional.native_color_mapping.native_window.* = SKIP
 1340 WIN : dEQP-EGL.functional.native_coord_mapping.native_window.* = FAIL
-1340 WIN : dEQP-EGL.functional.get_proc_address.extension.egl_ext_platform_base = FAIL
 1340 WIN : dEQP-EGL.functional.preserve_swap.preserve.no_read_before_swap.* = SKIP
 1340 WIN : dEQP-EGL.functional.preserve_swap.preserve.read_before_swap.* = SKIP
 1340 WIN : dEQP-EGL.functional.resize.back_buffer.* = SKIP
@@ -191,7 +190,6 @@
 2546 LINUX : dEQP-EGL.functional.render.single_context.gles2.rgba8888_pixmap = SKIP
 2546 LINUX : dEQP-EGL.functional.render.single_context.gles3.rgba8888_pixmap = SKIP
 2546 LINUX : dEQP-EGL.functional.thread_cleanup.* = SKIP
-2546 LINUX : dEQP-EGL.functional.get_proc_address.extension.egl_ext_platform_base = FAIL
 2546 LINUX : dEQP-EGL.functional.native_color_mapping.native_window.* = FAIL
 2546 LINUX : dEQP-EGL.functional.native_coord_mapping.native_window.* = FAIL
 2546 LINUX : dEQP-EGL.functional.negative_api.choose_config = FAIL
@@ -200,7 +198,6 @@
 2546 LINUX : dEQP-EGL.functional.query_surface.simple.pbuffer.rgba8888_no_depth_no_stencil = FAIL
 
 // Mac failures
-2546 MAC : dEQP-EGL.functional.get_proc_address.extension.egl_ext_platform_base = FAIL
 2546 MAC : dEQP-EGL.functional.native_color_mapping.native_window.* = FAIL
 2546 MAC : dEQP-EGL.functional.native_coord_mapping.native_window.* = FAIL
 2546 MAC : dEQP-EGL.functional.negative_api.choose_config = FAIL
@@ -221,7 +218,6 @@
 2546 ANDROID : dEQP-EGL.functional.color_clears.multi_context.* = FAIL
 2546 ANDROID : dEQP-EGL.functional.color_clears.multi_thread.* = FAIL
 2546 ANDROID : dEQP-EGL.functional.color_clears.single_context.* = FAIL
-2546 ANDROID : dEQP-EGL.functional.get_proc_address.extension.egl_ext_platform_base = FAIL
 2546 ANDROID : dEQP-EGL.functional.native_color_mapping.native_window.* = FAIL
 2546 ANDROID : dEQP-EGL.functional.native_coord_mapping.native_window.* = FAIL
 2546 ANDROID : dEQP-EGL.functional.negative_api.choose_config = FAIL