[PATCH 2/2] drm/amdgpu: allocate gart memory when it's required
Michel Dänzer
michel at daenzer.net
Tue Jun 26 07:42:01 UTC 2018
On 2018-06-26 08:00 AM, Junwei Zhang wrote:
> Instead of calling gart memory on every bo pin,
> allocates it on demand
>
> Signed-off-by: Junwei Zhang <Jerry.Zhang at amd.com>
>
> [...]
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 036b6f7..0d1c4be 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -194,6 +194,12 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
> goto unreserve;
> }
>
> + r = amdgpu_ttm_alloc_gart(&new_abo->tbo);
> + if (unlikely(r != 0)) {
> + DRM_ERROR("%p bind failed\n", new_abo);
> + goto unreserve;
> + }
The error case here also needs to unpin the BO, otherwise we leak the
pin. I suspect the same issue applies to at least some of the other
places modified by this patch.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the amd-gfx
mailing list