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

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

Issue 177953004: Enable SurfaceTexture based zero-copy texture uploading on Android platform Base URL: http://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.cc » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')
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 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 2143
2144 uint8_t* ResourceProvider::MapImage(const Resource* resource, int* stride) { 2144 uint8_t* ResourceProvider::MapImage(const Resource* resource, int* stride) {
2145 DCHECK(ReadLockFenceHasPassed(resource)); 2145 DCHECK(ReadLockFenceHasPassed(resource));
2146 DCHECK(resource->origin == Resource::Internal); 2146 DCHECK(resource->origin == Resource::Internal);
2147 DCHECK_EQ(resource->exported_count, 0); 2147 DCHECK_EQ(resource->exported_count, 0);
2148 2148
2149 if (resource->type == GLTexture) { 2149 if (resource->type == GLTexture) {
2150 DCHECK(resource->image_id); 2150 DCHECK(resource->image_id);
2151 GLES2Interface* gl = ContextGL(); 2151 GLES2Interface* gl = ContextGL();
2152 DCHECK(gl); 2152 DCHECK(gl);
2153 // For SurfaceTexture-backed GpuMemoryBuffer, the actual
2154 // Stride can only be got after it is mapped and ANativeWindow_Buffer
2155 // is locked.
reveman 2014/02/26 08:02:34 We should probably make this a general requirement
2156 uint8_t* ret = static_cast<uint8_t*>(
2157 gl->MapImageCHROMIUM(resource->image_id, GL_READ_WRITE));
2153 gl->GetImageParameterivCHROMIUM( 2158 gl->GetImageParameterivCHROMIUM(
2154 resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, stride); 2159 resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, stride);
2155 return static_cast<uint8_t*>( 2160 return ret;
2156 gl->MapImageCHROMIUM(resource->image_id, GL_READ_WRITE));
2157 } 2161 }
2158 DCHECK_EQ(Bitmap, resource->type); 2162 DCHECK_EQ(Bitmap, resource->type);
2159 *stride = 0; 2163 *stride = 0;
2160 return resource->pixels; 2164 return resource->pixels;
2161 } 2165 }
2162 2166
2163 void ResourceProvider::UnmapImage(const Resource* resource) { 2167 void ResourceProvider::UnmapImage(const Resource* resource) {
2164 DCHECK(resource->origin == Resource::Internal); 2168 DCHECK(resource->origin == Resource::Internal);
2165 DCHECK_EQ(resource->exported_count, 0); 2169 DCHECK_EQ(resource->exported_count, 0);
2166 2170
(...skipping 14 matching lines...) Expand all
2181 ContextProvider* context_provider = output_surface_->context_provider(); 2185 ContextProvider* context_provider = output_surface_->context_provider();
2182 return context_provider ? context_provider->ContextGL() : NULL; 2186 return context_provider ? context_provider->ContextGL() : NULL;
2183 } 2187 }
2184 2188
2185 class GrContext* ResourceProvider::GrContext() const { 2189 class GrContext* ResourceProvider::GrContext() const {
2186 ContextProvider* context_provider = output_surface_->context_provider(); 2190 ContextProvider* context_provider = output_surface_->context_provider();
2187 return context_provider ? context_provider->GrContext() : NULL; 2191 return context_provider ? context_provider->GrContext() : NULL;
2188 } 2192 }
2189 2193
2190 } // namespace cc 2194 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.cc » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698