xf86-video-intel: 3 commits - src/sna/kgem.c src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Sun Jan 19 08:02:03 PST 2014
src/sna/kgem.c | 98 ++++++++++++++++++++++++++++++++++----------------
src/sna/sna_display.c | 12 +++++-
2 files changed, 78 insertions(+), 32 deletions(-)
New commits:
commit 50a45a1cdd4d8319ba9358974d241069689591c5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Jan 19 15:59:42 2014 +0000
sna: Use device minor to narrow search for debugfs files
Also vital in case we ever have two Intel GPUs!
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 7badee1..eee1207 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1031,6 +1031,38 @@ static int kgem_get_screen_index(struct kgem *kgem)
return sna->scrn->scrnIndex;
}
+static int __find_debugfs(struct kgem *kgem)
+{
+ int i;
+
+ for (i = 0; i < DRM_MAX_MINOR; i++) {
+ char path[80];
+
+ sprintf(path, "/sys/kernel/debug/dri/%d/i915_wedged", i);
+ if (access(path, R_OK) == 0)
+ return i;
+
+ sprintf(path, "/debug/dri/%d/i915_wedged", i);
+ if (access(path, R_OK) == 0)
+ return i;
+ }
+
+ return -1;
+}
+
+static int kgem_get_minor(struct kgem *kgem)
+{
+ struct stat st;
+
+ if (fstat(kgem->fd, &st))
+ return __find_debugfs(kgem);
+
+ if (!S_ISCHR(st.st_mode))
+ return __find_debugfs(kgem);
+
+ return st.st_rdev & 0x63;
+}
+
static bool kgem_init_pinned_batches(struct kgem *kgem)
{
int count[2] = { 16, 4 };
@@ -2889,27 +2921,31 @@ static bool dump_file(const char *path)
return true;
}
-static void dump_debugfs(const char *name)
+static void dump_debugfs(struct kgem *kgem, const char *name)
{
- int i;
+ char path[80];
+ int minor = kgem_get_minor(kgem);
- for (i = 0; i < DRM_MAX_MINOR; i++) {
- char path[80];
+ if (minor < 0)
+ return;
- sprintf(path, "/sys/kernel/debug/dri/%d/%s", i, name);
- if (dump_file(path))
- return;
- }
+ sprintf(path, "/sys/kernel/debug/dri/%d/%s", minor, name);
+ if (dump_file(path))
+ return;
+
+ sprintf(path, "/debug/dri/%d/%s", minor, name);
+ if (dump_file(path))
+ return;
}
-static void dump_gtt_info(void)
+static void dump_gtt_info(struct kgem *kgem)
{
- dump_debugfs("i915_gem_gtt");
+ dump_debugfs(kgem, "i915_gem_gtt");
}
-static void dump_fence_regs(void)
+static void dump_fence_regs(struct kgem *kgem)
{
- dump_debugfs("i915_gem_fence_regs");
+ dump_debugfs(kgem, "i915_gem_fence_regs");
}
#endif
@@ -3068,9 +3104,9 @@ void _kgem_submit(struct kgem *kgem)
}
if (ret == ENOSPC)
- dump_gtt_info();
+ dump_gtt_info(kgem);
if (ret == EDEADLK)
- dump_fence_regs();
+ dump_fence_regs(kgem);
if (DEBUG_SYNC) {
int fd = open("/tmp/batchbuffer", O_WRONLY | O_CREAT | O_APPEND, 0666);
@@ -3096,26 +3132,24 @@ void _kgem_submit(struct kgem *kgem)
static void find_hang_state(struct kgem *kgem, char *path, int maxlen)
{
- int i;
+ int minor = kgem_get_minor(kgem);
/* Search for our hang state in a few canonical locations.
* In the unlikely event of having multiple devices, we
* will need to check which minor actually corresponds to ours.
*/
- for (i = 0; i < DRM_MAX_MINOR; i++) {
- snprintf(path, maxlen, "/sys/class/drm/card%d/error", i);
- if (access(path, R_OK) == 0)
- return;
+ snprintf(path, maxlen, "/sys/class/drm/card%d/error", minor);
+ if (access(path, R_OK) == 0)
+ return;
- snprintf(path, maxlen, "/sys/kernel/debug/dri%d/i915_error_state", i);
- if (access(path, R_OK) == 0)
- return;
+ snprintf(path, maxlen, "/sys/kernel/debug/dri/%d/i915_error_state", minor);
+ if (access(path, R_OK) == 0)
+ return;
- snprintf(path, maxlen, "/debug/dri%d/i915_error_state", i);
- if (access(path, R_OK) == 0)
- return;
- }
+ snprintf(path, maxlen, "/debug/dri/%d/i915_error_state", minor);
+ if (access(path, R_OK) == 0)
+ return;
path[0] = '\0';
}
commit d41bbfc97c46b01227f193d7e938390691a8b581
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Jan 19 15:18:44 2014 +0000
sna: Always emit an error message when an execbuffer fails
So that we are not left with a puzzled user with a mysteriously slow
machine.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 0aee958..7badee1 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3016,16 +3016,18 @@ void _kgem_submit(struct kgem *kgem)
ret = drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
}
if (ret == -1) {
- DBG(("%s: GPU hang detected [%d]\n",
- __FUNCTION__, errno));
+ ret = errno;
kgem_throttle(kgem);
- kgem->wedged = true;
+ if (!kgem->wedged) {
+ xf86DrvMsg(kgem_get_screen_index(kgem), X_ERROR,
+ "Failed to submit rendering commands, disabling acceleration.\n");
+ kgem->wedged = true;
+ }
#if !NDEBUG
- ret = errno;
ErrorF("batch[%d/%d]: %d %d %d, nreloc=%d, nexec=%d, nfence=%d, aperture=%d, fenced=%d, high=%d,%d: errno=%d\n",
kgem->mode, kgem->ring, batch_end, kgem->nbatch, kgem->surface,
- kgem->nreloc, kgem->nexec, kgem->nfence, kgem->aperture, kgem->aperture_fenced, kgem->aperture_high, kgem->aperture_total, errno);
+ kgem->nreloc, kgem->nexec, kgem->nfence, kgem->aperture, kgem->aperture_fenced, kgem->aperture_high, kgem->aperture_total, ret);
for (i = 0; i < kgem->nexec; i++) {
struct kgem_bo *bo, *found = NULL;
commit d7f753ba89c928f141f1feb750733f53130c3bfb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Jan 19 12:52:20 2014 +0000
sna: Discard pending wait_for_shadow updates before the TearFree flip
Rather than just assert that we have used the pending update in
wait_for_shadow, discard it first.
Reported-by: Joe Peterson <joe at wildlava.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=70905
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 10ee9e4..000d9ab 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -4530,7 +4530,17 @@ void sna_mode_redisplay(struct sna *sna)
return;
}
- assert(sna_pixmap(sna->front)->move_to_gpu == NULL);
+ {
+ struct sna_pixmap *priv;
+
+ priv = sna_pixmap(sna->front);
+ assert(priv != NULL);
+
+ if (priv->move_to_gpu)
+ (void)priv->move_to_gpu(sna, priv, 0);
+
+ assert(priv->move_to_gpu == NULL);
+ }
for (i = 0; i < config->num_crtc; i++) {
xf86CrtcPtr crtc = config->crtc[i];
More information about the xorg-commit
mailing list