aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'amdgpu/amdgpu_internal.h')
-rw-r--r--amdgpu/amdgpu_internal.h48
1 files changed, 9 insertions, 39 deletions
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index 4f039b68..99b8ce0b 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -25,10 +25,6 @@
25#ifndef _AMDGPU_INTERNAL_H_ 25#ifndef _AMDGPU_INTERNAL_H_
26#define _AMDGPU_INTERNAL_H_ 26#define _AMDGPU_INTERNAL_H_
27 27
28#ifdef HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include <assert.h> 28#include <assert.h>
33#include <pthread.h> 29#include <pthread.h>
34 30
@@ -53,8 +49,6 @@ struct amdgpu_bo_va_hole {
53}; 49};
54 50
55struct amdgpu_bo_va_mgr { 51struct amdgpu_bo_va_mgr {
56 /* the start virtual address */
57 uint64_t va_offset;
58 uint64_t va_max; 52 uint64_t va_max;
59 struct list_head va_holes; 53 struct list_head va_holes;
60 pthread_mutex_t bo_va_mutex; 54 pthread_mutex_t bo_va_mutex;
@@ -76,6 +70,7 @@ struct amdgpu_device {
76 unsigned major_version; 70 unsigned major_version;
77 unsigned minor_version; 71 unsigned minor_version;
78 72
73 char *marketing_name;
79 /** List of buffer handles. Protected by bo_table_mutex. */ 74 /** List of buffer handles. Protected by bo_table_mutex. */
80 struct util_hash_table *bo_handles; 75 struct util_hash_table *bo_handles;
81 /** List of buffer GEM flink names. Protected by bo_table_mutex. */ 76 /** List of buffer GEM flink names. Protected by bo_table_mutex. */
@@ -84,10 +79,14 @@ struct amdgpu_device {
84 pthread_mutex_t bo_table_mutex; 79 pthread_mutex_t bo_table_mutex;
85 struct drm_amdgpu_info_device dev_info; 80 struct drm_amdgpu_info_device dev_info;
86 struct amdgpu_gpu_info info; 81 struct amdgpu_gpu_info info;
87 /** The global VA manager for the whole virtual address space */ 82 /** The VA manager for the lower virtual address space */
88 struct amdgpu_bo_va_mgr *vamgr; 83 struct amdgpu_bo_va_mgr vamgr;
89 /** The VA manager for the 32bit address space */ 84 /** The VA manager for the 32bit address space */
90 struct amdgpu_bo_va_mgr *vamgr_32; 85 struct amdgpu_bo_va_mgr vamgr_32;
86 /** The VA manager for the high virtual address space */
87 struct amdgpu_bo_va_mgr vamgr_high;
88 /** The VA manager for the 32bit high address space */
89 struct amdgpu_bo_va_mgr vamgr_high_32;
91}; 90};
92 91
93struct amdgpu_bo { 92struct amdgpu_bo {
@@ -135,19 +134,12 @@ struct amdgpu_semaphore {
135 * Functions. 134 * Functions.
136 */ 135 */
137 136
138drm_private void amdgpu_bo_free_internal(amdgpu_bo_handle bo);
139
140drm_private void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start, 137drm_private void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start,
141 uint64_t max, uint64_t alignment); 138 uint64_t max, uint64_t alignment);
142 139
143drm_private void amdgpu_vamgr_deinit(struct amdgpu_bo_va_mgr *mgr); 140drm_private void amdgpu_vamgr_deinit(struct amdgpu_bo_va_mgr *mgr);
144 141
145drm_private uint64_t 142drm_private void amdgpu_parse_asic_ids(struct amdgpu_device *dev);
146amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size,
147 uint64_t alignment, uint64_t base_required);
148
149drm_private void
150amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va, uint64_t size);
151 143
152drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev); 144drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev);
153 145
@@ -179,26 +171,4 @@ static inline bool update_references(atomic_t *dst, atomic_t *src)
179 return false; 171 return false;
180} 172}
181 173
182/**
183 * Assignment between two amdgpu_bo pointers with reference counting.
184 *
185 * Usage:
186 * struct amdgpu_bo *dst = ... , *src = ...;
187 *
188 * dst = src;
189 * // No reference counting. Only use this when you need to move
190 * // a reference from one pointer to another.
191 *
192 * amdgpu_bo_reference(&dst, src);
193 * // Reference counters are updated. dst is decremented and src is
194 * // incremented. dst is freed if its reference counter is 0.
195 */
196static inline void amdgpu_bo_reference(struct amdgpu_bo **dst,
197 struct amdgpu_bo *src)
198{
199 if (update_references(&(*dst)->refcount, &src->refcount))
200 amdgpu_bo_free_internal(*dst);
201 *dst = src;
202}
203
204#endif 174#endif