Index: ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.cc |
diff --git a/ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.cc b/ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.cc |
index 7dbb1d481a628d26765811c099b8534a0bba51e5..faee338dfcefe5bbde68332aa67b8db90c1b8676 100644 |
--- a/ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.cc |
+++ b/ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.cc |
@@ -10,8 +10,10 @@ |
#include <sys/mman.h> |
#include <xf86drm.h> |
+#include "base/debug/crash_logging.h" |
#include "base/memory/ptr_util.h" |
#include "base/process/memory.h" |
+#include "base/strings/stringprintf.h" |
#include "base/trace_event/trace_event.h" |
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) |
@@ -80,8 +82,22 @@ ClientNativePixmapDmaBuf::ClientNativePixmapDmaBuf( |
data_ = mmap(nullptr, map_size, (PROT_READ | PROT_WRITE), MAP_SHARED, |
dmabuf_fd_.get(), 0); |
if (data_ == MAP_FAILED) { |
- PLOG(ERROR) << "Failed mmap()."; |
- base::TerminateBecauseOutOfMemory(map_size); |
+ // TODO(dcastagna): Remove the following diagnostic information and the |
+ // associated crash keys once crbug.com/629521 is fixed. |
+ logging::SystemErrorCode mmap_error = logging::GetLastSystemErrorCode(); |
+ bool fd_valid = fcntl(dmabuf_fd_.get(), F_GETFD) != -1 || |
+ logging::GetLastSystemErrorCode() != EBADF; |
+ std::string mmap_params = base::StringPrintf( |
+ "(addr=nullptr, length=%zu, prot=(PROT_READ | PROT_WRITE), " |
+ "flags=MAP_SHARED, fd=%d[valid=%d], offset=0)", |
+ map_size, dmabuf_fd_.get(), fd_valid); |
+ base::debug::ScopedCrashKey params_crash_key("mmap_params", mmap_params); |
+ base::debug::ScopedCrashKey size_crash_key("buffer_size", size.ToString()); |
+ base::debug::ScopedCrashKey errno_crash_key( |
+ "errno", logging::SystemErrorCodeToString(mmap_error)); |
+ if (mmap_error == ENOMEM) |
+ base::TerminateBecauseOutOfMemory(map_size); |
+ CHECK(false) << "Failed to mmap dmabuf."; |
} |
} |