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

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

Issue 2779303002: [EXPERIMENT] Revert "Route D3D VSync signal to Compositor" (Closed)
Patch Set: Resolve merge conflict Created 3 years, 8 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/client/command_buffer_proxy_impl.cc ('k') | ui/gl/gl_switches.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"
10 #include "gpu/ipc/service/child_window_surface_win.h" 9 #include "gpu/ipc/service/child_window_surface_win.h"
11 #include "gpu/ipc/service/direct_composition_surface_win.h" 10 #include "gpu/ipc/service/direct_composition_surface_win.h"
12 #include "gpu/ipc/service/gpu_vsync_provider_win.h"
13 #include "gpu/ipc/service/pass_through_image_transport_surface.h" 11 #include "gpu/ipc/service/pass_through_image_transport_surface.h"
14 #include "gpu/ipc/service/switches.h" 12 #include "gpu/ipc/service/switches.h"
15 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
16 #include "ui/gl/gl_bindings.h" 14 #include "ui/gl/gl_bindings.h"
17 #include "ui/gl/gl_implementation.h" 15 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_surface_egl.h" 16 #include "ui/gl/gl_surface_egl.h"
19 #include "ui/gl/gl_switches.h"
20 #include "ui/gl/init/gl_factory.h" 17 #include "ui/gl/init/gl_factory.h"
21 #include "ui/gl/vsync_provider_win.h" 18 #include "ui/gl/vsync_provider_win.h"
22 19
23 namespace gpu { 20 namespace gpu {
24 21
25 namespace {
26 bool IsGpuVSyncSignalSupported() {
27 // TODO(stanisc): http://crbug.com/467617 Limit to Windows 8+ for now because
28 // of locking issue caused by waiting for VSync on Win7.
29 return base::win::GetVersion() >= base::win::VERSION_WIN8 &&
30 base::FeatureList::IsEnabled(features::kD3DVsync);
31 }
32
33 } // namespace
34
35 // static 22 // static
36 scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface( 23 scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface(
37 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, 24 base::WeakPtr<ImageTransportSurfaceDelegate> delegate,
38 SurfaceHandle surface_handle, 25 SurfaceHandle surface_handle,
39 gl::GLSurfaceFormat format) { 26 gl::GLSurfaceFormat format) {
40 DCHECK_NE(surface_handle, kNullSurfaceHandle); 27 DCHECK_NE(surface_handle, kNullSurfaceHandle);
41 28
42 scoped_refptr<gl::GLSurface> surface; 29 scoped_refptr<gl::GLSurface> surface;
43 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) { 30 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) {
44 std::unique_ptr<gfx::VSyncProvider> vsync_provider; 31 std::unique_ptr<gfx::VSyncProvider> vsync_provider(
45 32 new gl::VSyncProviderWin(surface_handle));
46 if (IsGpuVSyncSignalSupported())
47 vsync_provider.reset(new GpuVSyncProviderWin(delegate, surface_handle));
48 else
49 vsync_provider.reset(new gl::VSyncProviderWin(surface_handle));
50 33
51 if (gl::GLSurfaceEGL::IsDirectCompositionSupported()) { 34 if (gl::GLSurfaceEGL::IsDirectCompositionSupported()) {
52 if (DirectCompositionSurfaceWin::AreOverlaysSupported()) { 35 if (DirectCompositionSurfaceWin::AreOverlaysSupported()) {
53 scoped_refptr<DirectCompositionSurfaceWin> egl_surface = 36 scoped_refptr<DirectCompositionSurfaceWin> egl_surface =
54 make_scoped_refptr( 37 make_scoped_refptr(
55 new DirectCompositionSurfaceWin(delegate, surface_handle)); 38 new DirectCompositionSurfaceWin(delegate, surface_handle));
56 if (!egl_surface->Initialize(std::move(vsync_provider))) 39 if (!egl_surface->Initialize(std::move(vsync_provider)))
57 return nullptr; 40 return nullptr;
58 surface = egl_surface; 41 surface = egl_surface;
59 } else { 42 } else {
(...skipping 13 matching lines...) Expand all
73 surface = gl::init::CreateViewGLSurface(surface_handle); 56 surface = gl::init::CreateViewGLSurface(surface_handle);
74 if (!surface) 57 if (!surface)
75 return nullptr; 58 return nullptr;
76 } 59 }
77 60
78 return scoped_refptr<gl::GLSurface>( 61 return scoped_refptr<gl::GLSurface>(
79 new PassThroughImageTransportSurface(delegate, surface.get())); 62 new PassThroughImageTransportSurface(delegate, surface.get()));
80 } 63 }
81 64
82 } // namespace gpu 65 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/command_buffer_proxy_impl.cc ('k') | ui/gl/gl_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698