diff options
author | Jerome Glisse <jglisse@redhat.com> | 2012-05-09 15:35:02 +0200 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-05-09 17:22:55 +0100 |
commit | f2e3922106f6b29083086393ee474ad4483bc487 (patch) | |
tree | 73ae3df5af1166f5f80f198598871113a97acc15 /drivers/gpu/drm/radeon/radeon_ring.c | |
parent | f237750f007412eb5e1baafe3e32857b35fbc6ee (diff) | |
download | op-kernel-dev-f2e3922106f6b29083086393ee474ad4483bc487.zip op-kernel-dev-f2e3922106f6b29083086393ee474ad4483bc487.tar.gz |
drm/radeon: make the ib an inline object
No need to malloc it any more.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ring.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ring.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index af8e1ee..a5dee76 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -65,51 +65,36 @@ u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx) } int radeon_ib_get(struct radeon_device *rdev, int ring, - struct radeon_ib **ib, unsigned size) + struct radeon_ib *ib, unsigned size) { int r; - *ib = kmalloc(sizeof(struct radeon_ib), GFP_KERNEL); - if (*ib == NULL) { - return -ENOMEM; - } - r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &(*ib)->sa_bo, size, 256, true); + r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &ib->sa_bo, size, 256, true); if (r) { dev_err(rdev->dev, "failed to get a new IB (%d)\n", r); - kfree(*ib); - *ib = NULL; return r; } - r = radeon_fence_create(rdev, &(*ib)->fence, ring); + r = radeon_fence_create(rdev, &ib->fence, ring); if (r) { dev_err(rdev->dev, "failed to create fence for new IB (%d)\n", r); - radeon_sa_bo_free(rdev, &(*ib)->sa_bo, NULL); - kfree(*ib); - *ib = NULL; + radeon_sa_bo_free(rdev, &ib->sa_bo, NULL); return r; } - (*ib)->ptr = radeon_sa_bo_cpu_addr((*ib)->sa_bo); - (*ib)->gpu_addr = radeon_sa_bo_gpu_addr((*ib)->sa_bo); - (*ib)->vm_id = 0; - (*ib)->is_const_ib = false; - (*ib)->semaphore = NULL; + ib->ptr = radeon_sa_bo_cpu_addr(ib->sa_bo); + ib->gpu_addr = radeon_sa_bo_gpu_addr(ib->sa_bo); + ib->vm_id = 0; + ib->is_const_ib = false; + ib->semaphore = NULL; return 0; } -void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib) +void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib) { - struct radeon_ib *tmp = *ib; - - *ib = NULL; - if (tmp == NULL) { - return; - } - radeon_semaphore_free(rdev, tmp->semaphore, tmp->fence); - radeon_sa_bo_free(rdev, &tmp->sa_bo, tmp->fence); - radeon_fence_unref(&tmp->fence); - kfree(tmp); + radeon_semaphore_free(rdev, ib->semaphore, ib->fence); + radeon_sa_bo_free(rdev, &ib->sa_bo, ib->fence); + radeon_fence_unref(&ib->fence); } int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib) |