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

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

Issue 2374183006: Remove GLFrameData from CompositorFrame. (Closed)
Patch Set: Rebase. Created 4 years, 2 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_browser_compositor_output_surface.h" 5 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "cc/output/compositor_frame.h"
11 #include "cc/output/output_surface_client.h" 10 #include "cc/output/output_surface_client.h"
11 #include "cc/output/output_surface_frame.h"
12 #include "components/display_compositor/compositor_overlay_candidate_validator.h " 12 #include "components/display_compositor/compositor_overlay_candidate_validator.h "
13 #include "content/browser/compositor/reflector_impl.h" 13 #include "content/browser/compositor/reflector_impl.h"
14 #include "content/browser/compositor/reflector_texture.h" 14 #include "content/browser/compositor/reflector_texture.h"
15 #include "content/browser/renderer_host/render_widget_host_impl.h" 15 #include "content/browser/renderer_host/render_widget_host_impl.h"
16 #include "content/common/gpu/client/context_provider_command_buffer.h" 16 #include "content/common/gpu/client/context_provider_command_buffer.h"
17 #include "gpu/command_buffer/client/context_support.h" 17 #include "gpu/command_buffer/client/context_support.h"
18 #include "gpu/command_buffer/client/gles2_interface.h" 18 #include "gpu/command_buffer/client/gles2_interface.h"
19 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 19 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
20 20
21 namespace content { 21 namespace content {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 void GpuBrowserCompositorOutputSurface::EnsureBackbuffer() {} 78 void GpuBrowserCompositorOutputSurface::EnsureBackbuffer() {}
79 79
80 void GpuBrowserCompositorOutputSurface::DiscardBackbuffer() { 80 void GpuBrowserCompositorOutputSurface::DiscardBackbuffer() {
81 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); 81 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM();
82 } 82 }
83 83
84 void GpuBrowserCompositorOutputSurface::BindFramebuffer() { 84 void GpuBrowserCompositorOutputSurface::BindFramebuffer() {
85 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); 85 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
86 } 86 }
87 87
88 void GpuBrowserCompositorOutputSurface::SwapBuffers(cc::CompositorFrame frame) { 88 void GpuBrowserCompositorOutputSurface::SwapBuffers(
89 DCHECK(frame.gl_frame_data); 89 cc::OutputSurfaceFrame frame) {
90 GetCommandBufferProxy()->SetLatencyInfo(frame.latency_info);
90 91
91 GetCommandBufferProxy()->SetLatencyInfo(frame.metadata.latency_info); 92 gfx::Rect swap_rect = frame.sub_buffer_rect;
92 93 gfx::Size surface_size = frame.size;
93 gfx::Rect swap_rect = frame.gl_frame_data->sub_buffer_rect;
94 gfx::Size surface_size = frame.gl_frame_data->size;
95 if (reflector_) { 94 if (reflector_) {
96 if (swap_rect == gfx::Rect(surface_size)) { 95 if (swap_rect == gfx::Rect(surface_size)) {
97 reflector_texture_->CopyTextureFullImage(surface_size); 96 reflector_texture_->CopyTextureFullImage(surface_size);
98 reflector_->OnSourceSwapBuffers(surface_size); 97 reflector_->OnSourceSwapBuffers(surface_size);
99 } else { 98 } else {
100 reflector_texture_->CopyTextureSubImage(swap_rect); 99 reflector_texture_->CopyTextureSubImage(swap_rect);
101 reflector_->OnSourcePostSubBuffer(swap_rect, surface_size); 100 reflector_->OnSourcePostSubBuffer(swap_rect, surface_size);
102 } 101 }
103 } 102 }
104 103
105 if (swap_rect == gfx::Rect(frame.gl_frame_data->size)) 104 if (swap_rect == gfx::Rect(frame.size))
106 context_provider_->ContextSupport()->Swap(); 105 context_provider_->ContextSupport()->Swap();
107 else 106 else
108 context_provider_->ContextSupport()->PartialSwapBuffers(swap_rect); 107 context_provider_->ContextSupport()->PartialSwapBuffers(swap_rect);
109 } 108 }
110 109
111 uint32_t GpuBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { 110 uint32_t GpuBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() {
112 auto* gl = static_cast<ContextProviderCommandBuffer*>(context_provider()); 111 auto* gl = static_cast<ContextProviderCommandBuffer*>(context_provider());
113 return gl->GetCopyTextureInternalFormat(); 112 return gl->GetCopyTextureInternalFormat();
114 } 113 }
115 114
(...skipping 16 matching lines...) Expand all
132 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 131 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
133 client_->DidSwapBuffersComplete(); 132 client_->DidSwapBuffersComplete();
134 } 133 }
135 134
136 #if defined(OS_MACOSX) 135 #if defined(OS_MACOSX)
137 void GpuBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( 136 void GpuBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle(
138 bool suspended) {} 137 bool suspended) {}
139 #endif 138 #endif
140 139
141 } // namespace content 140 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698