aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-06-07 17:30:40 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-06-07 21:53:13 +0100
commit17f297b427a32ef5524a494de331c68366e8226d (patch)
tree8edba0fd79e95fa371e84f2f803763c2aa7c0965 /drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
parentdrm/i915: Decouple vma vfuncs from vm (diff)
downloadlinux-dev-17f297b427a32ef5524a494de331c68366e8226d.tar.xz
linux-dev-17f297b427a32ef5524a494de331c68366e8226d.zip
drm/i915/gtt: Push allocation to hw ppgtt constructor
In the next patch, we will subclass the gen6 hw_ppgtt. In order, for the two different generations of hw ppgtt stucts to be of different size, push the allocation down to the constructor. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> Cc: Matthew Auld <matthew.william.auld@gmail.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180607163040.9781-1-chris@chris-wilson.co.uk
Diffstat (limited to '')
-rw-r--r--drivers/gpu/drm/i915/selftests/i915_gem_gtt.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index 58ab5e84ceb7..f80cf7ce3fa9 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -147,12 +147,16 @@ static int igt_ppgtt_alloc(void *arg)
return -ENOMEM;
mutex_lock(&dev_priv->drm.struct_mutex);
- err = __hw_ppgtt_init(ppgtt, dev_priv);
- if (err)
- goto err_ppgtt;
+ ppgtt = __hw_ppgtt_create(dev_priv);
+ if (IS_ERR(ppgtt)) {
+ err = PTR_ERR(ppgtt);
+ goto err_unlock;
+ }
- if (!ppgtt->vm.allocate_va_range)
+ if (!ppgtt->vm.allocate_va_range) {
+ err = 0;
goto err_ppgtt_cleanup;
+ }
/* Check we can allocate the entire range */
for (size = 4096;
@@ -189,9 +193,9 @@ static int igt_ppgtt_alloc(void *arg)
err_ppgtt_cleanup:
ppgtt->vm.cleanup(&ppgtt->vm);
-err_ppgtt:
- mutex_unlock(&dev_priv->drm.struct_mutex);
kfree(ppgtt);
+err_unlock:
+ mutex_unlock(&dev_priv->drm.struct_mutex);
return err;
}