aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-09-09 14:50:45 -0400
committerEric Anholt <eric@anholt.net>2009-09-09 15:52:05 -0400
commit5323fd042f89164927ee8c311f0a975e8c846412 (patch)
treea5328f9ce2dad76875652b0dfbc8f7530c5e6013 /drivers
parent7839c5d5519b6d9e2ccf3cdbf1c39e3817ad0835 (diff)
drm/i915: Zap mmaps of objects before unbinding them from the GTT.
Otherwise, some other userland writing into its buffer may race to land writes either after the CPU thinks it's got a coherent view, or after its GTT entries have been redirected to point at the scratch page. Either result is unpleasant. Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 954fb699131b..f3758f9fc979 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1915,6 +1915,12 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
1915 return -EINVAL; 1915 return -EINVAL;
1916 } 1916 }
1917 1917
1918 /* blow away mappings if mapped through GTT */
1919 i915_gem_release_mmap(obj);
1920
1921 if (obj_priv->fence_reg != I915_FENCE_REG_NONE)
1922 i915_gem_clear_fence_reg(obj);
1923
1918 /* Move the object to the CPU domain to ensure that 1924 /* Move the object to the CPU domain to ensure that
1919 * any possible CPU writes while it's not in the GTT 1925 * any possible CPU writes while it's not in the GTT
1920 * are flushed when we go to remap it. This will 1926 * are flushed when we go to remap it. This will
@@ -1928,20 +1934,14 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
1928 return ret; 1934 return ret;
1929 } 1935 }
1930 1936
1937 BUG_ON(obj_priv->active);
1938
1931 if (obj_priv->agp_mem != NULL) { 1939 if (obj_priv->agp_mem != NULL) {
1932 drm_unbind_agp(obj_priv->agp_mem); 1940 drm_unbind_agp(obj_priv->agp_mem);
1933 drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE); 1941 drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE);
1934 obj_priv->agp_mem = NULL; 1942 obj_priv->agp_mem = NULL;
1935 } 1943 }
1936 1944
1937 BUG_ON(obj_priv->active);
1938
1939 /* blow away mappings if mapped through GTT */
1940 i915_gem_release_mmap(obj);
1941
1942 if (obj_priv->fence_reg != I915_FENCE_REG_NONE)
1943 i915_gem_clear_fence_reg(obj);
1944
1945 i915_gem_object_put_pages(obj); 1945 i915_gem_object_put_pages(obj);
1946 1946
1947 if (obj_priv->gtt_space) { 1947 if (obj_priv->gtt_space) {