diff options
author | Christian König <christian.koenig@amd.com> | 2016-08-17 07:44:20 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-08-22 13:47:23 -0400 |
commit | 1fdc0b76ea9b6f6a50aa76b7cb7a025f87c1319d (patch) | |
tree | 9c387a6cb4ef2029946a1167a9ef66847eefd419 /drivers/gpu/drm/amd/amdgpu | |
parent | 8cc5e80641ed5e3973bd44c170529a756742e990 (diff) |
drm/amdgpu: fix lru size grouping v2
Adding a BO can make it the insertion point for larger sizes as well.
v2: add a comment about the guard structure.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index bdc76e28a240..5447973483ec 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -946,6 +946,8 @@ static struct list_head *amdgpu_ttm_lru_tail(struct ttm_buffer_object *tbo) | |||
946 | struct list_head *res = lru->lru[tbo->mem.mem_type]; | 946 | struct list_head *res = lru->lru[tbo->mem.mem_type]; |
947 | 947 | ||
948 | lru->lru[tbo->mem.mem_type] = &tbo->lru; | 948 | lru->lru[tbo->mem.mem_type] = &tbo->lru; |
949 | while ((++lru)->lru[tbo->mem.mem_type] == res) | ||
950 | lru->lru[tbo->mem.mem_type] = &tbo->lru; | ||
949 | 951 | ||
950 | return res; | 952 | return res; |
951 | } | 953 | } |
@@ -956,6 +958,8 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo) | |||
956 | struct list_head *res = lru->swap_lru; | 958 | struct list_head *res = lru->swap_lru; |
957 | 959 | ||
958 | lru->swap_lru = &tbo->swap; | 960 | lru->swap_lru = &tbo->swap; |
961 | while ((++lru)->swap_lru == res) | ||
962 | lru->swap_lru = &tbo->swap; | ||
959 | 963 | ||
960 | return res; | 964 | return res; |
961 | } | 965 | } |
@@ -1003,6 +1007,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) | |||
1003 | lru->swap_lru = &adev->mman.bdev.glob->swap_lru; | 1007 | lru->swap_lru = &adev->mman.bdev.glob->swap_lru; |
1004 | } | 1008 | } |
1005 | 1009 | ||
1010 | for (j = 0; j < TTM_NUM_MEM_TYPES; ++j) | ||
1011 | adev->mman.guard.lru[j] = NULL; | ||
1012 | adev->mman.guard.swap_lru = NULL; | ||
1013 | |||
1006 | adev->mman.initialized = true; | 1014 | adev->mman.initialized = true; |
1007 | r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_VRAM, | 1015 | r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_VRAM, |
1008 | adev->mc.real_vram_size >> PAGE_SHIFT); | 1016 | adev->mc.real_vram_size >> PAGE_SHIFT); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index 4d3927605309..72f6bfc15d8f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | |||
@@ -61,6 +61,8 @@ struct amdgpu_mman { | |||
61 | 61 | ||
62 | /* custom LRU management */ | 62 | /* custom LRU management */ |
63 | struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE]; | 63 | struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE]; |
64 | /* guard for log2_size array, don't add anything in between */ | ||
65 | struct amdgpu_mman_lru guard; | ||
64 | }; | 66 | }; |
65 | 67 | ||
66 | int amdgpu_copy_buffer(struct amdgpu_ring *ring, | 68 | int amdgpu_copy_buffer(struct amdgpu_ring *ring, |