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 "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" | 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 void GpuMemoryBufferImplOzoneNativePixmap::Unmap() { | 118 void GpuMemoryBufferImplOzoneNativePixmap::Unmap() { |
119 DCHECK(mapped_); | 119 DCHECK(mapped_); |
120 DCHECK(data_); | 120 DCHECK(data_); |
121 pixmap_->Unmap(); | 121 pixmap_->Unmap(); |
122 mapped_ = false; | 122 mapped_ = false; |
123 data_ = nullptr; | 123 data_ = nullptr; |
124 } | 124 } |
125 | 125 |
126 int GpuMemoryBufferImplOzoneNativePixmap::stride(size_t plane) const { | 126 uint32_t GpuMemoryBufferImplOzoneNativePixmap::stride(size_t plane) const { |
127 DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_)); | 127 DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_)); |
128 int stride; | 128 uint32_t stride; |
129 pixmap_->GetStride(&stride); | 129 pixmap_->GetStride(&stride); |
130 return stride; | 130 return stride; |
131 } | 131 } |
132 | 132 |
133 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle() | 133 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle() |
134 const { | 134 const { |
135 gfx::GpuMemoryBufferHandle handle; | 135 gfx::GpuMemoryBufferHandle handle; |
136 handle.type = gfx::OZONE_NATIVE_PIXMAP; | 136 handle.type = gfx::OZONE_NATIVE_PIXMAP; |
137 handle.id = id_; | 137 handle.id = id_; |
138 handle.native_pixmap_handle.fds.emplace_back(fd_.get(), | 138 handle.native_pixmap_handle.fds.emplace_back(fd_.get(), |
139 false /* auto_close */); | 139 false /* auto_close */); |
140 handle.native_pixmap_handle.planes = planes_; | 140 handle.native_pixmap_handle.planes = planes_; |
141 return handle; | 141 return handle; |
142 } | 142 } |
143 | 143 |
144 } // namespace gpu | 144 } // namespace gpu |
OLD | NEW |