[Intel-gfx] [PATCH v3 03/21] drm/i915/region: support contiguous allocations
Chris Wilson
chris at chris-wilson.co.uk
Tue Oct 8 09:06:59 UTC 2019
Quoting Matthew Auld (2019-10-04 18:04:34)
> @@ -98,10 +103,12 @@ i915_gem_object_get_pages_buddy(struct drm_i915_gem_object *obj)
> }
>
> void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,
> - struct intel_memory_region *mem)
> + struct intel_memory_region *mem,
> + unsigned long flags)
> {
> INIT_LIST_HEAD(&obj->mm.blocks);
> obj->mm.region = intel_memory_region_get(mem);
> + obj->flags = flags;
This is odd as you don't necessarily have exclusive control of obj->flags
Looks like this may be a wart in the api.
> +static struct drm_i915_gem_object *
> +igt_object_create(struct intel_memory_region *mem,
> + struct list_head *objects,
> + u64 size,
> + unsigned int flags)
> +{
> + struct drm_i915_gem_object *obj;
> + int err;
> +
> + obj = i915_gem_object_create_region(mem, size, flags);
> + if (IS_ERR(obj))
> + return obj;
> +
> + err = i915_gem_object_pin_pages(obj);
> + if (err)
> + goto put;
> +
> + list_add(&obj->st_link, objects);
> + return obj;
> +
> +put:
> + i915_gem_object_put(obj);
> + return ERR_PTR(err);
> +}
> +
> +static void igt_object_release(struct drm_i915_gem_object *obj)
> +{
> + i915_gem_object_unpin_pages(obj);
> + __i915_gem_object_put_pages(obj, I915_MM_NORMAL);
> + i915_gem_object_put(obj);
> + list_del(&obj->st_link);
Did you just put the object before operating on it? Did you have a spare
reference lying around? :)
-Chris
More information about the Intel-gfx
mailing list