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

Side by Side Diff: ui/ozone/gl/gl_image_ozone_native_pixmap.cc

Issue 2443703002: Remove old tokens for DMA-BUF import modifiers. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h" 5 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ui/gfx/buffer_format_util.h" 9 #include "ui/gfx/buffer_format_util.h"
10 #include "ui/gl/gl_surface_egl.h" 10 #include "ui/gl/gl_surface_egl.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 attrs.push_back(modifier & 0xffffffff); 179 attrs.push_back(modifier & 0xffffffff);
180 attrs.push_back(kLinuxDrmModifiers[attrs_plane] + 1); 180 attrs.push_back(kLinuxDrmModifiers[attrs_plane] + 1);
181 attrs.push_back(static_cast<uint32_t>(modifier >> 32)); 181 attrs.push_back(static_cast<uint32_t>(modifier >> 32));
182 } 182 }
183 } 183 }
184 attrs.push_back(EGL_NONE); 184 attrs.push_back(EGL_NONE);
185 185
186 if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT, 186 if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT,
187 static_cast<EGLClientBuffer>(nullptr), 187 static_cast<EGLClientBuffer>(nullptr),
188 &attrs[0])) { 188 &attrs[0])) {
189 // TODO(hshi): remove this workaround after chrome uprevs and 189 return false;
190 // corresponding driver updates are made. https://crosbug.com/p/58718
191 if (has_dma_buf_import_modifier) {
192 // If driver rejects the new DMA-BUF import modifer tokens, then try
193 // again with the old token definition.
194 for (size_t i = 0; i < attrs.size(); i += 2) {
195 switch (attrs[i]) {
196 case EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT:
197 attrs[i] = EGL_LINUX_DRM_PLANE0_MODIFIER0_EXT;
198 break;
199 case EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT:
200 attrs[i] = EGL_LINUX_DRM_PLANE0_MODIFIER1_EXT;
201 break;
202 case EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT:
203 attrs[i] = EGL_LINUX_DRM_PLANE1_MODIFIER0_EXT;
204 break;
205 case EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT:
206 attrs[i] = EGL_LINUX_DRM_PLANE1_MODIFIER1_EXT;
207 break;
208 case EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT:
209 attrs[i] = EGL_LINUX_DRM_PLANE2_MODIFIER0_EXT;
210 break;
211 case EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT:
212 attrs[i] = EGL_LINUX_DRM_PLANE2_MODIFIER1_EXT;
213 break;
214 default:
215 break;
216 }
217 }
218 if (!GLImageEGL::Initialize(EGL_LINUX_DMA_BUF_EXT,
219 static_cast<EGLClientBuffer>(nullptr),
220 &attrs[0])) {
221 return false;
222 }
223 } else {
224 return false;
225 }
226 } 190 }
227 } 191 }
228 192
229 pixmap_ = pixmap; 193 pixmap_ = pixmap;
230 return true; 194 return true;
231 } 195 }
232 196
233 unsigned GLImageOzoneNativePixmap::GetInternalFormat() { 197 unsigned GLImageOzoneNativePixmap::GetInternalFormat() {
234 return internalformat_; 198 return internalformat_;
235 } 199 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 case gfx::BufferFormat::UYVY_422: 275 case gfx::BufferFormat::UYVY_422:
312 NOTREACHED(); 276 NOTREACHED();
313 return GL_NONE; 277 return GL_NONE;
314 } 278 }
315 279
316 NOTREACHED(); 280 NOTREACHED();
317 return GL_NONE; 281 return GL_NONE;
318 } 282 }
319 283
320 } // namespace ui 284 } // namespace ui
OLDNEW
« third_party/khronos/EGL/eglext.h ('K') | « third_party/khronos/EGL/eglext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698