Index: cc/raster/raster_buffer_provider_perftest.cc |
diff --git a/cc/raster/raster_buffer_provider_perftest.cc b/cc/raster/raster_buffer_provider_perftest.cc |
index 43e35dacac06b12fb1fbe69b313c082a61d1a69d..5ebd47ac1bdc2ef6d08b5652548cfb37d0867cbe 100644 |
--- a/cc/raster/raster_buffer_provider_perftest.cc |
+++ b/cc/raster/raster_buffer_provider_perftest.cc |
@@ -13,11 +13,11 @@ |
#include "cc/output/context_provider.h" |
#include "cc/raster/bitmap_raster_buffer_provider.h" |
#include "cc/raster/gpu_raster_buffer_provider.h" |
-#include "cc/raster/gpu_rasterizer.h" |
#include "cc/raster/one_copy_raster_buffer_provider.h" |
#include "cc/raster/raster_buffer_provider.h" |
#include "cc/raster/synchronous_task_graph_runner.h" |
#include "cc/raster/zero_copy_raster_buffer_provider.h" |
+#include "cc/resources/platform_color.h" |
#include "cc/resources/resource_pool.h" |
#include "cc/resources/resource_provider.h" |
#include "cc/resources/scoped_resource.h" |
@@ -29,6 +29,7 @@ |
#include "cc/test/test_shared_bitmap_manager.h" |
#include "cc/test/test_web_graphics_context_3d.h" |
#include "cc/tiles/tile_task_manager.h" |
+#include "gpu/command_buffer/common/sync_token.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "testing/perf/perf_test.h" |
#include "third_party/khronos/GLES2/gl2.h" |
@@ -68,6 +69,13 @@ class PerfGLES2Interface : public gpu::gles2::GLES2InterfaceStub { |
if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) |
*params = 1; |
} |
+ void GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync, |
+ GLbyte* sync_token) override { |
+ // Copy the data over after setting the data to ensure alignment. |
+ gpu::SyncToken sync_token_data(gpu::CommandBufferNamespace::GPU_IO, 0, |
+ gpu::CommandBufferId(), fence_sync); |
+ memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
+ } |
}; |
class PerfContextProvider : public ContextProvider { |
@@ -311,43 +319,43 @@ class RasterBufferProviderPerfTest |
public: |
// Overridden from testing::Test: |
void SetUp() override { |
- std::unique_ptr<RasterBufferProvider> raster_buffer_provider; |
switch (GetParam()) { |
case RASTER_BUFFER_PROVIDER_TYPE_ZERO_COPY: |
Create3dOutputSurfaceAndResourceProvider(); |
- raster_buffer_provider = ZeroCopyRasterBufferProvider::Create( |
+ raster_buffer_provider_ = ZeroCopyRasterBufferProvider::Create( |
resource_provider_.get(), PlatformColor::BestTextureFormat()); |
break; |
case RASTER_BUFFER_PROVIDER_TYPE_ONE_COPY: |
Create3dOutputSurfaceAndResourceProvider(); |
- raster_buffer_provider = base::MakeUnique<OneCopyRasterBufferProvider>( |
+ raster_buffer_provider_ = base::MakeUnique<OneCopyRasterBufferProvider>( |
task_runner_.get(), compositor_context_provider_.get(), |
worker_context_provider_.get(), resource_provider_.get(), |
std::numeric_limits<int>::max(), false, |
- std::numeric_limits<int>::max(), |
- PlatformColor::BestTextureFormat()); |
+ std::numeric_limits<int>::max(), PlatformColor::BestTextureFormat(), |
+ false); |
break; |
case RASTER_BUFFER_PROVIDER_TYPE_GPU: |
Create3dOutputSurfaceAndResourceProvider(); |
- raster_buffer_provider = base::MakeUnique<GpuRasterBufferProvider>( |
+ raster_buffer_provider_ = base::MakeUnique<GpuRasterBufferProvider>( |
compositor_context_provider_.get(), worker_context_provider_.get(), |
- resource_provider_.get(), false, 0); |
+ resource_provider_.get(), false, 0, false); |
break; |
case RASTER_BUFFER_PROVIDER_TYPE_BITMAP: |
CreateSoftwareOutputSurfaceAndResourceProvider(); |
- raster_buffer_provider = |
+ raster_buffer_provider_ = |
BitmapRasterBufferProvider::Create(resource_provider_.get()); |
break; |
} |
- DCHECK(raster_buffer_provider); |
+ DCHECK(raster_buffer_provider_); |
- tile_task_manager_ = TileTaskManagerImpl::Create( |
- std::move(raster_buffer_provider), task_graph_runner_.get()); |
+ tile_task_manager_ = TileTaskManagerImpl::Create(task_graph_runner_.get()); |
} |
void TearDown() override { |
tile_task_manager_->Shutdown(); |
tile_task_manager_->CheckForCompletedTasks(); |
+ |
+ raster_buffer_provider_->Shutdown(); |
} |
// Overridden from PerfRasterBufferProviderHelper: |
@@ -355,13 +363,11 @@ class RasterBufferProviderPerfTest |
const Resource* resource, |
uint64_t resource_content_id, |
uint64_t previous_content_id) override { |
- return tile_task_manager_->GetRasterBufferProvider() |
- ->AcquireBufferForRaster(resource, resource_content_id, |
- previous_content_id); |
+ return raster_buffer_provider_->AcquireBufferForRaster( |
+ resource, resource_content_id, previous_content_id); |
} |
void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override { |
- tile_task_manager_->GetRasterBufferProvider()->ReleaseBufferForRaster( |
- std::move(buffer)); |
+ raster_buffer_provider_->ReleaseBufferForRaster(std::move(buffer)); |
} |
void RunMessageLoopUntilAllTasksHaveCompleted() { |
@@ -386,12 +392,14 @@ class RasterBufferProviderPerfTest |
graph.Reset(); |
ResetRasterTasks(raster_tasks); |
BuildTileTaskGraph(&graph, raster_tasks); |
+ raster_buffer_provider_->OrderingBarrier(); |
tile_task_manager_->ScheduleTasks(&graph); |
tile_task_manager_->CheckForCompletedTasks(); |
timer_.NextLap(); |
} while (!timer_.HasTimeLimitExpired()); |
TaskGraph empty; |
+ raster_buffer_provider_->OrderingBarrier(); |
tile_task_manager_->ScheduleTasks(&empty); |
RunMessageLoopUntilAllTasksHaveCompleted(); |
tile_task_manager_->CheckForCompletedTasks(); |
@@ -422,6 +430,7 @@ class RasterBufferProviderPerfTest |
// Reset the tasks as for scheduling new state tasks are needed. |
ResetRasterTasks(raster_tasks[count % kNumVersions]); |
BuildTileTaskGraph(&graph, raster_tasks[count % kNumVersions]); |
+ raster_buffer_provider_->OrderingBarrier(); |
tile_task_manager_->ScheduleTasks(&graph); |
tile_task_manager_->CheckForCompletedTasks(); |
++count; |
@@ -429,6 +438,7 @@ class RasterBufferProviderPerfTest |
} while (!timer_.HasTimeLimitExpired()); |
TaskGraph empty; |
+ raster_buffer_provider_->OrderingBarrier(); |
tile_task_manager_->ScheduleTasks(&empty); |
RunMessageLoopUntilAllTasksHaveCompleted(); |
tile_task_manager_->CheckForCompletedTasks(); |
@@ -453,12 +463,14 @@ class RasterBufferProviderPerfTest |
do { |
graph.Reset(); |
BuildTileTaskGraph(&graph, raster_tasks); |
+ raster_buffer_provider_->OrderingBarrier(); |
tile_task_manager_->ScheduleTasks(&graph); |
RunMessageLoopUntilAllTasksHaveCompleted(); |
timer_.NextLap(); |
} while (!timer_.HasTimeLimitExpired()); |
TaskGraph empty; |
+ raster_buffer_provider_->OrderingBarrier(); |
tile_task_manager_->ScheduleTasks(&empty); |
RunMessageLoopUntilAllTasksHaveCompleted(); |
@@ -499,6 +511,7 @@ class RasterBufferProviderPerfTest |
} |
std::unique_ptr<TileTaskManager> tile_task_manager_; |
+ std::unique_ptr<RasterBufferProvider> raster_buffer_provider_; |
TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
TestSharedBitmapManager shared_bitmap_manager_; |
}; |