Index: ui/ozone/platform/drm/gpu/gbm_buffer.cc |
diff --git a/ui/ozone/platform/drm/gpu/gbm_buffer.cc b/ui/ozone/platform/drm/gpu/gbm_buffer.cc |
index 8b9a893d2da7e1dad59abeb9f9721d3d319e6396..0f38ed86f5c3db563aa16a8be5aa5de5872253b5 100644 |
--- a/ui/ozone/platform/drm/gpu/gbm_buffer.cc |
+++ b/ui/ozone/platform/drm/gpu/gbm_buffer.cc |
@@ -75,6 +75,11 @@ int GbmBuffer::GetOffset(size_t index) const { |
return planes_[index].offset; |
} |
+size_t GbmBuffer::GetSize(size_t index) const { |
+ DCHECK_LT(index, planes_.size()); |
+ return planes_[index].size; |
+} |
+ |
uint64_t GbmBuffer::GetFormatModifier(size_t index) const { |
DCHECK_LT(index, planes_.size()); |
return planes_[index].modifier; |
@@ -123,16 +128,20 @@ scoped_refptr<GbmBuffer> GbmBuffer::CreateBuffer( |
// kept open for the lifetime of the buffer. |
base::ScopedFD fd(gbm_bo_get_plane_fd(bo, i)); |
- if (!fd.is_valid()) { |
- PLOG(ERROR) << "Failed to export buffer to dma_buf"; |
- gbm_bo_destroy(bo); |
- return nullptr; |
+ // TODO(dcastagna): support multiple fds. |
+ // crbug.com/642410 |
+ if (!i) { |
+ if (!fd.is_valid()) { |
+ PLOG(ERROR) << "Failed to export buffer to dma_buf"; |
+ gbm_bo_destroy(bo); |
+ return nullptr; |
+ } |
+ fds.emplace_back(std::move(fd)); |
} |
- fds.emplace_back(std::move(fd)); |
- planes.emplace_back(gbm_bo_get_plane_stride(bo, i), |
- gbm_bo_get_plane_offset(bo, i), |
- gbm_bo_get_plane_format_modifier(bo, i)); |
+ planes.emplace_back( |
+ gbm_bo_get_plane_stride(bo, i), gbm_bo_get_plane_offset(bo, i), |
+ gbm_bo_get_plane_size(bo, i), gbm_bo_get_plane_format_modifier(bo, i)); |
} |
scoped_refptr<GbmBuffer> buffer(new GbmBuffer( |
gbm, bo, format, usage, std::move(fds), size, std::move(planes))); |
@@ -216,6 +225,7 @@ gfx::NativePixmapHandle GbmPixmap::ExportHandle() { |
base::FileDescriptor(scoped_fd.release(), true /* auto_close */)); |
} |
handle.planes.emplace_back(buffer_->GetStride(i), buffer_->GetOffset(i), |
+ buffer_->GetSize(i), |
buffer_->GetFormatModifier(i)); |
} |
return handle; |