[PATCH 1/2] drm/radeon: allow selection of alignment in the sub-allocator
Christian König
deathsimple at vodafone.de
Mon Jul 15 02:06:15 PDT 2013
Am 12.07.2013 23:51, schrieb alexdeucher at gmail.com:
> From: Alex Deucher <alexander.deucher at amd.com>
>
> There are cases where we need more than 4k alignment. No
> functional change with this commit.
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
This series is: Reviewed-by: Christian König <christian.koenig at amd.com>
Out of curiosity: Where did you find that info? I looked for it quite a
bit while working on page table directories and couldn't find anything.
Christian.
> ---
> drivers/gpu/drm/radeon/radeon.h | 1 +
> drivers/gpu/drm/radeon/radeon_gart.c | 1 +
> drivers/gpu/drm/radeon/radeon_object.h | 2 +-
> drivers/gpu/drm/radeon/radeon_ring.c | 1 +
> drivers/gpu/drm/radeon/radeon_sa.c | 7 ++++---
> 5 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 6fe4b1c..39d2ce6 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -455,6 +455,7 @@ struct radeon_sa_manager {
> uint64_t gpu_addr;
> void *cpu_ptr;
> uint32_t domain;
> + uint32_t align;
> };
>
> struct radeon_sa_bo;
> diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
> index 43ec4a4..5ce190b 100644
> --- a/drivers/gpu/drm/radeon/radeon_gart.c
> +++ b/drivers/gpu/drm/radeon/radeon_gart.c
> @@ -467,6 +467,7 @@ int radeon_vm_manager_init(struct radeon_device *rdev)
> size *= 2;
> r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager,
> RADEON_GPU_PAGE_ALIGN(size),
> + RADEON_GPU_PAGE_SIZE,
> RADEON_GEM_DOMAIN_VRAM);
> if (r) {
> dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n",
> diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h
> index 91519a5..49c82c4 100644
> --- a/drivers/gpu/drm/radeon/radeon_object.h
> +++ b/drivers/gpu/drm/radeon/radeon_object.h
> @@ -174,7 +174,7 @@ static inline void * radeon_sa_bo_cpu_addr(struct radeon_sa_bo *sa_bo)
>
> extern int radeon_sa_bo_manager_init(struct radeon_device *rdev,
> struct radeon_sa_manager *sa_manager,
> - unsigned size, u32 domain);
> + unsigned size, u32 align, u32 domain);
> extern void radeon_sa_bo_manager_fini(struct radeon_device *rdev,
> struct radeon_sa_manager *sa_manager);
> extern int radeon_sa_bo_manager_start(struct radeon_device *rdev,
> diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
> index 5f1c51a..fb5ea62 100644
> --- a/drivers/gpu/drm/radeon/radeon_ring.c
> +++ b/drivers/gpu/drm/radeon/radeon_ring.c
> @@ -224,6 +224,7 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
> }
> r = radeon_sa_bo_manager_init(rdev, &rdev->ring_tmp_bo,
> RADEON_IB_POOL_SIZE*64*1024,
> + RADEON_GPU_PAGE_SIZE,
> RADEON_GEM_DOMAIN_GTT);
> if (r) {
> return r;
> diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c
> index 0abe5a9..f0bac68 100644
> --- a/drivers/gpu/drm/radeon/radeon_sa.c
> +++ b/drivers/gpu/drm/radeon/radeon_sa.c
> @@ -49,7 +49,7 @@ static void radeon_sa_bo_try_free(struct radeon_sa_manager *sa_manager);
>
> int radeon_sa_bo_manager_init(struct radeon_device *rdev,
> struct radeon_sa_manager *sa_manager,
> - unsigned size, u32 domain)
> + unsigned size, u32 align, u32 domain)
> {
> int i, r;
>
> @@ -57,13 +57,14 @@ int radeon_sa_bo_manager_init(struct radeon_device *rdev,
> sa_manager->bo = NULL;
> sa_manager->size = size;
> sa_manager->domain = domain;
> + sa_manager->align = align;
> sa_manager->hole = &sa_manager->olist;
> INIT_LIST_HEAD(&sa_manager->olist);
> for (i = 0; i < RADEON_NUM_RINGS; ++i) {
> INIT_LIST_HEAD(&sa_manager->flist[i]);
> }
>
> - r = radeon_bo_create(rdev, size, RADEON_GPU_PAGE_SIZE, true,
> + r = radeon_bo_create(rdev, size, align, true,
> domain, NULL, &sa_manager->bo);
> if (r) {
> dev_err(rdev->dev, "(%d) failed to allocate bo for manager\n", r);
> @@ -317,7 +318,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev,
> unsigned tries[RADEON_NUM_RINGS];
> int i, r;
>
> - BUG_ON(align > RADEON_GPU_PAGE_SIZE);
> + BUG_ON(align > sa_manager->align);
> BUG_ON(size > sa_manager->size);
>
> *sa_bo = kmalloc(sizeof(struct radeon_sa_bo), GFP_KERNEL);
More information about the dri-devel
mailing list