Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/exo/wayland/clients/client_base.h" | 5 #include "components/exo/wayland/clients/client_base.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <linux-dmabuf-unstable-v1-client-protocol.h> | 8 #include <linux-dmabuf-unstable-v1-client-protocol.h> |
| 9 #include <presentation-time-client-protocol.h> | 9 #include <presentation-time-client-protocol.h> |
| 10 #include <wayland-client-core.h> | 10 #include <wayland-client-core.h> |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 bool gl_initialized = gl::init::InitializeGLOneOff(); | 281 bool gl_initialized = gl::init::InitializeGLOneOff(); |
| 282 DCHECK(gl_initialized); | 282 DCHECK(gl_initialized); |
| 283 gl_surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); | 283 gl_surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); |
| 284 gl_context_ = | 284 gl_context_ = |
| 285 gl::init::CreateGLContext(nullptr, // share_group | 285 gl::init::CreateGLContext(nullptr, // share_group |
| 286 gl_surface_.get(), gl::GLContextAttribs()); | 286 gl_surface_.get(), gl::GLContextAttribs()); |
| 287 | 287 |
| 288 make_current_.reset( | 288 make_current_.reset( |
| 289 new ui::ScopedMakeCurrent(gl_context_.get(), gl_surface_.get())); | 289 new ui::ScopedMakeCurrent(gl_context_.get(), gl_surface_.get())); |
| 290 | 290 |
| 291 if (gl::GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_flush_external") || | |
| 292 gl::GLSurfaceEGL::HasEGLExtension("EGL_ARM_implicit_external_sync")) { | |
| 293 egl_sync_type_ = EGL_SYNC_FENCE_KHR; | |
| 294 } | |
| 295 if (gl::GLSurfaceEGL::HasEGLExtension("EGL_ANDROID_native_fence_sync")) { | 291 if (gl::GLSurfaceEGL::HasEGLExtension("EGL_ANDROID_native_fence_sync")) { |
| 296 egl_sync_type_ = EGL_SYNC_NATIVE_FENCE_ANDROID; | 292 egl_sync_type_ = EGL_SYNC_NATIVE_FENCE_ANDROID; |
| 293 } else { | |
| 294 egl_sync_type_ = EGL_SYNC_FENCE_KHR; | |
|
Daniele Castagna
2017/05/22 20:04:08
Should we DCHECK this is available?
reveman
2017/05/22 20:27:19
Added a EGL_KHR_fence_sync DCHECK here. We should
| |
| 297 } | 295 } |
| 298 | 296 |
| 299 native_interface = sk_sp<const GrGLInterface>(GrGLCreateNativeInterface()); | 297 native_interface = sk_sp<const GrGLInterface>(GrGLCreateNativeInterface()); |
| 300 DCHECK(native_interface); | 298 DCHECK(native_interface); |
| 301 gr_context_ = sk_sp<GrContext>(GrContext::Create( | 299 gr_context_ = sk_sp<GrContext>(GrContext::Create( |
| 302 kOpenGL_GrBackend, | 300 kOpenGL_GrBackend, |
| 303 reinterpret_cast<GrBackendContext>(native_interface.get()))); | 301 reinterpret_cast<GrBackendContext>(native_interface.get()))); |
| 304 DCHECK(gr_context_); | 302 DCHECK(gr_context_); |
| 305 } | 303 } |
| 306 #endif | 304 #endif |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 buffer->sk_surface = SkSurface::MakeRasterDirect( | 462 buffer->sk_surface = SkSurface::MakeRasterDirect( |
| 465 SkImageInfo::Make(width_, height_, kColorType, kOpaque_SkAlphaType), | 463 SkImageInfo::Make(width_, height_, kColorType, kOpaque_SkAlphaType), |
| 466 static_cast<uint8_t*>(buffer->shared_memory->memory()), stride); | 464 static_cast<uint8_t*>(buffer->shared_memory->memory()), stride); |
| 467 DCHECK(buffer->sk_surface); | 465 DCHECK(buffer->sk_surface); |
| 468 return buffer; | 466 return buffer; |
| 469 } | 467 } |
| 470 | 468 |
| 471 } // namespace clients | 469 } // namespace clients |
| 472 } // namespace wayland | 470 } // namespace wayland |
| 473 } // namespace exo | 471 } // namespace exo |
| OLD | NEW |