[PATCH 4/8] drm/radeon: move and rename radeon_bo_va function

Jerome Glisse j.glisse at gmail.com
Tue Sep 11 09:15:16 PDT 2012


On Tue, Sep 11, 2012 at 10:10 AM, Christian König
<deathsimple at vodafone.de> wrote:
> It doesn't really belong into the object functions,
> also rename it to avoid collisions with struct radeon_bo_va.
>
> Signed-off-by: Christian König <deathsimple at vodafone.de>

Reviewed-by: Jerome Glisse <jglisse at redhat.com>

> ---
>  drivers/gpu/drm/radeon/radeon.h        |    2 ++
>  drivers/gpu/drm/radeon/radeon_gart.c   |   34 ++++++++++++++++++++++++++++----
>  drivers/gpu/drm/radeon/radeon_gem.c    |    2 +-
>  drivers/gpu/drm/radeon/radeon_object.c |   13 ------------
>  drivers/gpu/drm/radeon/radeon_object.h |    2 --
>  5 files changed, 33 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 55f17f9..8cca1d2 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -1846,6 +1846,8 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
>                             struct ttm_mem_reg *mem);
>  void radeon_vm_bo_invalidate(struct radeon_device *rdev,
>                              struct radeon_bo *bo);
> +struct radeon_bo_va *radeon_vm_bo_find(struct radeon_vm *vm,
> +                                      struct radeon_bo *bo);
>  int radeon_vm_bo_add(struct radeon_device *rdev,
>                      struct radeon_vm *vm,
>                      struct radeon_bo *bo,
> diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
> index 1b1c001..2c59491 100644
> --- a/drivers/gpu/drm/radeon/radeon_gart.c
> +++ b/drivers/gpu/drm/radeon/radeon_gart.c
> @@ -662,7 +662,31 @@ void radeon_vm_fence(struct radeon_device *rdev,
>         vm->fence = radeon_fence_ref(fence);
>  }
>
> -/* object have to be reserved */
> +/**
> + * radeon_vm_bo_find - find the bo_va for a specific vm & bo
> + *
> + * @vm: requested vm
> + * @bo: requested buffer object
> + *
> + * Find @bo inside the requested vm (cayman+).
> + * Search inside the @bos vm list for the requested vm
> + * Returns the found bo_va or NULL if none is found
> + *
> + * Object has to be reserved!
> + */
> +struct radeon_bo_va *radeon_vm_bo_find(struct radeon_vm *vm,
> +                                      struct radeon_bo *bo)
> +{
> +       struct radeon_bo_va *bo_va;
> +
> +       list_for_each_entry(bo_va, &bo->va, bo_list) {
> +               if (bo_va->vm == vm) {
> +                       return bo_va;
> +               }
> +       }
> +       return NULL;
> +}
> +
>  /**
>   * radeon_vm_bo_add - add a bo to a specific vm
>   *
> @@ -676,6 +700,8 @@ void radeon_vm_fence(struct radeon_device *rdev,
>   * Add @bo to the list of bos associated with the vm and validate
>   * the offset requested within the vm address space.
>   * Returns 0 for success, error for failure.
> + *
> + * Object has to be reserved!
>   */
>  int radeon_vm_bo_add(struct radeon_device *rdev,
>                      struct radeon_vm *vm,
> @@ -823,7 +849,7 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
>         if (vm->sa_bo == NULL)
>                 return 0;
>
> -       bo_va = radeon_bo_va(bo, vm);
> +       bo_va = radeon_vm_bo_find(vm, bo);
>         if (bo_va == NULL) {
>                 dev_err(rdev->dev, "bo %p not in vm %p\n", bo, vm);
>                 return -EINVAL;
> @@ -912,7 +938,7 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev,
>         struct radeon_bo_va *bo_va;
>         int r;
>
> -       bo_va = radeon_bo_va(bo, vm);
> +       bo_va = radeon_vm_bo_find(vm, bo);
>         if (bo_va == NULL)
>                 return 0;
>
> @@ -1009,7 +1035,7 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm)
>          */
>         r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
>         if (!r) {
> -               bo_va = radeon_bo_va(rdev->ring_tmp_bo.bo, vm);
> +               bo_va = radeon_vm_bo_find(vm, rdev->ring_tmp_bo.bo);
>                 list_del_init(&bo_va->bo_list);
>                 list_del_init(&bo_va->vm_list);
>                 radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
> index 1b57b00..6cac5cc 100644
> --- a/drivers/gpu/drm/radeon/radeon_gem.c
> +++ b/drivers/gpu/drm/radeon/radeon_gem.c
> @@ -461,7 +461,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
>         }
>         switch (args->operation) {
>         case RADEON_VA_MAP:
> -               bo_va = radeon_bo_va(rbo, &fpriv->vm);
> +               bo_va = radeon_vm_bo_find(&fpriv->vm, rbo);
>                 if (bo_va) {
>                         args->operation = RADEON_VA_RESULT_VA_EXIST;
>                         args->offset = bo_va->soffset;
> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
> index 9024e72..2844e0b 100644
> --- a/drivers/gpu/drm/radeon/radeon_object.c
> +++ b/drivers/gpu/drm/radeon/radeon_object.c
> @@ -646,16 +646,3 @@ int radeon_bo_reserve(struct radeon_bo *bo, bool no_wait)
>         }
>         return 0;
>  }
> -
> -/* object have to be reserved */
> -struct radeon_bo_va *radeon_bo_va(struct radeon_bo *rbo, struct radeon_vm *vm)
> -{
> -       struct radeon_bo_va *bo_va;
> -
> -       list_for_each_entry(bo_va, &rbo->va, bo_list) {
> -               if (bo_va->vm == vm) {
> -                       return bo_va;
> -               }
> -       }
> -       return NULL;
> -}
> diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h
> index 17fb99f..2aaf6e3 100644
> --- a/drivers/gpu/drm/radeon/radeon_object.h
> +++ b/drivers/gpu/drm/radeon/radeon_object.h
> @@ -141,8 +141,6 @@ extern void radeon_bo_move_notify(struct ttm_buffer_object *bo,
>                                         struct ttm_mem_reg *mem);
>  extern int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
>  extern int radeon_bo_get_surface_reg(struct radeon_bo *bo);
> -extern struct radeon_bo_va *radeon_bo_va(struct radeon_bo *rbo,
> -                                        struct radeon_vm *vm);
>
>  /*
>   * sub allocation
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list