From patchwork Thu Feb 18 11:42:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Zhi A" X-Patchwork-Id: 8349171 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5B29EC0553 for ; Thu, 18 Feb 2016 11:45:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 914ED202FE for ; Thu, 18 Feb 2016 11:45:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B37A22026C for ; Thu, 18 Feb 2016 11:45:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0188C6EB76; Thu, 18 Feb 2016 11:45:22 +0000 (UTC) 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 D520E6EB73 for ; Thu, 18 Feb 2016 11:45:18 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 18 Feb 2016 03:45:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,465,1449561600"; d="scan'208";a="654960072" Received: from dev-inno.bj.intel.com ([10.238.135.69]) by FMSMGA003.fm.intel.com with ESMTP; 18 Feb 2016 03:45:17 -0800 From: Zhi Wang To: intel-gfx@lists.freedesktop.org, igvt-g@lists.01.org Date: Thu, 18 Feb 2016 19:42:19 +0800 Message-Id: <1455795741-3487-13-git-send-email-zhi.a.wang@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455795741-3487-1-git-send-email-zhi.a.wang@intel.com> References: <1455795741-3487-1-git-send-email-zhi.a.wang@intel.com> Cc: daniel.vetter@ffwll.ch, david.j.cowperthwaite@intel.com, zhiyuan.lv@intel.com Subject: [Intel-gfx] [RFCv2 12/14] drm/i915: factor out execlists_i915_pick_requests() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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.2 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 This patch factors out the request picking logics from execlists_context_unqueue(), with some fixes to makes checkpatch.pl happy. No logic is changed. Signed-off-by: Zhi Wang --- drivers/gpu/drm/i915/intel_lrc.c | 50 +++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 07aa5da..1c0366a 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -450,10 +450,38 @@ static inline void execlists_context_status_change( status, NULL); } +static void execlists_i915_pick_requests(struct intel_engine_cs *ring, + struct drm_i915_gem_request **req0, + struct drm_i915_gem_request **req1) +{ + struct drm_i915_gem_request *cursor, *tmp; + + *req0 = *req1 = NULL; + + /* Try to read in pairs */ + list_for_each_entry_safe(cursor, tmp, &ring->execlist_queue, + execlist_link) { + if (!*req0) { + *req0 = cursor; + } else if ((*req0)->ctx == cursor->ctx) { + /* + * Same ctx: ignore first request, as second request + * will update tail past first request's workload + */ + cursor->elsp_submitted = (*req0)->elsp_submitted; + list_move_tail(&(*req0)->execlist_link, + &ring->execlist_retired_req_list); + *req0 = cursor; + } else { + *req1 = cursor; + break; + } + } +} + static void execlists_context_unqueue(struct intel_engine_cs *ring) { - struct drm_i915_gem_request *req0 = NULL, *req1 = NULL; - struct drm_i915_gem_request *cursor = NULL, *tmp = NULL; + struct drm_i915_gem_request *req0, *req1; assert_spin_locked(&ring->execlist_lock); @@ -466,23 +494,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring) if (list_empty(&ring->execlist_queue)) return; - /* Try to read in pairs */ - list_for_each_entry_safe(cursor, tmp, &ring->execlist_queue, - execlist_link) { - if (!req0) { - req0 = cursor; - } else if (req0->ctx == cursor->ctx) { - /* Same ctx: ignore first request, as second request - * will update tail past first request's workload */ - cursor->elsp_submitted = req0->elsp_submitted; - list_move_tail(&req0->execlist_link, - &ring->execlist_retired_req_list); - req0 = cursor; - } else { - req1 = cursor; - break; - } - } + execlists_i915_pick_requests(ring, &req0, &req1); if (IS_GEN8(ring->dev) || IS_GEN9(ring->dev)) { /*