mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
drm/amdgpu: simplify pinning into visible VRAM
Just set the CPU access required flag when we pin it. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
c833d8aa4d
commit
e9c7577c09
1 changed files with 8 additions and 15 deletions
|
@ -635,7 +635,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
|
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
|
||||||
int r, i;
|
int r, i;
|
||||||
unsigned fpfn, lpfn;
|
|
||||||
|
|
||||||
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm))
|
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
@ -667,22 +666,16 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
|
||||||
}
|
}
|
||||||
|
|
||||||
bo->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
|
bo->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
|
||||||
|
/* force to pin into visible video ram */
|
||||||
|
if (!(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS))
|
||||||
|
bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
|
||||||
amdgpu_ttm_placement_from_domain(bo, domain);
|
amdgpu_ttm_placement_from_domain(bo, domain);
|
||||||
for (i = 0; i < bo->placement.num_placement; i++) {
|
for (i = 0; i < bo->placement.num_placement; i++) {
|
||||||
/* force to pin into visible video ram */
|
unsigned fpfn, lpfn;
|
||||||
if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
|
|
||||||
!(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) &&
|
fpfn = min_offset >> PAGE_SHIFT;
|
||||||
(!max_offset || max_offset >
|
lpfn = max_offset >> PAGE_SHIFT;
|
||||||
adev->mc.visible_vram_size)) {
|
|
||||||
if (WARN_ON_ONCE(min_offset >
|
|
||||||
adev->mc.visible_vram_size))
|
|
||||||
return -EINVAL;
|
|
||||||
fpfn = min_offset >> PAGE_SHIFT;
|
|
||||||
lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
|
|
||||||
} else {
|
|
||||||
fpfn = min_offset >> PAGE_SHIFT;
|
|
||||||
lpfn = max_offset >> PAGE_SHIFT;
|
|
||||||
}
|
|
||||||
if (fpfn > bo->placements[i].fpfn)
|
if (fpfn > bo->placements[i].fpfn)
|
||||||
bo->placements[i].fpfn = fpfn;
|
bo->placements[i].fpfn = fpfn;
|
||||||
if (!bo->placements[i].lpfn ||
|
if (!bo->placements[i].lpfn ||
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue