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

Side by Side Diff: content/common/gpu/surface_texture_bridge_android.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
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/common/gpu/surface_texture_bridge_android.h"
6
7 #include "base/bind.h"
8 #include "content/browser/android/child_process_launcher_android.h"
9 #include "content/common/android/surface_texture_peer.h"
10 #include "content/common/gpu/gpu_channel.h"
11 #include "content/common/gpu/gpu_messages.h"
12 #include "gpu/command_buffer/service/context_group.h"
13 #include "gpu/command_buffer/service/context_state.h"
14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
15 #include "gpu/command_buffer/service/texture_manager.h"
16 #include "ui/gfx/size.h"
17 #include "ui/gl/scoped_make_current.h"
18
19 namespace content {
20
21 using gpu::gles2::GLES2Decoder;
Hongbo Min 2014/03/18 06:10:03 You may want to remove these 3 unused 'using' stmt
22 using gpu::gles2::TextureManager;
23 using gpu::gles2::TextureRef;
24
25 // static
26 gfx::SurfaceTexture* SurfaceTextureBridge::CreateSurfaceTexture(
27 GpuCommandBufferStub* owner_stub,
28 uint32* gpu_texture_id) {
29 unsigned int texture_id = 0;
30 glGenTextures(1, &texture_id);
31 *gpu_texture_id = texture_id;
32 return new gfx::SurfaceTexture(texture_id);
33 }
34
35 // static
36 bool SurfaceTextureBridge::SetupSurfaceTexturePeer(
37 GpuCommandBufferStub* owner_stub,
38 void* gpu_memory_buffer,
39 gfx::SurfaceTexture* surface_texture) {
40 if (!owner_stub)
41 return false;
42
43 base::ProcessHandle process = owner_stub->channel()->renderer_pid();
44 scoped_refptr<gfx::SurfaceTexture> scoped_surface_texture(surface_texture);
45 SetupSurfaceTextureToRenderer(
46 process, gpu_memory_buffer, scoped_surface_texture);
47 return true;
48 }
49
50 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698