| Index: gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
|
| diff --git a/gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc b/gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
|
| index 8e84b7dd73f390fdea7146d372545f78c0fcad41..86855a8a3ddefd95d8dcb09454d3c0e1219f03e3 100644
|
| --- a/gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
|
| +++ b/gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
|
| @@ -35,7 +35,8 @@
|
| : GpuMemoryBufferImpl(id, size, format, callback),
|
| pixmap_(std::move(pixmap)),
|
| planes_(planes),
|
| - fd_(std::move(fd)) {}
|
| + fd_(std::move(fd)),
|
| + data_(nullptr) {}
|
|
|
| GpuMemoryBufferImplOzoneNativePixmap::~GpuMemoryBufferImplOzoneNativePixmap() {}
|
|
|
| @@ -100,24 +101,33 @@
|
|
|
| bool GpuMemoryBufferImplOzoneNativePixmap::Map() {
|
| DCHECK(!mapped_);
|
| - mapped_ = pixmap_->Map();
|
| + DCHECK(!data_);
|
| + data_ = pixmap_->Map();
|
| + if (!data_)
|
| + return false;
|
| + mapped_ = true;
|
| return mapped_;
|
| }
|
|
|
| void* GpuMemoryBufferImplOzoneNativePixmap::memory(size_t plane) {
|
| DCHECK(mapped_);
|
| - return pixmap_->GetMemoryAddress(plane);
|
| + DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
|
| + return data_;
|
| }
|
|
|
| void GpuMemoryBufferImplOzoneNativePixmap::Unmap() {
|
| DCHECK(mapped_);
|
| + DCHECK(data_);
|
| pixmap_->Unmap();
|
| mapped_ = false;
|
| + data_ = nullptr;
|
| }
|
|
|
| int GpuMemoryBufferImplOzoneNativePixmap::stride(size_t plane) const {
|
| DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
|
| - return pixmap_->GetStride(plane);
|
| + int stride;
|
| + pixmap_->GetStride(&stride);
|
| + return stride;
|
| }
|
|
|
| gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle()
|
|
|