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

Side by Side Diff: content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc

Issue 2873243002: Move components/display_compositor to components/viz/display_compositor (Closed)
Patch Set: Rebase Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" 5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
10 #include "cc/output/output_surface_frame.h" 10 #include "cc/output/output_surface_frame.h"
11 #include "components/display_compositor/buffer_queue.h" 11 #include "components/viz/display_compositor/buffer_queue.h"
12 #include "components/display_compositor/compositor_overlay_candidate_validator.h " 12 #include "components/viz/display_compositor/compositor_overlay_candidate_validat or.h"
13 #include "components/display_compositor/gl_helper.h" 13 #include "components/viz/display_compositor/gl_helper.h"
14 #include "content/browser/compositor/reflector_impl.h" 14 #include "content/browser/compositor/reflector_impl.h"
15 #include "gpu/GLES2/gl2extchromium.h" 15 #include "gpu/GLES2/gl2extchromium.h"
16 #include "gpu/command_buffer/client/gles2_interface.h" 16 #include "gpu/command_buffer/client/gles2_interface.h"
17 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 17 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 GpuSurfacelessBrowserCompositorOutputSurface:: 21 GpuSurfacelessBrowserCompositorOutputSurface::
22 GpuSurfacelessBrowserCompositorOutputSurface( 22 GpuSurfacelessBrowserCompositorOutputSurface(
23 scoped_refptr<ui::ContextProviderCommandBuffer> context, 23 scoped_refptr<ui::ContextProviderCommandBuffer> context,
24 gpu::SurfaceHandle surface_handle, 24 gpu::SurfaceHandle surface_handle,
25 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, 25 const UpdateVSyncParametersCallback& update_vsync_parameters_callback,
26 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 26 std::unique_ptr<viz::CompositorOverlayCandidateValidator>
27 overlay_candidate_validator, 27 overlay_candidate_validator,
28 unsigned int target, 28 unsigned int target,
29 unsigned int internalformat, 29 unsigned int internalformat,
30 gfx::BufferFormat format, 30 gfx::BufferFormat format,
31 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) 31 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager)
32 : GpuBrowserCompositorOutputSurface(std::move(context), 32 : GpuBrowserCompositorOutputSurface(std::move(context),
33 update_vsync_parameters_callback, 33 update_vsync_parameters_callback,
34 std::move(overlay_candidate_validator)), 34 std::move(overlay_candidate_validator)),
35 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { 35 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) {
36 capabilities_.uses_default_gl_framebuffer = false; 36 capabilities_.uses_default_gl_framebuffer = false;
37 capabilities_.flipped_output_surface = true; 37 capabilities_.flipped_output_surface = true;
38 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling 38 // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling
39 // more closely with the previous surfaced behavior. 39 // more closely with the previous surfaced behavior.
40 // With a surface, swap buffer ack used to return early, before actually 40 // With a surface, swap buffer ack used to return early, before actually
41 // presenting the back buffer, enabling the browser compositor to run ahead. 41 // presenting the back buffer, enabling the browser compositor to run ahead.
42 // Surfaceless implementation acks at the time of actual buffer swap, which 42 // Surfaceless implementation acks at the time of actual buffer swap, which
43 // shifts the start of the new frame forward relative to the old 43 // shifts the start of the new frame forward relative to the old
44 // implementation. 44 // implementation.
45 capabilities_.max_frames_pending = 2; 45 capabilities_.max_frames_pending = 2;
46 46
47 gl_helper_.reset(new display_compositor::GLHelper( 47 gl_helper_.reset(new viz::GLHelper(context_provider_->ContextGL(),
48 context_provider_->ContextGL(), context_provider_->ContextSupport())); 48 context_provider_->ContextSupport()));
49 buffer_queue_.reset(new display_compositor::BufferQueue( 49 buffer_queue_.reset(new viz::BufferQueue(
50 context_provider_->ContextGL(), target, internalformat, format, 50 context_provider_->ContextGL(), target, internalformat, format,
51 gl_helper_.get(), gpu_memory_buffer_manager_, surface_handle)); 51 gl_helper_.get(), gpu_memory_buffer_manager_, surface_handle));
52 buffer_queue_->Initialize(); 52 buffer_queue_->Initialize();
53 } 53 }
54 54
55 GpuSurfacelessBrowserCompositorOutputSurface:: 55 GpuSurfacelessBrowserCompositorOutputSurface::
56 ~GpuSurfacelessBrowserCompositorOutputSurface() { 56 ~GpuSurfacelessBrowserCompositorOutputSurface() {
57 } 57 }
58 58
59 bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() 59 bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane()
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 force_swap = true; 121 force_swap = true;
122 } 122 }
123 buffer_queue_->PageFlipComplete(); 123 buffer_queue_->PageFlipComplete();
124 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( 124 GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(
125 latency_info, result, params_mac); 125 latency_info, result, params_mac);
126 if (force_swap) 126 if (force_swap)
127 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_)); 127 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_));
128 } 128 }
129 129
130 } // namespace content 130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698