summaryrefslogtreecommitdiff
path: root/src/sna/kgem.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-20 14:02:07 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-20 14:02:07 +0000
commitb52c921204df6b2486717fcef05b4a1993aa1071 (patch)
tree74285fb0402894dbae615e49021318a28d4f337b /src/sna/kgem.c
parent8215a278f20d34819536edbda05a108a860fefb9 (diff)
sna: Adapt error detection and handling for invalid batchbuffers
Allow the DDX to continue even if the kernel rejects our batchbuffers by disabling hw acceleration - just extends the existing hang detection to also handle the driver producing garbage. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/kgem.c')
-rw-r--r--src/sna/kgem.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 49815e7e..a5a7a88b 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2648,33 +2648,23 @@ void _kgem_submit(struct kgem *kgem)
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf);
}
- if (ret == -1 && (errno == EIO || errno == EBUSY)) {
- DBG(("%s: GPU hang detected\n", __FUNCTION__));
- kgem_throttle(kgem);
- ret = 0;
- }
-
if (DEBUG_SYNC && ret == 0) {
struct drm_i915_gem_set_domain set_domain;
- DBG(("%s: debug sync, starting\n", __FUNCTION__));
-
VG_CLEAR(set_domain);
set_domain.handle = handle;
set_domain.read_domains = I915_GEM_DOMAIN_GTT;
set_domain.write_domain = I915_GEM_DOMAIN_GTT;
ret = drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
- if (ret == -1) {
- DBG(("%s: sync: GPU hang detected\n", __FUNCTION__));
- kgem_throttle(kgem);
- }
-
- DBG(("%s: debug sync, completed\n", __FUNCTION__));
}
+ if (ret == -1) {
+ DBG(("%s: GPU hang detected [%d]\n",
+ __FUNCTION__, errno));
+ kgem_throttle(kgem);
+ kgem->wedged = true;
#if !NDEBUG
- if (ret < 0) {
ret = errno;
ErrorF("batch[%d/%d]: %d %d %d, nreloc=%d, nexec=%d, nfence=%d, aperture=%d: errno=%d\n",
kgem->mode, kgem->ring, batch_end, kgem->nbatch, kgem->surface,
@@ -2710,15 +2700,17 @@ void _kgem_submit(struct kgem *kgem)
(int)kgem->reloc[i].presumed_offset);
}
- i = open("/tmp/batchbuffer", O_WRONLY | O_CREAT | O_APPEND, 0666);
- if (i != -1) {
- i = write(i, kgem->batch, batch_end*sizeof(uint32_t));
- (void)i;
- }
+ if (DEBUG_SYNC) {
+ int fd = open("/tmp/batchbuffer", O_WRONLY | O_CREAT | O_APPEND, 0666);
+ if (fd != -1) {
+ write(fd, kgem->batch, batch_end*sizeof(uint32_t));
+ close(fd);
+ }
- FatalError("SNA: failed to submit batchbuffer, errno=%d\n", ret);
- }
+ FatalError("SNA: failed to submit batchbuffer, errno=%d\n", ret);
+ }
#endif
+ }
}
kgem_commit(kgem);