From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH] drm/i915: Don't list gens one by bone in the VMA creation function Date: Fri, 10 Jan 2014 18:09:15 +0100 Message-ID: <20140110170915.GF4770@phenom.ffwll.local> References: <1389368872-2711-1-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) by gabe.freedesktop.org (Postfix) with ESMTP id AA19EFA353 for ; Fri, 10 Jan 2014 09:07:58 -0800 (PST) Received: by mail-ee0-f53.google.com with SMTP id b57so2057689eek.12 for ; Fri, 10 Jan 2014 09:07:57 -0800 (PST) Content-Disposition: inline In-Reply-To: <1389368872-2711-1-git-send-email-damien.lespiau@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Damien Lespiau Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Jan 10, 2014 at 03:47:52PM +0000, Damien Lespiau wrote: > There are only two cases here, pre and post SNB (PPGTT). > > Signed-off-by: Damien Lespiau > --- > drivers/gpu/drm/i915/i915_gem_gtt.c | 14 ++------------ > 1 file changed, 2 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c > index 3192089..866ca90 100644 > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > @@ -1795,10 +1795,7 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, > vma->vm = vm; > vma->obj = obj; > > - switch (INTEL_INFO(vm->dev)->gen) { > - case 8: > - case 7: > - case 6: > + if (INTEL_INFO(vm->dev)->gen >= 6) { > if (i915_is_ggtt(vm)) { > vma->unbind_vma = ggtt_unbind_vma; > vma->bind_vma = ggtt_bind_vma; Imo we should move the ->bind/unbind_vma functions into the global dev_prive->gt vtable - The personality we set here neither changes with the vma, the address space but the hw generation. So I'll reject this cleanup as not going far enough ;-) -Daniel > @@ -1806,17 +1803,10 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, > vma->unbind_vma = ppgtt_unbind_vma; > vma->bind_vma = ppgtt_bind_vma; > } > - break; > - case 5: > - case 4: > - case 3: > - case 2: > + } else { > BUG_ON(!i915_is_ggtt(vm)); > vma->unbind_vma = i915_ggtt_unbind_vma; > vma->bind_vma = i915_ggtt_bind_vma; > - break; > - default: > - BUG(); > } > > /* Keep GGTT vmas first to make debug easier */ > -- > 1.8.3.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch