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

Side by Side Diff: gpu/ipc/service/image_transport_surface_win.cc

Issue 2710183004: Support GPU VSync when DirectComposition isn't enabled (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « gpu/ipc/service/gpu_vsync_provider_win.cc ('k') | ui/gl/init/gl_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/ipc/service/image_transport_surface.h" 5 #include "gpu/ipc/service/image_transport_surface.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "gpu/ipc/service/child_window_surface_win.h" 10 #include "gpu/ipc/service/child_window_surface_win.h"
(...skipping 22 matching lines...) Expand all
33 } // namespace 33 } // namespace
34 34
35 // static 35 // static
36 scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface( 36 scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface(
37 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, 37 base::WeakPtr<ImageTransportSurfaceDelegate> delegate,
38 SurfaceHandle surface_handle, 38 SurfaceHandle surface_handle,
39 gl::GLSurfaceFormat format) { 39 gl::GLSurfaceFormat format) {
40 DCHECK_NE(surface_handle, kNullSurfaceHandle); 40 DCHECK_NE(surface_handle, kNullSurfaceHandle);
41 41
42 scoped_refptr<gl::GLSurface> surface; 42 scoped_refptr<gl::GLSurface> surface;
43 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && 43 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) {
44 gl::GLSurfaceEGL::IsDirectCompositionSupported()) {
45 std::unique_ptr<gfx::VSyncProvider> vsync_provider; 44 std::unique_ptr<gfx::VSyncProvider> vsync_provider;
46 45
47 if (IsGpuVSyncSignalSupported()) 46 if (IsGpuVSyncSignalSupported())
48 vsync_provider.reset(new GpuVSyncProviderWin(delegate, surface_handle)); 47 vsync_provider.reset(new GpuVSyncProviderWin(delegate, surface_handle));
49 else 48 else
50 vsync_provider.reset(new gl::VSyncProviderWin(surface_handle)); 49 vsync_provider.reset(new gl::VSyncProviderWin(surface_handle));
51 50
52 if (base::FeatureList::IsEnabled(switches::kDirectCompositionOverlays)) { 51 if (gl::GLSurfaceEGL::IsDirectCompositionSupported()) {
53 scoped_refptr<DirectCompositionSurfaceWin> egl_surface = 52 if (base::FeatureList::IsEnabled(switches::kDirectCompositionOverlays)) {
54 make_scoped_refptr( 53 scoped_refptr<DirectCompositionSurfaceWin> egl_surface =
55 new DirectCompositionSurfaceWin(delegate, surface_handle)); 54 make_scoped_refptr(
56 if (!egl_surface->Initialize(std::move(vsync_provider))) 55 new DirectCompositionSurfaceWin(delegate, surface_handle));
56 if (!egl_surface->Initialize(std::move(vsync_provider)))
57 return nullptr;
58 surface = egl_surface;
59 } else {
60 scoped_refptr<ChildWindowSurfaceWin> egl_surface = make_scoped_refptr(
61 new ChildWindowSurfaceWin(delegate, surface_handle));
62 if (!egl_surface->Initialize(std::move(vsync_provider)))
63 return nullptr;
64 surface = egl_surface;
65 }
66 } else {
67 surface = gl::init::CreateNativeViewGLSurfaceEGL(
68 surface_handle, std::move(vsync_provider));
69 if (!surface)
57 return nullptr; 70 return nullptr;
58 surface = egl_surface;
59 } else {
60 scoped_refptr<ChildWindowSurfaceWin> egl_surface = make_scoped_refptr(
61 new ChildWindowSurfaceWin(delegate, surface_handle));
62 if (!egl_surface->Initialize(std::move(vsync_provider)))
63 return nullptr;
64 surface = egl_surface;
65 } 71 }
66 } else { 72 } else {
67 surface = gl::init::CreateViewGLSurface(surface_handle); 73 surface = gl::init::CreateViewGLSurface(surface_handle);
68 if (!surface) 74 if (!surface)
69 return nullptr; 75 return nullptr;
70 } 76 }
71 77
72 return scoped_refptr<gl::GLSurface>( 78 return scoped_refptr<gl::GLSurface>(
73 new PassThroughImageTransportSurface(delegate, surface.get())); 79 new PassThroughImageTransportSurface(delegate, surface.get()));
74 } 80 }
75 81
76 } // namespace gpu 82 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_vsync_provider_win.cc ('k') | ui/gl/init/gl_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698