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

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

Issue 2374183006: Remove GLFrameData from CompositorFrame. (Closed)
Patch Set: Rebase + fix includes. 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 90 GetCommandBufferProxy()->SetLatencyInfo(frame.latency_info);
91 GetCommandBufferProxy()->SetLatencyInfo(frame.metadata.latency_info);
92 91
93 if (reflector_) { 92 if (reflector_) {
94 if (frame.gl_frame_data->sub_buffer_rect == 93 if (frame.sub_buffer_rect == gfx::Rect(frame.size)) {
95 gfx::Rect(frame.gl_frame_data->size)) {
96 reflector_texture_->CopyTextureFullImage(SurfaceSize()); 94 reflector_texture_->CopyTextureFullImage(SurfaceSize());
97 reflector_->OnSourceSwapBuffers(); 95 reflector_->OnSourceSwapBuffers();
98 } else { 96 } else {
99 const gfx::Rect& rect = frame.gl_frame_data->sub_buffer_rect; 97 const gfx::Rect& rect = frame.sub_buffer_rect;
100 reflector_texture_->CopyTextureSubImage(rect); 98 reflector_texture_->CopyTextureSubImage(rect);
101 reflector_->OnSourcePostSubBuffer(rect); 99 reflector_->OnSourcePostSubBuffer(rect);
102 } 100 }
103 } 101 }
104 102
105 if (frame.gl_frame_data->sub_buffer_rect == 103 if (frame.sub_buffer_rect == gfx::Rect(frame.size)) {
106 gfx::Rect(frame.gl_frame_data->size)) {
107 context_provider_->ContextSupport()->Swap(); 104 context_provider_->ContextSupport()->Swap();
108 } else { 105 } else {
109 context_provider_->ContextSupport()->PartialSwapBuffers( 106 context_provider_->ContextSupport()->PartialSwapBuffers(
110 frame.gl_frame_data->sub_buffer_rect); 107 frame.sub_buffer_rect);
111 } 108 }
112 } 109 }
113 110
114 uint32_t GpuBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { 111 uint32_t GpuBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() {
115 auto* gl = static_cast<ContextProviderCommandBuffer*>(context_provider()); 112 auto* gl = static_cast<ContextProviderCommandBuffer*>(context_provider());
116 return gl->GetCopyTextureInternalFormat(); 113 return gl->GetCopyTextureInternalFormat();
117 } 114 }
118 115
119 bool GpuBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() const { 116 bool GpuBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() const {
120 return false; 117 return false;
(...skipping 14 matching lines...) Expand all
135 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); 132 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
136 client_->DidSwapBuffersComplete(); 133 client_->DidSwapBuffersComplete();
137 } 134 }
138 135
139 #if defined(OS_MACOSX) 136 #if defined(OS_MACOSX)
140 void GpuBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( 137 void GpuBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle(
141 bool suspended) {} 138 bool suspended) {}
142 #endif 139 #endif
143 140
144 } // namespace content 141 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698