From patchwork Wed Dec 2 15:15:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 64294 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 nB2FFepg015057 for ; Wed, 2 Dec 2009 15:15:40 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 74E729F5B2; Wed, 2 Dec 2009 07:15:40 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D35C9E8CA for ; Wed, 2 Dec 2009 07:15:37 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 02 Dec 2009 07:15:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,328,1257148800"; d="scan'208";a="574971837" Received: from unknown (HELO localhost.localdomain) ([10.255.16.235]) by orsmga001.jf.intel.com with ESMTP; 02 Dec 2009 07:15:22 -0800 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 2 Dec 2009 15:15:31 +0000 Message-Id: <1259766931-23967-2-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: <1259766931-23967-1-git-send-email-chris@chris-wilson.co.uk> References: <1259766931-23967-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 2/2] drm/i915: Search again if we cannot find enough space in the aperture 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 diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 56fe427..8a647b6 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1276,9 +1276,17 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj) list->file_offset_node = drm_mm_search_free(&mm->offset_manager, obj->size / PAGE_SIZE, 0, 0); if (!list->file_offset_node) { - DRM_ERROR("failed to allocate offset for bo %d\n", obj->name); - ret = -ENOMEM; - goto out_free_list; + ret = i915_gem_evict_something(dev, obj->size); + if (ret) + return ret; + + list->file_offset_node = drm_mm_search_free(&mm->offset_manager, + obj->size / PAGE_SIZE, 0, 0); + if (!list->file_offset_node) { + DRM_ERROR("failed to allocate offset for bo %d\n", obj->name); + ret = -ENOSPC; + goto out_free_list; + } } list->file_offset_node = drm_mm_get_block(list->file_offset_node,