Index: ui/ozone/common/egl_util.cc |
diff --git a/ui/ozone/common/egl_util.cc b/ui/ozone/common/egl_util.cc |
index 8000360c7b0c4a99be228bcdb2f46b5a788a398a..847e6c61f1785ec599f635cf4ce0698d27abca8f 100644 |
--- a/ui/ozone/common/egl_util.cc |
+++ b/ui/ozone/common/egl_util.cc |
@@ -62,4 +62,27 @@ bool LoadEGLGLES2Bindings( |
return true; |
} |
+void* ChooseEGLConfig(const SurfaceFactoryOzone::EglConfigInfo& egl, |
+ const int32* attributes) { |
+ void* config; |
+ int32 num_configs; |
+ if (!egl.choose_config.Run(attributes, NULL, 0, &num_configs)) { |
+ LOG(ERROR) << "eglChooseConfig failed with error " |
+ << egl.get_last_error_string.Run(); |
+ return nullptr; |
+ } |
+ |
+ if (num_configs == 0) { |
+ LOG(ERROR) << "No suitable EGL configs found."; |
+ return nullptr; |
+ } |
+ |
+ if (!egl.choose_config.Run(attributes, &config, 1, &num_configs)) { |
+ LOG(ERROR) << "eglChooseConfig failed with error " |
+ << egl.get_last_error_string.Run(); |
+ return nullptr; |
+ } |
+ return config; |
+} |
+ |
} // namespace ui |