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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc

Issue 793693003: Tile Compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 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_manager.h" 9 #include "content/common/android/surface_texture_manager.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
11 11
12 namespace content { 12 namespace content {
13 namespace { 13 namespace {
14 14
15 int WindowFormat(gfx::GpuMemoryBuffer::Format format) { 15 int WindowFormat(gfx::GpuMemoryBuffer::Format format) {
16 switch (format) { 16 switch (format) {
17 case gfx::GpuMemoryBuffer::RGBA_8888: 17 case gfx::GpuMemoryBuffer::RGBA_8888:
18 return WINDOW_FORMAT_RGBA_8888; 18 return WINDOW_FORMAT_RGBA_8888;
19 case gfx::GpuMemoryBuffer::RGBX_8888: 19 case gfx::GpuMemoryBuffer::RGBX_8888:
20 case gfx::GpuMemoryBuffer::BGRA_8888: 20 case gfx::GpuMemoryBuffer::BGRA_8888:
21 case gfx::GpuMemoryBuffer::ATC:
22 case gfx::GpuMemoryBuffer::ATCIA:
23 case gfx::GpuMemoryBuffer::DXT1:
24 case gfx::GpuMemoryBuffer::DXT5:
25 case gfx::GpuMemoryBuffer::ETC1:
21 NOTREACHED(); 26 NOTREACHED();
22 return 0; 27 return 0;
23 } 28 }
24 29
25 NOTREACHED(); 30 NOTREACHED();
26 return 0; 31 return 0;
27 } 32 }
28 33
29 } // namespace 34 } // namespace
30 35
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 DCHECK(!mapped_); 74 DCHECK(!mapped_);
70 DCHECK(native_window_); 75 DCHECK(native_window_);
71 ANativeWindow_Buffer buffer; 76 ANativeWindow_Buffer buffer;
72 int status = ANativeWindow_lock(native_window_, &buffer, NULL); 77 int status = ANativeWindow_lock(native_window_, &buffer, NULL);
73 if (status) { 78 if (status) {
74 VLOG(1) << "ANativeWindow_lock failed with error code: " << status; 79 VLOG(1) << "ANativeWindow_lock failed with error code: " << status;
75 return NULL; 80 return NULL;
76 } 81 }
77 82
78 DCHECK_LE(size_.width(), buffer.stride); 83 DCHECK_LE(size_.width(), buffer.stride);
79 stride_ = buffer.stride * BytesPerPixel(format_); 84 stride_ = buffer.stride * BitsPerPixel(format_) / 8;
80 mapped_ = true; 85 mapped_ = true;
81 return buffer.bits; 86 return buffer.bits;
82 } 87 }
83 88
84 void GpuMemoryBufferImplSurfaceTexture::Unmap() { 89 void GpuMemoryBufferImplSurfaceTexture::Unmap() {
85 TRACE_EVENT0("gpu", "GpuMemoryBufferImplSurfaceTexture::Unmap"); 90 TRACE_EVENT0("gpu", "GpuMemoryBufferImplSurfaceTexture::Unmap");
86 91
87 DCHECK(mapped_); 92 DCHECK(mapped_);
88 ANativeWindow_unlockAndPost(native_window_); 93 ANativeWindow_unlockAndPost(native_window_);
89 mapped_ = false; 94 mapped_ = false;
90 } 95 }
91 96
92 uint32 GpuMemoryBufferImplSurfaceTexture::GetStride() const { 97 uint32 GpuMemoryBufferImplSurfaceTexture::GetStride() const {
93 return stride_; 98 return stride_;
94 } 99 }
95 100
96 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() 101 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle()
97 const { 102 const {
98 gfx::GpuMemoryBufferHandle handle; 103 gfx::GpuMemoryBufferHandle handle;
99 handle.type = gfx::SURFACE_TEXTURE_BUFFER; 104 handle.type = gfx::SURFACE_TEXTURE_BUFFER;
100 handle.id = id_; 105 handle.id = id_;
101 return handle; 106 return handle;
102 } 107 }
103 108
104 } // namespace content 109 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698