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

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

Issue 197223003: Start of hardware overlay support in CC with Ubercompositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/texture_mailbox.h » ('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 #include "cc/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 image_id(0), 225 image_id(0),
226 bound_image_id(0), 226 bound_image_id(0),
227 dirty_image(false), 227 dirty_image(false),
228 texture_pool(0), 228 texture_pool(0),
229 wrap_mode(0), 229 wrap_mode(0),
230 lost(false), 230 lost(false),
231 hint(TextureUsageAny), 231 hint(TextureUsageAny),
232 type(InvalidType), 232 type(InvalidType),
233 format(RGBA_8888), 233 format(RGBA_8888),
234 has_shared_bitmap_id(false), 234 has_shared_bitmap_id(false),
235 allow_overlay(false),
235 shared_bitmap(NULL) {} 236 shared_bitmap(NULL) {}
236 237
237 ResourceProvider::Resource::~Resource() {} 238 ResourceProvider::Resource::~Resource() {}
238 239
239 ResourceProvider::Resource::Resource(GLuint texture_id, 240 ResourceProvider::Resource::Resource(GLuint texture_id,
240 const gfx::Size& size, 241 const gfx::Size& size,
241 Origin origin, 242 Origin origin,
242 GLenum target, 243 GLenum target,
243 GLenum filter, 244 GLenum filter,
244 GLenum texture_pool, 245 GLenum texture_pool,
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 Resource* resource = GetResource(id); 604 Resource* resource = GetResource(id);
604 return resource->lock_for_read_count > 0 || resource->exported_count > 0 || 605 return resource->lock_for_read_count > 0 || resource->exported_count > 0 ||
605 resource->lost; 606 resource->lost;
606 } 607 }
607 608
608 bool ResourceProvider::IsLost(ResourceId id) { 609 bool ResourceProvider::IsLost(ResourceId id) {
609 Resource* resource = GetResource(id); 610 Resource* resource = GetResource(id);
610 return resource->lost; 611 return resource->lost;
611 } 612 }
612 613
614 bool ResourceProvider::AllowOverlay(ResourceId id) {
615 Resource* resource = GetResource(id);
616 return resource->allow_overlay;
617 }
618
613 ResourceProvider::ResourceId ResourceProvider::CreateResource( 619 ResourceProvider::ResourceId ResourceProvider::CreateResource(
614 const gfx::Size& size, 620 const gfx::Size& size,
615 GLint wrap_mode, 621 GLint wrap_mode,
616 TextureUsageHint hint, 622 TextureUsageHint hint,
617 ResourceFormat format) { 623 ResourceFormat format) {
618 DCHECK(!size.IsEmpty()); 624 DCHECK(!size.IsEmpty());
619 switch (default_resource_type_) { 625 switch (default_resource_type_) {
620 case GLTexture: 626 case GLTexture:
621 return CreateGLTexture(size, 627 return CreateGLTexture(size,
622 GL_TEXTURE_2D, 628 GL_TEXTURE_2D,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 mailbox.shared_memory_size(), 783 mailbox.shared_memory_size(),
778 Resource::External, 784 Resource::External,
779 GL_LINEAR, 785 GL_LINEAR,
780 GL_CLAMP_TO_EDGE); 786 GL_CLAMP_TO_EDGE);
781 } 787 }
782 resource.allocated = true; 788 resource.allocated = true;
783 resource.mailbox = mailbox; 789 resource.mailbox = mailbox;
784 resource.release_callback = 790 resource.release_callback =
785 base::Bind(&SingleReleaseCallback::Run, 791 base::Bind(&SingleReleaseCallback::Run,
786 base::Owned(release_callback.release())); 792 base::Owned(release_callback.release()));
793 resource.allow_overlay = mailbox.allow_overlay();
787 return id; 794 return id;
788 } 795 }
789 796
790 void ResourceProvider::DeleteResource(ResourceId id) { 797 void ResourceProvider::DeleteResource(ResourceId id) {
791 DCHECK(thread_checker_.CalledOnValidThread()); 798 DCHECK(thread_checker_.CalledOnValidThread());
792 ResourceMap::iterator it = resources_.find(id); 799 ResourceMap::iterator it = resources_.find(id);
793 CHECK(it != resources_.end()); 800 CHECK(it != resources_.end());
794 Resource* resource = &it->second; 801 Resource* resource = &it->second;
795 DCHECK(!resource->lock_for_read_count); 802 DCHECK(!resource->lock_for_read_count);
796 DCHECK(!resource->marked_for_deletion); 803 DCHECK(!resource->marked_for_deletion);
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 ContextProvider* context_provider = output_surface_->context_provider(); 2215 ContextProvider* context_provider = output_surface_->context_provider();
2209 return context_provider ? context_provider->ContextGL() : NULL; 2216 return context_provider ? context_provider->ContextGL() : NULL;
2210 } 2217 }
2211 2218
2212 class GrContext* ResourceProvider::GrContext() const { 2219 class GrContext* ResourceProvider::GrContext() const {
2213 ContextProvider* context_provider = output_surface_->context_provider(); 2220 ContextProvider* context_provider = output_surface_->context_provider();
2214 return context_provider ? context_provider->GrContext() : NULL; 2221 return context_provider ? context_provider->GrContext() : NULL;
2215 } 2222 }
2216 2223
2217 } // namespace cc 2224 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/texture_mailbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698