summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-05-05 13:40:50 -0700
committerEric Anholt <eric@anholt.net>2008-05-05 13:40:50 -0700
commit1f810b85b1e9393c8e606d2f28250cbb19cf916b (patch)
treeb0e10ed1fb24d464662a411a0d7d51a205a47d56
parent87ccc03736166db9ef85f3eee3723b82f395d3cf (diff)
Make intel_{batch,exec}_ioctl return an error code so we can recover better.
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.c25
-rw-r--r--src/mesa/drivers/dri/intel/intel_ioctl.c18
-rw-r--r--src/mesa/drivers/dri/intel/intel_ioctl.h16
3 files changed, 33 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 683d06a552..a95abd9ec9 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -125,6 +125,7 @@ do_flush_locked(struct intel_batchbuffer *batch,
GLuint used, GLboolean allow_unlock)
{
struct intel_context *intel = batch->intel;
+ int ret = 0;
dri_bo_unmap(batch->buf);
@@ -142,18 +143,18 @@ do_flush_locked(struct intel_batchbuffer *batch,
struct drm_i915_gem_execbuffer *execbuf;
execbuf = dri_process_relocs(batch->buf);
- intel_exec_ioctl(batch->intel,
- used,
- batch->cliprect_mode != LOOP_CLIPRECTS,
- allow_unlock,
- execbuf);
+ ret = intel_exec_ioctl(batch->intel,
+ used,
+ batch->cliprect_mode != LOOP_CLIPRECTS,
+ allow_unlock,
+ execbuf);
} else {
dri_process_relocs(batch->buf);
- intel_batch_ioctl(batch->intel,
- batch->buf->offset,
- used,
- batch->cliprect_mode != LOOP_CLIPRECTS,
- allow_unlock);
+ ret = intel_batch_ioctl(batch->intel,
+ batch->buf->offset,
+ used,
+ batch->cliprect_mode != LOOP_CLIPRECTS,
+ allow_unlock);
}
}
@@ -182,6 +183,10 @@ do_flush_locked(struct intel_batchbuffer *batch,
intel->vtbl.debug_batch(intel);
}
+ if (ret != 0) {
+ UNLOCK_HARDWARE(intel);
+ exit(1);
+ }
intel->vtbl.new_batch(intel);
}
diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c
index 317ff2c440..591548ae85 100644
--- a/src/mesa/drivers/dri/intel/intel_ioctl.c
+++ b/src/mesa/drivers/dri/intel/intel_ioctl.c
@@ -106,7 +106,7 @@ intelWaitIrq(struct intel_context *intel, int seq)
}
-void
+int
intel_batch_ioctl(struct intel_context *intel,
GLuint start_offset,
GLuint used,
@@ -115,7 +115,7 @@ intel_batch_ioctl(struct intel_context *intel,
struct drm_i915_batchbuffer batch;
if (intel->no_hw)
- return;
+ return 0;
assert(intel->locked);
assert(used);
@@ -144,12 +144,13 @@ intel_batch_ioctl(struct intel_context *intel,
if (drmCommandWrite(intel->driFd, DRM_I915_BATCHBUFFER, &batch,
sizeof(batch))) {
fprintf(stderr, "DRM_I915_BATCHBUFFER: %d\n", -errno);
- UNLOCK_HARDWARE(intel);
- exit(1);
+ return -errno;
}
+
+ return 0;
}
-void
+int
intel_exec_ioctl(struct intel_context *intel,
GLuint used,
GLboolean ignore_cliprects, GLboolean allow_unlock,
@@ -161,7 +162,7 @@ intel_exec_ioctl(struct intel_context *intel,
assert(used);
if (intel->no_hw)
- return;
+ return 0;
execbuf->batch_start_offset = 0;
execbuf->batch_len = used;
@@ -177,7 +178,8 @@ intel_exec_ioctl(struct intel_context *intel,
if (ret != 0) {
fprintf(stderr, "DRM_I915_GEM_EXECBUFFER: %d\n", -errno);
- UNLOCK_HARDWARE(intel);
- exit(1);
+ return -errno;
}
+
+ return 0;
}
diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.h b/src/mesa/drivers/dri/intel/intel_ioctl.h
index 52b0ab6102..526e38358c 100644
--- a/src/mesa/drivers/dri/intel/intel_ioctl.h
+++ b/src/mesa/drivers/dri/intel/intel_ioctl.h
@@ -33,14 +33,14 @@
void intelWaitIrq( struct intel_context *intel, int seq );
int intelEmitIrqLocked( struct intel_context *intel );
-void intel_batch_ioctl( struct intel_context *intel,
- GLuint start_offset,
- GLuint used,
- GLboolean ignore_cliprects,
- GLboolean allow_unlock );
-void intel_exec_ioctl(struct intel_context *intel,
+int intel_batch_ioctl(struct intel_context *intel,
+ GLuint start_offset,
GLuint used,
- GLboolean ignore_cliprects, GLboolean allow_unlock,
- struct drm_i915_gem_execbuffer *execbuf);
+ GLboolean ignore_cliprects,
+ GLboolean allow_unlock);
+int intel_exec_ioctl(struct intel_context *intel,
+ GLuint used,
+ GLboolean ignore_cliprects, GLboolean allow_unlock,
+ struct drm_i915_gem_execbuffer *execbuf);
#endif