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

Unified Diff: ui/ozone/gl/gl_image_ozone_native_pixmap.cc

Issue 2439703003: Update tokens for EGL_EXT_image_dma_buf_import_modifiers (Closed)
Patch Set: Fix the broken logic - move Initialize outside the for loop and don't return false if the retry suc… Created 4 years, 2 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 | « third_party/khronos/EGL/eglext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/gl/gl_image_ozone_native_pixmap.cc
diff --git a/ui/ozone/gl/gl_image_ozone_native_pixmap.cc b/ui/ozone/gl/gl_image_ozone_native_pixmap.cc
index aafabef689f2bd2755a8bfa7e9c809984c800ee2..9b1cea904141b5215ad85167c236137d81c640b9 100644
--- a/ui/ozone/gl/gl_image_ozone_native_pixmap.cc
+++ b/ui/ozone/gl/gl_image_ozone_native_pixmap.cc
@@ -152,9 +152,9 @@ bool GLImageOzoneNativePixmap::Initialize(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};
+ const EGLint kLinuxDrmModifiers[] = {EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT,
+ EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT,
+ EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT};
bool has_dma_buf_import_modifier = gl::GLSurfaceEGL::HasEGLExtension(
"EGL_EXT_image_dma_buf_import_modifiers");
@@ -186,7 +186,43 @@ bool GLImageOzoneNativePixmap::Initialize(NativePixmap* pixmap,
if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT,
static_cast<EGLClientBuffer>(nullptr),
&attrs[0])) {
- return false;
+ // TODO(hshi): remove this workaround after chrome uprevs and
+ // corresponding driver updates are made. https://crosbug.com/p/58718
+ if (has_dma_buf_import_modifier) {
+ // If driver rejects the new DMA-BUF import modifer tokens, then try
+ // again with the old token definition.
+ for (size_t i = 0; i < attrs.size(); i += 2) {
+ switch (attrs[i]) {
+ case EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT:
+ attrs[i] = EGL_LINUX_DRM_PLANE0_MODIFIER0_EXT;
+ break;
+ case EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT:
+ attrs[i] = EGL_LINUX_DRM_PLANE0_MODIFIER1_EXT;
+ break;
+ case EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT:
+ attrs[i] = EGL_LINUX_DRM_PLANE1_MODIFIER0_EXT;
+ break;
+ case EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT:
+ attrs[i] = EGL_LINUX_DRM_PLANE1_MODIFIER1_EXT;
+ break;
+ case EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT:
+ attrs[i] = EGL_LINUX_DRM_PLANE2_MODIFIER0_EXT;
+ break;
+ case EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT:
+ attrs[i] = EGL_LINUX_DRM_PLANE2_MODIFIER1_EXT;
+ break;
+ default:
+ break;
+ }
+ }
+ if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT,
+ static_cast<EGLClientBuffer>(nullptr),
+ &attrs[0])) {
+ return false;
+ }
+ } else {
+ return false;
+ }
}
}
« no previous file with comments | « third_party/khronos/EGL/eglext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698