[Intel-gfx] [PATCH 14/33] drm/i915: Create a VMA for an object
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Mon Aug 8 09:01:07 UTC 2016
On su, 2016-08-07 at 15:45 +0100, Chris Wilson wrote:
> In many places, we wish to store the VMA in preference to the object
> itself and so being able to create the persistent VMA is useful.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 2 ++
> drivers/gpu/drm/i915/i915_gem_gtt.c | 10 ++++++++++
> drivers/gpu/drm/i915/i915_gem_gtt.h | 5 +++++
> 3 files changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 826486d03e8e..2d8f32cd726d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3903,4 +3903,6 @@ static inline bool __i915_request_irq_complete(struct drm_i915_gem_request *req)
> return false;
> }
>
> +#define nullify(ptr) ({typeof(*ptr) T = *(ptr); *(ptr) = NULL; T;})
> +
Random lost hunk here.
> #endif
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 18c7c9644761..ce53f08186fa 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3388,6 +3388,16 @@ __i915_gem_vma_create(struct drm_i915_gem_object *obj,
> }
>
> struct i915_vma *
> +i915_vma_create(struct drm_i915_gem_object *obj,
> + struct i915_address_space *vm,
> + const struct i915_ggtt_view *view)
> +{
> + GEM_BUG_ON(view ? i915_gem_obj_to_ggtt_view(obj, view) : i915_gem_obj_to_vma(obj, vm));
GEM_BUG_ON(view && !i915_is_ggtt(vm)) ?
> +
> + return __i915_gem_vma_create(obj, vm, view ?: &i915_ggtt_view_normal);
> +}
> +
> +struct i915_vma *
> i915_gem_obj_lookup_or_create_vma(struct drm_i915_gem_object *obj,
> struct i915_address_space *vm)
> {
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index cc56206a1600..ac47663a4d32 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -232,6 +232,11 @@ struct i915_vma {
> struct drm_i915_gem_exec_object2 *exec_entry;
> };
>
> +struct i915_vma *
> +i915_vma_create(struct drm_i915_gem_object *obj,
> + struct i915_address_space *vm,
> + const struct i915_ggtt_view *view);
> +
> static inline bool i915_vma_is_ggtt(const struct i915_vma *vma)
> {
> return vma->flags & I915_VMA_GGTT;
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list