summaryrefslogtreecommitdiff
path: root/intel
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-03-04 21:17:48 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2010-03-04 21:17:48 +0000
commit3e21e3ba0090c4dbe976269409b336dc82fe3d36 (patch)
tree646c5e40735744d42a0ca6ea1731ec2472ae555e /intel
parentb5495527f4c7087d430c0d1c2b83357c40b9c16c (diff)
intel: Propagate some more error returns
Ensure that errors from the kernel are propagated back to the caller, and not masked with return 0; Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'intel')
-rw-r--r--intel/intel_bufmgr_gem.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 7ccadd2f..f852c09d 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1099,10 +1099,12 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo)
DRM_IOCTL_I915_GEM_SW_FINISH,
&sw_finish);
} while (ret == -1 && errno == EINTR);
+ ret = ret == -1 ? -errno : 0;
bo->virtual = NULL;
pthread_mutex_unlock(&bufmgr_gem->lock);
- return 0;
+
+ return ret;
}
static int
@@ -1125,12 +1127,14 @@ drm_intel_gem_bo_subdata(drm_intel_bo *bo, unsigned long offset,
&pwrite);
} while (ret == -1 && errno == EINTR);
if (ret != 0) {
+ ret = -errno;
fprintf(stderr,
"%s:%d: Error writing data to buffer %d: (%d %d) %s .\n",
__FILE__, __LINE__, bo_gem->gem_handle, (int)offset,
(int)size, strerror(errno));
}
- return 0;
+
+ return ret;
}
static int
@@ -1182,6 +1186,7 @@ drm_intel_gem_bo_get_subdata(drm_intel_bo *bo, unsigned long offset,
__FILE__, __LINE__, bo_gem->gem_handle, (int)offset,
(int)size, strerror(errno));
}
+
return ret;
}
@@ -1551,15 +1556,18 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
&execbuf);
} while (ret != 0 && errno == EAGAIN);
- if (ret != 0 && errno == ENOMEM) {
- fprintf(stderr,
- "Execbuffer fails to pin. "
- "Estimate: %u. Actual: %u. Available: %u\n",
- drm_intel_gem_estimate_batch_space(bufmgr_gem->exec_bos,
- bufmgr_gem->exec_count),
- drm_intel_gem_compute_batch_space(bufmgr_gem->exec_bos,
- bufmgr_gem->exec_count),
- (unsigned int) bufmgr_gem->gtt_size);
+ if (ret != 0) {
+ ret = -errno;
+ if (ret == -ENOMEM) {
+ fprintf(stderr,
+ "Execbuffer fails to pin. "
+ "Estimate: %u. Actual: %u. Available: %u\n",
+ drm_intel_gem_estimate_batch_space(bufmgr_gem->exec_bos,
+ bufmgr_gem->exec_count),
+ drm_intel_gem_compute_batch_space(bufmgr_gem->exec_bos,
+ bufmgr_gem->exec_count),
+ (unsigned int) bufmgr_gem->gtt_size);
+ }
}
drm_intel_update_buffer_offsets2(bufmgr_gem);
@@ -1577,7 +1585,7 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
bufmgr_gem->exec_count = 0;
pthread_mutex_unlock(&bufmgr_gem->lock);
- return 0;
+ return ret;
}
static int