[Intel-gfx] [PATCH] drm/i915: First recheck for an empty fence register.

Chris Wilson chris at chris-wilson.co.uk
Wed Feb 11 15:26:44 CET 2009


If we wait upon a request and successfully unbind a buffer occupying a
fence register, then that slot will be freed and cause a NULL derefrence
upon rescanning.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index cece254..739479d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1568,6 +1568,7 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj, bool write)
 
 	i915_verify_fence (dev, __FILE__, __LINE__);
 
+try_again:
 	/* First try to find a free reg */
 	for (i = dev_priv->fence_reg_start; i < dev_priv->num_fence_regs; i++) {
 		reg = &dev_priv->fence_regs[i];
@@ -1580,7 +1581,6 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj, bool write)
 		struct drm_i915_gem_object *old_obj_priv = NULL;
 		loff_t offset;
 
-try_again:
 		/* Could try to use LRU here instead... */
 		for (i = dev_priv->fence_reg_start;
 		     i < dev_priv->num_fence_regs; i++) {
-- 
1.6.0.4




More information about the Intel-gfx mailing list