drm/i915: Don't list gens one by bone in the VMA creation function
Subsystems (2)
PATCH 1/1 drm/i915: Don't list gens one by bone in the VMA creation function
There are only two cases here, pre and post SNB (PPGTT).
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -12
@@ -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;
@@ -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 */
Signature · 1 line
1.8.3.1
Quoted 13 lines · Damien Lespiau
There are only two cases here, pre and post SNB (PPGTT).
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -1795,10 +1795,7 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, vma->vm = vm;
drivers/gpu/drm/i915/i915_gem_gtt.c static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, · line 1801
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-4vma->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
Quoted 26 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-8@@ -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 */ Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 16 lines · Daniel Vetter
Quoted 15 lines · Damien Lespiau
There are only two cases here, pre and post SNB (PPGTT).
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -1795,10 +1795,7 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, vma->vm = vm; vma->obj = obj;
Quoted 14 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, · line 1801
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-4-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->gtvtable - 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
Actually, it was wrong to begin with anyway. gen6 shouldn't have PPGTT functions.
Quoted 36 lines
Quoted 27 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-8@@ -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 */ Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Quoted 32 lines · Ben Widawsky
Quoted 16 lines · Daniel Vetter
Quoted 15 lines · Damien Lespiau
There are only two cases here, pre and post SNB (PPGTT).
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -1795,10 +1795,7 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, vma->vm = vm; vma->obj = obj;Quoted 14 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, · line 1801
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-4-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->gtvtable - 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
Quoted 2 lines
Actually, it was wrong to begin with anyway. gen6 shouldn't have PPGTT functions.
If you want to go this far you can coalesce much more. _Everyone_ whether ppgtt or ggtt can use the same functions, which just call the insert/clear entries of the right vm. The exception is gen6 which needs to bind according to flags.
All the few remaining checks for has_*_mapping we still have splattered over the code can be garbage-collected and converted to unconditional calls to ->vma_bind with the right flags set, since vma_bind will short-circuit correctly on gen6 (and not care anywhere else really). -Daniel
Quoted 40 lines
Quoted 37 lines
Quoted 28 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-8@@ -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 */ Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 41 lines · Daniel Vetter
Quoted 32 lines · Ben Widawsky
Quoted 16 lines · Daniel Vetter
Quoted 15 lines · Damien Lespiau
There are only two cases here, pre and post SNB (PPGTT).
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -1795,10 +1795,7 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, vma->vm = vm; vma->obj = obj;Quoted 14 lines
drivers/gpu/drm/i915/i915_gem_gtt.c static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, · line 1801
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-4-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->gtvtable - 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 ;-)
-DanielQuoted 2 lines
Actually, it was wrong to begin with anyway. gen6 shouldn't have PPGTT functions.
If you want to go this far you can coalesce much more. _Everyone_ whether ppgtt or ggtt can use the same functions, which just call the insert/clear entries of the right vm. The exception is gen6 which needs to bind according to flags.
Quoted 4 lines
All the few remaining checks for has_*_mapping we still have splattered over the code can be garbage-collected and converted to unconditional calls to ->vma_bind with the right flags set, since
vma_bindwill short-circuit correctly on gen6 (and not care anywhere else really).
s/gen6/aliasing_ppgtt/ in the above, i.e. it depends upon the runtime option we're using in the driver ... Idea still holds. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch