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

Unified Diff: cc/raster/one_copy_tile_task_worker_pool.h

Issue 1273163004: Revert of cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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_tile_task_worker_pool.cc ('k') | cc/raster/one_copy_tile_task_worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/one_copy_tile_task_worker_pool.h
diff --git a/cc/raster/one_copy_tile_task_worker_pool.h b/cc/raster/one_copy_tile_task_worker_pool.h
index 6554fccb256945ee2573f495407b856a8b20a449..4e050b4c2023a6bba1ca0d706e404bd6fba5706b 100644
--- a/cc/raster/one_copy_tile_task_worker_pool.h
+++ b/cc/raster/one_copy_tile_task_worker_pool.h
@@ -5,12 +5,8 @@
#ifndef CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_
#define CC_RASTER_ONE_COPY_TILE_TASK_WORKER_POOL_H_
-#include <set>
-
#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
-#include "base/time/time.h"
-#include "base/trace_event/memory_dump_provider.h"
#include "base/values.h"
#include "cc/base/scoped_ptr_deque.h"
#include "cc/output/context_provider.h"
@@ -25,20 +21,15 @@
}
}
-namespace gpu {
-namespace gles2 {
-class GLES2Interface;
-}
-}
-
namespace cc {
class ResourcePool;
+class ScopedResource;
-class CC_EXPORT OneCopyTileTaskWorkerPool
- : public TileTaskWorkerPool,
- public TileTaskRunner,
- public TileTaskClient,
- public base::trace_event::MemoryDumpProvider {
+typedef int64 CopySequenceNumber;
+
+class CC_EXPORT OneCopyTileTaskWorkerPool : public TileTaskWorkerPool,
+ public TileTaskRunner,
+ public TileTaskClient {
public:
~OneCopyTileTaskWorkerPool() override;
@@ -47,10 +38,9 @@
TaskGraphRunner* task_graph_runner,
ContextProvider* context_provider,
ResourceProvider* resource_provider,
+ ResourcePool* resource_pool,
int max_copy_texture_chromium_size,
- bool use_persistent_gpu_memory_buffers,
- unsigned image_target,
- int max_staging_buffers);
+ bool have_persistent_gpu_memory_buffers);
// Overridden from TileTaskWorkerPool:
TileTaskRunner* AsTileTaskRunner() override;
@@ -70,58 +60,61 @@
uint64_t previous_content_id) override;
void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override;
- // Overridden from base::trace_event::MemoryDumpProvider:
- bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
- base::trace_event::ProcessMemoryDump* pmd) override;
-
- // Playback raster source and copy result into |resource|.
- void PlaybackAndCopyOnWorkerThread(
- const Resource* resource,
- const ResourceProvider::ScopedWriteLockGL* resource_lock,
+ // Playback raster source and schedule copy of |raster_resource| resource to
+ // |output_resource|. Returns a non-zero sequence number for this copy
+ // operation.
+ CopySequenceNumber PlaybackAndScheduleCopyOnWorkerThread(
+ bool reusing_raster_resource,
+ scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer>
+ raster_resource_write_lock,
+ const Resource* raster_resource,
+ const Resource* output_resource,
const RasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
float scale,
- bool include_images,
- uint64_t resource_content_id,
- uint64_t previous_content_id);
+ bool include_images);
+
+ // Issues copy operations until |sequence| has been processed. This will
+ // return immediately if |sequence| has already been processed.
+ void AdvanceLastIssuedCopyTo(CopySequenceNumber sequence);
+
+ bool have_persistent_gpu_memory_buffers() const {
+ return have_persistent_gpu_memory_buffers_;
+ }
protected:
OneCopyTileTaskWorkerPool(base::SequencedTaskRunner* task_runner,
TaskGraphRunner* task_graph_runner,
+ ContextProvider* context_provider,
ResourceProvider* resource_provider,
+ ResourcePool* resource_pool,
int max_copy_texture_chromium_size,
- bool use_persistent_gpu_memory_buffers,
- unsigned image_target,
- int max_staging_buffers);
+ bool have_persistent_gpu_memory_buffers);
private:
- struct StagingBuffer {
- explicit StagingBuffer(const gfx::Size& size);
- ~StagingBuffer();
+ struct CopyOperation {
+ typedef ScopedPtrDeque<CopyOperation> Deque;
- void DestroyGLResources(gpu::gles2::GLES2Interface* gl);
- void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
- ResourceFormat format,
- bool is_free) const;
+ CopyOperation(scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer>
+ src_write_lock,
+ const Resource* src,
+ const Resource* dst,
+ const gfx::Rect& rect);
+ ~CopyOperation();
- const gfx::Size size;
- scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer;
- base::TimeTicks last_usage;
- unsigned texture_id;
- unsigned image_id;
- unsigned query_id;
- uint64_t content_id;
+ scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> src_write_lock;
+ const Resource* src;
+ const Resource* dst;
+ const gfx::Rect rect;
};
- scoped_ptr<StagingBuffer> AcquireStagingBuffer(const Resource* resource,
- uint64_t previous_content_id);
- base::TimeTicks GetUsageTimeForLRUBuffer();
- void ScheduleReduceMemoryUsage();
- void ReduceMemoryUsage();
- void ReleaseBuffersNotUsedSince(base::TimeTicks time);
-
void OnTaskSetFinished(TaskSet task_set);
+ void AdvanceLastFlushedCopyTo(CopySequenceNumber sequence);
+ void IssueCopyOperations(int64 count);
+ void ScheduleCheckForCompletedCopyOperationsWithLockAcquired(
+ bool wait_if_needed);
+ void CheckForCompletedCopyOperations(bool wait_if_needed);
scoped_refptr<base::trace_event::ConvertableToTraceFormat> StateAsValue()
const;
void StagingStateAsValueInto(
@@ -131,30 +124,31 @@
TaskGraphRunner* task_graph_runner_;
const NamespaceToken namespace_token_;
TileTaskRunnerClient* client_;
- ResourceProvider* const resource_provider_;
+ ContextProvider* context_provider_;
+ ResourceProvider* resource_provider_;
+ ResourcePool* resource_pool_;
const int max_bytes_per_copy_operation_;
- const bool use_persistent_gpu_memory_buffers_;
- const unsigned image_target_;
+ const bool have_persistent_gpu_memory_buffers_;
TaskSetCollection tasks_pending_;
scoped_refptr<TileTask> task_set_finished_tasks_[kNumberOfTaskSets];
+ CopySequenceNumber last_issued_copy_operation_;
+ CopySequenceNumber last_flushed_copy_operation_;
// Task graph used when scheduling tasks and vector used to gather
// completed tasks.
TaskGraph graph_;
Task::Vector completed_tasks_;
- mutable base::Lock lock_;
+ base::Lock lock_;
// |lock_| must be acquired when accessing the following members.
- using StagingBufferSet = std::set<StagingBuffer*>;
- StagingBufferSet buffers_;
- using StagingBufferDeque = ScopedPtrDeque<StagingBuffer>;
- StagingBufferDeque free_buffers_;
- StagingBufferDeque busy_buffers_;
+ base::ConditionVariable copy_operation_count_cv_;
int bytes_scheduled_since_last_flush_;
- size_t max_staging_buffers_;
- const base::TimeDelta staging_buffer_expiration_delay_;
- bool reduce_memory_usage_pending_;
- base::Closure reduce_memory_usage_callback_;
+ size_t issued_copy_operation_count_;
+ CopyOperation::Deque pending_copy_operations_;
+ CopySequenceNumber next_copy_operation_sequence_;
+ bool check_for_completed_copy_operations_pending_;
+ base::TimeTicks last_check_for_completed_copy_operations_time_;
+ bool shutdown_;
base::WeakPtrFactory<OneCopyTileTaskWorkerPool> weak_ptr_factory_;
// "raster finished" tasks need their own factory as they need to be
« no previous file with comments | « cc/raster/gpu_tile_task_worker_pool.cc ('k') | cc/raster/one_copy_tile_task_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698