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

Side by Side Diff: gpu/ipc/service/stream_texture_android.cc

Issue 2014313002: StreamTextureImages can now override a Texture's service id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only clear the stream texture service id if the image is changed Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "gpu/ipc/service/stream_texture_android.h" 5 #include "gpu/ipc/service/stream_texture_android.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/stringize_macros.h" 10 #include "base/strings/stringize_macros.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // it could then call glBindTexImage2D() for doing the following. 44 // it could then call glBindTexImage2D() for doing the following.
45 scoped_refptr<gpu::gles2::GLStreamTextureImage> gl_image( 45 scoped_refptr<gpu::gles2::GLStreamTextureImage> gl_image(
46 new StreamTexture(owner_stub, stream_id, texture->service_id())); 46 new StreamTexture(owner_stub, stream_id, texture->service_id()));
47 gfx::Size size = gl_image->GetSize(); 47 gfx::Size size = gl_image->GetSize();
48 texture_manager->SetTarget(texture, GL_TEXTURE_EXTERNAL_OES); 48 texture_manager->SetTarget(texture, GL_TEXTURE_EXTERNAL_OES);
49 texture_manager->SetLevelInfo(texture, GL_TEXTURE_EXTERNAL_OES, 0, GL_RGBA, 49 texture_manager->SetLevelInfo(texture, GL_TEXTURE_EXTERNAL_OES, 0, GL_RGBA,
50 size.width(), size.height(), 1, 0, GL_RGBA, 50 size.width(), size.height(), 1, 0, GL_RGBA,
51 GL_UNSIGNED_BYTE, gfx::Rect(size)); 51 GL_UNSIGNED_BYTE, gfx::Rect(size));
52 texture_manager->SetLevelStreamTextureImage( 52 texture_manager->SetLevelStreamTextureImage(
53 texture, GL_TEXTURE_EXTERNAL_OES, 0, gl_image.get(), 53 texture, GL_TEXTURE_EXTERNAL_OES, 0, gl_image.get(),
54 gles2::Texture::UNBOUND); 54 gles2::Texture::UNBOUND, 0);
55 return true; 55 return true;
56 } 56 }
57 57
58 return false; 58 return false;
59 } 59 }
60 60
61 StreamTexture::StreamTexture(GpuCommandBufferStub* owner_stub, 61 StreamTexture::StreamTexture(GpuCommandBufferStub* owner_stub,
62 int32_t route_id, 62 int32_t route_id,
63 uint32_t texture_id) 63 uint32_t texture_id)
64 : surface_texture_(gl::SurfaceTexture::Create(texture_id)), 64 : surface_texture_(gl::SurfaceTexture::Create(texture_id)),
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 TextureManager* texture_manager = 192 TextureManager* texture_manager =
193 owner_stub_->decoder()->GetContextGroup()->texture_manager(); 193 owner_stub_->decoder()->GetContextGroup()->texture_manager();
194 gles2::Texture* texture = 194 gles2::Texture* texture =
195 texture_manager->GetTextureForServiceId(texture_id_); 195 texture_manager->GetTextureForServiceId(texture_id_);
196 if (texture) { 196 if (texture) {
197 // By setting image state to UNBOUND instead of COPIED we ensure that 197 // By setting image state to UNBOUND instead of COPIED we ensure that
198 // CopyTexImage() is called each time the surface texture is used for 198 // CopyTexImage() is called each time the surface texture is used for
199 // drawing. 199 // drawing.
200 texture->SetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, 0, this, 200 texture->SetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, 0, this,
201 gles2::Texture::UNBOUND); 201 gles2::Texture::UNBOUND, 0);
202 } 202 }
203 203
204 return true; 204 return true;
205 } 205 }
206 206
207 void StreamTexture::OnFrameAvailable() { 207 void StreamTexture::OnFrameAvailable() {
208 has_pending_frame_ = true; 208 has_pending_frame_ = true;
209 if (has_listener_ && owner_stub_) { 209 if (has_listener_ && owner_stub_) {
210 owner_stub_->channel()->Send( 210 owner_stub_->channel()->Send(
211 new GpuStreamTextureMsg_FrameAvailable(route_id_)); 211 new GpuStreamTextureMsg_FrameAvailable(route_id_));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return false; 272 return false;
273 } 273 }
274 274
275 void StreamTexture::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, 275 void StreamTexture::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
276 uint64_t process_tracing_id, 276 uint64_t process_tracing_id,
277 const std::string& dump_name) { 277 const std::string& dump_name) {
278 // TODO(ericrk): Add OnMemoryDump for GLImages. crbug.com/514914 278 // TODO(ericrk): Add OnMemoryDump for GLImages. crbug.com/514914
279 } 279 }
280 280
281 } // namespace gpu 281 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698