From patchwork Fri Apr 22 10:54:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Gordon X-Patchwork-Id: 8909611 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 000C1BF29F for ; Fri, 22 Apr 2016 10:54:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2626C20145 for ; Fri, 22 Apr 2016 10:54:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2DC9A20122 for ; Fri, 22 Apr 2016 10:54:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 370426E2C8; Fri, 22 Apr 2016 10:54:45 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id D2E0A6E2C8 for ; Fri, 22 Apr 2016 10:54:43 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 22 Apr 2016 03:54:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,516,1455004800"; d="scan'208";a="960503535" Received: from dsgordon-linux2.isw.intel.com (HELO [10.102.226.88]) ([10.102.226.88]) by orsmga002.jf.intel.com with ESMTP; 22 Apr 2016 03:54:34 -0700 To: intel-gfx@lists.freedesktop.org, Tvrtko Ursulin References: <1461240286-25968-1-git-send-email-tvrtko.ursulin@linux.intel.com> <1461240286-25968-4-git-send-email-tvrtko.ursulin@linux.intel.com> From: Dave Gordon Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Message-ID: <571A02E9.1020108@intel.com> Date: Fri, 22 Apr 2016 11:54:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1461240286-25968-4-git-send-email-tvrtko.ursulin@linux.intel.com> Subject: Re: [Intel-gfx] [PATCH 4/4] drm/i915: Simplify i915_gem_obj_ggtt_bound_view 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.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 On 21/04/16 13:04, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin > > Can use the new vma->is_gtt to simplify the check and > get rid of the local variables. > > Signed-off-by: Tvrtko Ursulin > --- > drivers/gpu/drm/i915/i915_gem.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 135e1e9c40c2..c5ca53d2e35d 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -5275,12 +5275,10 @@ bool i915_gem_obj_bound(struct drm_i915_gem_object *o, > bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o, > const struct i915_ggtt_view *view) > { > - struct drm_i915_private *dev_priv = to_i915(o->base.dev); > - struct i915_ggtt *ggtt = &dev_priv->ggtt; > struct i915_vma *vma; > > list_for_each_entry(vma, &o->vma_list, obj_link) > - if (vma->vm == &ggtt->base && > + if (vma->is_ggtt && > i915_ggtt_view_equal(&vma->ggtt_view, view) && > drm_mm_node_allocated(&vma->node)) > return true; > For patches 2-4, Reviewed-by: Dave Gordon As these three all now contain if (vma->is_ggtt && i915_ggtt_view_equal(&vma->ggtt_view, view) ... and these are the ONLY three uses of i915_ggtt_view_equal(), perhaps the latter could be deleted from the header file and replaced by a local (static) inline that encapsulates the is_ggtt test as well? The Cocci script below found one more candidate for updating: @is_ggtt@ idexpression struct i915_ggtt *GGTT; idexpression struct i915_vma *VMA; @@ { <... - VMA->vm == &GGTT->base + VMA->is_ggtt ...> } @not_ggtt@ idexpression struct i915_ggtt *GGTT; idexpression struct i915_vma *VMA; @@ { <... - VMA->vm != &GGTT->base + !VMA->is_ggtt ...> } .Dave. --- drivers/gpu/drm/i915/i915_gem_gtt.c +++ cocci-output-24681-2f2e3b-i915_gem_gtt.c @@ -3255,7 +3255,7 @@ void i915_gem_restore_gtt_mappings(struc list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { flush = false; list_for_each_entry(vma, &obj->vma_list, obj_link) { - if (vma->vm != &ggtt->base) + if (!vma->is_ggtt) continue; Cocci: