| Index: ui/gl/gl_image_egl.cc
|
| diff --git a/ui/gl/gl_image_egl.cc b/ui/gl/gl_image_egl.cc
|
| index 181999997ea4cdfd484704ad7b6e0caf27ecd131..841442019e9ac681fe19497cfb48be9caff41e04 100644
|
| --- a/ui/gl/gl_image_egl.cc
|
| +++ b/ui/gl/gl_image_egl.cc
|
| @@ -7,6 +7,10 @@
|
| #include "ui/gl/egl_util.h"
|
| #include "ui/gl/gl_surface_egl.h"
|
|
|
| +#define MAX_FORMATS 100
|
| +#define MAX_MODIFIERS 20
|
| +#define DRM_FORMAT_MOD_NONE 0
|
| +
|
| namespace gl {
|
|
|
| GLImageEGL::GLImageEGL(const gfx::Size& size)
|
| @@ -39,6 +43,30 @@ bool GLImageEGL::Initialize(EGLenum target,
|
| return true;
|
| }
|
|
|
| +std::vector<std::pair<EGLint, EGLuint64KHR>>
|
| +GLImageEGL::GetDmaBufFormatsWithModifiers() {
|
| + EGLDisplay dpy = GLSurfaceEGL::GetHardwareDisplay();
|
| + std::vector<std::pair<EGLint, EGLuint64KHR>> supported;
|
| + EGLint drm_formats[MAX_FORMATS];
|
| + EGLint num_formats = 0;
|
| +
|
| + eglQueryDmaBufFormatsEXT(dpy, MAX_FORMATS, &drm_formats[0], &num_formats);
|
| +
|
| + for (int i = 0; i < num_formats; i++) {
|
| + EGLuint64KHR drm_modifiers[MAX_MODIFIERS];
|
| + EGLint num_modifiers = 0;
|
| +
|
| + eglQueryDmaBufModifiersEXT(dpy, drm_formats[i], MAX_MODIFIERS,
|
| + &drm_modifiers[0], NULL, &num_modifiers);
|
| +
|
| + if (num_modifiers == 0)
|
| + supported.push_back(std::make_pair(drm_formats[i], DRM_FORMAT_MOD_NONE));
|
| + for (int j = 0; j < num_modifiers; j++)
|
| + supported.push_back(std::make_pair(drm_formats[i], drm_modifiers[j]));
|
| + }
|
| + return supported;
|
| +}
|
| +
|
| gfx::Size GLImageEGL::GetSize() {
|
| return size_;
|
| }
|
|
|