diff options
author | Keith Packard <keithp@keithp.com> | 2008-06-13 17:06:35 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-06-13 17:06:35 -0700 |
commit | 73bc18cad8d1c6b4481a199cebf7f0a28d19c2bb (patch) | |
tree | e8d2290a9f99facdf313d5cc31746d504b20ad2a | |
parent | 8b9ab108ec1f2ba2b503f713769c4946849b3cb2 (diff) |
[intel-gem] Wait for rendering to complete before unbinding.
Moving to the CPU domain doesn't ensure that rendering is finished, the
buffer may still be in use as a texture or other data source.
-rw-r--r-- | linux-core/i915_gem.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c index cb5d663e..0f037acf 100644 --- a/linux-core/i915_gem.c +++ b/linux-core/i915_gem.c @@ -688,6 +688,19 @@ i915_gem_object_unbind(struct drm_gem_object *obj) if (obj_priv->gtt_space == NULL) return 0; + if (obj_priv->pin_count != 0) { + DRM_ERROR("Attempting to unbind pinned buffer\n"); + return -EINVAL; + } + + /* Wait for any rendering to complete + */ + ret = i915_gem_object_wait_rendering(obj); + if (ret) { + DRM_ERROR ("wait_rendering failed: %d\n", ret); + return ret; + } + /* Move the object to the CPU domain to ensure that * any possible CPU writes while it's not in the GTT * are flushed when we go to remap it. This will |