From patchwork Mon Jul 1 20:01:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2809361 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7DDA09F3EB for ; Mon, 1 Jul 2013 20:06:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5372C201A8 for ; Mon, 1 Jul 2013 20:06:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2F3D2201AA for ; Mon, 1 Jul 2013 20:06:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A0F2E60A7 for ; Mon, 1 Jul 2013 13:06:23 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 4557BE5C25 for ; Mon, 1 Jul 2013 13:04:16 -0700 (PDT) Received: by mail-ea0-f177.google.com with SMTP id j14so2303370eak.22 for ; Mon, 01 Jul 2013 13:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=rtroZ4l8yxZLFKuW0834NstKwRvp1dGraOJt1xtfObQ=; b=MT6AQFO0d5fyNUXPUDCBVvNm3h1Bt4H9EhAQnOBeC2WWRKxMBcCC61dVIxkMkjDXrq 2sxsfoBmN+qvDRt7CrRaFkBUPNxIP8wJsm84oXIjuMAewg4B8ZZMpKi+dqBeqd5I1XNx b48hHvTN8SWIqo3w8ifQKIJC9bT9hWjGh8Lag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=rtroZ4l8yxZLFKuW0834NstKwRvp1dGraOJt1xtfObQ=; b=kSLRDD7j0MDVLQf53iQSfB7/TVl9gCiZHq0t/KRMEA8wv2RqGtj/ddWV97HlXeXou6 NkCg9g38UMYfkgcp6IX8gCGA2QBg1Euck6G+RD1PJcpvOzU+nxoxMP0mRBHatyR62oTl kQXDdjZEiSfKGUjBHYUgUw5ftXyd30lS4f/o4QBI7I01ipd0WpecXAaUVqbGVfafdKKP Cv0JWIQWUa76ovaEkSvz7whBPd833LnsekPHo5WhwPLEI014ruz1xrkAEgyRQX8bCeol WDvl/o8CZyuUYTHjwofJXKtZzYakblfGbytohaD4QezrqPCrb4ZAYyDIaUPQmSlllw+i V/yw== X-Received: by 10.14.148.133 with SMTP id v5mr22926709eej.81.1372709055498; Mon, 01 Jul 2013 13:04:15 -0700 (PDT) Received: from gina.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id ci50sm31853473eeb.12.2013.07.01.13.04.13 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Jul 2013 13:04:14 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Subject: [PATCH 2/3] drm/i915: Don't try to tear down the stolen drm_mm if it's not there Date: Mon, 1 Jul 2013 22:01:03 +0200 Message-Id: <1372708864-26963-2-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1372708864-26963-1-git-send-email-daniel.vetter@ffwll.ch> References: <1372708864-26963-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQmbhW+ZMX2a2NVRXtXKpLUw7uGPb8kGLvnzGke3PB0lX09AOTx6LX1wc5kGvpvitB0lXIQE Cc: Daniel Vetter , DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Every other place properly checks whether we've managed to set up the stolen allocator at boot-up properly, with the exception of the cleanup code. Which results in an ugly *ERROR* Memory manager not clean. Delaying takedown at module unload time since the drm_mm isn't initialized at all. v2: While at it check whether the stolen drm_mm is initialized instead of the more obscure stolen_base == 0 check. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65953 Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_gem_stolen.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 8e02344..32e63a8 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -147,7 +147,7 @@ int i915_gem_stolen_setup_compression(struct drm_device *dev, int size) { struct drm_i915_private *dev_priv = dev->dev_private; - if (dev_priv->mm.stolen_base == 0) + if (drm_mm_initialized(&dev_priv->mm.stolen)) return -ENODEV; if (size < dev_priv->fbc.size) @@ -179,6 +179,9 @@ void i915_gem_cleanup_stolen(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; + if (drm_mm_initialized(&dev_priv->mm.stolen)) + return; + i915_gem_stolen_cleanup_compression(dev); drm_mm_takedown(&dev_priv->mm.stolen); } @@ -300,7 +303,7 @@ i915_gem_object_create_stolen(struct drm_device *dev, u32 size) struct drm_i915_gem_object *obj; struct drm_mm_node *stolen; - if (dev_priv->mm.stolen_base == 0) + if (drm_mm_initialized(&dev_priv->mm.stolen)) return NULL; DRM_DEBUG_KMS("creating stolen object: size=%x\n", size); @@ -331,7 +334,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, struct drm_i915_gem_object *obj; struct drm_mm_node *stolen; - if (dev_priv->mm.stolen_base == 0) + if (drm_mm_initialized(&dev_priv->mm.stolen)) return NULL; DRM_DEBUG_KMS("creating preallocated stolen object: stolen_offset=%x, gtt_offset=%x, size=%x\n",