[Intel-gfx] [PATCH 2/6] intel: Use WAIT for wait-rendering

Chris Wilson chris at chris-wilson.co.uk
Tue May 5 01:53:56 PDT 2015


Using WAIT is preferrable to SET_DOMAIN as it doesn't have
any domain management side-effects - but has the same flushing
semantics.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 intel/intel_bufmgr_gem.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index eeb9acf..43cbae5 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1729,6 +1729,24 @@ drm_intel_gem_bo_get_subdata(drm_intel_bo *bo, unsigned long offset,
 static void
 drm_intel_gem_bo_wait_rendering(drm_intel_bo *bo)
 {
+	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
+
+	/* Using WAIT is preferrable to SET_DOMAIN as it doesn't have
+	 * any domain management side-effects - but has the same flushing
+	 * semantics.
+	 */
+	if (bufmgr_gem->has_wait_timeout) {
+		struct drm_i915_gem_wait wait;
+
+		memclear(wait);
+		wait.bo_handle = bo->handle;
+		wait.timeout_ns = -1;
+		if (drmIoctl(bufmgr_gem->fd,
+			     DRM_IOCTL_I915_GEM_WAIT,
+			     &wait) == 0)
+			return;
+	}
+
 	drm_intel_gem_bo_start_gtt_access(bo, 1);
 }
 
-- 
2.1.4



More information about the Intel-gfx mailing list