From 065a18ffb2fae2b5285e452e1803d20671fa63a8 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 16 Jan 2013 17:13:38 -0500 Subject: [PATCH] drm/radeon: exclude system placement when validating buffer Buffer needs to be in GTT or VRAM no system when being validated to be use by the gpu. Should fix : https://bugzilla.kernel.org/show_bug.cgi?id=52491 https://bugs.freedesktop.org/show_bug.cgi?id=58659 Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/radeon_object.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 883c95d..3a664ab 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -115,6 +115,26 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) rbo->placement.num_busy_placement = c; } +void radeon_ttm_placement_exclude_system(struct radeon_bo *rbo) +{ + unsigned i; + + for (i = 0; i < rbo->placement.num_placement; i++) { + if (rbo->placements[i] & TTM_PL_FLAG_SYSTEM) { + rbo->placements[i] &= ~TTM_PL_FLAG_SYSTEM; + rbo->placements[i] |= TTM_PL_FLAG_TT; + /* caching flags are fine */ + } + } + for (i = 0; i < rbo->placement.num_busy_placement; i++) { + if (rbo->busy_placements[i] & TTM_PL_FLAG_SYSTEM) { + rbo->busy_placements[i] &= ~TTM_PL_FLAG_SYSTEM; + rbo->busy_placements[i] |= TTM_PL_FLAG_TT; + /* caching flags are fine */ + } + } +} + int radeon_bo_create(struct radeon_device *rdev, unsigned long size, int byte_align, bool kernel, u32 domain, struct sg_table *sg, struct radeon_bo **bo_ptr) @@ -366,6 +386,7 @@ int radeon_bo_list_validate(struct list_head *head) list_for_each_entry(lobj, head, tv.head) { bo = lobj->bo; if (!bo->pin_count) { + radeon_ttm_placement_exclude_system(bo); r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false); if (unlikely(r)) { -- 1.7.11.7