OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/common/android/surface_texture_lookup.h" | 9 #include "content/common/android/surface_texture_lookup.h" |
10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 ANativeWindow_setBuffersGeometry(native_window_, | 59 ANativeWindow_setBuffersGeometry(native_window_, |
60 size_.width(), | 60 size_.width(), |
61 size_.height(), | 61 size_.height(), |
62 WindowFormat(internalformat_)); | 62 WindowFormat(internalformat_)); |
63 | 63 |
64 surface_texture_id_ = handle.surface_texture_id; | 64 surface_texture_id_ = handle.surface_texture_id; |
65 return true; | 65 return true; |
66 } | 66 } |
67 | 67 |
68 void* GpuMemoryBufferImplSurfaceTexture::Map(AccessMode mode) { | 68 void* GpuMemoryBufferImplSurfaceTexture::Map() { |
69 TRACE_EVENT0("gpu", "GpuMemoryBufferImplSurfaceTexture::Map"); | 69 TRACE_EVENT0("gpu", "GpuMemoryBufferImplSurfaceTexture::Map"); |
70 | 70 |
71 DCHECK(!mapped_); | 71 DCHECK(!mapped_); |
72 DCHECK(native_window_); | 72 DCHECK(native_window_); |
73 ANativeWindow_Buffer buffer; | 73 ANativeWindow_Buffer buffer; |
74 int status = ANativeWindow_lock(native_window_, &buffer, NULL); | 74 int status = ANativeWindow_lock(native_window_, &buffer, NULL); |
75 if (status) { | 75 if (status) { |
76 VLOG(1) << "ANativeWindow_lock failed with error code: " << status; | 76 VLOG(1) << "ANativeWindow_lock failed with error code: " << status; |
77 return NULL; | 77 return NULL; |
78 } | 78 } |
(...skipping 16 matching lines...) Expand all Loading... |
95 | 95 |
96 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() | 96 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() |
97 const { | 97 const { |
98 gfx::GpuMemoryBufferHandle handle; | 98 gfx::GpuMemoryBufferHandle handle; |
99 handle.type = gfx::SURFACE_TEXTURE_BUFFER; | 99 handle.type = gfx::SURFACE_TEXTURE_BUFFER; |
100 handle.surface_texture_id = surface_texture_id_; | 100 handle.surface_texture_id = surface_texture_id_; |
101 return handle; | 101 return handle; |
102 } | 102 } |
103 | 103 |
104 } // namespace content | 104 } // namespace content |
OLD | NEW |