[Intel-gfx] [PATCH] libdrm_intel: Fix return from drm_intel_gem_bo_busy

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Mon Jan 18 09:29:55 PST 2016


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Return path from this function got confused in:

   commit 02f93c21e6e1c3dad9d99349989daa84a8c0b5fb
   Author: Eric Anholt <eric at anholt.net>
   Date:   Wed Jan 15 00:38:39 2014 -0800

   intel: Track whether a buffer is idle to avoid trips to the kernel.

Consolidate the return paths and stop leaking out the internal
driver state since the API was intended to be a boolean.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Eric Anholt <eric at anholt.net>
Cc: Kenneth Graunke <kenneth at whitecape.org>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 intel/intel_bufmgr_gem.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index dc28200ffecc..2f8bad88166a 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -663,11 +663,10 @@ drm_intel_gem_bo_busy(drm_intel_bo *bo)
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_BUSY, &busy);
 	if (ret == 0) {
 		bo_gem->idle = !busy.busy;
-		return busy.busy;
-	} else {
-		return false;
+		return !bo_gem->idle;
 	}
-	return (ret == 0 && busy.busy);
+
+	return false;
 }
 
 static int
-- 
1.9.1



More information about the Intel-gfx mailing list