Index: content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc |
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc |
index f16125bfa181f8e5bd51abfe54c0d48b3d453511..4cf13dcc65964f07c78c3ae1a5fdd9a16c9a81ff 100644 |
--- a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc |
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc |
@@ -61,7 +61,14 @@ bool GpuMemoryBufferImplIOSurface::Map(void** data) { |
IOReturn status = IOSurfaceLock(io_surface_, lock_flags_, NULL); |
DCHECK_NE(status, kIOReturnCannotLock); |
mapped_ = true; |
- *data = IOSurfaceGetBaseAddress(io_surface_); |
+ |
+ const size_t planes = IOSurfaceGetPlaneCount(io_surface_); |
reveman
2015/08/10 22:40:54
nit: no need for 'const' and maybe plane_count or
Andre
2015/08/11 03:50:46
Done.
|
+ if (planes == 0) { |
reveman
2015/08/10 22:40:54
Does IOSurfaceGetPlaneCount actually return this?
Andre
2015/08/11 03:50:46
Yes, IOSurface actually returns 0 in the non-plana
|
+ data[0] = IOSurfaceGetBaseAddress(io_surface_); |
+ } else { |
+ for (size_t plane = 0; plane < planes; ++plane) |
+ data[plane] = IOSurfaceGetBaseAddressOfPlane(io_surface_, plane); |
+ } |
return true; |
} |
@@ -71,8 +78,14 @@ void GpuMemoryBufferImplIOSurface::Unmap() { |
mapped_ = false; |
} |
-void GpuMemoryBufferImplIOSurface::GetStride(int* stride) const { |
- *stride = IOSurfaceGetBytesPerRow(io_surface_); |
+void GpuMemoryBufferImplIOSurface::GetStride(int* strides) const { |
reveman
2015/08/10 22:40:55
same comments here as above
Andre
2015/08/11 03:50:45
Done.
|
+ const size_t planes = IOSurfaceGetPlaneCount(io_surface_); |
+ if (planes == 0) { |
+ strides[0] = IOSurfaceGetBytesPerRow(io_surface_); |
+ } else { |
+ for (size_t plane = 0; plane < planes; ++plane) |
+ strides[plane] = IOSurfaceGetBytesPerRowOfPlane(io_surface_, plane); |
+ } |
} |
gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |