From patchwork Thu Mar 27 17:59:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 3898851 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3151ABF540 for ; Thu, 27 Mar 2014 17:12:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5278120237 for ; Thu, 27 Mar 2014 17:12:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5C39E2024D for ; Thu, 27 Mar 2014 17:12:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 125C66EA18; Thu, 27 Mar 2014 10:12:18 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D0816EA18 for ; Thu, 27 Mar 2014 10:12:16 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 27 Mar 2014 10:07:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,743,1389772800"; d="scan'208";a="501086243" Received: from omateolo-linux2.iwi.intel.com ([172.28.253.148]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2014 10:05:42 -0700 From: oscar.mateo@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 27 Mar 2014 17:59:36 +0000 Message-Id: <1395943218-7708-8-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1395943218-7708-1-git-send-email-oscar.mateo@intel.com> References: <1395943218-7708-1-git-send-email-oscar.mateo@intel.com> Cc: Ben Widawsky , Ben Widawsky Subject: [Intel-gfx] [PATCH 07/49] drm/i915/bdw: Rework init code for gen8 contexts X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 From: Ben Widawsky This modifies the init code to try to start logical ring contexts when possible, and fall back to legacy ringbuffers when not. Most importantly, things make things easy if we do the context creation before ringbuffer initialization. Upcoming patches will make it clearer why that is. For the initial enabling of execlists, the ringbuffer code will be reused a decent amount. As such this code will have to change, but it helps with enabling to be able to run through a bunch of the context init, and still have a system boot. Finally, for the bikeshedders out there: I've tried merging the legacy hw context init functionality, ie. one init function, and this logic was in the context creation. The resulting code was much uglier and for no real gain. Signed-off-by: Ben Widawsky v2: Rebased on top of the Full PPGTT series. Signed-off-by: Oscar Mateo --- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_gem.c | 16 +++++++++++----- drivers/gpu/drm/i915/i915_lrc.c | 5 +++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 488d406..872849e 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2312,6 +2312,9 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, struct drm_file *file); +/* i915_lrc.c */ +int gen8_gem_context_init(struct drm_device *dev); + /* i915_gem_evict.c */ int __must_check i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index f429887..d734ee3 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4451,7 +4451,7 @@ err_out: int i915_gem_init(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; - int ret; + int ret = -1; mutex_lock(&dev->struct_mutex); @@ -4466,11 +4466,17 @@ int i915_gem_init(struct drm_device *dev) intel_init_rings_early(dev); - ret = i915_gem_context_init(dev); + if (HAS_LOGICAL_RING_CONTEXTS(dev) && USES_PPGTT(dev)) + ret = gen8_gem_context_init(dev); + if (ret) { - mutex_unlock(&dev->struct_mutex); - return ret; - } + ret = i915_gem_context_init(dev); + if (ret) { + mutex_unlock(&dev->struct_mutex); + return ret; + } + } else + dev_priv->lrc_enabled = true; ret = i915_gem_init_hw(dev); mutex_unlock(&dev->struct_mutex); diff --git a/drivers/gpu/drm/i915/i915_lrc.c b/drivers/gpu/drm/i915/i915_lrc.c index 49bb6fc..3a93e99 100644 --- a/drivers/gpu/drm/i915/i915_lrc.c +++ b/drivers/gpu/drm/i915/i915_lrc.c @@ -40,3 +40,8 @@ #include #include #include "i915_drv.h" + +int gen8_gem_context_init(struct drm_device *dev) +{ + return -ENOSYS; +}