summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/radeon_object.c
diff options
context:
space:
mode:
authorChristopher James Halse Rogers <christopher.halse.rogers@canonical.com>2017-04-03 06:35:23 +0300
committerAlex Deucher <alexander.deucher@amd.com>2017-04-07 19:20:41 +0300
commitede2e019adec0b6fd21a54ace92358969f1a1629 (patch)
tree6af5eeb8a3093ac93c41eac3f99e373eed969f29 /drivers/gpu/drm/radeon/radeon_object.c
parent0d16d299400471735e77d7a8c4107e71b523446d (diff)
downloadlinux-ede2e019adec0b6fd21a54ace92358969f1a1629.tar.xz
drm/radeon: Refuse to migrate a prime BO to VRAM. (v2)
BOs shared via dma-buf, either imported or exported, cannot sensibly be migrated to VRAM without breaking the dma-buf sharing. Refuse userspace requests to migrate to VRAM, ensure such BOs are not migrated during command submission, and refuse to pin them to VRAM. v2: Don't pin BOs in GTT. Instead, refuse to migrate BOs to VRAM. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_object.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 74b276060c20..bec2ec056de4 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -352,6 +352,11 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset,
return 0;
}
+ if (bo->prime_shared_count && domain == RADEON_GEM_DOMAIN_VRAM) {
+ /* A BO shared as a dma-buf cannot be sensibly migrated to VRAM */
+ return -EINVAL;
+ }
+
radeon_ttm_placement_from_domain(bo, domain);
for (i = 0; i < bo->placement.num_placement; i++) {
/* force to pin into visible video ram */