From 998fabb91851cef7c70e0f3920e45c70da301647 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Tue, 9 Sep 2014 12:24:33 -0400
Subject: [PATCH] drm/radeon: add RADEON_GEM_NO_CPU_ACCESS BO creation flag
(v3)
Allows pinning of buffers in the non-CPU visible portion of
vram.
v2: incorporate Michel's comments.
v3: rebase on Michel's patch
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/radeon/radeon_object.c | 3 ++-
include/uapi/drm/radeon_drm.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
@@ -312,7 +312,8 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset,
radeon_ttm_placement_from_domain(bo, domain);
for (i = 0; i < bo->placement.num_placement; i++) {
/* force to pin into visible video ram */
- if (bo->placements[i].flags & TTM_PL_FLAG_VRAM)
+ if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
+ (!(bo->flags & RADEON_GEM_NO_CPU_ACCESS)))
bo->placements[i].lpfn =
min(bo->rdev->mc.visible_vram_size, max_offset)
>> PAGE_SHIFT;
@@ -803,6 +803,8 @@ struct drm_radeon_gem_info {
#define RADEON_GEM_GTT_WC (1 << 2)
/* BO is expected to be accessed by the CPU */
#define RADEON_GEM_CPU_ACCESS (1 << 3)
+/* CPU access is not expected to work for this BO */
+#define RADEON_GEM_NO_CPU_ACCESS (1 << 4)
struct drm_radeon_gem_create {
uint64_t size;
--
1.8.3.1