From patchwork Wed Sep 9 19:46:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 46693 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8AMh0K9019780 for ; Thu, 10 Sep 2009 22:43:00 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 67DBA9E941; Wed, 9 Sep 2009 12:46:22 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from kingsolver.anholt.net (71-20-254-182.war.clearwire-wmx.net [71.20.254.182]) by gabe.freedesktop.org (Postfix) with ESMTP id 777389E762 for ; Wed, 9 Sep 2009 12:46:19 -0700 (PDT) Received: from gaiman.anholt.net (localhost [127.0.0.1]) by kingsolver.anholt.net (Postfix) with ESMTP id 1920D2C9C031; Wed, 9 Sep 2009 12:46:03 -0700 (PDT) Received: by gaiman.anholt.net (Postfix, from userid 1000) id F3A8C1620B0; Wed, 9 Sep 2009 12:46:01 -0700 (PDT) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 9 Sep 2009 12:46:00 -0700 Message-Id: <1252525560-32422-1-git-send-email-eric@anholt.net> X-Mailer: git-send-email 1.6.3.3 Subject: [Intel-gfx] [PATCH] drm/i915: Zap mmaps of objects before unbinding them from the GTT. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org 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 --- drivers/gpu/drm/i915/i915_gem.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 954fb69..c6fcc16 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1928,12 +1928,6 @@ i915_gem_object_unbind(struct drm_gem_object *obj) return ret; } - if (obj_priv->agp_mem != NULL) { - drm_unbind_agp(obj_priv->agp_mem); - drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE); - obj_priv->agp_mem = NULL; - } - BUG_ON(obj_priv->active); /* blow away mappings if mapped through GTT */ @@ -1942,6 +1936,12 @@ i915_gem_object_unbind(struct drm_gem_object *obj) if (obj_priv->fence_reg != I915_FENCE_REG_NONE) i915_gem_clear_fence_reg(obj); + if (obj_priv->agp_mem != NULL) { + drm_unbind_agp(obj_priv->agp_mem); + drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE); + obj_priv->agp_mem = NULL; + } + i915_gem_object_put_pages(obj); if (obj_priv->gtt_space) {