Re: [RFC PATCH 42/42] HAX drm/i915/lmem: default userspace allocations to LMEM

Chris Wilson
2019-02-14T16:13:23Z

Quoting Matthew Auld (2019-02-14 14:57:40)
> Hack patch to default all userspace allocations to LMEM. Useful for
> testing purposes.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 45 +++++++++++++++++++++++++++++++--
> 1 file changed, 43 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 3c86909d55b9..bd857f477ef9 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -641,7 +641,8 @@ i915_gem_create(struct drm_file *file,
> u32 *handle_p)
> {
> struct drm_i915_gem_object *obj;
> - int ret;
> + intel_wakeref_t wakeref;
> + int ret = 0;
> u32 handle;
>
> size = roundup(size, PAGE_SIZE);
> @@ -649,10 +650,50 @@ i915_gem_create(struct drm_file *file,
> return -EINVAL;
>
> /* Allocate the new object */
> - obj = i915_gem_object_create(dev_priv, size);
> + if (HAS_LMEM(dev_priv))
> + obj = i915_gem_object_create_lmem(dev_priv, size, 0);
> + else
> + obj = i915_gem_object_create(dev_priv, size);
> if (IS_ERR(obj))
> return PTR_ERR(obj);
>
> + if (i915_gem_object_is_lmem(obj)) {
> + struct i915_gem_context *ctx;
> +
> + /* XXX: we should prob use the blitter context for this? */

Or the kernel_context which is setup for emitting without taking
struct_mutex...
-Chris