diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_gem.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gem.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index ede5dccdf79f..69d00bf85b13 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -32,7 +32,8 @@ | |||
32 | 32 | ||
33 | int radeon_gem_object_init(struct drm_gem_object *obj) | 33 | int radeon_gem_object_init(struct drm_gem_object *obj) |
34 | { | 34 | { |
35 | /* we do nothings here */ | 35 | BUG(); |
36 | |||
36 | return 0; | 37 | return 0; |
37 | } | 38 | } |
38 | 39 | ||
@@ -44,9 +45,6 @@ void radeon_gem_object_free(struct drm_gem_object *gobj) | |||
44 | if (robj) { | 45 | if (robj) { |
45 | radeon_bo_unref(&robj); | 46 | radeon_bo_unref(&robj); |
46 | } | 47 | } |
47 | |||
48 | drm_gem_object_release(gobj); | ||
49 | kfree(gobj); | ||
50 | } | 48 | } |
51 | 49 | ||
52 | int radeon_gem_object_create(struct radeon_device *rdev, int size, | 50 | int radeon_gem_object_create(struct radeon_device *rdev, int size, |
@@ -54,29 +52,27 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, | |||
54 | bool discardable, bool kernel, | 52 | bool discardable, bool kernel, |
55 | struct drm_gem_object **obj) | 53 | struct drm_gem_object **obj) |
56 | { | 54 | { |
57 | struct drm_gem_object *gobj; | ||
58 | struct radeon_bo *robj; | 55 | struct radeon_bo *robj; |
59 | int r; | 56 | int r; |
60 | 57 | ||
61 | *obj = NULL; | 58 | *obj = NULL; |
62 | gobj = drm_gem_object_alloc(rdev->ddev, size); | ||
63 | if (!gobj) { | ||
64 | return -ENOMEM; | ||
65 | } | ||
66 | /* At least align on page size */ | 59 | /* At least align on page size */ |
67 | if (alignment < PAGE_SIZE) { | 60 | if (alignment < PAGE_SIZE) { |
68 | alignment = PAGE_SIZE; | 61 | alignment = PAGE_SIZE; |
69 | } | 62 | } |
70 | r = radeon_bo_create(rdev, gobj, size, alignment, kernel, initial_domain, &robj); | 63 | r = radeon_bo_create(rdev, size, alignment, kernel, initial_domain, &robj); |
71 | if (r) { | 64 | if (r) { |
72 | if (r != -ERESTARTSYS) | 65 | if (r != -ERESTARTSYS) |
73 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", | 66 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", |
74 | size, initial_domain, alignment, r); | 67 | size, initial_domain, alignment, r); |
75 | drm_gem_object_unreference_unlocked(gobj); | ||
76 | return r; | 68 | return r; |
77 | } | 69 | } |
78 | gobj->driver_private = robj; | 70 | *obj = &robj->gem_base; |
79 | *obj = gobj; | 71 | |
72 | mutex_lock(&rdev->gem.mutex); | ||
73 | list_add_tail(&robj->list, &rdev->gem.objects); | ||
74 | mutex_unlock(&rdev->gem.mutex); | ||
75 | |||
80 | return 0; | 76 | return 0; |
81 | } | 77 | } |
82 | 78 | ||