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

Unified Diff: ui/ozone/platform/drm/gpu/gbm_buffer.cc

Issue 2279553002: ozone: GbmBuffer::CreateBuffer multi-plane support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4f4ff472b616cd21f9d5aa62d831bbd91951b7d1..2235b707906932e5a9d4b7550b0d330c4cb41734 100644
--- a/ui/ozone/platform/drm/gpu/gbm_buffer.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
@@ -113,19 +113,27 @@ scoped_refptr<GbmBuffer> GbmBuffer::CreateBuffer(
if (!bo)
return nullptr;
- // The fd returned by gbm_bo_get_fd is not ref-counted and need to be
- // kept open for the lifetime of the buffer.
- base::ScopedFD fd(gbm_bo_get_fd(bo));
- if (!fd.is_valid()) {
- PLOG(ERROR) << "Failed to export buffer to dma_buf";
- gbm_bo_destroy(bo);
- return nullptr;
- }
std::vector<base::ScopedFD> fds;
- fds.emplace_back(std::move(fd));
std::vector<gfx::NativePixmapPlane> planes;
- planes.emplace_back(gbm_bo_get_stride(bo), gbm_bo_get_plane_offset(bo, 0),
- gbm_bo_get_format_modifier(bo));
+
+ DCHECK_EQ(gbm_bo_get_num_planes(bo),
+ gfx::NumberOfPlanesForBufferFormat(format));
+ for (size_t i = 0; i < gfx::NumberOfPlanesForBufferFormat(format); ++i) {
+ // The fd returned by gbm_bo_get_fd is not ref-counted and need to be
+ // 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;
+ }
+ 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));
+ }
scoped_refptr<GbmBuffer> buffer(new GbmBuffer(
gbm, bo, format, usage, std::move(fds), size, std::move(planes)));
if (usage == gfx::BufferUsage::SCANOUT && !buffer->GetFramebufferId())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698