diff options
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 77 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 58 |
2 files changed, 67 insertions, 68 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 241abc140896..db6f153cf1ee 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -373,77 +373,10 @@ struct amdgpu_clock { | |||
373 | }; | 373 | }; |
374 | 374 | ||
375 | /* | 375 | /* |
376 | * BO. | 376 | * GEM. |
377 | */ | 377 | */ |
378 | struct amdgpu_bo_list_entry { | ||
379 | struct amdgpu_bo *robj; | ||
380 | struct ttm_validate_buffer tv; | ||
381 | struct amdgpu_bo_va *bo_va; | ||
382 | uint32_t priority; | ||
383 | struct page **user_pages; | ||
384 | int user_invalidated; | ||
385 | }; | ||
386 | |||
387 | struct amdgpu_bo_va_mapping { | ||
388 | struct list_head list; | ||
389 | struct rb_node rb; | ||
390 | uint64_t start; | ||
391 | uint64_t last; | ||
392 | uint64_t __subtree_last; | ||
393 | uint64_t offset; | ||
394 | uint64_t flags; | ||
395 | }; | ||
396 | |||
397 | /* bo virtual addresses in a specific vm */ | ||
398 | struct amdgpu_bo_va { | ||
399 | /* protected by bo being reserved */ | ||
400 | struct list_head bo_list; | ||
401 | struct dma_fence *last_pt_update; | ||
402 | unsigned ref_count; | ||
403 | |||
404 | /* protected by vm mutex and spinlock */ | ||
405 | struct list_head vm_status; | ||
406 | |||
407 | /* mappings for this bo_va */ | ||
408 | struct list_head invalids; | ||
409 | struct list_head valids; | ||
410 | |||
411 | /* constant after initialization */ | ||
412 | struct amdgpu_vm *vm; | ||
413 | struct amdgpu_bo *bo; | ||
414 | }; | ||
415 | 378 | ||
416 | #define AMDGPU_GEM_DOMAIN_MAX 0x3 | 379 | #define AMDGPU_GEM_DOMAIN_MAX 0x3 |
417 | |||
418 | struct amdgpu_bo { | ||
419 | /* Protected by tbo.reserved */ | ||
420 | u32 prefered_domains; | ||
421 | u32 allowed_domains; | ||
422 | struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX + 1]; | ||
423 | struct ttm_placement placement; | ||
424 | struct ttm_buffer_object tbo; | ||
425 | struct ttm_bo_kmap_obj kmap; | ||
426 | u64 flags; | ||
427 | unsigned pin_count; | ||
428 | u64 tiling_flags; | ||
429 | u64 metadata_flags; | ||
430 | void *metadata; | ||
431 | u32 metadata_size; | ||
432 | unsigned prime_shared_count; | ||
433 | /* list of all virtual address to which this bo | ||
434 | * is associated to | ||
435 | */ | ||
436 | struct list_head va; | ||
437 | /* Constant after initialization */ | ||
438 | struct drm_gem_object gem_base; | ||
439 | struct amdgpu_bo *parent; | ||
440 | struct amdgpu_bo *shadow; | ||
441 | |||
442 | struct ttm_bo_kmap_obj dma_buf_vmap; | ||
443 | struct amdgpu_mn *mn; | ||
444 | struct list_head mn_list; | ||
445 | struct list_head shadow_list; | ||
446 | }; | ||
447 | #define gem_to_amdgpu_bo(gobj) container_of((gobj), struct amdgpu_bo, gem_base) | 380 | #define gem_to_amdgpu_bo(gobj) container_of((gobj), struct amdgpu_bo, gem_base) |
448 | 381 | ||
449 | void amdgpu_gem_object_free(struct drm_gem_object *obj); | 382 | void amdgpu_gem_object_free(struct drm_gem_object *obj); |
@@ -824,6 +757,14 @@ struct amdgpu_fpriv { | |||
824 | /* | 757 | /* |
825 | * residency list | 758 | * residency list |
826 | */ | 759 | */ |
760 | struct amdgpu_bo_list_entry { | ||
761 | struct amdgpu_bo *robj; | ||
762 | struct ttm_validate_buffer tv; | ||
763 | struct amdgpu_bo_va *bo_va; | ||
764 | uint32_t priority; | ||
765 | struct page **user_pages; | ||
766 | int user_invalidated; | ||
767 | }; | ||
827 | 768 | ||
828 | struct amdgpu_bo_list { | 769 | struct amdgpu_bo_list { |
829 | struct mutex lock; | 770 | struct mutex lock; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index f53d53d7a0af..a401fe3bdd26 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | |||
@@ -33,6 +33,64 @@ | |||
33 | 33 | ||
34 | #define AMDGPU_BO_INVALID_OFFSET LONG_MAX | 34 | #define AMDGPU_BO_INVALID_OFFSET LONG_MAX |
35 | 35 | ||
36 | struct amdgpu_bo_va_mapping { | ||
37 | struct list_head list; | ||
38 | struct rb_node rb; | ||
39 | uint64_t start; | ||
40 | uint64_t last; | ||
41 | uint64_t __subtree_last; | ||
42 | uint64_t offset; | ||
43 | uint64_t flags; | ||
44 | }; | ||
45 | |||
46 | /* bo virtual addresses in a specific vm */ | ||
47 | struct amdgpu_bo_va { | ||
48 | /* protected by bo being reserved */ | ||
49 | struct list_head bo_list; | ||
50 | struct dma_fence *last_pt_update; | ||
51 | unsigned ref_count; | ||
52 | |||
53 | /* protected by vm mutex and spinlock */ | ||
54 | struct list_head vm_status; | ||
55 | |||
56 | /* mappings for this bo_va */ | ||
57 | struct list_head invalids; | ||
58 | struct list_head valids; | ||
59 | |||
60 | /* constant after initialization */ | ||
61 | struct amdgpu_vm *vm; | ||
62 | struct amdgpu_bo *bo; | ||
63 | }; | ||
64 | |||
65 | |||
66 | struct amdgpu_bo { | ||
67 | /* Protected by tbo.reserved */ | ||
68 | u32 prefered_domains; | ||
69 | u32 allowed_domains; | ||
70 | struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX + 1]; | ||
71 | struct ttm_placement placement; | ||
72 | struct ttm_buffer_object tbo; | ||
73 | struct ttm_bo_kmap_obj kmap; | ||
74 | u64 flags; | ||
75 | unsigned pin_count; | ||
76 | u64 tiling_flags; | ||
77 | u64 metadata_flags; | ||
78 | void *metadata; | ||
79 | u32 metadata_size; | ||
80 | unsigned prime_shared_count; | ||
81 | /* list of all virtual address to which this bo is associated to */ | ||
82 | struct list_head va; | ||
83 | /* Constant after initialization */ | ||
84 | struct drm_gem_object gem_base; | ||
85 | struct amdgpu_bo *parent; | ||
86 | struct amdgpu_bo *shadow; | ||
87 | |||
88 | struct ttm_bo_kmap_obj dma_buf_vmap; | ||
89 | struct amdgpu_mn *mn; | ||
90 | struct list_head mn_list; | ||
91 | struct list_head shadow_list; | ||
92 | }; | ||
93 | |||
36 | /** | 94 | /** |
37 | * amdgpu_mem_type_to_domain - return domain corresponding to mem_type | 95 | * amdgpu_mem_type_to_domain - return domain corresponding to mem_type |
38 | * @mem_type: ttm memory type | 96 | * @mem_type: ttm memory type |