[PATCH 2/5] drm/amdgpu: use explicit limit for VRAM_LINEAR handling
Edward O'Callaghan
funfunctor at folklore1984.net
Mon Aug 29 10:59:08 UTC 2016
On 08/29/2016 07:20 PM, Christian König wrote:
> From: Christian König <christian.koenig at amd.com>
>
> Split VRAM won't have a valid offset, so just set an explicit limit
> when the flag is given to trigger reallocation if necessary.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 6f83909..79f6413 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -123,12 +123,17 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
>
> if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
> unsigned visible_pfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
> + unsigned lpfn = 0;
> +
> + /* This forces a reallocation if the flag wasn't set before */
> + if (flags & AMDGPU_GEM_CREATE_VRAM_LINEAR)
> + lpfn = adev->mc.real_vram_size >> PAGE_SHIFT;
>
> if (flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS &&
> !(flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) &&
> adev->mc.visible_vram_size < adev->mc.real_vram_size) {
> places[c].fpfn = visible_pfn;
> - places[c].lpfn = 0;
> + places[c].lpfn = lpfn;
> places[c].flags = TTM_PL_FLAG_WC |
> TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM |
> TTM_PL_FLAG_TOPDOWN;
> @@ -136,7 +141,7 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
> }
>
> places[c].fpfn = 0;
> - places[c].lpfn = 0;
> + places[c].lpfn = lpfn;
> places[c].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
> TTM_PL_FLAG_VRAM;
> if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160829/c89bd813/attachment.sig>
More information about the amd-gfx
mailing list