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

Side by Side Diff: cc/output/output_surface.cc

Issue 619453002: gpu: Remove Echo and SwapCompletion GL interfacess (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tits
Patch Set: rebase Created 6 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
« no previous file with comments | « no previous file | cc/test/test_context_provider.h » ('j') | cc/test/test_gles2_interface.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "cc/output/output_surface.h" 5 #include "cc/output/output_surface.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 DCHECK(!context_provider_.get()); 170 DCHECK(!context_provider_.get());
171 } 171 }
172 172
173 void OutputSurface::SetUpContext3d() { 173 void OutputSurface::SetUpContext3d() {
174 DCHECK(context_provider_.get()); 174 DCHECK(context_provider_.get());
175 DCHECK(client_); 175 DCHECK(client_);
176 176
177 context_provider_->SetLostContextCallback( 177 context_provider_->SetLostContextCallback(
178 base::Bind(&OutputSurface::DidLoseOutputSurface, 178 base::Bind(&OutputSurface::DidLoseOutputSurface,
179 base::Unretained(this))); 179 base::Unretained(this)));
180 context_provider_->ContextSupport()->SetSwapBuffersCompleteCallback(
181 base::Bind(&OutputSurface::OnSwapBuffersComplete,
182 base::Unretained(this)));
183 context_provider_->SetMemoryPolicyChangedCallback( 180 context_provider_->SetMemoryPolicyChangedCallback(
184 base::Bind(&OutputSurface::SetMemoryPolicy, 181 base::Bind(&OutputSurface::SetMemoryPolicy,
185 base::Unretained(this))); 182 base::Unretained(this)));
186 } 183 }
187 184
188 void OutputSurface::ReleaseContextProvider() { 185 void OutputSurface::ReleaseContextProvider() {
189 DCHECK(client_); 186 DCHECK(client_);
190 DCHECK(context_provider_.get()); 187 DCHECK(context_provider_.get());
191 ResetContext3d(); 188 ResetContext3d();
192 } 189 }
193 190
194 void OutputSurface::ResetContext3d() { 191 void OutputSurface::ResetContext3d() {
195 if (context_provider_.get()) { 192 if (context_provider_.get()) {
196 while (!pending_gpu_latency_query_ids_.empty()) { 193 while (!pending_gpu_latency_query_ids_.empty()) {
197 unsigned query_id = pending_gpu_latency_query_ids_.front(); 194 unsigned query_id = pending_gpu_latency_query_ids_.front();
198 pending_gpu_latency_query_ids_.pop_front(); 195 pending_gpu_latency_query_ids_.pop_front();
199 context_provider_->ContextGL()->DeleteQueriesEXT(1, &query_id); 196 context_provider_->ContextGL()->DeleteQueriesEXT(1, &query_id);
200 } 197 }
201 while (!available_gpu_latency_query_ids_.empty()) { 198 while (!available_gpu_latency_query_ids_.empty()) {
202 unsigned query_id = available_gpu_latency_query_ids_.front(); 199 unsigned query_id = available_gpu_latency_query_ids_.front();
203 available_gpu_latency_query_ids_.pop_front(); 200 available_gpu_latency_query_ids_.pop_front();
204 context_provider_->ContextGL()->DeleteQueriesEXT(1, &query_id); 201 context_provider_->ContextGL()->DeleteQueriesEXT(1, &query_id);
205 } 202 }
206 context_provider_->SetLostContextCallback( 203 context_provider_->SetLostContextCallback(
207 ContextProvider::LostContextCallback()); 204 ContextProvider::LostContextCallback());
208 context_provider_->SetMemoryPolicyChangedCallback( 205 context_provider_->SetMemoryPolicyChangedCallback(
209 ContextProvider::MemoryPolicyChangedCallback()); 206 ContextProvider::MemoryPolicyChangedCallback());
210 if (gpu::ContextSupport* support = context_provider_->ContextSupport())
211 support->SetSwapBuffersCompleteCallback(base::Closure());
212 } 207 }
213 context_provider_ = NULL; 208 context_provider_ = NULL;
214 } 209 }
215 210
216 void OutputSurface::EnsureBackbuffer() { 211 void OutputSurface::EnsureBackbuffer() {
217 if (software_device_) 212 if (software_device_)
218 software_device_->EnsureBackbuffer(); 213 software_device_->EnsureBackbuffer();
219 } 214 }
220 215
221 void OutputSurface::DiscardBackbuffer() { 216 void OutputSurface::DiscardBackbuffer() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 client_->DidSwapBuffers(); 249 client_->DidSwapBuffers();
255 return; 250 return;
256 } 251 }
257 252
258 DCHECK(context_provider_.get()); 253 DCHECK(context_provider_.get());
259 DCHECK(frame->gl_frame_data); 254 DCHECK(frame->gl_frame_data);
260 255
261 UpdateAndMeasureGpuLatency(); 256 UpdateAndMeasureGpuLatency();
262 if (frame->gl_frame_data->sub_buffer_rect == 257 if (frame->gl_frame_data->sub_buffer_rect ==
263 gfx::Rect(frame->gl_frame_data->size)) { 258 gfx::Rect(frame->gl_frame_data->size)) {
264 context_provider_->ContextSupport()->Swap(); 259 context_provider_->ContextGL()->SwapBuffers();
265 } else { 260 } else {
266 context_provider_->ContextSupport()->PartialSwapBuffers( 261 const gfx::Rect& rect = frame->gl_frame_data->sub_buffer_rect;
267 frame->gl_frame_data->sub_buffer_rect); 262 context_provider_->ContextGL()->PostSubBufferCHROMIUM(
263 rect.x(), rect.y(), rect.width(), rect.height());
268 } 264 }
265 uint32_t sync_point =
266 context_provider_->ContextGL()->InsertSyncPointCHROMIUM();
267 context_provider_->ContextSupport()->SignalSyncPoint(
268 sync_point,
269 base::Bind(&OutputSurface::OnSwapBuffersComplete,
270 weak_ptr_factory_.GetWeakPtr()));
269 271
270 client_->DidSwapBuffers(); 272 client_->DidSwapBuffers();
271 } 273 }
272 274
273 base::TimeDelta OutputSurface::GpuLatencyEstimate() { 275 base::TimeDelta OutputSurface::GpuLatencyEstimate() {
274 if (context_provider_.get() && !capabilities_.adjust_deadline_for_parent) 276 if (context_provider_.get() && !capabilities_.adjust_deadline_for_parent)
275 return gpu_latency_history_.Percentile(kGpuLatencyEstimationPercentile); 277 return gpu_latency_history_.Percentile(kGpuLatencyEstimationPercentile);
276 else 278 else
277 return base::TimeDelta(); 279 return base::TimeDelta();
278 } 280 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy", 362 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy",
361 "bytes_limit_when_visible", policy.bytes_limit_when_visible); 363 "bytes_limit_when_visible", policy.bytes_limit_when_visible);
362 // Just ignore the memory manager when it says to set the limit to zero 364 // Just ignore the memory manager when it says to set the limit to zero
363 // bytes. This will happen when the memory manager thinks that the renderer 365 // bytes. This will happen when the memory manager thinks that the renderer
364 // is not visible (which the renderer knows better). 366 // is not visible (which the renderer knows better).
365 if (policy.bytes_limit_when_visible) 367 if (policy.bytes_limit_when_visible)
366 client_->SetMemoryPolicy(policy); 368 client_->SetMemoryPolicy(policy);
367 } 369 }
368 370
369 } // namespace cc 371 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/test/test_context_provider.h » ('j') | cc/test/test_gles2_interface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698