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

Unified Diff: ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.cc

Issue 2710183005: ozone: drm: Add more debug details when dmabuf mmap fails. (Closed)
Patch Set: Address reveman's nits. Created 3 years, 10 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 | « chrome/common/crash_keys.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/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.";
}
}
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698