summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Isorce <j.isorce@samsung.com>2016-10-07 15:08:37 +0100
committerJulien Isorce <j.isorce@samsung.com>2016-11-21 21:22:47 +0000
commitb68d9bbe436d6d62b75572a563853d86783660e0 (patch)
treef8ae394484b496a30b92c7bea63e8af6f438958d
parent7e14875458c6f2dc68b071251a0d372bcd87f693 (diff)
gstfdmemory: log with GST_INFO instead of GST_ERROR on permission denied
For example mmap can fail with EACCES if the the fd has been open with read only mode. And mapping the memory might be the only way to check that. So no need to print out an error. Ex: ioctl(dev, DRM_IOCTL_PRIME_HANDLE_TO_FD, flags & ~DRM_RDWR) https://bugzilla.gnome.org/show_bug.cgi?id=765600
-rw-r--r--gst-libs/gst/allocators/gstfdmemory.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gst-libs/gst/allocators/gstfdmemory.c b/gst-libs/gst/allocators/gstfdmemory.c
index a15859a8a..f09da9e4e 100644
--- a/gst-libs/gst/allocators/gstfdmemory.c
+++ b/gst-libs/gst/allocators/gstfdmemory.c
@@ -110,9 +110,20 @@ gst_fd_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags)
mem->data = mmap (0, gmem->maxsize, prot, flags, mem->fd, 0);
if (mem->data == MAP_FAILED) {
+ GstDebugLevel level;
mem->data = NULL;
- GST_ERROR ("%p: fd %d: mmap failed: %s", mem, mem->fd,
- g_strerror (errno));
+
+ switch (errno) {
+ case EACCES:
+ level = GST_LEVEL_INFO;
+ break;
+ default:
+ level = GST_LEVEL_ERROR;
+ break;
+ }
+
+ GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, level, NULL,
+ "%p: fd %d: mmap failed: %s", mem, mem->fd, g_strerror (errno));
goto out;
}
}