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

Unified Diff: cc/raster/one_copy_raster_buffer_provider.cc

Issue 2885533002: cc: Allocate resources on worker context.
Patch Set: rebase Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/raster/gpu_raster_buffer_provider.cc ('k') | cc/resources/resource_format.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/one_copy_raster_buffer_provider.cc
diff --git a/cc/raster/one_copy_raster_buffer_provider.cc b/cc/raster/one_copy_raster_buffer_provider.cc
index f662e6c15094c6d43eb53c4cbf34ee19416f3eca..e8b8fad09a920c7c84296e63854a6f242059c24d 100644
--- a/cc/raster/one_copy_raster_buffer_provider.cc
+++ b/cc/raster/one_copy_raster_buffer_provider.cc
@@ -232,8 +232,10 @@ void OneCopyRasterBufferProvider::PlaybackAndCopyOnWorkerThread(
if (async_worker_context_enabled_) {
// Early out if sync token is invalid. This happens if the compositor
// context was lost before ScheduleTasks was called.
- if (!sync_token.HasData())
+ if (!sync_token.HasData()) {
+ DLOG(ERROR) << "Context destroyed while scheduling raster tasks";
return;
+ }
ContextProvider::ScopedContextLock scoped_context(worker_context_provider_);
gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL();
DCHECK(gl);
@@ -327,11 +329,10 @@ void OneCopyRasterBufferProvider::CopyOnWorkerThread(
gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL();
DCHECK(gl);
- // Create texture after synchronizing with compositor.
- ResourceProvider::ScopedTextureProvider scoped_texture(
- gl, resource_lock, async_worker_context_enabled_);
+ unsigned resource_texture_id = resource_lock->texture_id();
+ if (async_worker_context_enabled_)
+ resource_texture_id = resource_lock->ConsumeTexture(gl);
- unsigned resource_texture_id = scoped_texture.texture_id();
unsigned image_target = resource_provider_->GetImageTextureTarget(
StagingBufferUsage(), staging_buffer->format);
@@ -420,6 +421,9 @@ void OneCopyRasterBufferProvider::CopyOnWorkerThread(
#endif
}
+ if (async_worker_context_enabled_)
+ gl->DeleteTextures(1, &resource_texture_id);
+
const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
// Barrier to sync worker context output to cc context.
@@ -429,7 +433,6 @@ void OneCopyRasterBufferProvider::CopyOnWorkerThread(
gpu::SyncToken resource_sync_token;
gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData());
resource_lock->set_sync_token(resource_sync_token);
- resource_lock->set_synchronized(!async_worker_context_enabled_);
}
gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const {
« no previous file with comments | « cc/raster/gpu_raster_buffer_provider.cc ('k') | cc/resources/resource_format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698