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

Side by Side Diff: cc/raster/gpu_raster_buffer_provider.cc

Issue 2555743004: Delay activation/draw on GPU tile work completion (Closed)
Patch Set: cleanup Created 4 years 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 "cc/raster/gpu_raster_buffer_provider.h" 5 #include "cc/raster/gpu_raster_buffer_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "cc/base/histograms.h" 15 #include "cc/base/histograms.h"
16 #include "cc/playback/image_hijack_canvas.h" 16 #include "cc/playback/image_hijack_canvas.h"
17 #include "cc/playback/raster_source.h" 17 #include "cc/playback/raster_source.h"
18 #include "cc/raster/scoped_gpu_raster.h" 18 #include "cc/raster/scoped_gpu_raster.h"
19 #include "cc/resources/resource.h" 19 #include "cc/resources/resource.h"
20 #include "gpu/command_buffer/client/context_support.h"
20 #include "gpu/command_buffer/client/gles2_interface.h" 21 #include "gpu/command_buffer/client/gles2_interface.h"
21 #include "third_party/skia/include/core/SkMultiPictureDraw.h" 22 #include "third_party/skia/include/core/SkMultiPictureDraw.h"
22 #include "third_party/skia/include/core/SkPictureRecorder.h" 23 #include "third_party/skia/include/core/SkPictureRecorder.h"
23 #include "third_party/skia/include/core/SkSurface.h" 24 #include "third_party/skia/include/core/SkSurface.h"
24 #include "third_party/skia/include/gpu/GrContext.h" 25 #include "third_party/skia/include/gpu/GrContext.h"
25 26
26 namespace cc { 27 namespace cc {
27 namespace { 28 namespace {
28 29
29 static sk_sp<SkPicture> PlaybackToPicture( 30 static sk_sp<SkPicture> PlaybackToPicture(
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return false; 228 return false;
228 } 229 }
229 230
230 bool GpuRasterBufferProvider::CanPartialRasterIntoProvidedResource() const { 231 bool GpuRasterBufferProvider::CanPartialRasterIntoProvidedResource() const {
231 // Partial raster doesn't support MSAA, as the MSAA resolve is unaware of clip 232 // Partial raster doesn't support MSAA, as the MSAA resolve is unaware of clip
232 // rects. 233 // rects.
233 // TODO(crbug.com/629683): See if we can work around this limitation. 234 // TODO(crbug.com/629683): See if we can work around this limitation.
234 return msaa_sample_count_ == 0; 235 return msaa_sample_count_ == 0;
235 } 236 }
236 237
238 uint64_t GpuRasterBufferProvider::SetReadyToDrawCallback(
239 const ResourceProvider::ResourceIdArray& resource_ids,
240 const base::Callback<void(uint64_t)>& callback,
241 uint64_t pending_callback_id) const {
242 if (!async_worker_context_enabled_)
243 return 0;
244
245 gpu::SyncToken sync_token =
246 resource_provider_->GetSyncTokenForResources(resource_ids);
247 uint64_t callback_id = sync_token.release_count();
248 DCHECK_NE(callback_id, 0u);
249
250 if (callback_id != pending_callback_id) {
251 compositor_context_provider_->ContextSupport()->SignalSyncToken(
252 sync_token, base::Bind(callback, callback_id));
253 }
254
255 return callback_id;
256 }
257
237 void GpuRasterBufferProvider::Shutdown() { 258 void GpuRasterBufferProvider::Shutdown() {
238 pending_raster_buffers_.clear(); 259 pending_raster_buffers_.clear();
239 } 260 }
240 261
241 void GpuRasterBufferProvider::PlaybackOnWorkerThread( 262 void GpuRasterBufferProvider::PlaybackOnWorkerThread(
242 ResourceProvider::ScopedWriteLockGL* resource_lock, 263 ResourceProvider::ScopedWriteLockGL* resource_lock,
243 const gpu::SyncToken& sync_token, 264 const gpu::SyncToken& sync_token,
244 bool resource_has_previous_content, 265 bool resource_has_previous_content,
245 const RasterSource* raster_source, 266 const RasterSource* raster_source,
246 const gfx::Rect& raster_full_rect, 267 const gfx::Rect& raster_full_rect,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 gl->OrderingBarrierCHROMIUM(); 304 gl->OrderingBarrierCHROMIUM();
284 305
285 // Generate sync token after the barrier for cross context synchronization. 306 // Generate sync token after the barrier for cross context synchronization.
286 gpu::SyncToken resource_sync_token; 307 gpu::SyncToken resource_sync_token;
287 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); 308 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData());
288 resource_lock->set_sync_token(resource_sync_token); 309 resource_lock->set_sync_token(resource_sync_token);
289 resource_lock->set_synchronized(!async_worker_context_enabled_); 310 resource_lock->set_synchronized(!async_worker_context_enabled_);
290 } 311 }
291 312
292 } // namespace cc 313 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698