aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 4f345414fe7c..174aef2d6481 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2162,7 +2162,6 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg)
2162 val |= I830_FENCE_REG_VALID; 2162 val |= I830_FENCE_REG_VALID;
2163 2163
2164 I915_WRITE(FENCE_REG_830_0 + (regnum * 4), val); 2164 I915_WRITE(FENCE_REG_830_0 + (regnum * 4), val);
2165
2166} 2165}
2167 2166
2168/** 2167/**
@@ -2329,6 +2328,42 @@ i915_gem_clear_fence_reg(struct drm_gem_object *obj)
2329} 2328}
2330 2329
2331/** 2330/**
2331 * i915_gem_object_put_fence_reg - waits on outstanding fenced access
2332 * to the buffer to finish, and then resets the fence register.
2333 * @obj: tiled object holding a fence register.
2334 *
2335 * Zeroes out the fence register itself and clears out the associated
2336 * data structures in dev_priv and obj_priv.
2337 */
2338int
2339i915_gem_object_put_fence_reg(struct drm_gem_object *obj)
2340{
2341 struct drm_device *dev = obj->dev;
2342 struct drm_i915_gem_object *obj_priv = obj->driver_private;
2343
2344 if (obj_priv->fence_reg == I915_FENCE_REG_NONE)
2345 return 0;
2346
2347 /* On the i915, GPU access to tiled buffers is via a fence,
2348 * therefore we must wait for any outstanding access to complete
2349 * before clearing the fence.
2350 */
2351 if (!IS_I965G(dev)) {
2352 int ret;
2353
2354 i915_gem_object_flush_gpu_write_domain(obj);
2355 i915_gem_object_flush_gtt_write_domain(obj);
2356 ret = i915_gem_object_wait_rendering(obj);
2357 if (ret != 0)
2358 return ret;
2359 }
2360
2361 i915_gem_clear_fence_reg (obj);
2362
2363 return 0;
2364}
2365
2366/**
2332 * Finds free space in the GTT aperture and binds the object there. 2367 * Finds free space in the GTT aperture and binds the object there.
2333 */ 2368 */
2334static int 2369static int