| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 bool gl_initialized = gl::init::InitializeGLOneOff(); | 267 bool gl_initialized = gl::init::InitializeGLOneOff(); |
| 268 DCHECK(gl_initialized); | 268 DCHECK(gl_initialized); |
| 269 gl_surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); | 269 gl_surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); |
| 270 gl_context_ = | 270 gl_context_ = |
| 271 gl::init::CreateGLContext(nullptr, // share_group | 271 gl::init::CreateGLContext(nullptr, // share_group |
| 272 gl_surface_.get(), gl::GLContextAttribs()); | 272 gl_surface_.get(), gl::GLContextAttribs()); |
| 273 | 273 |
| 274 make_current_.reset( | 274 make_current_.reset( |
| 275 new ui::ScopedMakeCurrent(gl_context_.get(), gl_surface_.get())); | 275 new ui::ScopedMakeCurrent(gl_context_.get(), gl_surface_.get())); |
| 276 | 276 |
| 277 if (gl::GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_flush_external") || | 277 DCHECK(gl::GLSurfaceEGL::HasEGLExtension("EGL_KHR_fence_sync")); |
| 278 gl::GLSurfaceEGL::HasEGLExtension("EGL_ARM_implicit_external_sync")) { | |
| 279 egl_sync_type_ = EGL_SYNC_FENCE_KHR; | |
| 280 } | |
| 281 if (gl::GLSurfaceEGL::HasEGLExtension("EGL_ANDROID_native_fence_sync")) { | 278 if (gl::GLSurfaceEGL::HasEGLExtension("EGL_ANDROID_native_fence_sync")) { |
| 282 egl_sync_type_ = EGL_SYNC_NATIVE_FENCE_ANDROID; | 279 egl_sync_type_ = EGL_SYNC_NATIVE_FENCE_ANDROID; |
| 280 } else { |
| 281 egl_sync_type_ = EGL_SYNC_FENCE_KHR; |
| 283 } | 282 } |
| 284 | 283 |
| 285 native_interface = sk_sp<const GrGLInterface>(GrGLCreateNativeInterface()); | 284 native_interface = sk_sp<const GrGLInterface>(GrGLCreateNativeInterface()); |
| 286 DCHECK(native_interface); | 285 DCHECK(native_interface); |
| 287 gr_context_ = sk_sp<GrContext>(GrContext::Create( | 286 gr_context_ = sk_sp<GrContext>(GrContext::Create( |
| 288 kOpenGL_GrBackend, | 287 kOpenGL_GrBackend, |
| 289 reinterpret_cast<GrBackendContext>(native_interface.get()))); | 288 reinterpret_cast<GrBackendContext>(native_interface.get()))); |
| 290 DCHECK(gr_context_); | 289 DCHECK(gr_context_); |
| 291 } | 290 } |
| 292 #endif | 291 #endif |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 buffer->sk_surface = SkSurface::MakeRasterDirect( | 448 buffer->sk_surface = SkSurface::MakeRasterDirect( |
| 450 SkImageInfo::Make(width_, height_, kColorType, kOpaque_SkAlphaType), | 449 SkImageInfo::Make(width_, height_, kColorType, kOpaque_SkAlphaType), |
| 451 static_cast<uint8_t*>(buffer->shared_memory->memory()), stride); | 450 static_cast<uint8_t*>(buffer->shared_memory->memory()), stride); |
| 452 DCHECK(buffer->sk_surface); | 451 DCHECK(buffer->sk_surface); |
| 453 return buffer; | 452 return buffer; |
| 454 } | 453 } |
| 455 | 454 |
| 456 } // namespace clients | 455 } // namespace clients |
| 457 } // namespace wayland | 456 } // namespace wayland |
| 458 } // namespace exo | 457 } // namespace exo |
| OLD | NEW |