Index: ui/ozone/common/egl_util.cc |
diff --git a/ui/ozone/common/egl_util.cc b/ui/ozone/common/egl_util.cc |
index a86704640ad21f36649ba0e35c16d993c4f876b4..b33407ae5428013d0e31c363dad107bd72de9ce7 100644 |
--- a/ui/ozone/common/egl_util.cc |
+++ b/ui/ozone/common/egl_util.cc |
@@ -5,6 +5,8 @@ |
#include "ui/ozone/common/egl_util.h" |
#include "base/files/file_path.h" |
+#include "ui/gl/egl_util.h" |
+#include "ui/gl/gl_bindings.h" |
namespace ui { |
namespace { |
@@ -62,6 +64,28 @@ bool LoadEGLGLES2Bindings( |
return true; |
} |
+EGLConfig ChooseEGLConfig(EGLDisplay display, const int32_t* attributes) { |
+ int32_t num_configs; |
+ if (!eglChooseConfig(display, attributes, nullptr, 0, &num_configs)) { |
+ LOG(ERROR) << "eglChooseConfig failed with error " |
+ << GetLastEGLErrorString(); |
+ return nullptr; |
+ } |
+ |
+ if (num_configs == 0) { |
+ LOG(ERROR) << "No suitable EGL configs found."; |
+ return nullptr; |
+ } |
+ |
+ EGLConfig config; |
+ if (!eglChooseConfig(display, attributes, &config, 1, &num_configs)) { |
+ LOG(ERROR) << "eglChooseConfig failed with error " |
+ << GetLastEGLErrorString(); |
+ return nullptr; |
+ } |
+ return config; |
+} |
+ |
void* /* EGLConfig */ ChooseEGLConfig(const EglConfigCallbacks& egl, |
const int32_t* attributes) { |
void* config; |