Make intel_{batch,exec}_ioctl return an error code so we can recover better.

This commit is contained in:
Eric Anholt 2008-05-05 13:40:50 -07:00
parent 87ccc03736
commit 1f810b85b1
3 changed files with 33 additions and 26 deletions

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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