summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-06 12:18:32 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-06 12:23:06 +0100
commitd3345cd269dc75999b35f3286d21059974dcb24b (patch)
tree3f635fddbd5127e453583871c35f650f874350f7
parent70fa080d02bff9742523cea52c875d9447a78bfd (diff)
sna: Only emit an error for terminal mmap failures
If we repeat the mmap, keep quiet. Only emit the ErrorF in case even the repeated attempts to mmap the bo fail. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 62713de7..fefaa8b4 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -292,8 +292,8 @@ retry_gtt:
VG_CLEAR(mmap_arg);
mmap_arg.handle = bo->handle;
if (drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg)) {
- ErrorF("%s: failed to retrieve GTT offset for handle=%d: %d\n",
- __FUNCTION__, bo->handle, errno);
+ int err = errno;
+
(void)__kgem_throttle_retire(kgem, 0);
if (kgem_expire_cache(kgem))
goto retry_gtt;
@@ -303,6 +303,8 @@ retry_gtt:
goto retry_gtt;
}
+ ErrorF("%s: failed to retrieve GTT offset for handle=%d: %d\n",
+ __FUNCTION__, bo->handle, err);
return NULL;
}
@@ -310,8 +312,8 @@ retry_mmap:
ptr = mmap(0, bytes(bo), PROT_READ | PROT_WRITE, MAP_SHARED,
kgem->fd, mmap_arg.offset);
if (ptr == MAP_FAILED) {
- ErrorF("%s: failed to mmap %d, %d bytes, into GTT domain: %d\n",
- __FUNCTION__, bo->handle, bytes(bo), errno);
+ int err = errno;
+
if (__kgem_throttle_retire(kgem, 0))
goto retry_mmap;
@@ -320,6 +322,8 @@ retry_mmap:
goto retry_mmap;
}
+ ErrorF("%s: failed to mmap handle=%d, %d bytes, into GTT domain: %d\n",
+ __FUNCTION__, bo->handle, bytes(bo), err);
ptr = NULL;
}
@@ -4694,8 +4698,8 @@ retry:
mmap_arg.offset = 0;
mmap_arg.size = bytes(bo);
if (drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg)) {
- ErrorF("%s: failed to mmap %d, %d bytes, into CPU domain: %d\n",
- __FUNCTION__, bo->handle, bytes(bo), errno);
+ int err = errno;
+
if (__kgem_throttle_retire(kgem, 0))
goto retry;
@@ -4704,6 +4708,8 @@ retry:
goto retry;
}
+ ErrorF("%s: failed to mmap handle=%d, %d bytes, into CPU domain: %d\n",
+ __FUNCTION__, bo->handle, bytes(bo), err);
return NULL;
}
@@ -4734,8 +4740,8 @@ retry:
mmap_arg.offset = 0;
mmap_arg.size = bytes(bo);
if (drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg)) {
- ErrorF("%s: failed to mmap %d, %d bytes, into CPU domain: %d\n",
- __FUNCTION__, bo->handle, bytes(bo), errno);
+ int err = errno;
+
if (__kgem_throttle_retire(kgem, 0))
goto retry;
@@ -4744,6 +4750,8 @@ retry:
goto retry;
}
+ ErrorF("%s: failed to mmap handle=%d, %d bytes, into CPU domain: %d\n",
+ __FUNCTION__, bo->handle, bytes(bo), err);
return NULL;
}