From 60fd6764eba05f51bb83efba5593975cf8d1285b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 23 Jun 2014 11:25:47 +0100 Subject: [PATCH] sna: Handle old busy_ioctl not reporting the active ring If we have an old kernel, just presume that the bo was last active on the render ring. Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 2 +- src/sna/sna_dri2.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 3e4a4b59..ecec0527 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -6439,7 +6439,7 @@ fixup_flip: if (drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_BUSY, &busy) == 0) { if (busy.busy) { int mode = KGEM_RENDER; - if ((busy.busy & (1 << 16)) == 0) + if (busy.busy & (0xfffe << 16)) mode = KGEM_BLT; DBG(("%s: marking flip bo as busy [%x -> mode=%d]\n", __FUNCTION__, busy.busy, mode)); kgem_bo_mark_busy(&sna->kgem, flip_bo, mode); diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index 2b8cd037..686fd605 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -778,13 +778,17 @@ static void sna_dri2_select_mode(struct sna *sna, struct kgem_bo *dst, struct kg if (drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_BUSY, &busy)) return; - DBG(("%s: src busy?=%x\n", __FUNCTION__, busy.busy)); + DBG(("%s: src handle=%d busy?=%x\n", __FUNCTION__, busy.handle, busy.busy)); if (busy.busy == 0) { + __kgem_bo_clear_busy(src); + busy.handle = dst->handle; if (drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_BUSY, &busy)) return; - DBG(("%s: dst busy?=%x\n", __FUNCTION__, busy.busy)); + + DBG(("%s: dst handle=%d busy?=%x\n", __FUNCTION__, busy.handle, busy.busy)); if (busy.busy == 0) { + __kgem_bo_clear_busy(dst); DBG(("%s: src/dst is idle, using defaults\n", __FUNCTION__)); return; } @@ -806,7 +810,7 @@ static void sna_dri2_select_mode(struct sna *sna, struct kgem_bo *dst, struct kg * the cost of the query. */ mode = KGEM_RENDER; - if ((busy.busy & (1 << 16)) == 0) + if (busy.busy & (0xfffe << 16)) mode = KGEM_BLT; kgem_bo_mark_busy(&sna->kgem, busy.handle == src->handle ? src : dst, mode); _kgem_set_mode(&sna->kgem, mode);