| 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 DCHECK(gl::GLSurfaceEGL::HasEGLExtension("EGL_KHR_fence_sync")); | 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 } |
| 292 if (gl::GLSurfaceEGL::HasEGLExtension("EGL_ANDROID_native_fence_sync")) { | 295 if (gl::GLSurfaceEGL::HasEGLExtension("EGL_ANDROID_native_fence_sync")) { |
| 293 egl_sync_type_ = EGL_SYNC_NATIVE_FENCE_ANDROID; | 296 egl_sync_type_ = EGL_SYNC_NATIVE_FENCE_ANDROID; |
| 294 } else { | |
| 295 egl_sync_type_ = EGL_SYNC_FENCE_KHR; | |
| 296 } | 297 } |
| 297 | 298 |
| 298 native_interface = sk_sp<const GrGLInterface>(GrGLCreateNativeInterface()); | 299 native_interface = sk_sp<const GrGLInterface>(GrGLCreateNativeInterface()); |
| 299 DCHECK(native_interface); | 300 DCHECK(native_interface); |
| 300 gr_context_ = sk_sp<GrContext>(GrContext::Create( | 301 gr_context_ = sk_sp<GrContext>(GrContext::Create( |
| 301 kOpenGL_GrBackend, | 302 kOpenGL_GrBackend, |
| 302 reinterpret_cast<GrBackendContext>(native_interface.get()))); | 303 reinterpret_cast<GrBackendContext>(native_interface.get()))); |
| 303 DCHECK(gr_context_); | 304 DCHECK(gr_context_); |
| 304 } | 305 } |
| 305 #endif | 306 #endif |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 buffer->sk_surface = SkSurface::MakeRasterDirect( | 464 buffer->sk_surface = SkSurface::MakeRasterDirect( |
| 464 SkImageInfo::Make(width_, height_, kColorType, kOpaque_SkAlphaType), | 465 SkImageInfo::Make(width_, height_, kColorType, kOpaque_SkAlphaType), |
| 465 static_cast<uint8_t*>(buffer->shared_memory->memory()), stride); | 466 static_cast<uint8_t*>(buffer->shared_memory->memory()), stride); |
| 466 DCHECK(buffer->sk_surface); | 467 DCHECK(buffer->sk_surface); |
| 467 return buffer; | 468 return buffer; |
| 468 } | 469 } |
| 469 | 470 |
| 470 } // namespace clients | 471 } // namespace clients |
| 471 } // namespace wayland | 472 } // namespace wayland |
| 472 } // namespace exo | 473 } // namespace exo |
| OLD | NEW |