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

Side by Side Diff: cc/resources/resource_provider.h

Issue 2007593005: Remove the concept of OutputSurface from ResourceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resourceprovider-no-outputsurface: moreccptcompile Created 4 years, 7 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 | « cc/resources/resource.h ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_
6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 TEXTURE_HINT_FRAMEBUFFER = 0x2, 78 TEXTURE_HINT_FRAMEBUFFER = 0x2,
79 TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER = 79 TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER =
80 TEXTURE_HINT_IMMUTABLE | TEXTURE_HINT_FRAMEBUFFER 80 TEXTURE_HINT_IMMUTABLE | TEXTURE_HINT_FRAMEBUFFER
81 }; 81 };
82 enum ResourceType { 82 enum ResourceType {
83 RESOURCE_TYPE_GPU_MEMORY_BUFFER, 83 RESOURCE_TYPE_GPU_MEMORY_BUFFER,
84 RESOURCE_TYPE_GL_TEXTURE, 84 RESOURCE_TYPE_GL_TEXTURE,
85 RESOURCE_TYPE_BITMAP, 85 RESOURCE_TYPE_BITMAP,
86 }; 86 };
87 87
88 static std::unique_ptr<ResourceProvider> Create( 88 ResourceProvider(ContextProvider* compositor_context_provider,
89 OutputSurface* output_surface, 89 SharedBitmapManager* shared_bitmap_manager,
90 SharedBitmapManager* shared_bitmap_manager, 90 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
91 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 91 BlockingTaskRunner* blocking_main_thread_task_runner,
92 BlockingTaskRunner* blocking_main_thread_task_runner, 92 int highp_threshold_min,
93 int highp_threshold_min, 93 size_t id_allocation_chunk_size,
94 size_t id_allocation_chunk_size, 94 bool delegated_sync_points_required,
95 bool use_gpu_memory_buffer_resources, 95 bool use_gpu_memory_buffer_resources,
96 const std::vector<unsigned>& use_image_texture_targets); 96 const std::vector<unsigned>& use_image_texture_targets);
97 ~ResourceProvider() override; 97 ~ResourceProvider() override;
98 98
99 void Initialize();
100
99 void DidLoseOutputSurface() { lost_output_surface_ = true; } 101 void DidLoseOutputSurface() { lost_output_surface_ = true; }
100 102
101 int max_texture_size() const { return max_texture_size_; } 103 int max_texture_size() const { return max_texture_size_; }
102 ResourceFormat best_texture_format() const { return best_texture_format_; } 104 ResourceFormat best_texture_format() const { return best_texture_format_; }
103 ResourceFormat best_render_buffer_format() const { 105 ResourceFormat best_render_buffer_format() const {
104 return best_render_buffer_format_; 106 return best_render_buffer_format_;
105 } 107 }
106 ResourceFormat YuvResourceFormat(int bits) const; 108 ResourceFormat YuvResourceFormat(int bits) const;
107 bool use_sync_query() const { return use_sync_query_; } 109 bool use_sync_query() const { return use_sync_query_; }
108 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { 110 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 356
355 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGpuMemoryBuffer); 357 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGpuMemoryBuffer);
356 }; 358 };
357 359
358 class CC_EXPORT ScopedWriteLockGr { 360 class CC_EXPORT ScopedWriteLockGr {
359 public: 361 public:
360 ScopedWriteLockGr(ResourceProvider* resource_provider, 362 ScopedWriteLockGr(ResourceProvider* resource_provider,
361 ResourceId resource_id); 363 ResourceId resource_id);
362 ~ScopedWriteLockGr(); 364 ~ScopedWriteLockGr();
363 365
364 void InitSkSurface(bool use_distance_field_text, 366 void InitSkSurface(GrContext* gr_context,
367 bool use_distance_field_text,
365 bool can_use_lcd_text, 368 bool can_use_lcd_text,
366 int msaa_sample_count); 369 int msaa_sample_count);
367 void ReleaseSkSurface(); 370 void ReleaseSkSurface();
368 371
369 SkSurface* sk_surface() { return sk_surface_.get(); } 372 SkSurface* sk_surface() { return sk_surface_.get(); }
370 373
371 gfx::Size GetResourceSize() const { return resource_->size; } 374 gfx::Size GetResourceSize() const { return resource_->size; }
372 375
373 void UpdateResourceSyncToken(const gpu::SyncToken& sync_token) { 376 void UpdateResourceSyncToken(const gpu::SyncToken& sync_token) {
374 set_sync_token_ = true; 377 set_sync_token_ = true;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // http://crbug.com/577121 462 // http://crbug.com/577121
460 bool IsInUseByMacOSWindowServer(ResourceId id); 463 bool IsInUseByMacOSWindowServer(ResourceId id);
461 464
462 // Indicates if this resource may be used for a hardware overlay plane. 465 // Indicates if this resource may be used for a hardware overlay plane.
463 bool IsOverlayCandidate(ResourceId id); 466 bool IsOverlayCandidate(ResourceId id);
464 467
465 void WaitSyncTokenIfNeeded(ResourceId id); 468 void WaitSyncTokenIfNeeded(ResourceId id);
466 469
467 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); 470 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl);
468 471
469 OutputSurface* output_surface() { return output_surface_; }
470
471 void ValidateResource(ResourceId id) const; 472 void ValidateResource(ResourceId id) const;
472 473
473 GLenum GetImageTextureTarget(ResourceFormat format); 474 GLenum GetImageTextureTarget(ResourceFormat format);
474 475
475 // base::trace_event::MemoryDumpProvider implementation. 476 // base::trace_event::MemoryDumpProvider implementation.
476 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 477 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
477 base::trace_event::ProcessMemoryDump* pmd) override; 478 base::trace_event::ProcessMemoryDump* pmd) override;
478 479
479 int tracing_id() const { return tracing_id_; } 480 int tracing_id() const { return tracing_id_; }
480 481
481 protected:
482 ResourceProvider(OutputSurface* output_surface,
483 SharedBitmapManager* shared_bitmap_manager,
484 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
485 BlockingTaskRunner* blocking_main_thread_task_runner,
486 int highp_threshold_min,
487 size_t id_allocation_chunk_size,
488 bool use_gpu_memory_buffer_resources,
489 const std::vector<unsigned>& use_image_texture_targets);
490 void Initialize();
491
492 private: 482 private:
493 struct Resource { 483 struct Resource {
494 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; 484 enum Origin { INTERNAL, EXTERNAL, DELEGATED };
495 enum SynchronizationState { 485 enum SynchronizationState {
496 // The LOCALLY_USED state is the state each resource defaults to when 486 // The LOCALLY_USED state is the state each resource defaults to when
497 // constructed or modified or read. This state indicates that the 487 // constructed or modified or read. This state indicates that the
498 // resource has not been properly synchronized and it would be an error 488 // resource has not been properly synchronized and it would be an error
499 // to send this resource to a parent, child, or client. 489 // to send this resource to a parent, child, or client.
500 LOCALLY_USED, 490 LOCALLY_USED,
501 491
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 void LazyCreate(Resource* resource); 646 void LazyCreate(Resource* resource);
657 void LazyAllocate(Resource* resource); 647 void LazyAllocate(Resource* resource);
658 void LazyCreateImage(Resource* resource); 648 void LazyCreateImage(Resource* resource);
659 649
660 void BindImageForSampling(Resource* resource); 650 void BindImageForSampling(Resource* resource);
661 // Binds the given GL resource to a texture target for sampling using the 651 // Binds the given GL resource to a texture target for sampling using the
662 // specified filter for both minification and magnification. Returns the 652 // specified filter for both minification and magnification. Returns the
663 // texture target used. The resource must be locked for reading. 653 // texture target used. The resource must be locked for reading.
664 GLenum BindForSampling(ResourceId resource_id, GLenum unit, GLenum filter); 654 GLenum BindForSampling(ResourceId resource_id, GLenum unit, GLenum filter);
665 655
666 // Returns NULL if the output_surface_ does not have a ContextProvider. 656 // Returns null if we do not have a ContextProvider.
667 gpu::gles2::GLES2Interface* ContextGL() const; 657 gpu::gles2::GLES2Interface* ContextGL() const;
668 class GrContext* GrContext(bool worker_context) const;
669 bool IsGLContextLost() const; 658 bool IsGLContextLost() const;
670 659
671 OutputSurface* output_surface_; 660 ContextProvider* compositor_context_provider_;
672 SharedBitmapManager* shared_bitmap_manager_; 661 SharedBitmapManager* shared_bitmap_manager_;
673 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 662 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
674 BlockingTaskRunner* blocking_main_thread_task_runner_; 663 BlockingTaskRunner* blocking_main_thread_task_runner_;
675 bool lost_output_surface_; 664 bool lost_output_surface_;
676 int highp_threshold_min_; 665 int highp_threshold_min_;
677 ResourceId next_id_; 666 ResourceId next_id_;
678 ResourceMap resources_; 667 ResourceMap resources_;
679 int next_child_; 668 int next_child_;
680 ChildMap children_; 669 ChildMap children_;
681 670
671 const bool delegated_sync_points_required_;
672
682 ResourceType default_resource_type_; 673 ResourceType default_resource_type_;
683 bool use_gpu_memory_buffer_resources_;
684 bool use_texture_storage_ext_; 674 bool use_texture_storage_ext_;
685 bool use_texture_format_bgra_; 675 bool use_texture_format_bgra_;
686 bool use_texture_usage_hint_; 676 bool use_texture_usage_hint_;
687 bool use_compressed_texture_etc1_; 677 bool use_compressed_texture_etc1_;
688 ResourceFormat yuv_resource_format_; 678 ResourceFormat yuv_resource_format_;
689 ResourceFormat yuv_highbit_resource_format_; 679 ResourceFormat yuv_highbit_resource_format_;
690 int max_texture_size_; 680 int max_texture_size_;
691 ResourceFormat best_texture_format_; 681 ResourceFormat best_texture_format_;
692 ResourceFormat best_render_buffer_format_; 682 ResourceFormat best_render_buffer_format_;
693 683
(...skipping 11 matching lines...) Expand all
705 // A process-unique ID used for disambiguating memory dumps from different 695 // A process-unique ID used for disambiguating memory dumps from different
706 // resource providers. 696 // resource providers.
707 int tracing_id_; 697 int tracing_id_;
708 698
709 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 699 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
710 }; 700 };
711 701
712 } // namespace cc 702 } // namespace cc
713 703
714 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 704 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « cc/resources/resource.h ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698