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

Unified Diff: ui/gl/gl_image_ozone_native_pixmap.cc

Issue 2039813002: Add format modifier IDs for EGL_EXT_image_dma_buf_import extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add format modifier IDs for EGL_EXT_image_dma_buf_import extension Created 4 years, 6 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/gfx/native_pixmap_handle_ozone.cc ('k') | ui/gl/gl_image_ozone_native_pixmap_drm_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_ozone_native_pixmap.cc
diff --git a/ui/gl/gl_image_ozone_native_pixmap.cc b/ui/gl/gl_image_ozone_native_pixmap.cc
index 977f02e424ff06f389098e1a4094bc4dfa6da31a..0475abf9c6af5bd6278824a1dc5cb18848b238f2 100644
--- a/ui/gl/gl_image_ozone_native_pixmap.cc
+++ b/ui/gl/gl_image_ozone_native_pixmap.cc
@@ -4,6 +4,7 @@
#include "ui/gfx/buffer_format_util.h"
#include "ui/gl/gl_image_ozone_native_pixmap.h"
+#include "ui/gl/gl_surface_egl.h"
#define FOURCC(a, b, c, d) \
((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \
@@ -137,6 +138,12 @@ bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap,
attrs.push_back(EGL_LINUX_DRM_FOURCC_EXT);
attrs.push_back(FourCC(format));
+ const EGLint kLinuxDrmModifiers[] = {EGL_LINUX_DRM_PLANE0_MODIFIER0_EXT,
+ EGL_LINUX_DRM_PLANE1_MODIFIER0_EXT,
+ EGL_LINUX_DRM_PLANE2_MODIFIER0_EXT};
+ bool has_dma_buf_import_modifier =
+ GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_dma_buf_import_modifiers");
+
for (size_t plane = 0;
plane < gfx::NumberOfPlanesForBufferFormat(pixmap->GetBufferFormat());
++plane) {
@@ -147,6 +154,14 @@ bool GLImageOzoneNativePixmap::Initialize(ui::NativePixmap* pixmap,
attrs.push_back(pixmap->GetDmaBufOffset(plane));
attrs.push_back(EGL_DMA_BUF_PLANE0_PITCH_EXT + plane * 3);
attrs.push_back(pixmap->GetDmaBufPitch(plane));
+ if (has_dma_buf_import_modifier) {
+ uint64_t modifier = pixmap->GetDmaBufModifier(plane);
+ DCHECK(plane < arraysize(kLinuxDrmModifiers));
+ attrs.push_back(kLinuxDrmModifiers[plane]);
+ attrs.push_back(modifier & 0xffffffff);
+ attrs.push_back(kLinuxDrmModifiers[plane] + 1);
+ attrs.push_back(static_cast<uint32_t>(modifier >> 32));
+ }
}
attrs.push_back(EGL_NONE);
« no previous file with comments | « ui/gfx/native_pixmap_handle_ozone.cc ('k') | ui/gl/gl_image_ozone_native_pixmap_drm_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698