Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: ui/gl/gl_image_egl.cc

Issue 2801713002: GLImageEGL: add dmabuf queries
Patch Set: remove enum BufferFormatModifier Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_image_egl.h ('k') | ui/gl/gl_image_native_pixmap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
}
« no previous file with comments | « ui/gl/gl_image_egl.h ('k') | ui/gl/gl_image_native_pixmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698