From patchwork Fri Jun 12 17:09:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Gordon X-Patchwork-Id: 6599921 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 AD533C0020 for ; Fri, 12 Jun 2015 17:09:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD9822068D for ; Fri, 12 Jun 2015 17:09:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D8BFC2068C for ; Fri, 12 Jun 2015 17:09:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6853E6EA07; Fri, 12 Jun 2015 10:09:43 -0700 (PDT) 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 BC5026EA07 for ; Fri, 12 Jun 2015 10:09:41 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 12 Jun 2015 10:09:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,602,1427785200"; d="scan'208";a="586798985" Received: from dsgordon-linux.isw.intel.com ([10.102.226.51]) by orsmga003.jf.intel.com with ESMTP; 12 Jun 2015 10:09:37 -0700 From: Dave Gordon To: intel-gfx@lists.freedesktop.org Date: Fri, 12 Jun 2015 18:09:07 +0100 Message-Id: <1434128948-9221-2-git-send-email-david.s.gordon@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1434128948-9221-1-git-send-email-david.s.gordon@intel.com> References: <1433789441-8295-1-git-send-email-david.s.gordon@intel.com> <1434128948-9221-1-git-send-email-david.s.gordon@intel.com> Subject: [Intel-gfx] [PATCH 1/2] drm/i915: use effective_size for ringbuffer calculations 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, T_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 When calculating the available space in a ringbuffer, we should use the effective_size rather than the true size of the ring. v2: rebase to latest drm-intel-nightly v3: rebase to latest drm-intel-nightly Signed-off-by: Dave Gordon --- drivers/gpu/drm/i915/intel_lrc.c | 5 +++-- drivers/gpu/drm/i915/intel_ringbuffer.c | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 9b74ffa..454e836 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -699,7 +699,7 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf, /* Would completion of this request free enough space? */ space = __intel_ring_space(request->postfix, ringbuf->tail, - ringbuf->size); + ringbuf->effective_size); if (space >= bytes) break; } @@ -711,7 +711,8 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf, if (ret) return ret; - ringbuf->space = space; + /* Update ring space after wait+retire */ + intel_ring_update_space(ringbuf); return 0; } diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index b70d25b..a3406b2 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -66,7 +66,8 @@ void intel_ring_update_space(struct intel_ringbuffer *ringbuf) } ringbuf->space = __intel_ring_space(ringbuf->head & HEAD_ADDR, - ringbuf->tail, ringbuf->size); + ringbuf->tail, + ringbuf->effective_size); } int intel_ring_space(struct intel_ringbuffer *ringbuf) @@ -2117,8 +2118,9 @@ static int ring_wait_for_space(struct intel_engine_cs *ring, int n) return 0; list_for_each_entry(request, &ring->request_list, list) { + /* Would completion of this request free enough space? */ space = __intel_ring_space(request->postfix, ringbuf->tail, - ringbuf->size); + ringbuf->effective_size); if (space >= n) break; } @@ -2130,7 +2132,8 @@ static int ring_wait_for_space(struct intel_engine_cs *ring, int n) if (ret) return ret; - ringbuf->space = space; + /* Update ring space after wait+retire */ + intel_ring_update_space(ringbuf); return 0; }