Skip to content

Commit

Permalink
drm/radeon: remove visible vram size limit on bo allocation (v4)
Browse files Browse the repository at this point in the history
Now that fallback to gtt is fixed for cpu access, we can
remove this limit.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=78717

v2: use new gart_pin_size to accurately track available gtt.
v3: fix comment
v4: clarify comment

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
  • Loading branch information
Alex Deucher committed Aug 5, 2014
1 parent 2c6316c commit 391bfec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/radeon/radeon.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ struct radeon_gem {

int radeon_gem_init(struct radeon_device *rdev);
void radeon_gem_fini(struct radeon_device *rdev);
int radeon_gem_object_create(struct radeon_device *rdev, int size,
int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size,
int alignment, int initial_domain,
u32 flags, bool discardable, bool kernel,
struct drm_gem_object **obj);
Expand Down
12 changes: 7 additions & 5 deletions drivers/gpu/drm/radeon/radeon_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void radeon_gem_object_free(struct drm_gem_object *gobj)
}
}

int radeon_gem_object_create(struct radeon_device *rdev, int size,
int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size,
int alignment, int initial_domain,
u32 flags, bool discardable, bool kernel,
struct drm_gem_object **obj)
Expand All @@ -55,10 +55,12 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size,
alignment = PAGE_SIZE;
}

/* maximun bo size is the minimun btw visible vram and gtt size */
max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size);
/* Maximum bo size is the unpinned gtt size since we use the gtt to
* handle vram to system pool migrations.
*/
max_size = rdev->mc.gtt_size - rdev->gart_pin_size;
if (size > max_size) {
DRM_DEBUG("Allocation size %dMb bigger than %ldMb limit\n",
DRM_DEBUG("Allocation size %ldMb bigger than %ldMb limit\n",
size >> 20, max_size >> 20);
return -ENOMEM;
}
Expand All @@ -72,7 +74,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size,
initial_domain |= RADEON_GEM_DOMAIN_GTT;
goto retry;
}
DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n",
DRM_ERROR("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
size, initial_domain, alignment, r);
}
return r;
Expand Down

0 comments on commit 391bfec

Please sign in to comment.