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

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

Issue 2797443003: Fix screen mirroring on Chrome OS (ReflectorTexture partial swap) (Closed)
Patch Set: Track texture status in output surface class 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 | « content/browser/compositor/gpu_browser_compositor_output_surface.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/output_surface_client.h" 10 #include "cc/output/output_surface_client.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 client_->DidReceiveSwapBuffersAck(); 58 client_->DidReceiveSwapBuffersAck();
59 } 59 }
60 60
61 void GpuBrowserCompositorOutputSurface::OnReflectorChanged() { 61 void GpuBrowserCompositorOutputSurface::OnReflectorChanged() {
62 if (!reflector_) { 62 if (!reflector_) {
63 reflector_texture_.reset(); 63 reflector_texture_.reset();
64 } else { 64 } else {
65 reflector_texture_.reset(new ReflectorTexture(context_provider())); 65 reflector_texture_.reset(new ReflectorTexture(context_provider()));
66 reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox()); 66 reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox());
67 } 67 }
68 reflector_texture_defined_ = false;
68 } 69 }
69 70
70 void GpuBrowserCompositorOutputSurface::BindToClient( 71 void GpuBrowserCompositorOutputSurface::BindToClient(
71 cc::OutputSurfaceClient* client) { 72 cc::OutputSurfaceClient* client) {
72 DCHECK(client); 73 DCHECK(client);
73 DCHECK(!client_); 74 DCHECK(!client_);
74 client_ = client; 75 client_ = client;
75 76
76 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( 77 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback(
77 base::Bind(&GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted, 78 base::Bind(&GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted,
(...skipping 23 matching lines...) Expand all
101 context_provider()->ContextGL()->ResizeCHROMIUM( 102 context_provider()->ContextGL()->ResizeCHROMIUM(
102 size.width(), size.height(), device_scale_factor, has_alpha); 103 size.width(), size.height(), device_scale_factor, has_alpha);
103 } 104 }
104 105
105 void GpuBrowserCompositorOutputSurface::SwapBuffers( 106 void GpuBrowserCompositorOutputSurface::SwapBuffers(
106 cc::OutputSurfaceFrame frame) { 107 cc::OutputSurfaceFrame frame) {
107 GetCommandBufferProxy()->SetLatencyInfo(frame.latency_info); 108 GetCommandBufferProxy()->SetLatencyInfo(frame.latency_info);
108 109
109 gfx::Size surface_size = frame.size; 110 gfx::Size surface_size = frame.size;
110 if (reflector_) { 111 if (reflector_) {
111 if (frame.sub_buffer_rect) { 112 if (frame.sub_buffer_rect && reflector_texture_defined_) {
112 reflector_texture_->CopyTextureSubImage(*frame.sub_buffer_rect); 113 reflector_texture_->CopyTextureSubImage(*frame.sub_buffer_rect);
113 reflector_->OnSourcePostSubBuffer(*frame.sub_buffer_rect, surface_size); 114 reflector_->OnSourcePostSubBuffer(*frame.sub_buffer_rect, surface_size);
114 } else { 115 } else {
115 reflector_texture_->CopyTextureFullImage(surface_size); 116 reflector_texture_->CopyTextureFullImage(surface_size);
116 reflector_->OnSourceSwapBuffers(surface_size); 117 reflector_->OnSourceSwapBuffers(surface_size);
118 reflector_texture_defined_ = true;
117 } 119 }
118 } 120 }
119 121
120 set_draw_rectangle_for_frame_ = false; 122 set_draw_rectangle_for_frame_ = false;
121 123
122 if (frame.sub_buffer_rect) { 124 if (frame.sub_buffer_rect) {
123 DCHECK(frame.content_bounds.empty()); 125 DCHECK(frame.content_bounds.empty());
124 context_provider_->ContextSupport()->PartialSwapBuffers( 126 context_provider_->ContextSupport()->PartialSwapBuffers(
125 *frame.sub_buffer_rect); 127 *frame.sub_buffer_rect);
126 } else if (!frame.content_bounds.empty()) { 128 } else if (!frame.content_bounds.empty()) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 GpuBrowserCompositorOutputSurface::GetCommandBufferProxy() { 171 GpuBrowserCompositorOutputSurface::GetCommandBufferProxy() {
170 ui::ContextProviderCommandBuffer* provider_command_buffer = 172 ui::ContextProviderCommandBuffer* provider_command_buffer =
171 static_cast<ui::ContextProviderCommandBuffer*>(context_provider_.get()); 173 static_cast<ui::ContextProviderCommandBuffer*>(context_provider_.get());
172 gpu::CommandBufferProxyImpl* command_buffer_proxy = 174 gpu::CommandBufferProxyImpl* command_buffer_proxy =
173 provider_command_buffer->GetCommandBufferProxy(); 175 provider_command_buffer->GetCommandBufferProxy();
174 DCHECK(command_buffer_proxy); 176 DCHECK(command_buffer_proxy);
175 return command_buffer_proxy; 177 return command_buffer_proxy;
176 } 178 }
177 179
178 } // namespace content 180 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_browser_compositor_output_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698