diff mbox

[2/2] intel: Use WAIT for wait-rendering

Message ID 1429024125-7859-2-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson April 14, 2015, 3:08 p.m. UTC
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@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 intel/intel_bufmgr_gem.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox

Patch

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index ecbf8ee..a938441 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1740,6 +1740,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);
 }