diff mbox series

[2/3] drm/ttm: check with temporary GTT memory in BO validation

Message ID 20210531082241.4254-2-Lang.Yu@amd.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/3] drm/ttm: cleanup and add TTM_PL_FLAG_TEMPORARY flag | expand

Commit Message

Lang Yu May 31, 2021, 8:22 a.m. UTC
If a BO's backing store is temporary GTT memory, we should
move it in BO validation.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Christian König May 31, 2021, 9:04 a.m. UTC | #1
Am 31.05.21 um 10:22 schrieb Lang Yu:
> If a BO's backing store is temporary GTT memory, we should
> move it in BO validation.
>
> Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index c32a37d0a460..80c8cb2c3f31 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -944,6 +944,8 @@ static bool ttm_bo_places_compat(const struct ttm_place *places,
>   		if ((mem->start < heap->fpfn ||
>   		     (heap->lpfn != 0 && (mem->start + mem->num_pages) > heap->lpfn)))
>   			continue;
> +		if (mem->placement & TTM_PL_FLAG_TEMPORARY)
> +			continue;

Oh, good idea. But please move the check outside of the loop since mem 
never changes here we can return false right away.

Thanks,
Christian.

>   
>   		*new_flags = heap->flags;
>   		if ((mem->mem_type == heap->mem_type) &&
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index c32a37d0a460..80c8cb2c3f31 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -944,6 +944,8 @@  static bool ttm_bo_places_compat(const struct ttm_place *places,
 		if ((mem->start < heap->fpfn ||
 		     (heap->lpfn != 0 && (mem->start + mem->num_pages) > heap->lpfn)))
 			continue;
+		if (mem->placement & TTM_PL_FLAG_TEMPORARY)
+			continue;
 
 		*new_flags = heap->flags;
 		if ((mem->mem_type == heap->mem_type) &&