32 #include <linux/list.h>
33 #include <linux/slab.h>
42 static void radeon_bo_clear_surface_reg(
struct radeon_bo *bo);
65 list_del_init(&bo->
list);
67 radeon_bo_clear_surface_reg(bo);
75 if (bo->
destroy == &radeon_ttm_bo_destroy)
102 unsigned long size,
int byte_align,
bool kernel,
u32 domain,
113 rdev->
mman.bdev.dev_mapping = rdev->
ddev->dev_mapping;
137 INIT_LIST_HEAD(&bo->
list);
138 INIT_LIST_HEAD(&bo->
va);
144 acc_size, sg, &radeon_ttm_bo_destroy);
151 trace_radeon_bo_create(bo);
171 bo->
kptr = ttm_kmap_obj_virtual(&bo->
kmap, &is_iomem);
212 *gpu_addr = radeon_bo_gpu_offset(bo);
214 if (max_offset != 0) {
218 domain_start = bo->
rdev->mc.vram_start;
220 domain_start = bo->
rdev->mc.gtt_start;
222 (radeon_bo_gpu_offset(bo) - domain_start));
238 if (lpfn < bo->placement.lpfn)
241 for (i = 0; i < bo->
placement.num_placement; i++)
246 if (gpu_addr !=
NULL)
247 *gpu_addr = radeon_bo_gpu_offset(bo);
264 dev_warn(bo->
rdev->dev,
"%p unpin not necessary\n", bo);
270 for (i = 0; i < bo->
placement.num_placement; i++)
274 dev_err(bo->
rdev->dev,
"%p validate failed for unpin\n", bo);
282 if (rdev->
mc.igp_sideport_enabled ==
false)
293 if (list_empty(&rdev->
gem.objects)) {
296 dev_err(rdev->
dev,
"Userspace still has active objects !\n");
299 dev_err(rdev->
dev,
"%p %p %lu %lu force free\n",
301 *((
unsigned long *)&bo->
gem_base.refcount));
303 list_del_init(&bo->
list);
306 drm_gem_object_unreference(&bo->
gem_base);
314 rdev->
mc.vram_mtrr =
mtrr_add(rdev->
mc.aper_base, rdev->
mc.aper_size,
316 DRM_INFO(
"Detected VRAM RAM=%lluM, BAR=%lluM\n",
317 rdev->
mc.mc_vram_size >> 20,
318 (
unsigned long long)rdev->
mc.aper_size >> 20);
319 DRM_INFO(
"RAM width %dbits %cDR\n",
320 rdev->
mc.vram_width, rdev->
mc.vram_is_ddr ?
'D' :
'S');
333 list_add(&lobj->
tv.head, head);
405 old_object = reg->
bo;
411 if (i == RADEON_GEM_MAX_SURFACES) {
416 old_object = reg->
bo;
418 DRM_DEBUG(
"stealing surface reg %d from %p\n", steal, old_object);
434 static void radeon_bo_clear_surface_reg(
struct radeon_bo *bo)
456 unsigned bankw, bankh, mtaspect, tilesplit, stilesplit;
496 if (stilesplit > 6) {
505 radeon_bo_unreserve(bo);
529 radeon_bo_clear_surface_reg(bo);
538 radeon_bo_clear_surface_reg(bo);
574 if ((offset + size) > rdev->
mc.visible_vram_size) {
583 if ((offset + size) > rdev->
mc.visible_vram_size)
597 spin_lock(&bo->
tbo.bdev->fence_lock);
599 *mem_type = bo->
tbo.mem.mem_type;
600 if (bo->
tbo.sync_obj)
602 spin_unlock(&bo->
tbo.bdev->fence_lock);