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

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

Issue 2052003006: More YVU_420 buffers support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address dnicoara's comment. Created 4 years, 6 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 | « ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc ('k') | 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 ca9a55b986c60162305bf75b619df72e9046b642..549b067782d11ffd1dc69067ccdc11ccab5d1224 100644
--- a/ui/ozone/platform/drm/gpu/gbm_buffer.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
@@ -164,13 +164,16 @@ gfx::NativePixmapHandle GbmPixmap::ExportHandle() {
gfx::NativePixmapHandle handle;
for (size_t i = 0;
i < gfx::NumberOfPlanesForBufferFormat(buffer_->GetFormat()); ++i) {
- base::ScopedFD scoped_fd(HANDLE_EINTR(dup(buffer_->GetFd(i))));
- if (!scoped_fd.is_valid()) {
- PLOG(ERROR) << "dup";
- return gfx::NativePixmapHandle();
+ // Some formats (e.g: YVU_420) might have less than one fd per plane.
+ if (i < buffer_->GetFdCount()) {
+ base::ScopedFD scoped_fd(HANDLE_EINTR(dup(buffer_->GetFd(i))));
+ if (!scoped_fd.is_valid()) {
+ PLOG(ERROR) << "dup";
+ return gfx::NativePixmapHandle();
+ }
+ handle.fds.emplace_back(
+ base::FileDescriptor(scoped_fd.release(), true /* auto_close */));
}
- handle.fds.emplace_back(
- base::FileDescriptor(scoped_fd.release(), true /* auto_close */));
handle.strides_and_offsets.emplace_back(buffer_->GetStride(i),
buffer_->GetOffset(i));
}
« no previous file with comments | « ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698