diff options
author | Christian König <christian.koenig@amd.com> | 2016-09-12 07:34:37 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-14 15:10:42 -0400 |
commit | 283cde69aa318f7b2eeb02a7c62b16f69e1d422a (patch) | |
tree | b778c1d978bc45785c94dbb8bbb4ab454b409e81 /drivers/gpu/drm | |
parent | 5d98d0bcff64c9a76d21da9648881e14ed26fff6 (diff) |
drm/ttm: rework handling of private mem types
Instead of keeping a bunch of potentially unused flags, just define
the start for private memory types and remove the rest.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_object.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_ttm.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 8 |
4 files changed, 20 insertions, 20 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index 214bae965fc6..3ee825f4de28 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | |||
@@ -26,13 +26,13 @@ | |||
26 | 26 | ||
27 | #include "gpu_scheduler.h" | 27 | #include "gpu_scheduler.h" |
28 | 28 | ||
29 | #define AMDGPU_PL_GDS TTM_PL_PRIV0 | 29 | #define AMDGPU_PL_GDS (TTM_PL_PRIV + 0) |
30 | #define AMDGPU_PL_GWS TTM_PL_PRIV1 | 30 | #define AMDGPU_PL_GWS (TTM_PL_PRIV + 1) |
31 | #define AMDGPU_PL_OA TTM_PL_PRIV2 | 31 | #define AMDGPU_PL_OA (TTM_PL_PRIV + 2) |
32 | 32 | ||
33 | #define AMDGPU_PL_FLAG_GDS TTM_PL_FLAG_PRIV0 | 33 | #define AMDGPU_PL_FLAG_GDS (TTM_PL_FLAG_PRIV << 0) |
34 | #define AMDGPU_PL_FLAG_GWS TTM_PL_FLAG_PRIV1 | 34 | #define AMDGPU_PL_FLAG_GWS (TTM_PL_FLAG_PRIV << 1) |
35 | #define AMDGPU_PL_FLAG_OA TTM_PL_FLAG_PRIV2 | 35 | #define AMDGPU_PL_FLAG_OA (TTM_PL_FLAG_PRIV << 2) |
36 | 36 | ||
37 | #define AMDGPU_TTM_LRU_SIZE 20 | 37 | #define AMDGPU_TTM_LRU_SIZE 20 |
38 | 38 | ||
diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 5e1d7899dd72..fa5440dc9a19 100644 --- a/drivers/gpu/drm/qxl/qxl_object.c +++ b/drivers/gpu/drm/qxl/qxl_object.c | |||
@@ -61,7 +61,7 @@ void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain, bool pinned) | |||
61 | if (domain == QXL_GEM_DOMAIN_VRAM) | 61 | if (domain == QXL_GEM_DOMAIN_VRAM) |
62 | qbo->placements[c++].flags = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_VRAM | pflag; | 62 | qbo->placements[c++].flags = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_VRAM | pflag; |
63 | if (domain == QXL_GEM_DOMAIN_SURFACE) | 63 | if (domain == QXL_GEM_DOMAIN_SURFACE) |
64 | qbo->placements[c++].flags = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_PRIV0 | pflag; | 64 | qbo->placements[c++].flags = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_PRIV | pflag; |
65 | if (domain == QXL_GEM_DOMAIN_CPU) | 65 | if (domain == QXL_GEM_DOMAIN_CPU) |
66 | qbo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM | pflag; | 66 | qbo->placements[c++].flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM | pflag; |
67 | if (!c) | 67 | if (!c) |
@@ -151,7 +151,7 @@ void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, | |||
151 | 151 | ||
152 | if (bo->tbo.mem.mem_type == TTM_PL_VRAM) | 152 | if (bo->tbo.mem.mem_type == TTM_PL_VRAM) |
153 | map = qdev->vram_mapping; | 153 | map = qdev->vram_mapping; |
154 | else if (bo->tbo.mem.mem_type == TTM_PL_PRIV0) | 154 | else if (bo->tbo.mem.mem_type == TTM_PL_PRIV) |
155 | map = qdev->surface_mapping; | 155 | map = qdev->surface_mapping; |
156 | else | 156 | else |
157 | goto fallback; | 157 | goto fallback; |
@@ -191,7 +191,7 @@ void qxl_bo_kunmap_atomic_page(struct qxl_device *qdev, | |||
191 | 191 | ||
192 | if (bo->tbo.mem.mem_type == TTM_PL_VRAM) | 192 | if (bo->tbo.mem.mem_type == TTM_PL_VRAM) |
193 | map = qdev->vram_mapping; | 193 | map = qdev->vram_mapping; |
194 | else if (bo->tbo.mem.mem_type == TTM_PL_PRIV0) | 194 | else if (bo->tbo.mem.mem_type == TTM_PL_PRIV) |
195 | map = qdev->surface_mapping; | 195 | map = qdev->surface_mapping; |
196 | else | 196 | else |
197 | goto fallback; | 197 | goto fallback; |
@@ -311,7 +311,7 @@ int qxl_bo_check_id(struct qxl_device *qdev, struct qxl_bo *bo) | |||
311 | 311 | ||
312 | int qxl_surf_evict(struct qxl_device *qdev) | 312 | int qxl_surf_evict(struct qxl_device *qdev) |
313 | { | 313 | { |
314 | return ttm_bo_evict_mm(&qdev->mman.bdev, TTM_PL_PRIV0); | 314 | return ttm_bo_evict_mm(&qdev->mman.bdev, TTM_PL_PRIV); |
315 | } | 315 | } |
316 | 316 | ||
317 | int qxl_vram_evict(struct qxl_device *qdev) | 317 | int qxl_vram_evict(struct qxl_device *qdev) |
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index 6a22de045cb5..a257ad26beef 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c | |||
@@ -168,7 +168,7 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, | |||
168 | man->default_caching = TTM_PL_FLAG_CACHED; | 168 | man->default_caching = TTM_PL_FLAG_CACHED; |
169 | break; | 169 | break; |
170 | case TTM_PL_VRAM: | 170 | case TTM_PL_VRAM: |
171 | case TTM_PL_PRIV0: | 171 | case TTM_PL_PRIV: |
172 | /* "On-card" video ram */ | 172 | /* "On-card" video ram */ |
173 | man->func = &ttm_bo_manager_func; | 173 | man->func = &ttm_bo_manager_func; |
174 | man->gpu_offset = 0; | 174 | man->gpu_offset = 0; |
@@ -235,7 +235,7 @@ static int qxl_ttm_io_mem_reserve(struct ttm_bo_device *bdev, | |||
235 | mem->bus.base = qdev->vram_base; | 235 | mem->bus.base = qdev->vram_base; |
236 | mem->bus.offset = mem->start << PAGE_SHIFT; | 236 | mem->bus.offset = mem->start << PAGE_SHIFT; |
237 | break; | 237 | break; |
238 | case TTM_PL_PRIV0: | 238 | case TTM_PL_PRIV: |
239 | mem->bus.is_iomem = true; | 239 | mem->bus.is_iomem = true; |
240 | mem->bus.base = qdev->surfaceram_base; | 240 | mem->bus.base = qdev->surfaceram_base; |
241 | mem->bus.offset = mem->start << PAGE_SHIFT; | 241 | mem->bus.offset = mem->start << PAGE_SHIFT; |
@@ -376,7 +376,7 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo, | |||
376 | qbo = to_qxl_bo(bo); | 376 | qbo = to_qxl_bo(bo); |
377 | qdev = qbo->gem_base.dev->dev_private; | 377 | qdev = qbo->gem_base.dev->dev_private; |
378 | 378 | ||
379 | if (bo->mem.mem_type == TTM_PL_PRIV0 && qbo->surface_id) | 379 | if (bo->mem.mem_type == TTM_PL_PRIV && qbo->surface_id) |
380 | qxl_surface_evict(qdev, qbo, new_mem ? true : false); | 380 | qxl_surface_evict(qdev, qbo, new_mem ? true : false); |
381 | } | 381 | } |
382 | 382 | ||
@@ -422,7 +422,7 @@ int qxl_ttm_init(struct qxl_device *qdev) | |||
422 | DRM_ERROR("Failed initializing VRAM heap.\n"); | 422 | DRM_ERROR("Failed initializing VRAM heap.\n"); |
423 | return r; | 423 | return r; |
424 | } | 424 | } |
425 | r = ttm_bo_init_mm(&qdev->mman.bdev, TTM_PL_PRIV0, | 425 | r = ttm_bo_init_mm(&qdev->mman.bdev, TTM_PL_PRIV, |
426 | qdev->surfaceram_size / PAGE_SIZE); | 426 | qdev->surfaceram_size / PAGE_SIZE); |
427 | if (r) { | 427 | if (r) { |
428 | DRM_ERROR("Failed initializing Surfaces heap.\n"); | 428 | DRM_ERROR("Failed initializing Surfaces heap.\n"); |
@@ -445,7 +445,7 @@ int qxl_ttm_init(struct qxl_device *qdev) | |||
445 | void qxl_ttm_fini(struct qxl_device *qdev) | 445 | void qxl_ttm_fini(struct qxl_device *qdev) |
446 | { | 446 | { |
447 | ttm_bo_clean_mm(&qdev->mman.bdev, TTM_PL_VRAM); | 447 | ttm_bo_clean_mm(&qdev->mman.bdev, TTM_PL_VRAM); |
448 | ttm_bo_clean_mm(&qdev->mman.bdev, TTM_PL_PRIV0); | 448 | ttm_bo_clean_mm(&qdev->mman.bdev, TTM_PL_PRIV); |
449 | ttm_bo_device_release(&qdev->mman.bdev); | 449 | ttm_bo_device_release(&qdev->mman.bdev); |
450 | qxl_ttm_global_fini(qdev); | 450 | qxl_ttm_global_fini(qdev); |
451 | DRM_INFO("qxl: ttm finalized\n"); | 451 | DRM_INFO("qxl: ttm finalized\n"); |
@@ -489,7 +489,7 @@ static int qxl_ttm_debugfs_init(struct qxl_device *qdev) | |||
489 | if (i == 0) | 489 | if (i == 0) |
490 | qxl_mem_types_list[i].data = qdev->mman.bdev.man[TTM_PL_VRAM].priv; | 490 | qxl_mem_types_list[i].data = qdev->mman.bdev.man[TTM_PL_VRAM].priv; |
491 | else | 491 | else |
492 | qxl_mem_types_list[i].data = qdev->mman.bdev.man[TTM_PL_PRIV0].priv; | 492 | qxl_mem_types_list[i].data = qdev->mman.bdev.man[TTM_PL_PRIV].priv; |
493 | 493 | ||
494 | } | 494 | } |
495 | return qxl_debugfs_add_files(qdev, qxl_mem_types_list, i); | 495 | return qxl_debugfs_add_files(qdev, qxl_mem_types_list, i); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 74304b03f9d4..070d750af16d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -67,10 +67,10 @@ | |||
67 | VMWGFX_NUM_GB_SURFACE +\ | 67 | VMWGFX_NUM_GB_SURFACE +\ |
68 | VMWGFX_NUM_GB_SCREEN_TARGET) | 68 | VMWGFX_NUM_GB_SCREEN_TARGET) |
69 | 69 | ||
70 | #define VMW_PL_GMR TTM_PL_PRIV0 | 70 | #define VMW_PL_GMR (TTM_PL_PRIV + 0) |
71 | #define VMW_PL_FLAG_GMR TTM_PL_FLAG_PRIV0 | 71 | #define VMW_PL_FLAG_GMR (TTM_PL_FLAG_PRIV << 0) |
72 | #define VMW_PL_MOB TTM_PL_PRIV1 | 72 | #define VMW_PL_MOB (TTM_PL_PRIV + 1) |
73 | #define VMW_PL_FLAG_MOB TTM_PL_FLAG_PRIV1 | 73 | #define VMW_PL_FLAG_MOB (TTM_PL_FLAG_PRIV << 1) |
74 | 74 | ||
75 | #define VMW_RES_CONTEXT ttm_driver_type0 | 75 | #define VMW_RES_CONTEXT ttm_driver_type0 |
76 | #define VMW_RES_SURFACE ttm_driver_type1 | 76 | #define VMW_RES_SURFACE ttm_driver_type1 |