diff options
author | Dave Airlie <airlied@redhat.com> | 2016-03-17 17:16:25 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-03-17 17:16:25 -0400 |
commit | 902d02db1ff1b0d0075276917a36ba70847798a7 (patch) | |
tree | 2dbd296578edf17b7abd5d2ecde1b1f2f1eb5e10 | |
parent | e6087877794520748f7295212a4c6bdb870122f2 (diff) | |
parent | b9c743b85dc378510ef0e5ebe3c2e4ac1495c410 (diff) |
Merge branch 'drm-next-4.6' of git://people.freedesktop.org/~agd5f/linux into drm-next
A few other misc cleanups and bug fixes for 4.6. Highlights:
- unify endian handling in powerplay
- powerplay fixes
- fix a regression in 4.5 on boards with no display connectors
- fence cleanups and locking fixes
- whitespace cleanups and code refactoring in radeon
* 'drm-next-4.6' of git://people.freedesktop.org/~agd5f/linux: (35 commits)
drm/amdgpu/gfx7: add MTYPE definition
drm/amdgpu: removing BO_VAs shouldn't be interruptible
drm/amd/powerplay: show uvd/vce power gate enablement for tonga.
drm/amd/powerplay: show uvd/vce power gate info for fiji
drm/amdgpu: use sched fence if possible
drm/amdgpu: move ib.fence to job.fence
drm/amdgpu: give a fence param to ib_free
drm/amdgpu: include the right version of gmc header files for iceland
drm/radeon: fix indentation.
drm/amd/powerplay: add uvd/vce dpm enabling flag to fix the performance issue for CZ
drm/amdgpu: switch back to 32bit hw fences v2
drm/amdgpu: remove amdgpu_fence_is_signaled
drm/amdgpu: drop the extra fence range check v2
drm/amdgpu: signal fences directly in amdgpu_fence_process
drm/amdgpu: cleanup amdgpu_fence_wait_empty v2
drm/amdgpu: keep all fences in an RCU protected array v2
drm/amdgpu: add number of hardware submissions to amdgpu_fence_driver_init_ring
drm/amdgpu: RCU protected amd_sched_fence_release
drm/amdgpu: RCU protected amdgpu_fence_release
drm/amdgpu: merge amdgpu_fence_process and _activity
...
64 files changed, 1844 insertions, 2332 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index a80c8cea7609..c4a21c6428f5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -141,7 +141,6 @@ extern unsigned amdgpu_pcie_lane_cap; | |||
141 | #define CIK_CURSOR_HEIGHT 128 | 141 | #define CIK_CURSOR_HEIGHT 128 |
142 | 142 | ||
143 | struct amdgpu_device; | 143 | struct amdgpu_device; |
144 | struct amdgpu_fence; | ||
145 | struct amdgpu_ib; | 144 | struct amdgpu_ib; |
146 | struct amdgpu_vm; | 145 | struct amdgpu_vm; |
147 | struct amdgpu_ring; | 146 | struct amdgpu_ring; |
@@ -348,13 +347,15 @@ struct amdgpu_fence_driver { | |||
348 | uint64_t gpu_addr; | 347 | uint64_t gpu_addr; |
349 | volatile uint32_t *cpu_addr; | 348 | volatile uint32_t *cpu_addr; |
350 | /* sync_seq is protected by ring emission lock */ | 349 | /* sync_seq is protected by ring emission lock */ |
351 | uint64_t sync_seq; | 350 | uint32_t sync_seq; |
352 | atomic64_t last_seq; | 351 | atomic_t last_seq; |
353 | bool initialized; | 352 | bool initialized; |
354 | struct amdgpu_irq_src *irq_src; | 353 | struct amdgpu_irq_src *irq_src; |
355 | unsigned irq_type; | 354 | unsigned irq_type; |
356 | struct timer_list fallback_timer; | 355 | struct timer_list fallback_timer; |
357 | wait_queue_head_t fence_queue; | 356 | unsigned num_fences_mask; |
357 | spinlock_t lock; | ||
358 | struct fence **fences; | ||
358 | }; | 359 | }; |
359 | 360 | ||
360 | /* some special values for the owner field */ | 361 | /* some special values for the owner field */ |
@@ -364,16 +365,6 @@ struct amdgpu_fence_driver { | |||
364 | #define AMDGPU_FENCE_FLAG_64BIT (1 << 0) | 365 | #define AMDGPU_FENCE_FLAG_64BIT (1 << 0) |
365 | #define AMDGPU_FENCE_FLAG_INT (1 << 1) | 366 | #define AMDGPU_FENCE_FLAG_INT (1 << 1) |
366 | 367 | ||
367 | struct amdgpu_fence { | ||
368 | struct fence base; | ||
369 | |||
370 | /* RB, DMA, etc. */ | ||
371 | struct amdgpu_ring *ring; | ||
372 | uint64_t seq; | ||
373 | |||
374 | wait_queue_t fence_wake; | ||
375 | }; | ||
376 | |||
377 | struct amdgpu_user_fence { | 368 | struct amdgpu_user_fence { |
378 | /* write-back bo */ | 369 | /* write-back bo */ |
379 | struct amdgpu_bo *bo; | 370 | struct amdgpu_bo *bo; |
@@ -385,7 +376,8 @@ int amdgpu_fence_driver_init(struct amdgpu_device *adev); | |||
385 | void amdgpu_fence_driver_fini(struct amdgpu_device *adev); | 376 | void amdgpu_fence_driver_fini(struct amdgpu_device *adev); |
386 | void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev); | 377 | void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev); |
387 | 378 | ||
388 | int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring); | 379 | int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, |
380 | unsigned num_hw_submission); | ||
389 | int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, | 381 | int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, |
390 | struct amdgpu_irq_src *irq_src, | 382 | struct amdgpu_irq_src *irq_src, |
391 | unsigned irq_type); | 383 | unsigned irq_type); |
@@ -393,7 +385,6 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev); | |||
393 | void amdgpu_fence_driver_resume(struct amdgpu_device *adev); | 385 | void amdgpu_fence_driver_resume(struct amdgpu_device *adev); |
394 | int amdgpu_fence_emit(struct amdgpu_ring *ring, struct fence **fence); | 386 | int amdgpu_fence_emit(struct amdgpu_ring *ring, struct fence **fence); |
395 | void amdgpu_fence_process(struct amdgpu_ring *ring); | 387 | void amdgpu_fence_process(struct amdgpu_ring *ring); |
396 | int amdgpu_fence_wait_next(struct amdgpu_ring *ring); | ||
397 | int amdgpu_fence_wait_empty(struct amdgpu_ring *ring); | 388 | int amdgpu_fence_wait_empty(struct amdgpu_ring *ring); |
398 | unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring); | 389 | unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring); |
399 | 390 | ||
@@ -539,11 +530,14 @@ int amdgpu_gem_debugfs_init(struct amdgpu_device *adev); | |||
539 | * Assumption is that there won't be hole (all object on same | 530 | * Assumption is that there won't be hole (all object on same |
540 | * alignment). | 531 | * alignment). |
541 | */ | 532 | */ |
533 | |||
534 | #define AMDGPU_SA_NUM_FENCE_LISTS 32 | ||
535 | |||
542 | struct amdgpu_sa_manager { | 536 | struct amdgpu_sa_manager { |
543 | wait_queue_head_t wq; | 537 | wait_queue_head_t wq; |
544 | struct amdgpu_bo *bo; | 538 | struct amdgpu_bo *bo; |
545 | struct list_head *hole; | 539 | struct list_head *hole; |
546 | struct list_head flist[AMDGPU_MAX_RINGS]; | 540 | struct list_head flist[AMDGPU_SA_NUM_FENCE_LISTS]; |
547 | struct list_head olist; | 541 | struct list_head olist; |
548 | unsigned size; | 542 | unsigned size; |
549 | uint64_t gpu_addr; | 543 | uint64_t gpu_addr; |
@@ -727,7 +721,6 @@ struct amdgpu_ib { | |||
727 | uint32_t length_dw; | 721 | uint32_t length_dw; |
728 | uint64_t gpu_addr; | 722 | uint64_t gpu_addr; |
729 | uint32_t *ptr; | 723 | uint32_t *ptr; |
730 | struct fence *fence; | ||
731 | struct amdgpu_user_fence *user; | 724 | struct amdgpu_user_fence *user; |
732 | struct amdgpu_vm *vm; | 725 | struct amdgpu_vm *vm; |
733 | unsigned vm_id; | 726 | unsigned vm_id; |
@@ -1143,7 +1136,7 @@ struct amdgpu_gfx { | |||
1143 | 1136 | ||
1144 | int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, | 1137 | int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
1145 | unsigned size, struct amdgpu_ib *ib); | 1138 | unsigned size, struct amdgpu_ib *ib); |
1146 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib); | 1139 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fence *f); |
1147 | int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | 1140 | int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, |
1148 | struct amdgpu_ib *ib, struct fence *last_vm_update, | 1141 | struct amdgpu_ib *ib, struct fence *last_vm_update, |
1149 | struct fence **f); | 1142 | struct fence **f); |
@@ -1164,7 +1157,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
1164 | struct amdgpu_irq_src *irq_src, unsigned irq_type, | 1157 | struct amdgpu_irq_src *irq_src, unsigned irq_type, |
1165 | enum amdgpu_ring_type ring_type); | 1158 | enum amdgpu_ring_type ring_type); |
1166 | void amdgpu_ring_fini(struct amdgpu_ring *ring); | 1159 | void amdgpu_ring_fini(struct amdgpu_ring *ring); |
1167 | struct amdgpu_ring *amdgpu_ring_from_fence(struct fence *f); | ||
1168 | 1160 | ||
1169 | /* | 1161 | /* |
1170 | * CS. | 1162 | * CS. |
@@ -1206,6 +1198,7 @@ struct amdgpu_job { | |||
1206 | struct amdgpu_ring *ring; | 1198 | struct amdgpu_ring *ring; |
1207 | struct amdgpu_sync sync; | 1199 | struct amdgpu_sync sync; |
1208 | struct amdgpu_ib *ibs; | 1200 | struct amdgpu_ib *ibs; |
1201 | struct fence *fence; /* the hw fence */ | ||
1209 | uint32_t num_ibs; | 1202 | uint32_t num_ibs; |
1210 | void *owner; | 1203 | void *owner; |
1211 | struct amdgpu_user_fence uf; | 1204 | struct amdgpu_user_fence uf; |
@@ -2067,20 +2060,6 @@ u32 amdgpu_mm_rdoorbell(struct amdgpu_device *adev, u32 index); | |||
2067 | void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v); | 2060 | void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v); |
2068 | 2061 | ||
2069 | /* | 2062 | /* |
2070 | * Cast helper | ||
2071 | */ | ||
2072 | extern const struct fence_ops amdgpu_fence_ops; | ||
2073 | static inline struct amdgpu_fence *to_amdgpu_fence(struct fence *f) | ||
2074 | { | ||
2075 | struct amdgpu_fence *__f = container_of(f, struct amdgpu_fence, base); | ||
2076 | |||
2077 | if (__f->base.ops == &amdgpu_fence_ops) | ||
2078 | return __f; | ||
2079 | |||
2080 | return NULL; | ||
2081 | } | ||
2082 | |||
2083 | /* | ||
2084 | * Registers read & write functions. | 2063 | * Registers read & write functions. |
2085 | */ | 2064 | */ |
2086 | #define RREG32(reg) amdgpu_mm_rreg(adev, (reg), false) | 2065 | #define RREG32(reg) amdgpu_mm_rreg(adev, (reg), false) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index 83599f2a0387..4303b447efe8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | |||
@@ -47,9 +47,30 @@ | |||
47 | * that the the relevant GPU caches have been flushed. | 47 | * that the the relevant GPU caches have been flushed. |
48 | */ | 48 | */ |
49 | 49 | ||
50 | struct amdgpu_fence { | ||
51 | struct fence base; | ||
52 | |||
53 | /* RB, DMA, etc. */ | ||
54 | struct amdgpu_ring *ring; | ||
55 | }; | ||
56 | |||
50 | static struct kmem_cache *amdgpu_fence_slab; | 57 | static struct kmem_cache *amdgpu_fence_slab; |
51 | static atomic_t amdgpu_fence_slab_ref = ATOMIC_INIT(0); | 58 | static atomic_t amdgpu_fence_slab_ref = ATOMIC_INIT(0); |
52 | 59 | ||
60 | /* | ||
61 | * Cast helper | ||
62 | */ | ||
63 | static const struct fence_ops amdgpu_fence_ops; | ||
64 | static inline struct amdgpu_fence *to_amdgpu_fence(struct fence *f) | ||
65 | { | ||
66 | struct amdgpu_fence *__f = container_of(f, struct amdgpu_fence, base); | ||
67 | |||
68 | if (__f->base.ops == &amdgpu_fence_ops) | ||
69 | return __f; | ||
70 | |||
71 | return NULL; | ||
72 | } | ||
73 | |||
53 | /** | 74 | /** |
54 | * amdgpu_fence_write - write a fence value | 75 | * amdgpu_fence_write - write a fence value |
55 | * | 76 | * |
@@ -82,7 +103,7 @@ static u32 amdgpu_fence_read(struct amdgpu_ring *ring) | |||
82 | if (drv->cpu_addr) | 103 | if (drv->cpu_addr) |
83 | seq = le32_to_cpu(*drv->cpu_addr); | 104 | seq = le32_to_cpu(*drv->cpu_addr); |
84 | else | 105 | else |
85 | seq = lower_32_bits(atomic64_read(&drv->last_seq)); | 106 | seq = atomic_read(&drv->last_seq); |
86 | 107 | ||
87 | return seq; | 108 | return seq; |
88 | } | 109 | } |
@@ -100,20 +121,32 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct fence **f) | |||
100 | { | 121 | { |
101 | struct amdgpu_device *adev = ring->adev; | 122 | struct amdgpu_device *adev = ring->adev; |
102 | struct amdgpu_fence *fence; | 123 | struct amdgpu_fence *fence; |
124 | struct fence **ptr; | ||
125 | uint32_t seq; | ||
103 | 126 | ||
104 | fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL); | 127 | fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL); |
105 | if (fence == NULL) | 128 | if (fence == NULL) |
106 | return -ENOMEM; | 129 | return -ENOMEM; |
107 | 130 | ||
108 | fence->seq = ++ring->fence_drv.sync_seq; | 131 | seq = ++ring->fence_drv.sync_seq; |
109 | fence->ring = ring; | 132 | fence->ring = ring; |
110 | fence_init(&fence->base, &amdgpu_fence_ops, | 133 | fence_init(&fence->base, &amdgpu_fence_ops, |
111 | &ring->fence_drv.fence_queue.lock, | 134 | &ring->fence_drv.lock, |
112 | adev->fence_context + ring->idx, | 135 | adev->fence_context + ring->idx, |
113 | fence->seq); | 136 | seq); |
114 | amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, | 137 | amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, |
115 | fence->seq, AMDGPU_FENCE_FLAG_INT); | 138 | seq, AMDGPU_FENCE_FLAG_INT); |
139 | |||
140 | ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask]; | ||
141 | /* This function can't be called concurrently anyway, otherwise | ||
142 | * emitting the fence would mess up the hardware ring buffer. | ||
143 | */ | ||
144 | BUG_ON(rcu_dereference_protected(*ptr, 1)); | ||
145 | |||
146 | rcu_assign_pointer(*ptr, fence_get(&fence->base)); | ||
147 | |||
116 | *f = &fence->base; | 148 | *f = &fence->base; |
149 | |||
117 | return 0; | 150 | return 0; |
118 | } | 151 | } |
119 | 152 | ||
@@ -131,89 +164,48 @@ static void amdgpu_fence_schedule_fallback(struct amdgpu_ring *ring) | |||
131 | } | 164 | } |
132 | 165 | ||
133 | /** | 166 | /** |
134 | * amdgpu_fence_activity - check for fence activity | 167 | * amdgpu_fence_process - check for fence activity |
135 | * | 168 | * |
136 | * @ring: pointer to struct amdgpu_ring | 169 | * @ring: pointer to struct amdgpu_ring |
137 | * | 170 | * |
138 | * Checks the current fence value and calculates the last | 171 | * Checks the current fence value and calculates the last |
139 | * signalled fence value. Returns true if activity occured | 172 | * signalled fence value. Wakes the fence queue if the |
140 | * on the ring, and the fence_queue should be waken up. | 173 | * sequence number has increased. |
141 | */ | 174 | */ |
142 | static bool amdgpu_fence_activity(struct amdgpu_ring *ring) | 175 | void amdgpu_fence_process(struct amdgpu_ring *ring) |
143 | { | 176 | { |
144 | uint64_t seq, last_seq, last_emitted; | 177 | struct amdgpu_fence_driver *drv = &ring->fence_drv; |
145 | unsigned count_loop = 0; | 178 | uint32_t seq, last_seq; |
146 | bool wake = false; | 179 | int r; |
147 | 180 | ||
148 | /* Note there is a scenario here for an infinite loop but it's | ||
149 | * very unlikely to happen. For it to happen, the current polling | ||
150 | * process need to be interrupted by another process and another | ||
151 | * process needs to update the last_seq btw the atomic read and | ||
152 | * xchg of the current process. | ||
153 | * | ||
154 | * More over for this to go in infinite loop there need to be | ||
155 | * continuously new fence signaled ie amdgpu_fence_read needs | ||
156 | * to return a different value each time for both the currently | ||
157 | * polling process and the other process that xchg the last_seq | ||
158 | * btw atomic read and xchg of the current process. And the | ||
159 | * value the other process set as last seq must be higher than | ||
160 | * the seq value we just read. Which means that current process | ||
161 | * need to be interrupted after amdgpu_fence_read and before | ||
162 | * atomic xchg. | ||
163 | * | ||
164 | * To be even more safe we count the number of time we loop and | ||
165 | * we bail after 10 loop just accepting the fact that we might | ||
166 | * have temporarly set the last_seq not to the true real last | ||
167 | * seq but to an older one. | ||
168 | */ | ||
169 | last_seq = atomic64_read(&ring->fence_drv.last_seq); | ||
170 | do { | 181 | do { |
171 | last_emitted = ring->fence_drv.sync_seq; | 182 | last_seq = atomic_read(&ring->fence_drv.last_seq); |
172 | seq = amdgpu_fence_read(ring); | 183 | seq = amdgpu_fence_read(ring); |
173 | seq |= last_seq & 0xffffffff00000000LL; | ||
174 | if (seq < last_seq) { | ||
175 | seq &= 0xffffffff; | ||
176 | seq |= last_emitted & 0xffffffff00000000LL; | ||
177 | } | ||
178 | 184 | ||
179 | if (seq <= last_seq || seq > last_emitted) { | 185 | } while (atomic_cmpxchg(&drv->last_seq, last_seq, seq) != last_seq); |
180 | break; | ||
181 | } | ||
182 | /* If we loop over we don't want to return without | ||
183 | * checking if a fence is signaled as it means that the | ||
184 | * seq we just read is different from the previous on. | ||
185 | */ | ||
186 | wake = true; | ||
187 | last_seq = seq; | ||
188 | if ((count_loop++) > 10) { | ||
189 | /* We looped over too many time leave with the | ||
190 | * fact that we might have set an older fence | ||
191 | * seq then the current real last seq as signaled | ||
192 | * by the hw. | ||
193 | */ | ||
194 | break; | ||
195 | } | ||
196 | } while (atomic64_xchg(&ring->fence_drv.last_seq, seq) > seq); | ||
197 | 186 | ||
198 | if (seq < last_emitted) | 187 | if (seq != ring->fence_drv.sync_seq) |
199 | amdgpu_fence_schedule_fallback(ring); | 188 | amdgpu_fence_schedule_fallback(ring); |
200 | 189 | ||
201 | return wake; | 190 | while (last_seq != seq) { |
202 | } | 191 | struct fence *fence, **ptr; |
203 | 192 | ||
204 | /** | 193 | ptr = &drv->fences[++last_seq & drv->num_fences_mask]; |
205 | * amdgpu_fence_process - process a fence | 194 | |
206 | * | 195 | /* There is always exactly one thread signaling this fence slot */ |
207 | * @adev: amdgpu_device pointer | 196 | fence = rcu_dereference_protected(*ptr, 1); |
208 | * @ring: ring index the fence is associated with | 197 | rcu_assign_pointer(*ptr, NULL); |
209 | * | 198 | |
210 | * Checks the current fence value and wakes the fence queue | 199 | BUG_ON(!fence); |
211 | * if the sequence number has increased (all asics). | 200 | |
212 | */ | 201 | r = fence_signal(fence); |
213 | void amdgpu_fence_process(struct amdgpu_ring *ring) | 202 | if (!r) |
214 | { | 203 | FENCE_TRACE(fence, "signaled from irq context\n"); |
215 | if (amdgpu_fence_activity(ring)) | 204 | else |
216 | wake_up_all(&ring->fence_drv.fence_queue); | 205 | BUG(); |
206 | |||
207 | fence_put(fence); | ||
208 | } | ||
217 | } | 209 | } |
218 | 210 | ||
219 | /** | 211 | /** |
@@ -231,77 +223,6 @@ static void amdgpu_fence_fallback(unsigned long arg) | |||
231 | } | 223 | } |
232 | 224 | ||
233 | /** | 225 | /** |
234 | * amdgpu_fence_seq_signaled - check if a fence sequence number has signaled | ||
235 | * | ||
236 | * @ring: ring the fence is associated with | ||
237 | * @seq: sequence number | ||
238 | * | ||
239 | * Check if the last signaled fence sequnce number is >= the requested | ||
240 | * sequence number (all asics). | ||
241 | * Returns true if the fence has signaled (current fence value | ||
242 | * is >= requested value) or false if it has not (current fence | ||
243 | * value is < the requested value. Helper function for | ||
244 | * amdgpu_fence_signaled(). | ||
245 | */ | ||
246 | static bool amdgpu_fence_seq_signaled(struct amdgpu_ring *ring, u64 seq) | ||
247 | { | ||
248 | if (atomic64_read(&ring->fence_drv.last_seq) >= seq) | ||
249 | return true; | ||
250 | |||
251 | /* poll new last sequence at least once */ | ||
252 | amdgpu_fence_process(ring); | ||
253 | if (atomic64_read(&ring->fence_drv.last_seq) >= seq) | ||
254 | return true; | ||
255 | |||
256 | return false; | ||
257 | } | ||
258 | |||
259 | /* | ||
260 | * amdgpu_ring_wait_seq - wait for seq of the specific ring to signal | ||
261 | * @ring: ring to wait on for the seq number | ||
262 | * @seq: seq number wait for | ||
263 | * | ||
264 | * return value: | ||
265 | * 0: seq signaled, and gpu not hang | ||
266 | * -EINVAL: some paramter is not valid | ||
267 | */ | ||
268 | static int amdgpu_fence_ring_wait_seq(struct amdgpu_ring *ring, uint64_t seq) | ||
269 | { | ||
270 | BUG_ON(!ring); | ||
271 | if (seq > ring->fence_drv.sync_seq) | ||
272 | return -EINVAL; | ||
273 | |||
274 | if (atomic64_read(&ring->fence_drv.last_seq) >= seq) | ||
275 | return 0; | ||
276 | |||
277 | amdgpu_fence_schedule_fallback(ring); | ||
278 | wait_event(ring->fence_drv.fence_queue, | ||
279 | amdgpu_fence_seq_signaled(ring, seq)); | ||
280 | |||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | /** | ||
285 | * amdgpu_fence_wait_next - wait for the next fence to signal | ||
286 | * | ||
287 | * @adev: amdgpu device pointer | ||
288 | * @ring: ring index the fence is associated with | ||
289 | * | ||
290 | * Wait for the next fence on the requested ring to signal (all asics). | ||
291 | * Returns 0 if the next fence has passed, error for all other cases. | ||
292 | * Caller must hold ring lock. | ||
293 | */ | ||
294 | int amdgpu_fence_wait_next(struct amdgpu_ring *ring) | ||
295 | { | ||
296 | uint64_t seq = atomic64_read(&ring->fence_drv.last_seq) + 1ULL; | ||
297 | |||
298 | if (seq >= ring->fence_drv.sync_seq) | ||
299 | return -ENOENT; | ||
300 | |||
301 | return amdgpu_fence_ring_wait_seq(ring, seq); | ||
302 | } | ||
303 | |||
304 | /** | ||
305 | * amdgpu_fence_wait_empty - wait for all fences to signal | 226 | * amdgpu_fence_wait_empty - wait for all fences to signal |
306 | * | 227 | * |
307 | * @adev: amdgpu device pointer | 228 | * @adev: amdgpu device pointer |
@@ -309,16 +230,28 @@ int amdgpu_fence_wait_next(struct amdgpu_ring *ring) | |||
309 | * | 230 | * |
310 | * Wait for all fences on the requested ring to signal (all asics). | 231 | * Wait for all fences on the requested ring to signal (all asics). |
311 | * Returns 0 if the fences have passed, error for all other cases. | 232 | * Returns 0 if the fences have passed, error for all other cases. |
312 | * Caller must hold ring lock. | ||
313 | */ | 233 | */ |
314 | int amdgpu_fence_wait_empty(struct amdgpu_ring *ring) | 234 | int amdgpu_fence_wait_empty(struct amdgpu_ring *ring) |
315 | { | 235 | { |
316 | uint64_t seq = ring->fence_drv.sync_seq; | 236 | uint64_t seq = ACCESS_ONCE(ring->fence_drv.sync_seq); |
237 | struct fence *fence, **ptr; | ||
238 | int r; | ||
317 | 239 | ||
318 | if (!seq) | 240 | if (!seq) |
319 | return 0; | 241 | return 0; |
320 | 242 | ||
321 | return amdgpu_fence_ring_wait_seq(ring, seq); | 243 | ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask]; |
244 | rcu_read_lock(); | ||
245 | fence = rcu_dereference(*ptr); | ||
246 | if (!fence || !fence_get_rcu(fence)) { | ||
247 | rcu_read_unlock(); | ||
248 | return 0; | ||
249 | } | ||
250 | rcu_read_unlock(); | ||
251 | |||
252 | r = fence_wait(fence, false); | ||
253 | fence_put(fence); | ||
254 | return r; | ||
322 | } | 255 | } |
323 | 256 | ||
324 | /** | 257 | /** |
@@ -338,13 +271,10 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring) | |||
338 | * but it's ok to report slightly wrong fence count here. | 271 | * but it's ok to report slightly wrong fence count here. |
339 | */ | 272 | */ |
340 | amdgpu_fence_process(ring); | 273 | amdgpu_fence_process(ring); |
341 | emitted = ring->fence_drv.sync_seq | 274 | emitted = 0x100000000ull; |
342 | - atomic64_read(&ring->fence_drv.last_seq); | 275 | emitted -= atomic_read(&ring->fence_drv.last_seq); |
343 | /* to avoid 32bits warp around */ | 276 | emitted += ACCESS_ONCE(ring->fence_drv.sync_seq); |
344 | if (emitted > 0x10000000) | 277 | return lower_32_bits(emitted); |
345 | emitted = 0x10000000; | ||
346 | |||
347 | return (unsigned)emitted; | ||
348 | } | 278 | } |
349 | 279 | ||
350 | /** | 280 | /** |
@@ -376,7 +306,7 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, | |||
376 | ring->fence_drv.cpu_addr = adev->uvd.cpu_addr + index; | 306 | ring->fence_drv.cpu_addr = adev->uvd.cpu_addr + index; |
377 | ring->fence_drv.gpu_addr = adev->uvd.gpu_addr + index; | 307 | ring->fence_drv.gpu_addr = adev->uvd.gpu_addr + index; |
378 | } | 308 | } |
379 | amdgpu_fence_write(ring, atomic64_read(&ring->fence_drv.last_seq)); | 309 | amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq)); |
380 | amdgpu_irq_get(adev, irq_src, irq_type); | 310 | amdgpu_irq_get(adev, irq_src, irq_type); |
381 | 311 | ||
382 | ring->fence_drv.irq_src = irq_src; | 312 | ring->fence_drv.irq_src = irq_src; |
@@ -394,25 +324,36 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, | |||
394 | * for the requested ring. | 324 | * for the requested ring. |
395 | * | 325 | * |
396 | * @ring: ring to init the fence driver on | 326 | * @ring: ring to init the fence driver on |
327 | * @num_hw_submission: number of entries on the hardware queue | ||
397 | * | 328 | * |
398 | * Init the fence driver for the requested ring (all asics). | 329 | * Init the fence driver for the requested ring (all asics). |
399 | * Helper function for amdgpu_fence_driver_init(). | 330 | * Helper function for amdgpu_fence_driver_init(). |
400 | */ | 331 | */ |
401 | int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) | 332 | int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, |
333 | unsigned num_hw_submission) | ||
402 | { | 334 | { |
403 | long timeout; | 335 | long timeout; |
404 | int r; | 336 | int r; |
405 | 337 | ||
338 | /* Check that num_hw_submission is a power of two */ | ||
339 | if ((num_hw_submission & (num_hw_submission - 1)) != 0) | ||
340 | return -EINVAL; | ||
341 | |||
406 | ring->fence_drv.cpu_addr = NULL; | 342 | ring->fence_drv.cpu_addr = NULL; |
407 | ring->fence_drv.gpu_addr = 0; | 343 | ring->fence_drv.gpu_addr = 0; |
408 | ring->fence_drv.sync_seq = 0; | 344 | ring->fence_drv.sync_seq = 0; |
409 | atomic64_set(&ring->fence_drv.last_seq, 0); | 345 | atomic_set(&ring->fence_drv.last_seq, 0); |
410 | ring->fence_drv.initialized = false; | 346 | ring->fence_drv.initialized = false; |
411 | 347 | ||
412 | setup_timer(&ring->fence_drv.fallback_timer, amdgpu_fence_fallback, | 348 | setup_timer(&ring->fence_drv.fallback_timer, amdgpu_fence_fallback, |
413 | (unsigned long)ring); | 349 | (unsigned long)ring); |
414 | 350 | ||
415 | init_waitqueue_head(&ring->fence_drv.fence_queue); | 351 | ring->fence_drv.num_fences_mask = num_hw_submission - 1; |
352 | spin_lock_init(&ring->fence_drv.lock); | ||
353 | ring->fence_drv.fences = kcalloc(num_hw_submission, sizeof(void *), | ||
354 | GFP_KERNEL); | ||
355 | if (!ring->fence_drv.fences) | ||
356 | return -ENOMEM; | ||
416 | 357 | ||
417 | timeout = msecs_to_jiffies(amdgpu_lockup_timeout); | 358 | timeout = msecs_to_jiffies(amdgpu_lockup_timeout); |
418 | if (timeout == 0) { | 359 | if (timeout == 0) { |
@@ -426,7 +367,7 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) | |||
426 | timeout = MAX_SCHEDULE_TIMEOUT; | 367 | timeout = MAX_SCHEDULE_TIMEOUT; |
427 | } | 368 | } |
428 | r = amd_sched_init(&ring->sched, &amdgpu_sched_ops, | 369 | r = amd_sched_init(&ring->sched, &amdgpu_sched_ops, |
429 | amdgpu_sched_hw_submission, | 370 | num_hw_submission, |
430 | timeout, ring->name); | 371 | timeout, ring->name); |
431 | if (r) { | 372 | if (r) { |
432 | DRM_ERROR("Failed to create scheduler on ring %s.\n", | 373 | DRM_ERROR("Failed to create scheduler on ring %s.\n", |
@@ -474,10 +415,9 @@ int amdgpu_fence_driver_init(struct amdgpu_device *adev) | |||
474 | */ | 415 | */ |
475 | void amdgpu_fence_driver_fini(struct amdgpu_device *adev) | 416 | void amdgpu_fence_driver_fini(struct amdgpu_device *adev) |
476 | { | 417 | { |
477 | int i, r; | 418 | unsigned i, j; |
419 | int r; | ||
478 | 420 | ||
479 | if (atomic_dec_and_test(&amdgpu_fence_slab_ref)) | ||
480 | kmem_cache_destroy(amdgpu_fence_slab); | ||
481 | for (i = 0; i < AMDGPU_MAX_RINGS; i++) { | 421 | for (i = 0; i < AMDGPU_MAX_RINGS; i++) { |
482 | struct amdgpu_ring *ring = adev->rings[i]; | 422 | struct amdgpu_ring *ring = adev->rings[i]; |
483 | 423 | ||
@@ -488,13 +428,18 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) | |||
488 | /* no need to trigger GPU reset as we are unloading */ | 428 | /* no need to trigger GPU reset as we are unloading */ |
489 | amdgpu_fence_driver_force_completion(adev); | 429 | amdgpu_fence_driver_force_completion(adev); |
490 | } | 430 | } |
491 | wake_up_all(&ring->fence_drv.fence_queue); | ||
492 | amdgpu_irq_put(adev, ring->fence_drv.irq_src, | 431 | amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
493 | ring->fence_drv.irq_type); | 432 | ring->fence_drv.irq_type); |
494 | amd_sched_fini(&ring->sched); | 433 | amd_sched_fini(&ring->sched); |
495 | del_timer_sync(&ring->fence_drv.fallback_timer); | 434 | del_timer_sync(&ring->fence_drv.fallback_timer); |
435 | for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j) | ||
436 | fence_put(ring->fence_drv.fences[i]); | ||
437 | kfree(ring->fence_drv.fences); | ||
496 | ring->fence_drv.initialized = false; | 438 | ring->fence_drv.initialized = false; |
497 | } | 439 | } |
440 | |||
441 | if (atomic_dec_and_test(&amdgpu_fence_slab_ref)) | ||
442 | kmem_cache_destroy(amdgpu_fence_slab); | ||
498 | } | 443 | } |
499 | 444 | ||
500 | /** | 445 | /** |
@@ -591,103 +536,57 @@ static const char *amdgpu_fence_get_timeline_name(struct fence *f) | |||
591 | } | 536 | } |
592 | 537 | ||
593 | /** | 538 | /** |
594 | * amdgpu_fence_is_signaled - test if fence is signaled | 539 | * amdgpu_fence_enable_signaling - enable signalling on fence |
595 | * | 540 | * @fence: fence |
596 | * @f: fence to test | ||
597 | * | 541 | * |
598 | * Test the fence sequence number if it is already signaled. If it isn't | 542 | * This function is called with fence_queue lock held, and adds a callback |
599 | * signaled start fence processing. Returns True if the fence is signaled. | 543 | * to fence_queue that checks if this fence is signaled, and if so it |
544 | * signals the fence and removes itself. | ||
600 | */ | 545 | */ |
601 | static bool amdgpu_fence_is_signaled(struct fence *f) | 546 | static bool amdgpu_fence_enable_signaling(struct fence *f) |
602 | { | 547 | { |
603 | struct amdgpu_fence *fence = to_amdgpu_fence(f); | 548 | struct amdgpu_fence *fence = to_amdgpu_fence(f); |
604 | struct amdgpu_ring *ring = fence->ring; | 549 | struct amdgpu_ring *ring = fence->ring; |
605 | 550 | ||
606 | if (atomic64_read(&ring->fence_drv.last_seq) >= fence->seq) | 551 | if (!timer_pending(&ring->fence_drv.fallback_timer)) |
607 | return true; | 552 | amdgpu_fence_schedule_fallback(ring); |
608 | |||
609 | amdgpu_fence_process(ring); | ||
610 | 553 | ||
611 | if (atomic64_read(&ring->fence_drv.last_seq) >= fence->seq) | 554 | FENCE_TRACE(&fence->base, "armed on ring %i!\n", ring->idx); |
612 | return true; | ||
613 | 555 | ||
614 | return false; | 556 | return true; |
615 | } | 557 | } |
616 | 558 | ||
617 | /** | 559 | /** |
618 | * amdgpu_fence_check_signaled - callback from fence_queue | 560 | * amdgpu_fence_free - free up the fence memory |
561 | * | ||
562 | * @rcu: RCU callback head | ||
619 | * | 563 | * |
620 | * this function is called with fence_queue lock held, which is also used | 564 | * Free up the fence memory after the RCU grace period. |
621 | * for the fence locking itself, so unlocked variants are used for | ||
622 | * fence_signal, and remove_wait_queue. | ||
623 | */ | 565 | */ |
624 | static int amdgpu_fence_check_signaled(wait_queue_t *wait, unsigned mode, int flags, void *key) | 566 | static void amdgpu_fence_free(struct rcu_head *rcu) |
625 | { | 567 | { |
626 | struct amdgpu_fence *fence; | 568 | struct fence *f = container_of(rcu, struct fence, rcu); |
627 | struct amdgpu_device *adev; | 569 | struct amdgpu_fence *fence = to_amdgpu_fence(f); |
628 | u64 seq; | 570 | kmem_cache_free(amdgpu_fence_slab, fence); |
629 | int ret; | ||
630 | |||
631 | fence = container_of(wait, struct amdgpu_fence, fence_wake); | ||
632 | adev = fence->ring->adev; | ||
633 | |||
634 | /* | ||
635 | * We cannot use amdgpu_fence_process here because we're already | ||
636 | * in the waitqueue, in a call from wake_up_all. | ||
637 | */ | ||
638 | seq = atomic64_read(&fence->ring->fence_drv.last_seq); | ||
639 | if (seq >= fence->seq) { | ||
640 | ret = fence_signal_locked(&fence->base); | ||
641 | if (!ret) | ||
642 | FENCE_TRACE(&fence->base, "signaled from irq context\n"); | ||
643 | else | ||
644 | FENCE_TRACE(&fence->base, "was already signaled\n"); | ||
645 | |||
646 | __remove_wait_queue(&fence->ring->fence_drv.fence_queue, &fence->fence_wake); | ||
647 | fence_put(&fence->base); | ||
648 | } else | ||
649 | FENCE_TRACE(&fence->base, "pending\n"); | ||
650 | return 0; | ||
651 | } | 571 | } |
652 | 572 | ||
653 | /** | 573 | /** |
654 | * amdgpu_fence_enable_signaling - enable signalling on fence | 574 | * amdgpu_fence_release - callback that fence can be freed |
575 | * | ||
655 | * @fence: fence | 576 | * @fence: fence |
656 | * | 577 | * |
657 | * This function is called with fence_queue lock held, and adds a callback | 578 | * This function is called when the reference count becomes zero. |
658 | * to fence_queue that checks if this fence is signaled, and if so it | 579 | * It just RCU schedules freeing up the fence. |
659 | * signals the fence and removes itself. | ||
660 | */ | 580 | */ |
661 | static bool amdgpu_fence_enable_signaling(struct fence *f) | ||
662 | { | ||
663 | struct amdgpu_fence *fence = to_amdgpu_fence(f); | ||
664 | struct amdgpu_ring *ring = fence->ring; | ||
665 | |||
666 | if (atomic64_read(&ring->fence_drv.last_seq) >= fence->seq) | ||
667 | return false; | ||
668 | |||
669 | fence->fence_wake.flags = 0; | ||
670 | fence->fence_wake.private = NULL; | ||
671 | fence->fence_wake.func = amdgpu_fence_check_signaled; | ||
672 | __add_wait_queue(&ring->fence_drv.fence_queue, &fence->fence_wake); | ||
673 | fence_get(f); | ||
674 | if (!timer_pending(&ring->fence_drv.fallback_timer)) | ||
675 | amdgpu_fence_schedule_fallback(ring); | ||
676 | FENCE_TRACE(&fence->base, "armed on ring %i!\n", ring->idx); | ||
677 | return true; | ||
678 | } | ||
679 | |||
680 | static void amdgpu_fence_release(struct fence *f) | 581 | static void amdgpu_fence_release(struct fence *f) |
681 | { | 582 | { |
682 | struct amdgpu_fence *fence = to_amdgpu_fence(f); | 583 | call_rcu(&f->rcu, amdgpu_fence_free); |
683 | kmem_cache_free(amdgpu_fence_slab, fence); | ||
684 | } | 584 | } |
685 | 585 | ||
686 | const struct fence_ops amdgpu_fence_ops = { | 586 | static const struct fence_ops amdgpu_fence_ops = { |
687 | .get_driver_name = amdgpu_fence_get_driver_name, | 587 | .get_driver_name = amdgpu_fence_get_driver_name, |
688 | .get_timeline_name = amdgpu_fence_get_timeline_name, | 588 | .get_timeline_name = amdgpu_fence_get_timeline_name, |
689 | .enable_signaling = amdgpu_fence_enable_signaling, | 589 | .enable_signaling = amdgpu_fence_enable_signaling, |
690 | .signaled = amdgpu_fence_is_signaled, | ||
691 | .wait = fence_default_wait, | 590 | .wait = fence_default_wait, |
692 | .release = amdgpu_fence_release, | 591 | .release = amdgpu_fence_release, |
693 | }; | 592 | }; |
@@ -711,9 +610,9 @@ static int amdgpu_debugfs_fence_info(struct seq_file *m, void *data) | |||
711 | amdgpu_fence_process(ring); | 610 | amdgpu_fence_process(ring); |
712 | 611 | ||
713 | seq_printf(m, "--- ring %d (%s) ---\n", i, ring->name); | 612 | seq_printf(m, "--- ring %d (%s) ---\n", i, ring->name); |
714 | seq_printf(m, "Last signaled fence 0x%016llx\n", | 613 | seq_printf(m, "Last signaled fence 0x%08x\n", |
715 | (unsigned long long)atomic64_read(&ring->fence_drv.last_seq)); | 614 | atomic_read(&ring->fence_drv.last_seq)); |
716 | seq_printf(m, "Last emitted 0x%016llx\n", | 615 | seq_printf(m, "Last emitted 0x%08x\n", |
717 | ring->fence_drv.sync_seq); | 616 | ring->fence_drv.sync_seq); |
718 | } | 617 | } |
719 | return 0; | 618 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 1ecdf6c01368..3e128c52bb87 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |||
@@ -161,7 +161,7 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj, | |||
161 | 161 | ||
162 | amdgpu_vm_get_pd_bo(vm, &list, &vm_pd); | 162 | amdgpu_vm_get_pd_bo(vm, &list, &vm_pd); |
163 | 163 | ||
164 | r = ttm_eu_reserve_buffers(&ticket, &list, true, &duplicates); | 164 | r = ttm_eu_reserve_buffers(&ticket, &list, false, &duplicates); |
165 | if (r) { | 165 | if (r) { |
166 | dev_err(adev->dev, "leaking bo va because " | 166 | dev_err(adev->dev, "leaking bo va because " |
167 | "we fail to reserve bo (%d)\n", r); | 167 | "we fail to reserve bo (%d)\n", r); |
@@ -258,12 +258,10 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, | |||
258 | AMDGPU_GEM_USERPTR_REGISTER)) | 258 | AMDGPU_GEM_USERPTR_REGISTER)) |
259 | return -EINVAL; | 259 | return -EINVAL; |
260 | 260 | ||
261 | if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) && ( | 261 | if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) && |
262 | !(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) || | 262 | !(args->flags & AMDGPU_GEM_USERPTR_REGISTER)) { |
263 | !(args->flags & AMDGPU_GEM_USERPTR_REGISTER))) { | ||
264 | 263 | ||
265 | /* if we want to write to it we must require anonymous | 264 | /* if we want to write to it we must install a MMU notifier */ |
266 | memory and install a MMU notifier */ | ||
267 | return -EACCES; | 265 | return -EACCES; |
268 | } | 266 | } |
269 | 267 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 798d46626820..8443cea6821a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |||
@@ -85,13 +85,13 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
85 | * | 85 | * |
86 | * @adev: amdgpu_device pointer | 86 | * @adev: amdgpu_device pointer |
87 | * @ib: IB object to free | 87 | * @ib: IB object to free |
88 | * @f: the fence SA bo need wait on for the ib alloation | ||
88 | * | 89 | * |
89 | * Free an IB (all asics). | 90 | * Free an IB (all asics). |
90 | */ | 91 | */ |
91 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib) | 92 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fence *f) |
92 | { | 93 | { |
93 | amdgpu_sa_bo_free(adev, &ib->sa_bo, ib->fence); | 94 | amdgpu_sa_bo_free(adev, &ib->sa_bo, f); |
94 | fence_put(ib->fence); | ||
95 | } | 95 | } |
96 | 96 | ||
97 | /** | 97 | /** |
@@ -123,6 +123,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
123 | struct amdgpu_ib *ib = &ibs[0]; | 123 | struct amdgpu_ib *ib = &ibs[0]; |
124 | struct amdgpu_ctx *ctx, *old_ctx; | 124 | struct amdgpu_ctx *ctx, *old_ctx; |
125 | struct amdgpu_vm *vm; | 125 | struct amdgpu_vm *vm; |
126 | struct fence *hwf; | ||
126 | unsigned i; | 127 | unsigned i; |
127 | int r = 0; | 128 | int r = 0; |
128 | 129 | ||
@@ -179,7 +180,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
179 | amdgpu_ring_emit_hdp_invalidate(ring); | 180 | amdgpu_ring_emit_hdp_invalidate(ring); |
180 | } | 181 | } |
181 | 182 | ||
182 | r = amdgpu_fence_emit(ring, &ib->fence); | 183 | r = amdgpu_fence_emit(ring, &hwf); |
183 | if (r) { | 184 | if (r) { |
184 | dev_err(adev->dev, "failed to emit fence (%d)\n", r); | 185 | dev_err(adev->dev, "failed to emit fence (%d)\n", r); |
185 | ring->current_ctx = old_ctx; | 186 | ring->current_ctx = old_ctx; |
@@ -198,7 +199,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
198 | } | 199 | } |
199 | 200 | ||
200 | if (f) | 201 | if (f) |
201 | *f = fence_get(ib->fence); | 202 | *f = fence_get(hwf); |
202 | 203 | ||
203 | amdgpu_ring_commit(ring); | 204 | amdgpu_ring_commit(ring); |
204 | return 0; | 205 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 692b45560d0a..9c9b19e2f353 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | |||
@@ -70,9 +70,13 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size, | |||
70 | void amdgpu_job_free(struct amdgpu_job *job) | 70 | void amdgpu_job_free(struct amdgpu_job *job) |
71 | { | 71 | { |
72 | unsigned i; | 72 | unsigned i; |
73 | struct fence *f; | ||
74 | /* use sched fence if available */ | ||
75 | f = (job->base.s_fence)? &job->base.s_fence->base : job->fence; | ||
73 | 76 | ||
74 | for (i = 0; i < job->num_ibs; ++i) | 77 | for (i = 0; i < job->num_ibs; ++i) |
75 | amdgpu_ib_free(job->adev, &job->ibs[i]); | 78 | amdgpu_sa_bo_free(job->adev, &job->ibs[i].sa_bo, f); |
79 | fence_put(job->fence); | ||
76 | 80 | ||
77 | amdgpu_bo_unref(&job->uf.bo); | 81 | amdgpu_bo_unref(&job->uf.bo); |
78 | amdgpu_sync_free(&job->sync); | 82 | amdgpu_sync_free(&job->sync); |
@@ -156,6 +160,7 @@ static struct fence *amdgpu_job_run(struct amd_sched_job *sched_job) | |||
156 | } | 160 | } |
157 | 161 | ||
158 | err: | 162 | err: |
163 | job->fence = fence; | ||
159 | amdgpu_job_free(job); | 164 | amdgpu_job_free(job); |
160 | return fence; | 165 | return fence; |
161 | } | 166 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 9a025a77958d..151a2d42c639 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -308,7 +308,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev, | |||
308 | int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr) | 308 | int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr) |
309 | { | 309 | { |
310 | bool is_iomem; | 310 | bool is_iomem; |
311 | int r; | 311 | long r; |
312 | 312 | ||
313 | if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) | 313 | if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) |
314 | return -EPERM; | 314 | return -EPERM; |
@@ -319,14 +319,20 @@ int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr) | |||
319 | } | 319 | } |
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | |||
323 | r = reservation_object_wait_timeout_rcu(bo->tbo.resv, false, false, | ||
324 | MAX_SCHEDULE_TIMEOUT); | ||
325 | if (r < 0) | ||
326 | return r; | ||
327 | |||
322 | r = ttm_bo_kmap(&bo->tbo, 0, bo->tbo.num_pages, &bo->kmap); | 328 | r = ttm_bo_kmap(&bo->tbo, 0, bo->tbo.num_pages, &bo->kmap); |
323 | if (r) { | 329 | if (r) |
324 | return r; | 330 | return r; |
325 | } | 331 | |
326 | bo->kptr = ttm_kmap_obj_virtual(&bo->kmap, &is_iomem); | 332 | bo->kptr = ttm_kmap_obj_virtual(&bo->kmap, &is_iomem); |
327 | if (ptr) { | 333 | if (ptr) |
328 | *ptr = bo->kptr; | 334 | *ptr = bo->kptr; |
329 | } | 335 | |
330 | return 0; | 336 | return 0; |
331 | } | 337 | } |
332 | 338 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 56c07e3fdb33..972eed2ef787 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | |||
@@ -236,7 +236,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
236 | ring->adev = adev; | 236 | ring->adev = adev; |
237 | ring->idx = adev->num_rings++; | 237 | ring->idx = adev->num_rings++; |
238 | adev->rings[ring->idx] = ring; | 238 | adev->rings[ring->idx] = ring; |
239 | r = amdgpu_fence_driver_init_ring(ring); | 239 | r = amdgpu_fence_driver_init_ring(ring, |
240 | amdgpu_sched_hw_submission); | ||
240 | if (r) | 241 | if (r) |
241 | return r; | 242 | return r; |
242 | } | 243 | } |
@@ -352,30 +353,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring) | |||
352 | } | 353 | } |
353 | } | 354 | } |
354 | 355 | ||
355 | /** | ||
356 | * amdgpu_ring_from_fence - get ring from fence | ||
357 | * | ||
358 | * @f: fence structure | ||
359 | * | ||
360 | * Extract the ring a fence belongs to. Handles both scheduler as | ||
361 | * well as hardware fences. | ||
362 | */ | ||
363 | struct amdgpu_ring *amdgpu_ring_from_fence(struct fence *f) | ||
364 | { | ||
365 | struct amdgpu_fence *a_fence; | ||
366 | struct amd_sched_fence *s_fence; | ||
367 | |||
368 | s_fence = to_amd_sched_fence(f); | ||
369 | if (s_fence) | ||
370 | return container_of(s_fence->sched, struct amdgpu_ring, sched); | ||
371 | |||
372 | a_fence = to_amdgpu_fence(f); | ||
373 | if (a_fence) | ||
374 | return a_fence->ring; | ||
375 | |||
376 | return NULL; | ||
377 | } | ||
378 | |||
379 | /* | 356 | /* |
380 | * Debugfs info | 357 | * Debugfs info |
381 | */ | 358 | */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c index 2faf03bcda21..8bf84efafb04 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | |||
@@ -60,9 +60,8 @@ int amdgpu_sa_bo_manager_init(struct amdgpu_device *adev, | |||
60 | sa_manager->align = align; | 60 | sa_manager->align = align; |
61 | sa_manager->hole = &sa_manager->olist; | 61 | sa_manager->hole = &sa_manager->olist; |
62 | INIT_LIST_HEAD(&sa_manager->olist); | 62 | INIT_LIST_HEAD(&sa_manager->olist); |
63 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 63 | for (i = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) |
64 | INIT_LIST_HEAD(&sa_manager->flist[i]); | 64 | INIT_LIST_HEAD(&sa_manager->flist[i]); |
65 | } | ||
66 | 65 | ||
67 | r = amdgpu_bo_create(adev, size, align, true, domain, | 66 | r = amdgpu_bo_create(adev, size, align, true, domain, |
68 | 0, NULL, NULL, &sa_manager->bo); | 67 | 0, NULL, NULL, &sa_manager->bo); |
@@ -228,11 +227,9 @@ static bool amdgpu_sa_event(struct amdgpu_sa_manager *sa_manager, | |||
228 | unsigned soffset, eoffset, wasted; | 227 | unsigned soffset, eoffset, wasted; |
229 | int i; | 228 | int i; |
230 | 229 | ||
231 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 230 | for (i = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) |
232 | if (!list_empty(&sa_manager->flist[i])) { | 231 | if (!list_empty(&sa_manager->flist[i])) |
233 | return true; | 232 | return true; |
234 | } | ||
235 | } | ||
236 | 233 | ||
237 | soffset = amdgpu_sa_bo_hole_soffset(sa_manager); | 234 | soffset = amdgpu_sa_bo_hole_soffset(sa_manager); |
238 | eoffset = amdgpu_sa_bo_hole_eoffset(sa_manager); | 235 | eoffset = amdgpu_sa_bo_hole_eoffset(sa_manager); |
@@ -265,12 +262,11 @@ static bool amdgpu_sa_bo_next_hole(struct amdgpu_sa_manager *sa_manager, | |||
265 | /* go over all fence list and try to find the closest sa_bo | 262 | /* go over all fence list and try to find the closest sa_bo |
266 | * of the current last | 263 | * of the current last |
267 | */ | 264 | */ |
268 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 265 | for (i = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) { |
269 | struct amdgpu_sa_bo *sa_bo; | 266 | struct amdgpu_sa_bo *sa_bo; |
270 | 267 | ||
271 | if (list_empty(&sa_manager->flist[i])) { | 268 | if (list_empty(&sa_manager->flist[i])) |
272 | continue; | 269 | continue; |
273 | } | ||
274 | 270 | ||
275 | sa_bo = list_first_entry(&sa_manager->flist[i], | 271 | sa_bo = list_first_entry(&sa_manager->flist[i], |
276 | struct amdgpu_sa_bo, flist); | 272 | struct amdgpu_sa_bo, flist); |
@@ -299,7 +295,9 @@ static bool amdgpu_sa_bo_next_hole(struct amdgpu_sa_manager *sa_manager, | |||
299 | } | 295 | } |
300 | 296 | ||
301 | if (best_bo) { | 297 | if (best_bo) { |
302 | uint32_t idx = amdgpu_ring_from_fence(best_bo->fence)->idx; | 298 | uint32_t idx = best_bo->fence->context; |
299 | |||
300 | idx %= AMDGPU_SA_NUM_FENCE_LISTS; | ||
303 | ++tries[idx]; | 301 | ++tries[idx]; |
304 | sa_manager->hole = best_bo->olist.prev; | 302 | sa_manager->hole = best_bo->olist.prev; |
305 | 303 | ||
@@ -315,8 +313,8 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, | |||
315 | struct amdgpu_sa_bo **sa_bo, | 313 | struct amdgpu_sa_bo **sa_bo, |
316 | unsigned size, unsigned align) | 314 | unsigned size, unsigned align) |
317 | { | 315 | { |
318 | struct fence *fences[AMDGPU_MAX_RINGS]; | 316 | struct fence *fences[AMDGPU_SA_NUM_FENCE_LISTS]; |
319 | unsigned tries[AMDGPU_MAX_RINGS]; | 317 | unsigned tries[AMDGPU_SA_NUM_FENCE_LISTS]; |
320 | unsigned count; | 318 | unsigned count; |
321 | int i, r; | 319 | int i, r; |
322 | signed long t; | 320 | signed long t; |
@@ -338,7 +336,7 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, | |||
338 | 336 | ||
339 | spin_lock(&sa_manager->wq.lock); | 337 | spin_lock(&sa_manager->wq.lock); |
340 | do { | 338 | do { |
341 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 339 | for (i = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) { |
342 | fences[i] = NULL; | 340 | fences[i] = NULL; |
343 | tries[i] = 0; | 341 | tries[i] = 0; |
344 | } | 342 | } |
@@ -355,7 +353,7 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, | |||
355 | /* see if we can skip over some allocations */ | 353 | /* see if we can skip over some allocations */ |
356 | } while (amdgpu_sa_bo_next_hole(sa_manager, fences, tries)); | 354 | } while (amdgpu_sa_bo_next_hole(sa_manager, fences, tries)); |
357 | 355 | ||
358 | for (i = 0, count = 0; i < AMDGPU_MAX_RINGS; ++i) | 356 | for (i = 0, count = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) |
359 | if (fences[i]) | 357 | if (fences[i]) |
360 | fences[count++] = fence_get(fences[i]); | 358 | fences[count++] = fence_get(fences[i]); |
361 | 359 | ||
@@ -397,8 +395,9 @@ void amdgpu_sa_bo_free(struct amdgpu_device *adev, struct amdgpu_sa_bo **sa_bo, | |||
397 | spin_lock(&sa_manager->wq.lock); | 395 | spin_lock(&sa_manager->wq.lock); |
398 | if (fence && !fence_is_signaled(fence)) { | 396 | if (fence && !fence_is_signaled(fence)) { |
399 | uint32_t idx; | 397 | uint32_t idx; |
398 | |||
400 | (*sa_bo)->fence = fence_get(fence); | 399 | (*sa_bo)->fence = fence_get(fence); |
401 | idx = amdgpu_ring_from_fence(fence)->idx; | 400 | idx = fence->context % AMDGPU_SA_NUM_FENCE_LISTS; |
402 | list_add_tail(&(*sa_bo)->flist, &sa_manager->flist[idx]); | 401 | list_add_tail(&(*sa_bo)->flist, &sa_manager->flist[idx]); |
403 | } else { | 402 | } else { |
404 | amdgpu_sa_bo_remove_locked(*sa_bo); | 403 | amdgpu_sa_bo_remove_locked(*sa_bo); |
@@ -410,25 +409,6 @@ void amdgpu_sa_bo_free(struct amdgpu_device *adev, struct amdgpu_sa_bo **sa_bo, | |||
410 | 409 | ||
411 | #if defined(CONFIG_DEBUG_FS) | 410 | #if defined(CONFIG_DEBUG_FS) |
412 | 411 | ||
413 | static void amdgpu_sa_bo_dump_fence(struct fence *fence, struct seq_file *m) | ||
414 | { | ||
415 | struct amdgpu_fence *a_fence = to_amdgpu_fence(fence); | ||
416 | struct amd_sched_fence *s_fence = to_amd_sched_fence(fence); | ||
417 | |||
418 | if (a_fence) | ||
419 | seq_printf(m, " protected by 0x%016llx on ring %d", | ||
420 | a_fence->seq, a_fence->ring->idx); | ||
421 | |||
422 | if (s_fence) { | ||
423 | struct amdgpu_ring *ring; | ||
424 | |||
425 | |||
426 | ring = container_of(s_fence->sched, struct amdgpu_ring, sched); | ||
427 | seq_printf(m, " protected by 0x%016x on ring %d", | ||
428 | s_fence->base.seqno, ring->idx); | ||
429 | } | ||
430 | } | ||
431 | |||
432 | void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, | 412 | void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, |
433 | struct seq_file *m) | 413 | struct seq_file *m) |
434 | { | 414 | { |
@@ -445,8 +425,11 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, | |||
445 | } | 425 | } |
446 | seq_printf(m, "[0x%010llx 0x%010llx] size %8lld", | 426 | seq_printf(m, "[0x%010llx 0x%010llx] size %8lld", |
447 | soffset, eoffset, eoffset - soffset); | 427 | soffset, eoffset, eoffset - soffset); |
428 | |||
448 | if (i->fence) | 429 | if (i->fence) |
449 | amdgpu_sa_bo_dump_fence(i->fence, m); | 430 | seq_printf(m, " protected by 0x%08x on context %d", |
431 | i->fence->seqno, i->fence->context); | ||
432 | |||
450 | seq_printf(m, "\n"); | 433 | seq_printf(m, "\n"); |
451 | } | 434 | } |
452 | spin_unlock(&sa_manager->wq.lock); | 435 | spin_unlock(&sa_manager->wq.lock); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index e5f0a5e29551..c1a581044417 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |||
@@ -539,13 +539,6 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx, | |||
539 | return -EINVAL; | 539 | return -EINVAL; |
540 | } | 540 | } |
541 | 541 | ||
542 | r = reservation_object_wait_timeout_rcu(bo->tbo.resv, true, false, | ||
543 | MAX_SCHEDULE_TIMEOUT); | ||
544 | if (r < 0) { | ||
545 | DRM_ERROR("Failed waiting for UVD message (%ld)!\n", r); | ||
546 | return r; | ||
547 | } | ||
548 | |||
549 | r = amdgpu_bo_kmap(bo, &ptr); | 542 | r = amdgpu_bo_kmap(bo, &ptr); |
550 | if (r) { | 543 | if (r) { |
551 | DRM_ERROR("Failed mapping the UVD message (%ld)!\n", r); | 544 | DRM_ERROR("Failed mapping the UVD message (%ld)!\n", r); |
@@ -887,6 +880,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, | |||
887 | 880 | ||
888 | if (direct) { | 881 | if (direct) { |
889 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); | 882 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); |
883 | job->fence = f; | ||
890 | if (r) | 884 | if (r) |
891 | goto err_free; | 885 | goto err_free; |
892 | 886 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c index 6d191fb40b38..4bec0c108cea 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | |||
@@ -426,6 +426,7 @@ int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | |||
426 | ib->ptr[i] = 0x0; | 426 | ib->ptr[i] = 0x0; |
427 | 427 | ||
428 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); | 428 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); |
429 | job->fence = f; | ||
429 | if (r) | 430 | if (r) |
430 | goto err; | 431 | goto err; |
431 | 432 | ||
@@ -487,6 +488,7 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | |||
487 | 488 | ||
488 | if (direct) { | 489 | if (direct) { |
489 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); | 490 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); |
491 | job->fence = f; | ||
490 | if (r) | 492 | if (r) |
491 | goto err; | 493 | goto err; |
492 | 494 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c index 02122197d2b6..d3ac3298fba8 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c | |||
@@ -669,7 +669,8 @@ static int cik_sdma_ring_test_ib(struct amdgpu_ring *ring) | |||
669 | 669 | ||
670 | err1: | 670 | err1: |
671 | fence_put(f); | 671 | fence_put(f); |
672 | amdgpu_ib_free(adev, &ib); | 672 | amdgpu_ib_free(adev, &ib, NULL); |
673 | fence_put(f); | ||
673 | err0: | 674 | err0: |
674 | amdgpu_wb_free(adev, index); | 675 | amdgpu_wb_free(adev, index); |
675 | return r; | 676 | return r; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index a06045f040f1..bb8709066fd8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |||
@@ -2163,7 +2163,8 @@ static int gfx_v7_0_ring_test_ib(struct amdgpu_ring *ring) | |||
2163 | 2163 | ||
2164 | err2: | 2164 | err2: |
2165 | fence_put(f); | 2165 | fence_put(f); |
2166 | amdgpu_ib_free(adev, &ib); | 2166 | amdgpu_ib_free(adev, &ib, NULL); |
2167 | fence_put(f); | ||
2167 | err1: | 2168 | err1: |
2168 | amdgpu_gfx_scratch_free(adev, scratch); | 2169 | amdgpu_gfx_scratch_free(adev, scratch); |
2169 | return r; | 2170 | return r; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 509d0baaeaae..f0c7b3596480 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -732,7 +732,8 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring) | |||
732 | } | 732 | } |
733 | err2: | 733 | err2: |
734 | fence_put(f); | 734 | fence_put(f); |
735 | amdgpu_ib_free(adev, &ib); | 735 | amdgpu_ib_free(adev, &ib, NULL); |
736 | fence_put(f); | ||
736 | err1: | 737 | err1: |
737 | amdgpu_gfx_scratch_free(adev, scratch); | 738 | amdgpu_gfx_scratch_free(adev, scratch); |
738 | return r; | 739 | return r; |
@@ -1289,7 +1290,8 @@ static int gfx_v8_0_do_edc_gpr_workarounds(struct amdgpu_device *adev) | |||
1289 | 1290 | ||
1290 | fail: | 1291 | fail: |
1291 | fence_put(f); | 1292 | fence_put(f); |
1292 | amdgpu_ib_free(adev, &ib); | 1293 | amdgpu_ib_free(adev, &ib, NULL); |
1294 | fence_put(f); | ||
1293 | 1295 | ||
1294 | return r; | 1296 | return r; |
1295 | } | 1297 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c index ab9ff89a3096..6e0a86a563f3 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | |||
@@ -32,8 +32,8 @@ | |||
32 | #include "oss/oss_2_4_d.h" | 32 | #include "oss/oss_2_4_d.h" |
33 | #include "oss/oss_2_4_sh_mask.h" | 33 | #include "oss/oss_2_4_sh_mask.h" |
34 | 34 | ||
35 | #include "gmc/gmc_8_1_d.h" | 35 | #include "gmc/gmc_7_1_d.h" |
36 | #include "gmc/gmc_8_1_sh_mask.h" | 36 | #include "gmc/gmc_7_1_sh_mask.h" |
37 | 37 | ||
38 | #include "gca/gfx_8_0_d.h" | 38 | #include "gca/gfx_8_0_d.h" |
39 | #include "gca/gfx_8_0_enum.h" | 39 | #include "gca/gfx_8_0_enum.h" |
@@ -727,7 +727,8 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring) | |||
727 | 727 | ||
728 | err1: | 728 | err1: |
729 | fence_put(f); | 729 | fence_put(f); |
730 | amdgpu_ib_free(adev, &ib); | 730 | amdgpu_ib_free(adev, &ib, NULL); |
731 | fence_put(f); | ||
731 | err0: | 732 | err0: |
732 | amdgpu_wb_free(adev, index); | 733 | amdgpu_wb_free(adev, index); |
733 | return r; | 734 | return r; |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 4c24c371fec7..8c8ca98dd129 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | |||
@@ -878,7 +878,8 @@ static int sdma_v3_0_ring_test_ib(struct amdgpu_ring *ring) | |||
878 | } | 878 | } |
879 | err1: | 879 | err1: |
880 | fence_put(f); | 880 | fence_put(f); |
881 | amdgpu_ib_free(adev, &ib); | 881 | amdgpu_ib_free(adev, &ib, NULL); |
882 | fence_put(f); | ||
882 | err0: | 883 | err0: |
883 | amdgpu_wb_free(adev, index); | 884 | amdgpu_wb_free(adev, index); |
884 | return r; | 885 | return r; |
diff --git a/drivers/gpu/drm/amd/include/asic_reg/gca/gfx_7_2_enum.h b/drivers/gpu/drm/amd/include/asic_reg/gca/gfx_7_2_enum.h index 9d4347dd6125..dfe78799100d 100644 --- a/drivers/gpu/drm/amd/include/asic_reg/gca/gfx_7_2_enum.h +++ b/drivers/gpu/drm/amd/include/asic_reg/gca/gfx_7_2_enum.h | |||
@@ -6225,6 +6225,12 @@ typedef enum TCC_CACHE_POLICIES { | |||
6225 | TCC_CACHE_POLICY_STREAM = 0x1, | 6225 | TCC_CACHE_POLICY_STREAM = 0x1, |
6226 | TCC_CACHE_POLICY_BYPASS = 0x2, | 6226 | TCC_CACHE_POLICY_BYPASS = 0x2, |
6227 | } TCC_CACHE_POLICIES; | 6227 | } TCC_CACHE_POLICIES; |
6228 | typedef enum MTYPE { | ||
6229 | MTYPE_NC_NV = 0x0, | ||
6230 | MTYPE_NC = 0x1, | ||
6231 | MTYPE_CC = 0x2, | ||
6232 | MTYPE_UC = 0x3, | ||
6233 | } MTYPE; | ||
6228 | typedef enum PERFMON_COUNTER_MODE { | 6234 | typedef enum PERFMON_COUNTER_MODE { |
6229 | PERFMON_COUNTER_MODE_ACCUM = 0x0, | 6235 | PERFMON_COUNTER_MODE_ACCUM = 0x0, |
6230 | PERFMON_COUNTER_MODE_ACTIVE_CYCLES = 0x1, | 6236 | PERFMON_COUNTER_MODE_ACTIVE_CYCLES = 0x1, |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c index 727d5c9ea04c..5682490337e3 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | |||
@@ -241,6 +241,11 @@ static int cz_initialize_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
241 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 241 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
242 | PHM_PlatformCaps_DynamicUVDState); | 242 | PHM_PlatformCaps_DynamicUVDState); |
243 | 243 | ||
244 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
245 | PHM_PlatformCaps_UVDDPM); | ||
246 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
247 | PHM_PlatformCaps_VCEDPM); | ||
248 | |||
244 | cz_hwmgr->cc6_settings.cpu_cc6_disable = false; | 249 | cz_hwmgr->cc6_settings.cpu_cc6_disable = false; |
245 | cz_hwmgr->cc6_settings.cpu_pstate_disable = false; | 250 | cz_hwmgr->cc6_settings.cpu_pstate_disable = false; |
246 | cz_hwmgr->cc6_settings.nb_pstate_switch_disable = false; | 251 | cz_hwmgr->cc6_settings.nb_pstate_switch_disable = false; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c index 5cca2ecc6bea..51dedf84623c 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | |||
@@ -4275,7 +4275,6 @@ static int fiji_populate_and_upload_sclk_mclk_dpm_levels( | |||
4275 | if (data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_MCLK) { | 4275 | if (data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_MCLK) { |
4276 | dpm_table->mclk_table.dpm_levels | 4276 | dpm_table->mclk_table.dpm_levels |
4277 | [dpm_table->mclk_table.count - 1].value = mclk; | 4277 | [dpm_table->mclk_table.count - 1].value = mclk; |
4278 | |||
4279 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, | 4278 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
4280 | PHM_PlatformCaps_OD6PlusinACSupport) || | 4279 | PHM_PlatformCaps_OD6PlusinACSupport) || |
4281 | phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, | 4280 | phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
@@ -4886,6 +4885,10 @@ static void fiji_print_current_perforce_level( | |||
4886 | activity_percent >>= 8; | 4885 | activity_percent >>= 8; |
4887 | 4886 | ||
4888 | seq_printf(m, "\n [GPU load]: %u%%\n\n", activity_percent > 100 ? 100 : activity_percent); | 4887 | seq_printf(m, "\n [GPU load]: %u%%\n\n", activity_percent > 100 ? 100 : activity_percent); |
4888 | |||
4889 | seq_printf(m, "uvd %sabled\n", data->uvd_power_gated ? "dis" : "en"); | ||
4890 | |||
4891 | seq_printf(m, "vce %sabled\n", data->vce_power_gated ? "dis" : "en"); | ||
4889 | } | 4892 | } |
4890 | 4893 | ||
4891 | static int fiji_program_display_gap(struct pp_hwmgr *hwmgr) | 4894 | static int fiji_program_display_gap(struct pp_hwmgr *hwmgr) |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h index 22e273b1c1c5..a16f7cd4c238 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "smu73_discrete.h" | 29 | #include "smu73_discrete.h" |
30 | #include "ppatomctrl.h" | 30 | #include "ppatomctrl.h" |
31 | #include "fiji_ppsmc.h" | 31 | #include "fiji_ppsmc.h" |
32 | #include "pp_endian.h" | ||
32 | 33 | ||
33 | #define FIJI_MAX_HARDWARE_POWERLEVELS 2 | 34 | #define FIJI_MAX_HARDWARE_POWERLEVELS 2 |
34 | #define FIJI_AT_DFLT 30 | 35 | #define FIJI_AT_DFLT 30 |
@@ -347,15 +348,4 @@ int fiji_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate); | |||
347 | int fiji_update_acp_dpm(struct pp_hwmgr *hwmgr, bool bgate); | 348 | int fiji_update_acp_dpm(struct pp_hwmgr *hwmgr, bool bgate); |
348 | int fiji_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable); | 349 | int fiji_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable); |
349 | 350 | ||
350 | #define PP_HOST_TO_SMC_UL(X) cpu_to_be32(X) | ||
351 | #define PP_SMC_TO_HOST_UL(X) be32_to_cpu(X) | ||
352 | |||
353 | #define PP_HOST_TO_SMC_US(X) cpu_to_be16(X) | ||
354 | #define PP_SMC_TO_HOST_US(X) be16_to_cpu(X) | ||
355 | |||
356 | #define CONVERT_FROM_HOST_TO_SMC_UL(X) ((X) = PP_HOST_TO_SMC_UL(X)) | ||
357 | #define CONVERT_FROM_SMC_TO_HOST_UL(X) ((X) = PP_SMC_TO_HOST_UL(X)) | ||
358 | |||
359 | #define CONVERT_FROM_HOST_TO_SMC_US(X) ((X) = PP_HOST_TO_SMC_US(X)) | ||
360 | |||
361 | #endif /* _FIJI_HWMGR_H_ */ | 351 | #endif /* _FIJI_HWMGR_H_ */ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index aec4f8346d9c..0d5d8372953e 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | |||
@@ -5185,7 +5185,6 @@ tonga_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m) | |||
5185 | mclk = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0); | 5185 | mclk = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0); |
5186 | seq_printf(m, "\n [ mclk ]: %u MHz\n\n [ sclk ]: %u MHz\n", mclk/100, sclk/100); | 5186 | seq_printf(m, "\n [ mclk ]: %u MHz\n\n [ sclk ]: %u MHz\n", mclk/100, sclk/100); |
5187 | 5187 | ||
5188 | |||
5189 | offset = data->soft_regs_start + offsetof(SMU72_SoftRegisters, AverageGraphicsActivity); | 5188 | offset = data->soft_regs_start + offsetof(SMU72_SoftRegisters, AverageGraphicsActivity); |
5190 | activity_percent = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset); | 5189 | activity_percent = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset); |
5191 | activity_percent += 0x80; | 5190 | activity_percent += 0x80; |
@@ -5193,6 +5192,9 @@ tonga_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m) | |||
5193 | 5192 | ||
5194 | seq_printf(m, "\n [GPU load]: %u%%\n\n", activity_percent > 100 ? 100 : activity_percent); | 5193 | seq_printf(m, "\n [GPU load]: %u%%\n\n", activity_percent > 100 ? 100 : activity_percent); |
5195 | 5194 | ||
5195 | seq_printf(m, "uvd %sabled\n", data->uvd_power_gated ? "dis" : "en"); | ||
5196 | |||
5197 | seq_printf(m, "vce %sabled\n", data->vce_power_gated ? "dis" : "en"); | ||
5196 | } | 5198 | } |
5197 | 5199 | ||
5198 | static int tonga_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, const void *input) | 5200 | static int tonga_find_dpm_states_clocks_in_dpm_table(struct pp_hwmgr *hwmgr, const void *input) |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h index 49168d262ccc..f88d3bbe6671 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "ppatomctrl.h" | 28 | #include "ppatomctrl.h" |
29 | #include "ppinterrupt.h" | 29 | #include "ppinterrupt.h" |
30 | #include "tonga_powertune.h" | 30 | #include "tonga_powertune.h" |
31 | #include "pp_endian.h" | ||
31 | 32 | ||
32 | #define TONGA_MAX_HARDWARE_POWERLEVELS 2 | 33 | #define TONGA_MAX_HARDWARE_POWERLEVELS 2 |
33 | #define TONGA_DYNCLK_NUMBER_OF_TREND_COEFFICIENTS 15 | 34 | #define TONGA_DYNCLK_NUMBER_OF_TREND_COEFFICIENTS 15 |
@@ -386,17 +387,6 @@ typedef struct tonga_hwmgr tonga_hwmgr; | |||
386 | 387 | ||
387 | #define TONGA_UNUSED_GPIO_PIN 0x7F | 388 | #define TONGA_UNUSED_GPIO_PIN 0x7F |
388 | 389 | ||
389 | #define PP_HOST_TO_SMC_UL(X) cpu_to_be32(X) | ||
390 | #define PP_SMC_TO_HOST_UL(X) be32_to_cpu(X) | ||
391 | |||
392 | #define PP_HOST_TO_SMC_US(X) cpu_to_be16(X) | ||
393 | #define PP_SMC_TO_HOST_US(X) be16_to_cpu(X) | ||
394 | |||
395 | #define CONVERT_FROM_HOST_TO_SMC_UL(X) ((X) = PP_HOST_TO_SMC_UL(X)) | ||
396 | #define CONVERT_FROM_SMC_TO_HOST_UL(X) ((X) = PP_SMC_TO_HOST_UL(X)) | ||
397 | |||
398 | #define CONVERT_FROM_HOST_TO_SMC_US(X) ((X) = PP_HOST_TO_SMC_US(X)) | ||
399 | |||
400 | int tonga_hwmgr_init(struct pp_hwmgr *hwmgr); | 390 | int tonga_hwmgr_init(struct pp_hwmgr *hwmgr); |
401 | int tonga_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input); | 391 | int tonga_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input); |
402 | int tonga_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate); | 392 | int tonga_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate); |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_endian.h b/drivers/gpu/drm/amd/powerplay/inc/pp_endian.h new file mode 100644 index 000000000000..f49d1963fe85 --- /dev/null +++ b/drivers/gpu/drm/amd/powerplay/inc/pp_endian.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Advanced Micro Devices, Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #ifndef _PP_ENDIAN_H_ | ||
25 | #define _PP_ENDIAN_H_ | ||
26 | |||
27 | #define PP_HOST_TO_SMC_UL(X) cpu_to_be32(X) | ||
28 | #define PP_SMC_TO_HOST_UL(X) be32_to_cpu(X) | ||
29 | |||
30 | #define PP_HOST_TO_SMC_US(X) cpu_to_be16(X) | ||
31 | #define PP_SMC_TO_HOST_US(X) be16_to_cpu(X) | ||
32 | |||
33 | #define CONVERT_FROM_HOST_TO_SMC_UL(X) ((X) = PP_HOST_TO_SMC_UL(X)) | ||
34 | #define CONVERT_FROM_SMC_TO_HOST_UL(X) ((X) = PP_SMC_TO_HOST_UL(X)) | ||
35 | |||
36 | #define CONVERT_FROM_HOST_TO_SMC_US(X) ((X) = PP_HOST_TO_SMC_US(X)) | ||
37 | |||
38 | #endif /* _PP_ENDIAN_H_ */ | ||
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h index 504f035d1843..fc9e3d1dd409 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h | |||
@@ -32,6 +32,27 @@ struct pp_instance; | |||
32 | #define smu_lower_32_bits(n) ((uint32_t)(n)) | 32 | #define smu_lower_32_bits(n) ((uint32_t)(n)) |
33 | #define smu_upper_32_bits(n) ((uint32_t)(((n)>>16)>>16)) | 33 | #define smu_upper_32_bits(n) ((uint32_t)(((n)>>16)>>16)) |
34 | 34 | ||
35 | enum AVFS_BTC_STATUS { | ||
36 | AVFS_BTC_BOOT = 0, | ||
37 | AVFS_BTC_BOOT_STARTEDSMU, | ||
38 | AVFS_LOAD_VIRUS, | ||
39 | AVFS_BTC_VIRUS_LOADED, | ||
40 | AVFS_BTC_VIRUS_FAIL, | ||
41 | AVFS_BTC_COMPLETED_PREVIOUSLY, | ||
42 | AVFS_BTC_ENABLEAVFS, | ||
43 | AVFS_BTC_STARTED, | ||
44 | AVFS_BTC_FAILED, | ||
45 | AVFS_BTC_RESTOREVFT_FAILED, | ||
46 | AVFS_BTC_SAVEVFT_FAILED, | ||
47 | AVFS_BTC_DPMTABLESETUP_FAILED, | ||
48 | AVFS_BTC_COMPLETED_UNSAVED, | ||
49 | AVFS_BTC_COMPLETED_SAVED, | ||
50 | AVFS_BTC_COMPLETED_RESTORED, | ||
51 | AVFS_BTC_DISABLED, | ||
52 | AVFS_BTC_NOTSUPPORTED, | ||
53 | AVFS_BTC_SMUMSG_ERROR | ||
54 | }; | ||
55 | |||
35 | struct pp_smumgr_func { | 56 | struct pp_smumgr_func { |
36 | int (*smu_init)(struct pp_smumgr *smumgr); | 57 | int (*smu_init)(struct pp_smumgr *smumgr); |
37 | int (*smu_fini)(struct pp_smumgr *smumgr); | 58 | int (*smu_fini)(struct pp_smumgr *smumgr); |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h index 8cd22d9c9140..b4eb483215b1 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h +++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.h | |||
@@ -23,24 +23,6 @@ | |||
23 | #ifndef _FIJI_SMUMANAGER_H_ | 23 | #ifndef _FIJI_SMUMANAGER_H_ |
24 | #define _FIJI_SMUMANAGER_H_ | 24 | #define _FIJI_SMUMANAGER_H_ |
25 | 25 | ||
26 | enum AVFS_BTC_STATUS { | ||
27 | AVFS_BTC_BOOT = 0, | ||
28 | AVFS_BTC_BOOT_STARTEDSMU, | ||
29 | AVFS_LOAD_VIRUS, | ||
30 | AVFS_BTC_VIRUS_LOADED, | ||
31 | AVFS_BTC_VIRUS_FAIL, | ||
32 | AVFS_BTC_STARTED, | ||
33 | AVFS_BTC_FAILED, | ||
34 | AVFS_BTC_RESTOREVFT_FAILED, | ||
35 | AVFS_BTC_SAVEVFT_FAILED, | ||
36 | AVFS_BTC_DPMTABLESETUP_FAILED, | ||
37 | AVFS_BTC_COMPLETED_UNSAVED, | ||
38 | AVFS_BTC_COMPLETED_SAVED, | ||
39 | AVFS_BTC_COMPLETED_RESTORED, | ||
40 | AVFS_BTC_DISABLED, | ||
41 | AVFS_BTC_NOTSUPPORTED, | ||
42 | AVFS_BTC_SMUMSG_ERROR | ||
43 | }; | ||
44 | 26 | ||
45 | struct fiji_smu_avfs { | 27 | struct fiji_smu_avfs { |
46 | enum AVFS_BTC_STATUS AvfsBtcStatus; | 28 | enum AVFS_BTC_STATUS AvfsBtcStatus; |
diff --git a/drivers/gpu/drm/amd/scheduler/sched_fence.c b/drivers/gpu/drm/amd/scheduler/sched_fence.c index 87c78eecea64..dc115aea352b 100644 --- a/drivers/gpu/drm/amd/scheduler/sched_fence.c +++ b/drivers/gpu/drm/amd/scheduler/sched_fence.c | |||
@@ -84,12 +84,33 @@ static bool amd_sched_fence_enable_signaling(struct fence *f) | |||
84 | return true; | 84 | return true; |
85 | } | 85 | } |
86 | 86 | ||
87 | static void amd_sched_fence_release(struct fence *f) | 87 | /** |
88 | * amd_sched_fence_free - free up the fence memory | ||
89 | * | ||
90 | * @rcu: RCU callback head | ||
91 | * | ||
92 | * Free up the fence memory after the RCU grace period. | ||
93 | */ | ||
94 | static void amd_sched_fence_free(struct rcu_head *rcu) | ||
88 | { | 95 | { |
96 | struct fence *f = container_of(rcu, struct fence, rcu); | ||
89 | struct amd_sched_fence *fence = to_amd_sched_fence(f); | 97 | struct amd_sched_fence *fence = to_amd_sched_fence(f); |
90 | kmem_cache_free(sched_fence_slab, fence); | 98 | kmem_cache_free(sched_fence_slab, fence); |
91 | } | 99 | } |
92 | 100 | ||
101 | /** | ||
102 | * amd_sched_fence_release - callback that fence can be freed | ||
103 | * | ||
104 | * @fence: fence | ||
105 | * | ||
106 | * This function is called when the reference count becomes zero. | ||
107 | * It just RCU schedules freeing up the fence. | ||
108 | */ | ||
109 | static void amd_sched_fence_release(struct fence *f) | ||
110 | { | ||
111 | call_rcu(&f->rcu, amd_sched_fence_free); | ||
112 | } | ||
113 | |||
93 | const struct fence_ops amd_sched_fence_ops = { | 114 | const struct fence_ops amd_sched_fence_ops = { |
94 | .get_driver_name = amd_sched_fence_get_driver_name, | 115 | .get_driver_name = amd_sched_fence_get_driver_name, |
95 | .get_timeline_name = amd_sched_fence_get_timeline_name, | 116 | .get_timeline_name = amd_sched_fence_get_timeline_name, |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index ec1593a6a561..f66c33dd21a3 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -66,9 +66,10 @@ int atom_debug = 0; | |||
66 | static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); | 66 | static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); |
67 | int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); | 67 | int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); |
68 | 68 | ||
69 | static uint32_t atom_arg_mask[8] = | 69 | static uint32_t atom_arg_mask[8] = { |
70 | { 0xFFFFFFFF, 0xFFFF, 0xFFFF00, 0xFFFF0000, 0xFF, 0xFF00, 0xFF0000, | 70 | 0xFFFFFFFF, 0x0000FFFF, 0x00FFFF00, 0xFFFF0000, |
71 | 0xFF000000 }; | 71 | 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 |
72 | }; | ||
72 | static int atom_arg_shift[8] = { 0, 0, 8, 16, 0, 8, 16, 24 }; | 73 | static int atom_arg_shift[8] = { 0, 0, 8, 16, 0, 8, 16, 24 }; |
73 | 74 | ||
74 | static int atom_dst_to_src[8][4] = { | 75 | static int atom_dst_to_src[8][4] = { |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index e187beca38f7..cf61e0856f4a 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1665,11 +1665,11 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
1665 | } | 1665 | } |
1666 | 1666 | ||
1667 | int atombios_crtc_set_base_atomic(struct drm_crtc *crtc, | 1667 | int atombios_crtc_set_base_atomic(struct drm_crtc *crtc, |
1668 | struct drm_framebuffer *fb, | 1668 | struct drm_framebuffer *fb, |
1669 | int x, int y, enum mode_set_atomic state) | 1669 | int x, int y, enum mode_set_atomic state) |
1670 | { | 1670 | { |
1671 | struct drm_device *dev = crtc->dev; | 1671 | struct drm_device *dev = crtc->dev; |
1672 | struct radeon_device *rdev = dev->dev_private; | 1672 | struct radeon_device *rdev = dev->dev_private; |
1673 | 1673 | ||
1674 | if (ASIC_IS_DCE4(rdev)) | 1674 | if (ASIC_IS_DCE4(rdev)) |
1675 | return dce4_crtc_do_set_base(crtc, fb, x, y, 1); | 1675 | return dce4_crtc_do_set_base(crtc, fb, x, y, 1); |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 6af832545bc5..afa9db1dc0e3 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -37,10 +37,10 @@ | |||
37 | #define DP_DPCD_SIZE DP_RECEIVER_CAP_SIZE | 37 | #define DP_DPCD_SIZE DP_RECEIVER_CAP_SIZE |
38 | 38 | ||
39 | static char *voltage_names[] = { | 39 | static char *voltage_names[] = { |
40 | "0.4V", "0.6V", "0.8V", "1.2V" | 40 | "0.4V", "0.6V", "0.8V", "1.2V" |
41 | }; | 41 | }; |
42 | static char *pre_emph_names[] = { | 42 | static char *pre_emph_names[] = { |
43 | "0dB", "3.5dB", "6dB", "9.5dB" | 43 | "0dB", "3.5dB", "6dB", "9.5dB" |
44 | }; | 44 | }; |
45 | 45 | ||
46 | /***** radeon AUX functions *****/ | 46 | /***** radeon AUX functions *****/ |
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c index 69556f5e247e..38e5123708e7 100644 --- a/drivers/gpu/drm/radeon/btc_dpm.c +++ b/drivers/gpu/drm/radeon/btc_dpm.c | |||
@@ -1163,12 +1163,11 @@ u32 btc_valid_sclk[40] = | |||
1163 | 155000, 160000, 165000, 170000, 175000, 180000, 185000, 190000, 195000, 200000 | 1163 | 155000, 160000, 165000, 170000, 175000, 180000, 185000, 190000, 195000, 200000 |
1164 | }; | 1164 | }; |
1165 | 1165 | ||
1166 | static const struct radeon_blacklist_clocks btc_blacklist_clocks[] = | 1166 | static const struct radeon_blacklist_clocks btc_blacklist_clocks[] = { |
1167 | { | 1167 | { 10000, 30000, RADEON_SCLK_UP }, |
1168 | { 10000, 30000, RADEON_SCLK_UP }, | 1168 | { 15000, 30000, RADEON_SCLK_UP }, |
1169 | { 15000, 30000, RADEON_SCLK_UP }, | 1169 | { 20000, 30000, RADEON_SCLK_UP }, |
1170 | { 20000, 30000, RADEON_SCLK_UP }, | 1170 | { 25000, 30000, RADEON_SCLK_UP } |
1171 | { 25000, 30000, RADEON_SCLK_UP } | ||
1172 | }; | 1171 | }; |
1173 | 1172 | ||
1174 | void btc_get_max_clock_from_voltage_dependency_table(struct radeon_clock_voltage_dependency_table *table, | 1173 | void btc_get_max_clock_from_voltage_dependency_table(struct radeon_clock_voltage_dependency_table *table, |
@@ -1637,14 +1636,14 @@ static int btc_init_smc_table(struct radeon_device *rdev, | |||
1637 | cypress_populate_smc_voltage_tables(rdev, table); | 1636 | cypress_populate_smc_voltage_tables(rdev, table); |
1638 | 1637 | ||
1639 | switch (rdev->pm.int_thermal_type) { | 1638 | switch (rdev->pm.int_thermal_type) { |
1640 | case THERMAL_TYPE_EVERGREEN: | 1639 | case THERMAL_TYPE_EVERGREEN: |
1641 | case THERMAL_TYPE_EMC2103_WITH_INTERNAL: | 1640 | case THERMAL_TYPE_EMC2103_WITH_INTERNAL: |
1642 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL; | 1641 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL; |
1643 | break; | 1642 | break; |
1644 | case THERMAL_TYPE_NONE: | 1643 | case THERMAL_TYPE_NONE: |
1645 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE; | 1644 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE; |
1646 | break; | 1645 | break; |
1647 | default: | 1646 | default: |
1648 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL; | 1647 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL; |
1649 | break; | 1648 | break; |
1650 | } | 1649 | } |
@@ -1860,37 +1859,37 @@ static bool btc_check_s0_mc_reg_index(u16 in_reg, u16 *out_reg) | |||
1860 | case MC_SEQ_RAS_TIMING >> 2: | 1859 | case MC_SEQ_RAS_TIMING >> 2: |
1861 | *out_reg = MC_SEQ_RAS_TIMING_LP >> 2; | 1860 | *out_reg = MC_SEQ_RAS_TIMING_LP >> 2; |
1862 | break; | 1861 | break; |
1863 | case MC_SEQ_CAS_TIMING >> 2: | 1862 | case MC_SEQ_CAS_TIMING >> 2: |
1864 | *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; | 1863 | *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; |
1865 | break; | 1864 | break; |
1866 | case MC_SEQ_MISC_TIMING >> 2: | 1865 | case MC_SEQ_MISC_TIMING >> 2: |
1867 | *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; | 1866 | *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; |
1868 | break; | 1867 | break; |
1869 | case MC_SEQ_MISC_TIMING2 >> 2: | 1868 | case MC_SEQ_MISC_TIMING2 >> 2: |
1870 | *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2; | 1869 | *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2; |
1871 | break; | 1870 | break; |
1872 | case MC_SEQ_RD_CTL_D0 >> 2: | 1871 | case MC_SEQ_RD_CTL_D0 >> 2: |
1873 | *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2; | 1872 | *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2; |
1874 | break; | 1873 | break; |
1875 | case MC_SEQ_RD_CTL_D1 >> 2: | 1874 | case MC_SEQ_RD_CTL_D1 >> 2: |
1876 | *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2; | 1875 | *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2; |
1877 | break; | 1876 | break; |
1878 | case MC_SEQ_WR_CTL_D0 >> 2: | 1877 | case MC_SEQ_WR_CTL_D0 >> 2: |
1879 | *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2; | 1878 | *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2; |
1880 | break; | 1879 | break; |
1881 | case MC_SEQ_WR_CTL_D1 >> 2: | 1880 | case MC_SEQ_WR_CTL_D1 >> 2: |
1882 | *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2; | 1881 | *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2; |
1883 | break; | 1882 | break; |
1884 | case MC_PMG_CMD_EMRS >> 2: | 1883 | case MC_PMG_CMD_EMRS >> 2: |
1885 | *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2; | 1884 | *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2; |
1886 | break; | 1885 | break; |
1887 | case MC_PMG_CMD_MRS >> 2: | 1886 | case MC_PMG_CMD_MRS >> 2: |
1888 | *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2; | 1887 | *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2; |
1889 | break; | 1888 | break; |
1890 | case MC_PMG_CMD_MRS1 >> 2: | 1889 | case MC_PMG_CMD_MRS1 >> 2: |
1891 | *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2; | 1890 | *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2; |
1892 | break; | 1891 | break; |
1893 | default: | 1892 | default: |
1894 | result = false; | 1893 | result = false; |
1895 | break; | 1894 | break; |
1896 | } | 1895 | } |
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 4a09947be244..35e0fc3ae8a7 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
@@ -192,9 +192,9 @@ static void ci_fan_ctrl_set_default_mode(struct radeon_device *rdev); | |||
192 | 192 | ||
193 | static struct ci_power_info *ci_get_pi(struct radeon_device *rdev) | 193 | static struct ci_power_info *ci_get_pi(struct radeon_device *rdev) |
194 | { | 194 | { |
195 | struct ci_power_info *pi = rdev->pm.dpm.priv; | 195 | struct ci_power_info *pi = rdev->pm.dpm.priv; |
196 | 196 | ||
197 | return pi; | 197 | return pi; |
198 | } | 198 | } |
199 | 199 | ||
200 | static struct ci_ps *ci_get_ps(struct radeon_ps *rps) | 200 | static struct ci_ps *ci_get_ps(struct radeon_ps *rps) |
@@ -1632,7 +1632,7 @@ static int ci_notify_hw_of_power_source(struct radeon_device *rdev, | |||
1632 | else | 1632 | else |
1633 | power_limit = (u32)(cac_tdp_table->battery_power_limit * 256); | 1633 | power_limit = (u32)(cac_tdp_table->battery_power_limit * 256); |
1634 | 1634 | ||
1635 | ci_set_power_limit(rdev, power_limit); | 1635 | ci_set_power_limit(rdev, power_limit); |
1636 | 1636 | ||
1637 | if (pi->caps_automatic_dc_transition) { | 1637 | if (pi->caps_automatic_dc_transition) { |
1638 | if (ac_power) | 1638 | if (ac_power) |
@@ -2017,9 +2017,9 @@ static void ci_enable_display_gap(struct radeon_device *rdev) | |||
2017 | { | 2017 | { |
2018 | u32 tmp = RREG32_SMC(CG_DISPLAY_GAP_CNTL); | 2018 | u32 tmp = RREG32_SMC(CG_DISPLAY_GAP_CNTL); |
2019 | 2019 | ||
2020 | tmp &= ~(DISP_GAP_MASK | DISP_GAP_MCHG_MASK); | 2020 | tmp &= ~(DISP_GAP_MASK | DISP_GAP_MCHG_MASK); |
2021 | tmp |= (DISP_GAP(R600_PM_DISPLAY_GAP_IGNORE) | | 2021 | tmp |= (DISP_GAP(R600_PM_DISPLAY_GAP_IGNORE) | |
2022 | DISP_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK)); | 2022 | DISP_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK)); |
2023 | 2023 | ||
2024 | WREG32_SMC(CG_DISPLAY_GAP_CNTL, tmp); | 2024 | WREG32_SMC(CG_DISPLAY_GAP_CNTL, tmp); |
2025 | } | 2025 | } |
@@ -2938,8 +2938,8 @@ static int ci_populate_single_memory_level(struct radeon_device *rdev, | |||
2938 | 2938 | ||
2939 | memory_level->MinVddc = cpu_to_be32(memory_level->MinVddc * VOLTAGE_SCALE); | 2939 | memory_level->MinVddc = cpu_to_be32(memory_level->MinVddc * VOLTAGE_SCALE); |
2940 | memory_level->MinVddcPhases = cpu_to_be32(memory_level->MinVddcPhases); | 2940 | memory_level->MinVddcPhases = cpu_to_be32(memory_level->MinVddcPhases); |
2941 | memory_level->MinVddci = cpu_to_be32(memory_level->MinVddci * VOLTAGE_SCALE); | 2941 | memory_level->MinVddci = cpu_to_be32(memory_level->MinVddci * VOLTAGE_SCALE); |
2942 | memory_level->MinMvdd = cpu_to_be32(memory_level->MinMvdd * VOLTAGE_SCALE); | 2942 | memory_level->MinMvdd = cpu_to_be32(memory_level->MinMvdd * VOLTAGE_SCALE); |
2943 | 2943 | ||
2944 | memory_level->MclkFrequency = cpu_to_be32(memory_level->MclkFrequency); | 2944 | memory_level->MclkFrequency = cpu_to_be32(memory_level->MclkFrequency); |
2945 | memory_level->ActivityLevel = cpu_to_be16(memory_level->ActivityLevel); | 2945 | memory_level->ActivityLevel = cpu_to_be16(memory_level->ActivityLevel); |
@@ -3152,7 +3152,7 @@ static int ci_calculate_sclk_params(struct radeon_device *rdev, | |||
3152 | 3152 | ||
3153 | spll_func_cntl_3 &= ~SPLL_FB_DIV_MASK; | 3153 | spll_func_cntl_3 &= ~SPLL_FB_DIV_MASK; |
3154 | spll_func_cntl_3 |= SPLL_FB_DIV(fbdiv); | 3154 | spll_func_cntl_3 |= SPLL_FB_DIV(fbdiv); |
3155 | spll_func_cntl_3 |= SPLL_DITHEN; | 3155 | spll_func_cntl_3 |= SPLL_DITHEN; |
3156 | 3156 | ||
3157 | if (pi->caps_sclk_ss_support) { | 3157 | if (pi->caps_sclk_ss_support) { |
3158 | struct radeon_atom_ss ss; | 3158 | struct radeon_atom_ss ss; |
@@ -3229,7 +3229,7 @@ static int ci_populate_single_graphic_level(struct radeon_device *rdev, | |||
3229 | graphic_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; | 3229 | graphic_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; |
3230 | 3230 | ||
3231 | graphic_level->Flags = cpu_to_be32(graphic_level->Flags); | 3231 | graphic_level->Flags = cpu_to_be32(graphic_level->Flags); |
3232 | graphic_level->MinVddc = cpu_to_be32(graphic_level->MinVddc * VOLTAGE_SCALE); | 3232 | graphic_level->MinVddc = cpu_to_be32(graphic_level->MinVddc * VOLTAGE_SCALE); |
3233 | graphic_level->MinVddcPhases = cpu_to_be32(graphic_level->MinVddcPhases); | 3233 | graphic_level->MinVddcPhases = cpu_to_be32(graphic_level->MinVddcPhases); |
3234 | graphic_level->SclkFrequency = cpu_to_be32(graphic_level->SclkFrequency); | 3234 | graphic_level->SclkFrequency = cpu_to_be32(graphic_level->SclkFrequency); |
3235 | graphic_level->ActivityLevel = cpu_to_be16(graphic_level->ActivityLevel); | 3235 | graphic_level->ActivityLevel = cpu_to_be16(graphic_level->ActivityLevel); |
@@ -4393,7 +4393,7 @@ static bool ci_check_s0_mc_reg_index(u16 in_reg, u16 *out_reg) | |||
4393 | break; | 4393 | break; |
4394 | case MC_SEQ_CAS_TIMING >> 2: | 4394 | case MC_SEQ_CAS_TIMING >> 2: |
4395 | *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; | 4395 | *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; |
4396 | break; | 4396 | break; |
4397 | case MC_SEQ_MISC_TIMING >> 2: | 4397 | case MC_SEQ_MISC_TIMING >> 2: |
4398 | *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; | 4398 | *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; |
4399 | break; | 4399 | break; |
@@ -4625,7 +4625,7 @@ static int ci_initialize_mc_reg_table(struct radeon_device *rdev) | |||
4625 | if (ret) | 4625 | if (ret) |
4626 | goto init_mc_done; | 4626 | goto init_mc_done; |
4627 | 4627 | ||
4628 | ret = ci_copy_vbios_mc_reg_table(table, ci_table); | 4628 | ret = ci_copy_vbios_mc_reg_table(table, ci_table); |
4629 | if (ret) | 4629 | if (ret) |
4630 | goto init_mc_done; | 4630 | goto init_mc_done; |
4631 | 4631 | ||
@@ -4916,7 +4916,7 @@ static int ci_set_private_data_variables_based_on_pptable(struct radeon_device * | |||
4916 | allowed_mclk_vddc_table->entries[allowed_sclk_vddc_table->count - 1].clk; | 4916 | allowed_mclk_vddc_table->entries[allowed_sclk_vddc_table->count - 1].clk; |
4917 | rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddc = | 4917 | rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddc = |
4918 | allowed_sclk_vddc_table->entries[allowed_sclk_vddc_table->count - 1].v; | 4918 | allowed_sclk_vddc_table->entries[allowed_sclk_vddc_table->count - 1].v; |
4919 | rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddci = | 4919 | rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddci = |
4920 | allowed_mclk_vddci_table->entries[allowed_mclk_vddci_table->count - 1].v; | 4920 | allowed_mclk_vddci_table->entries[allowed_mclk_vddci_table->count - 1].v; |
4921 | 4921 | ||
4922 | return 0; | 4922 | return 0; |
@@ -5517,7 +5517,7 @@ static int ci_parse_power_table(struct radeon_device *rdev) | |||
5517 | struct _NonClockInfoArray *non_clock_info_array; | 5517 | struct _NonClockInfoArray *non_clock_info_array; |
5518 | union power_info *power_info; | 5518 | union power_info *power_info; |
5519 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 5519 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
5520 | u16 data_offset; | 5520 | u16 data_offset; |
5521 | u8 frev, crev; | 5521 | u8 frev, crev; |
5522 | u8 *power_state_offset; | 5522 | u8 *power_state_offset; |
5523 | struct ci_ps *ps; | 5523 | struct ci_ps *ps; |
@@ -5693,8 +5693,8 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
5693 | return ret; | 5693 | return ret; |
5694 | } | 5694 | } |
5695 | 5695 | ||
5696 | pi->dll_default_on = false; | 5696 | pi->dll_default_on = false; |
5697 | pi->sram_end = SMC_RAM_END; | 5697 | pi->sram_end = SMC_RAM_END; |
5698 | 5698 | ||
5699 | pi->activity_target[0] = CISLAND_TARGETACTIVITY_DFLT; | 5699 | pi->activity_target[0] = CISLAND_TARGETACTIVITY_DFLT; |
5700 | pi->activity_target[1] = CISLAND_TARGETACTIVITY_DFLT; | 5700 | pi->activity_target[1] = CISLAND_TARGETACTIVITY_DFLT; |
@@ -5734,9 +5734,9 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
5734 | pi->caps_uvd_dpm = true; | 5734 | pi->caps_uvd_dpm = true; |
5735 | pi->caps_vce_dpm = true; | 5735 | pi->caps_vce_dpm = true; |
5736 | 5736 | ||
5737 | ci_get_leakage_voltages(rdev); | 5737 | ci_get_leakage_voltages(rdev); |
5738 | ci_patch_dependency_tables_with_leakage(rdev); | 5738 | ci_patch_dependency_tables_with_leakage(rdev); |
5739 | ci_set_private_data_variables_based_on_pptable(rdev); | 5739 | ci_set_private_data_variables_based_on_pptable(rdev); |
5740 | 5740 | ||
5741 | rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = | 5741 | rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = |
5742 | kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); | 5742 | kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); |
@@ -5839,7 +5839,7 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
5839 | pi->vddci_control = CISLANDS_VOLTAGE_CONTROL_BY_SVID2; | 5839 | pi->vddci_control = CISLANDS_VOLTAGE_CONTROL_BY_SVID2; |
5840 | else | 5840 | else |
5841 | rdev->pm.dpm.platform_caps &= ~ATOM_PP_PLATFORM_CAP_VDDCI_CONTROL; | 5841 | rdev->pm.dpm.platform_caps &= ~ATOM_PP_PLATFORM_CAP_VDDCI_CONTROL; |
5842 | } | 5842 | } |
5843 | 5843 | ||
5844 | if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_MVDDCONTROL) { | 5844 | if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_MVDDCONTROL) { |
5845 | if (radeon_atom_is_voltage_gpio(rdev, VOLTAGE_TYPE_MVDDC, VOLTAGE_OBJ_GPIO_LUT)) | 5845 | if (radeon_atom_is_voltage_gpio(rdev, VOLTAGE_TYPE_MVDDC, VOLTAGE_OBJ_GPIO_LUT)) |
@@ -5860,7 +5860,7 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
5860 | #endif | 5860 | #endif |
5861 | 5861 | ||
5862 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 5862 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, |
5863 | &frev, &crev, &data_offset)) { | 5863 | &frev, &crev, &data_offset)) { |
5864 | pi->caps_sclk_ss_support = true; | 5864 | pi->caps_sclk_ss_support = true; |
5865 | pi->caps_mclk_ss_support = true; | 5865 | pi->caps_mclk_ss_support = true; |
5866 | pi->dynamic_ss = true; | 5866 | pi->dynamic_ss = true; |
diff --git a/drivers/gpu/drm/radeon/ci_smc.c b/drivers/gpu/drm/radeon/ci_smc.c index 35c6f648ba04..24760ee3063e 100644 --- a/drivers/gpu/drm/radeon/ci_smc.c +++ b/drivers/gpu/drm/radeon/ci_smc.c | |||
@@ -194,11 +194,11 @@ PPSMC_Result ci_wait_for_smc_inactive(struct radeon_device *rdev) | |||
194 | return PPSMC_Result_OK; | 194 | return PPSMC_Result_OK; |
195 | 195 | ||
196 | for (i = 0; i < rdev->usec_timeout; i++) { | 196 | for (i = 0; i < rdev->usec_timeout; i++) { |
197 | tmp = RREG32_SMC(SMC_SYSCON_CLOCK_CNTL_0); | 197 | tmp = RREG32_SMC(SMC_SYSCON_CLOCK_CNTL_0); |
198 | if ((tmp & CKEN) == 0) | 198 | if ((tmp & CKEN) == 0) |
199 | break; | 199 | break; |
200 | udelay(1); | 200 | udelay(1); |
201 | } | 201 | } |
202 | 202 | ||
203 | return PPSMC_Result_OK; | 203 | return PPSMC_Result_OK; |
204 | } | 204 | } |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 06001400ce8b..8ac82df2efde 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -1712,7 +1712,7 @@ static void cik_init_golden_registers(struct radeon_device *rdev) | |||
1712 | */ | 1712 | */ |
1713 | u32 cik_get_xclk(struct radeon_device *rdev) | 1713 | u32 cik_get_xclk(struct radeon_device *rdev) |
1714 | { | 1714 | { |
1715 | u32 reference_clock = rdev->clock.spll.reference_freq; | 1715 | u32 reference_clock = rdev->clock.spll.reference_freq; |
1716 | 1716 | ||
1717 | if (rdev->flags & RADEON_IS_IGP) { | 1717 | if (rdev->flags & RADEON_IS_IGP) { |
1718 | if (RREG32_SMC(GENERAL_PWRMGT) & GPU_COUNTER_CLK) | 1718 | if (RREG32_SMC(GENERAL_PWRMGT) & GPU_COUNTER_CLK) |
@@ -2343,9 +2343,13 @@ out: | |||
2343 | */ | 2343 | */ |
2344 | static void cik_tiling_mode_table_init(struct radeon_device *rdev) | 2344 | static void cik_tiling_mode_table_init(struct radeon_device *rdev) |
2345 | { | 2345 | { |
2346 | const u32 num_tile_mode_states = 32; | 2346 | u32 *tile = rdev->config.cik.tile_mode_array; |
2347 | const u32 num_secondary_tile_mode_states = 16; | 2347 | u32 *macrotile = rdev->config.cik.macrotile_mode_array; |
2348 | u32 reg_offset, gb_tile_moden, split_equal_to_row_size; | 2348 | const u32 num_tile_mode_states = |
2349 | ARRAY_SIZE(rdev->config.cik.tile_mode_array); | ||
2350 | const u32 num_secondary_tile_mode_states = | ||
2351 | ARRAY_SIZE(rdev->config.cik.macrotile_mode_array); | ||
2352 | u32 reg_offset, split_equal_to_row_size; | ||
2349 | u32 num_pipe_configs; | 2353 | u32 num_pipe_configs; |
2350 | u32 num_rbs = rdev->config.cik.max_backends_per_se * | 2354 | u32 num_rbs = rdev->config.cik.max_backends_per_se * |
2351 | rdev->config.cik.max_shader_engines; | 2355 | rdev->config.cik.max_shader_engines; |
@@ -2367,1032 +2371,669 @@ static void cik_tiling_mode_table_init(struct radeon_device *rdev) | |||
2367 | if (num_pipe_configs > 8) | 2371 | if (num_pipe_configs > 8) |
2368 | num_pipe_configs = 16; | 2372 | num_pipe_configs = 16; |
2369 | 2373 | ||
2370 | if (num_pipe_configs == 16) { | 2374 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) |
2371 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { | 2375 | tile[reg_offset] = 0; |
2372 | switch (reg_offset) { | 2376 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) |
2373 | case 0: | 2377 | macrotile[reg_offset] = 0; |
2374 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2378 | |
2375 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2379 | switch(num_pipe_configs) { |
2376 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2380 | case 16: |
2377 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); | 2381 | tile[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2378 | break; | 2382 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2379 | case 1: | 2383 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2380 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2384 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); |
2381 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2385 | tile[1] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2382 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2386 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2383 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); | 2387 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2384 | break; | 2388 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); |
2385 | case 2: | 2389 | tile[2] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2386 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2390 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2387 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2391 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2388 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2392 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); |
2389 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | 2393 | tile[3] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2390 | break; | 2394 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2391 | case 3: | 2395 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2392 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2396 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); |
2393 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2397 | tile[4] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2394 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2398 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2395 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); | 2399 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2396 | break; | 2400 | TILE_SPLIT(split_equal_to_row_size)); |
2397 | case 4: | 2401 | tile[5] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2398 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2402 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2399 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2403 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); |
2400 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2404 | tile[6] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2401 | TILE_SPLIT(split_equal_to_row_size)); | 2405 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2402 | break; | 2406 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2403 | case 5: | 2407 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); |
2404 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2408 | tile[7] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2405 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2409 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2406 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); | 2410 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2407 | break; | 2411 | TILE_SPLIT(split_equal_to_row_size)); |
2408 | case 6: | 2412 | tile[8] = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | |
2409 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2413 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16)); |
2410 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2414 | tile[9] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2411 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2415 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2412 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | 2416 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING)); |
2413 | break; | 2417 | tile[10] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2414 | case 7: | 2418 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2415 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2419 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2416 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2420 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2417 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2421 | tile[11] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2418 | TILE_SPLIT(split_equal_to_row_size)); | 2422 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2419 | break; | 2423 | PIPE_CONFIG(ADDR_SURF_P16_32x32_8x16) | |
2420 | case 8: | 2424 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2421 | gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | | 2425 | tile[12] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2422 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16)); | 2426 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2423 | break; | 2427 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2424 | case 9: | 2428 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2425 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2429 | tile[13] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2426 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2430 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2427 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING)); | 2431 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); |
2428 | break; | 2432 | tile[14] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2429 | case 10: | 2433 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2430 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2434 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2431 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2435 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2432 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2436 | tile[16] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2433 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2437 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2434 | break; | 2438 | PIPE_CONFIG(ADDR_SURF_P16_32x32_8x16) | |
2435 | case 11: | 2439 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2436 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | 2440 | tile[17] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2437 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2441 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2438 | PIPE_CONFIG(ADDR_SURF_P16_32x32_8x16) | | 2442 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2439 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2443 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2440 | break; | 2444 | tile[27] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2441 | case 12: | 2445 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2442 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2446 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING)); |
2443 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2447 | tile[28] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2444 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2448 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2445 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2449 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2446 | break; | 2450 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2447 | case 13: | 2451 | tile[29] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2448 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2452 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2449 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2453 | PIPE_CONFIG(ADDR_SURF_P16_32x32_8x16) | |
2450 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); | 2454 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2451 | break; | 2455 | tile[30] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2452 | case 14: | 2456 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2453 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2457 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | |
2454 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | 2458 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2455 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2459 | |
2456 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2460 | macrotile[0] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2457 | break; | 2461 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2458 | case 16: | 2462 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2459 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | 2463 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2460 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | 2464 | macrotile[1] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2461 | PIPE_CONFIG(ADDR_SURF_P16_32x32_8x16) | | 2465 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2462 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2466 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2463 | break; | 2467 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2464 | case 17: | 2468 | macrotile[2] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2465 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2469 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2466 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | 2470 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2467 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2471 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2468 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2472 | macrotile[3] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2469 | break; | 2473 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2470 | case 27: | 2474 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2471 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2475 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2472 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2476 | macrotile[4] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2473 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING)); | 2477 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2474 | break; | 2478 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2475 | case 28: | 2479 | NUM_BANKS(ADDR_SURF_8_BANK)); |
2476 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2480 | macrotile[5] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2477 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | 2481 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2478 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2482 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2479 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2483 | NUM_BANKS(ADDR_SURF_4_BANK)); |
2480 | break; | 2484 | macrotile[6] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2481 | case 29: | 2485 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2482 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | 2486 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2483 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | 2487 | NUM_BANKS(ADDR_SURF_2_BANK)); |
2484 | PIPE_CONFIG(ADDR_SURF_P16_32x32_8x16) | | 2488 | macrotile[8] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2485 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2489 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2486 | break; | 2490 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2487 | case 30: | 2491 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2488 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2492 | macrotile[9] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2489 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | 2493 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2490 | PIPE_CONFIG(ADDR_SURF_P16_32x32_16x16) | | 2494 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2491 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2495 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2492 | break; | 2496 | macrotile[10] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2493 | default: | 2497 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2494 | gb_tile_moden = 0; | 2498 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2495 | break; | 2499 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2496 | } | 2500 | macrotile[11] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2497 | rdev->config.cik.tile_mode_array[reg_offset] = gb_tile_moden; | 2501 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2498 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); | 2502 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2499 | } | 2503 | NUM_BANKS(ADDR_SURF_8_BANK)); |
2500 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) { | 2504 | macrotile[12] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2501 | switch (reg_offset) { | 2505 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2502 | case 0: | 2506 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2503 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2507 | NUM_BANKS(ADDR_SURF_4_BANK)); |
2504 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2508 | macrotile[13] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2505 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | 2509 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2506 | NUM_BANKS(ADDR_SURF_16_BANK)); | 2510 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2507 | break; | 2511 | NUM_BANKS(ADDR_SURF_2_BANK)); |
2508 | case 1: | 2512 | macrotile[14] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2509 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2513 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2510 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2514 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2511 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | 2515 | NUM_BANKS(ADDR_SURF_2_BANK)); |
2512 | NUM_BANKS(ADDR_SURF_16_BANK)); | 2516 | |
2513 | break; | 2517 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) |
2514 | case 2: | 2518 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), tile[reg_offset]); |
2515 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2519 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) |
2516 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2520 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), macrotile[reg_offset]); |
2517 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2521 | break; |
2518 | NUM_BANKS(ADDR_SURF_16_BANK)); | 2522 | |
2519 | break; | 2523 | case 8: |
2520 | case 3: | 2524 | tile[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2521 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2525 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2522 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2526 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2523 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2527 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); |
2524 | NUM_BANKS(ADDR_SURF_16_BANK)); | 2528 | tile[1] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2525 | break; | 2529 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2526 | case 4: | 2530 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2527 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2531 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); |
2528 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2532 | tile[2] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2529 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2533 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2530 | NUM_BANKS(ADDR_SURF_8_BANK)); | 2534 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2531 | break; | 2535 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); |
2532 | case 5: | 2536 | tile[3] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2533 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2537 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2534 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2538 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2535 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2539 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); |
2536 | NUM_BANKS(ADDR_SURF_4_BANK)); | 2540 | tile[4] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2537 | break; | 2541 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2538 | case 6: | 2542 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2539 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2543 | TILE_SPLIT(split_equal_to_row_size)); |
2540 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2544 | tile[5] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2541 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2545 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2542 | NUM_BANKS(ADDR_SURF_2_BANK)); | 2546 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); |
2543 | break; | 2547 | tile[6] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2544 | case 8: | 2548 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2545 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2549 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2546 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2550 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); |
2547 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | 2551 | tile[7] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2548 | NUM_BANKS(ADDR_SURF_16_BANK)); | 2552 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2549 | break; | 2553 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2550 | case 9: | 2554 | TILE_SPLIT(split_equal_to_row_size)); |
2551 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2555 | tile[8] = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | |
2552 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2556 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16)); |
2553 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | 2557 | tile[9] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2554 | NUM_BANKS(ADDR_SURF_16_BANK)); | 2558 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2555 | break; | 2559 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING)); |
2556 | case 10: | 2560 | tile[10] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2557 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2561 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2558 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2562 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2559 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2563 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2560 | NUM_BANKS(ADDR_SURF_16_BANK)); | 2564 | tile[11] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2561 | break; | 2565 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2562 | case 11: | 2566 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2563 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2567 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2564 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2568 | tile[12] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2565 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2569 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2566 | NUM_BANKS(ADDR_SURF_8_BANK)); | 2570 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2567 | break; | 2571 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2568 | case 12: | 2572 | tile[13] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2569 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2573 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2570 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2574 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); |
2571 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2575 | tile[14] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2572 | NUM_BANKS(ADDR_SURF_4_BANK)); | 2576 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2573 | break; | 2577 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2574 | case 13: | 2578 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2575 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2579 | tile[16] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2576 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2580 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2577 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2581 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2578 | NUM_BANKS(ADDR_SURF_2_BANK)); | 2582 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2579 | break; | 2583 | tile[17] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2580 | case 14: | 2584 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2581 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2585 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2582 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2586 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2583 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | 2587 | tile[27] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2584 | NUM_BANKS(ADDR_SURF_2_BANK)); | 2588 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2585 | break; | 2589 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING)); |
2586 | default: | 2590 | tile[28] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2587 | gb_tile_moden = 0; | 2591 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2588 | break; | 2592 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2589 | } | 2593 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2590 | rdev->config.cik.macrotile_mode_array[reg_offset] = gb_tile_moden; | 2594 | tile[29] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2591 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), gb_tile_moden); | 2595 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2592 | } | 2596 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2593 | } else if (num_pipe_configs == 8) { | 2597 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2594 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { | 2598 | tile[30] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2595 | switch (reg_offset) { | 2599 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2596 | case 0: | 2600 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | |
2597 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2601 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2598 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2602 | |
2599 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2603 | macrotile[0] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2600 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); | 2604 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2601 | break; | 2605 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | |
2602 | case 1: | 2606 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2603 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2607 | macrotile[1] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2604 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2608 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2605 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2609 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2606 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); | 2610 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2607 | break; | 2611 | macrotile[2] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2608 | case 2: | 2612 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2609 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2613 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2610 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2614 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2611 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2615 | macrotile[3] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2612 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | 2616 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2613 | break; | 2617 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2614 | case 3: | 2618 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2615 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2619 | macrotile[4] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2616 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2620 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2617 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2621 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2618 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); | 2622 | NUM_BANKS(ADDR_SURF_8_BANK)); |
2619 | break; | 2623 | macrotile[5] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2620 | case 4: | 2624 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2621 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2625 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2622 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2626 | NUM_BANKS(ADDR_SURF_4_BANK)); |
2623 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2627 | macrotile[6] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2624 | TILE_SPLIT(split_equal_to_row_size)); | 2628 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2625 | break; | 2629 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2626 | case 5: | 2630 | NUM_BANKS(ADDR_SURF_2_BANK)); |
2627 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2631 | macrotile[8] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2628 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2632 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_8) | |
2629 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); | 2633 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | |
2630 | break; | 2634 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2631 | case 6: | 2635 | macrotile[9] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2632 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2636 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2633 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2637 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | |
2634 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2638 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2635 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | 2639 | macrotile[10] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2636 | break; | 2640 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2637 | case 7: | 2641 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2638 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2642 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2639 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2643 | macrotile[11] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2640 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2644 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2641 | TILE_SPLIT(split_equal_to_row_size)); | 2645 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | |
2642 | break; | 2646 | NUM_BANKS(ADDR_SURF_16_BANK)); |
2643 | case 8: | 2647 | macrotile[12] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2644 | gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | | 2648 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2645 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16)); | 2649 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2646 | break; | 2650 | NUM_BANKS(ADDR_SURF_8_BANK)); |
2647 | case 9: | 2651 | macrotile[13] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2648 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2652 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2649 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2653 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2650 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING)); | 2654 | NUM_BANKS(ADDR_SURF_4_BANK)); |
2651 | break; | 2655 | macrotile[14] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2652 | case 10: | 2656 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2653 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2657 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | |
2654 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2658 | NUM_BANKS(ADDR_SURF_2_BANK)); |
2655 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | 2659 | |
2656 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2660 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) |
2657 | break; | 2661 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), tile[reg_offset]); |
2658 | case 11: | 2662 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) |
2659 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | 2663 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), macrotile[reg_offset]); |
2660 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2664 | break; |
2661 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2665 | |
2662 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2666 | case 4: |
2663 | break; | ||
2664 | case 12: | ||
2665 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2666 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
2667 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | ||
2668 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2669 | break; | ||
2670 | case 13: | ||
2671 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
2672 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | ||
2673 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); | ||
2674 | break; | ||
2675 | case 14: | ||
2676 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2677 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2678 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | ||
2679 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2680 | break; | ||
2681 | case 16: | ||
2682 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
2683 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2684 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | ||
2685 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2686 | break; | ||
2687 | case 17: | ||
2688 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2689 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2690 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | ||
2691 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2692 | break; | ||
2693 | case 27: | ||
2694 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
2695 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | ||
2696 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING)); | ||
2697 | break; | ||
2698 | case 28: | ||
2699 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2700 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2701 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | ||
2702 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2703 | break; | ||
2704 | case 29: | ||
2705 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
2706 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2707 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | ||
2708 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2709 | break; | ||
2710 | case 30: | ||
2711 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2712 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2713 | PIPE_CONFIG(ADDR_SURF_P8_32x32_16x16) | | ||
2714 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2715 | break; | ||
2716 | default: | ||
2717 | gb_tile_moden = 0; | ||
2718 | break; | ||
2719 | } | ||
2720 | rdev->config.cik.tile_mode_array[reg_offset] = gb_tile_moden; | ||
2721 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); | ||
2722 | } | ||
2723 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) { | ||
2724 | switch (reg_offset) { | ||
2725 | case 0: | ||
2726 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2727 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
2728 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2729 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2730 | break; | ||
2731 | case 1: | ||
2732 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2733 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
2734 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2735 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2736 | break; | ||
2737 | case 2: | ||
2738 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2739 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2740 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2741 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2742 | break; | ||
2743 | case 3: | ||
2744 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2745 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2746 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2747 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2748 | break; | ||
2749 | case 4: | ||
2750 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2751 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2752 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
2753 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
2754 | break; | ||
2755 | case 5: | ||
2756 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2757 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2758 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
2759 | NUM_BANKS(ADDR_SURF_4_BANK)); | ||
2760 | break; | ||
2761 | case 6: | ||
2762 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2763 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2764 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
2765 | NUM_BANKS(ADDR_SURF_2_BANK)); | ||
2766 | break; | ||
2767 | case 8: | ||
2768 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2769 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_8) | | ||
2770 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2771 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2772 | break; | ||
2773 | case 9: | ||
2774 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2775 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
2776 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2777 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2778 | break; | ||
2779 | case 10: | ||
2780 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2781 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
2782 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2783 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2784 | break; | ||
2785 | case 11: | ||
2786 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2787 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2788 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2789 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2790 | break; | ||
2791 | case 12: | ||
2792 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2793 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2794 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
2795 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
2796 | break; | ||
2797 | case 13: | ||
2798 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2799 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2800 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
2801 | NUM_BANKS(ADDR_SURF_4_BANK)); | ||
2802 | break; | ||
2803 | case 14: | ||
2804 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2805 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2806 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
2807 | NUM_BANKS(ADDR_SURF_2_BANK)); | ||
2808 | break; | ||
2809 | default: | ||
2810 | gb_tile_moden = 0; | ||
2811 | break; | ||
2812 | } | ||
2813 | rdev->config.cik.macrotile_mode_array[reg_offset] = gb_tile_moden; | ||
2814 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), gb_tile_moden); | ||
2815 | } | ||
2816 | } else if (num_pipe_configs == 4) { | ||
2817 | if (num_rbs == 4) { | 2667 | if (num_rbs == 4) { |
2818 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { | 2668 | tile[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2819 | switch (reg_offset) { | 2669 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2820 | case 0: | 2670 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2821 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2671 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); |
2822 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2672 | tile[1] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2823 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2673 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2824 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); | 2674 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2825 | break; | 2675 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); |
2826 | case 1: | 2676 | tile[2] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2827 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2677 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2828 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2678 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2829 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2679 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); |
2830 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); | 2680 | tile[3] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2831 | break; | 2681 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2832 | case 2: | 2682 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2833 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2683 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); |
2834 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2684 | tile[4] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2835 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2685 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2836 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | 2686 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2837 | break; | 2687 | TILE_SPLIT(split_equal_to_row_size)); |
2838 | case 3: | 2688 | tile[5] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2839 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2689 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2840 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2690 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); |
2841 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2691 | tile[6] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2842 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); | 2692 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2843 | break; | 2693 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2844 | case 4: | 2694 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); |
2845 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2695 | tile[7] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2846 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2696 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2847 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2697 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2848 | TILE_SPLIT(split_equal_to_row_size)); | 2698 | TILE_SPLIT(split_equal_to_row_size)); |
2849 | break; | 2699 | tile[8] = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | |
2850 | case 5: | 2700 | PIPE_CONFIG(ADDR_SURF_P4_16x16)); |
2851 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2701 | tile[9] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2852 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2702 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2853 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); | 2703 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING)); |
2854 | break; | 2704 | tile[10] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2855 | case 6: | 2705 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2856 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2706 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2857 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2707 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2858 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2708 | tile[11] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2859 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | 2709 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2860 | break; | 2710 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2861 | case 7: | 2711 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2862 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2712 | tile[12] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2863 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2713 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2864 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2714 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2865 | TILE_SPLIT(split_equal_to_row_size)); | 2715 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2866 | break; | 2716 | tile[13] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2867 | case 8: | 2717 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2868 | gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | | 2718 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); |
2869 | PIPE_CONFIG(ADDR_SURF_P4_16x16)); | 2719 | tile[14] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2870 | break; | 2720 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2871 | case 9: | 2721 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2872 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2722 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2873 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2723 | tile[16] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2874 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING)); | 2724 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2875 | break; | 2725 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2876 | case 10: | 2726 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2877 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2727 | tile[17] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2878 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2728 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
2879 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2729 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2880 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2730 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2881 | break; | 2731 | tile[27] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2882 | case 11: | 2732 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2883 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | 2733 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING)); |
2884 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2734 | tile[28] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2885 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2735 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2886 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2736 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2887 | break; | 2737 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2888 | case 12: | 2738 | tile[29] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2889 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2739 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2890 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2740 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2891 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2741 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2892 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2742 | tile[30] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2893 | break; | 2743 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
2894 | case 13: | 2744 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | |
2895 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2745 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2896 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | 2746 | |
2897 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); | ||
2898 | break; | ||
2899 | case 14: | ||
2900 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2901 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2902 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | ||
2903 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2904 | break; | ||
2905 | case 16: | ||
2906 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
2907 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2908 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
2909 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2910 | break; | ||
2911 | case 17: | ||
2912 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2913 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2914 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | ||
2915 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2916 | break; | ||
2917 | case 27: | ||
2918 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
2919 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | ||
2920 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING)); | ||
2921 | break; | ||
2922 | case 28: | ||
2923 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2924 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2925 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | ||
2926 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2927 | break; | ||
2928 | case 29: | ||
2929 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
2930 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2931 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
2932 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2933 | break; | ||
2934 | case 30: | ||
2935 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2936 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2937 | PIPE_CONFIG(ADDR_SURF_P4_16x16) | | ||
2938 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2939 | break; | ||
2940 | default: | ||
2941 | gb_tile_moden = 0; | ||
2942 | break; | ||
2943 | } | ||
2944 | rdev->config.cik.tile_mode_array[reg_offset] = gb_tile_moden; | ||
2945 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); | ||
2946 | } | ||
2947 | } else if (num_rbs < 4) { | 2747 | } else if (num_rbs < 4) { |
2948 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { | 2748 | tile[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2949 | switch (reg_offset) { | 2749 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2950 | case 0: | 2750 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2951 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2751 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); |
2952 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2752 | tile[1] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2953 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2753 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2954 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); | 2754 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2955 | break; | 2755 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); |
2956 | case 1: | 2756 | tile[2] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2957 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2757 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2958 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2758 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2959 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2759 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); |
2960 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); | 2760 | tile[3] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2961 | break; | 2761 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2962 | case 2: | 2762 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2963 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2763 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); |
2964 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2764 | tile[4] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2965 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2765 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2966 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | 2766 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2967 | break; | 2767 | TILE_SPLIT(split_equal_to_row_size)); |
2968 | case 3: | 2768 | tile[5] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2969 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2769 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2970 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2770 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); |
2971 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2771 | tile[6] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2972 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); | 2772 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2973 | break; | 2773 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2974 | case 4: | 2774 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); |
2975 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2775 | tile[7] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2976 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2776 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | |
2977 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2777 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2978 | TILE_SPLIT(split_equal_to_row_size)); | 2778 | TILE_SPLIT(split_equal_to_row_size)); |
2979 | break; | 2779 | tile[8] = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | |
2980 | case 5: | 2780 | PIPE_CONFIG(ADDR_SURF_P4_8x16)); |
2981 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2781 | tile[9] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2982 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2782 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2983 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); | 2783 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING)); |
2984 | break; | 2784 | tile[10] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2985 | case 6: | 2785 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2986 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2786 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2987 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2787 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2988 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2788 | tile[11] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
2989 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | 2789 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2990 | break; | 2790 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2991 | case 7: | 2791 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2992 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2792 | tile[12] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
2993 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | 2793 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2994 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2794 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2995 | TILE_SPLIT(split_equal_to_row_size)); | 2795 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
2996 | break; | 2796 | tile[13] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2997 | case 8: | 2797 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2998 | gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | | 2798 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); |
2999 | PIPE_CONFIG(ADDR_SURF_P4_8x16)); | 2799 | tile[14] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
3000 | break; | 2800 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
3001 | case 9: | 2801 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
3002 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2802 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
3003 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2803 | tile[16] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
3004 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING)); | 2804 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
3005 | break; | 2805 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
3006 | case 10: | 2806 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
3007 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2807 | tile[17] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
3008 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2808 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | |
3009 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2809 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
3010 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2810 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
3011 | break; | 2811 | tile[27] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
3012 | case 11: | 2812 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
3013 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | 2813 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING)); |
3014 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2814 | tile[28] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
3015 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2815 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
3016 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2816 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
3017 | break; | 2817 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
3018 | case 12: | 2818 | tile[29] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | |
3019 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | 2819 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
3020 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2820 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
3021 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2821 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
3022 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | 2822 | tile[30] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | |
3023 | break; | 2823 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | |
3024 | case 13: | 2824 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
3025 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2825 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); |
3026 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
3027 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); | ||
3028 | break; | ||
3029 | case 14: | ||
3030 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
3031 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
3032 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
3033 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3034 | break; | ||
3035 | case 16: | ||
3036 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
3037 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
3038 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
3039 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3040 | break; | ||
3041 | case 17: | ||
3042 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3043 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
3044 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
3045 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3046 | break; | ||
3047 | case 27: | ||
3048 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
3049 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
3050 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING)); | ||
3051 | break; | ||
3052 | case 28: | ||
3053 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3054 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
3055 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
3056 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3057 | break; | ||
3058 | case 29: | ||
3059 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
3060 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
3061 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
3062 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3063 | break; | ||
3064 | case 30: | ||
3065 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3066 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
3067 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | ||
3068 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3069 | break; | ||
3070 | default: | ||
3071 | gb_tile_moden = 0; | ||
3072 | break; | ||
3073 | } | ||
3074 | rdev->config.cik.tile_mode_array[reg_offset] = gb_tile_moden; | ||
3075 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); | ||
3076 | } | ||
3077 | } | ||
3078 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) { | ||
3079 | switch (reg_offset) { | ||
3080 | case 0: | ||
3081 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3082 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
3083 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3084 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3085 | break; | ||
3086 | case 1: | ||
3087 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3088 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
3089 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3090 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3091 | break; | ||
3092 | case 2: | ||
3093 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3094 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3095 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3096 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3097 | break; | ||
3098 | case 3: | ||
3099 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3100 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3101 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3102 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3103 | break; | ||
3104 | case 4: | ||
3105 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3106 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3107 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3108 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3109 | break; | ||
3110 | case 5: | ||
3111 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3112 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3113 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3114 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
3115 | break; | ||
3116 | case 6: | ||
3117 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3118 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3119 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
3120 | NUM_BANKS(ADDR_SURF_4_BANK)); | ||
3121 | break; | ||
3122 | case 8: | ||
3123 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
3124 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_8) | | ||
3125 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3126 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3127 | break; | ||
3128 | case 9: | ||
3129 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
3130 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
3131 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3132 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3133 | break; | ||
3134 | case 10: | ||
3135 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3136 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
3137 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3138 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3139 | break; | ||
3140 | case 11: | ||
3141 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3142 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
3143 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3144 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3145 | break; | ||
3146 | case 12: | ||
3147 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3148 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3149 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3150 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3151 | break; | ||
3152 | case 13: | ||
3153 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3154 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3155 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3156 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
3157 | break; | ||
3158 | case 14: | ||
3159 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3160 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3161 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
3162 | NUM_BANKS(ADDR_SURF_4_BANK)); | ||
3163 | break; | ||
3164 | default: | ||
3165 | gb_tile_moden = 0; | ||
3166 | break; | ||
3167 | } | ||
3168 | rdev->config.cik.macrotile_mode_array[reg_offset] = gb_tile_moden; | ||
3169 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), gb_tile_moden); | ||
3170 | } | ||
3171 | } else if (num_pipe_configs == 2) { | ||
3172 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { | ||
3173 | switch (reg_offset) { | ||
3174 | case 0: | ||
3175 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
3176 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
3177 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3178 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); | ||
3179 | break; | ||
3180 | case 1: | ||
3181 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
3182 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
3183 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3184 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); | ||
3185 | break; | ||
3186 | case 2: | ||
3187 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
3188 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
3189 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3190 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | ||
3191 | break; | ||
3192 | case 3: | ||
3193 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
3194 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
3195 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3196 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); | ||
3197 | break; | ||
3198 | case 4: | ||
3199 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
3200 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
3201 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3202 | TILE_SPLIT(split_equal_to_row_size)); | ||
3203 | break; | ||
3204 | case 5: | ||
3205 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
3206 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3207 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); | ||
3208 | break; | ||
3209 | case 6: | ||
3210 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3211 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
3212 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3213 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | ||
3214 | break; | ||
3215 | case 7: | ||
3216 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3217 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
3218 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3219 | TILE_SPLIT(split_equal_to_row_size)); | ||
3220 | break; | ||
3221 | case 8: | ||
3222 | gb_tile_moden = ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | | ||
3223 | PIPE_CONFIG(ADDR_SURF_P2); | ||
3224 | break; | ||
3225 | case 9: | ||
3226 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
3227 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
3228 | PIPE_CONFIG(ADDR_SURF_P2)); | ||
3229 | break; | ||
3230 | case 10: | ||
3231 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
3232 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
3233 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3234 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3235 | break; | ||
3236 | case 11: | ||
3237 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
3238 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
3239 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3240 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3241 | break; | ||
3242 | case 12: | ||
3243 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3244 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
3245 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3246 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3247 | break; | ||
3248 | case 13: | ||
3249 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
3250 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3251 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); | ||
3252 | break; | ||
3253 | case 14: | ||
3254 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
3255 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
3256 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3257 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3258 | break; | ||
3259 | case 16: | ||
3260 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
3261 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
3262 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3263 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3264 | break; | ||
3265 | case 17: | ||
3266 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3267 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
3268 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3269 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3270 | break; | ||
3271 | case 27: | ||
3272 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
3273 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
3274 | PIPE_CONFIG(ADDR_SURF_P2)); | ||
3275 | break; | ||
3276 | case 28: | ||
3277 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3278 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
3279 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3280 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3281 | break; | ||
3282 | case 29: | ||
3283 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
3284 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
3285 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3286 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3287 | break; | ||
3288 | case 30: | ||
3289 | gb_tile_moden = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
3290 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
3291 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
3292 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
3293 | break; | ||
3294 | default: | ||
3295 | gb_tile_moden = 0; | ||
3296 | break; | ||
3297 | } | ||
3298 | rdev->config.cik.tile_mode_array[reg_offset] = gb_tile_moden; | ||
3299 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); | ||
3300 | } | ||
3301 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) { | ||
3302 | switch (reg_offset) { | ||
3303 | case 0: | ||
3304 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
3305 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
3306 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3307 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3308 | break; | ||
3309 | case 1: | ||
3310 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
3311 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
3312 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3313 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3314 | break; | ||
3315 | case 2: | ||
3316 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3317 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
3318 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3319 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3320 | break; | ||
3321 | case 3: | ||
3322 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3323 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3324 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3325 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3326 | break; | ||
3327 | case 4: | ||
3328 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3329 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3330 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3331 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3332 | break; | ||
3333 | case 5: | ||
3334 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3335 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3336 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3337 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3338 | break; | ||
3339 | case 6: | ||
3340 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3341 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3342 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3343 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
3344 | break; | ||
3345 | case 8: | ||
3346 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_4) | | ||
3347 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_8) | | ||
3348 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3349 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3350 | break; | ||
3351 | case 9: | ||
3352 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_4) | | ||
3353 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
3354 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3355 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3356 | break; | ||
3357 | case 10: | ||
3358 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
3359 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
3360 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3361 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3362 | break; | ||
3363 | case 11: | ||
3364 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
3365 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
3366 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3367 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3368 | break; | ||
3369 | case 12: | ||
3370 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3371 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
3372 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3373 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3374 | break; | ||
3375 | case 13: | ||
3376 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3377 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3378 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3379 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3380 | break; | ||
3381 | case 14: | ||
3382 | gb_tile_moden = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3383 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3384 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3385 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
3386 | break; | ||
3387 | default: | ||
3388 | gb_tile_moden = 0; | ||
3389 | break; | ||
3390 | } | ||
3391 | rdev->config.cik.macrotile_mode_array[reg_offset] = gb_tile_moden; | ||
3392 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), gb_tile_moden); | ||
3393 | } | 2826 | } |
3394 | } else | 2827 | |
2828 | macrotile[0] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2829 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
2830 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2831 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2832 | macrotile[1] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2833 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
2834 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2835 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2836 | macrotile[2] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2837 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2838 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2839 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2840 | macrotile[3] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2841 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2842 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2843 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2844 | macrotile[4] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2845 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2846 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2847 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2848 | macrotile[5] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2849 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2850 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2851 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
2852 | macrotile[6] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2853 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2854 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
2855 | NUM_BANKS(ADDR_SURF_4_BANK)); | ||
2856 | macrotile[8] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
2857 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_8) | | ||
2858 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2859 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2860 | macrotile[9] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
2861 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
2862 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2863 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2864 | macrotile[10] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2865 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
2866 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2867 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2868 | macrotile[11] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2869 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
2870 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2871 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2872 | macrotile[12] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2873 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2874 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2875 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2876 | macrotile[13] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2877 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2878 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2879 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
2880 | macrotile[14] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2881 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2882 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) | | ||
2883 | NUM_BANKS(ADDR_SURF_4_BANK)); | ||
2884 | |||
2885 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) | ||
2886 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), tile[reg_offset]); | ||
2887 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) | ||
2888 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), macrotile[reg_offset]); | ||
2889 | break; | ||
2890 | |||
2891 | case 2: | ||
2892 | tile[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2893 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
2894 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2895 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B)); | ||
2896 | tile[1] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2897 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
2898 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2899 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B)); | ||
2900 | tile[2] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2901 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
2902 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2903 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | ||
2904 | tile[3] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2905 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
2906 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2907 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B)); | ||
2908 | tile[4] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2909 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
2910 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2911 | TILE_SPLIT(split_equal_to_row_size)); | ||
2912 | tile[5] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
2913 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2914 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING)); | ||
2915 | tile[6] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2916 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
2917 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2918 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B)); | ||
2919 | tile[7] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2920 | MICRO_TILE_MODE_NEW(ADDR_SURF_DEPTH_MICRO_TILING) | | ||
2921 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2922 | TILE_SPLIT(split_equal_to_row_size)); | ||
2923 | tile[8] = ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | | ||
2924 | PIPE_CONFIG(ADDR_SURF_P2); | ||
2925 | tile[9] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
2926 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
2927 | PIPE_CONFIG(ADDR_SURF_P2)); | ||
2928 | tile[10] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2929 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
2930 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2931 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2932 | tile[11] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
2933 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
2934 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2935 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2936 | tile[12] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2937 | MICRO_TILE_MODE_NEW(ADDR_SURF_DISPLAY_MICRO_TILING) | | ||
2938 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2939 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2940 | tile[13] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
2941 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2942 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING)); | ||
2943 | tile[14] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2944 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2945 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2946 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2947 | tile[16] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
2948 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2949 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2950 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2951 | tile[17] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2952 | MICRO_TILE_MODE_NEW(ADDR_SURF_THIN_MICRO_TILING) | | ||
2953 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2954 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2955 | tile[27] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | ||
2956 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2957 | PIPE_CONFIG(ADDR_SURF_P2)); | ||
2958 | tile[28] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2959 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2960 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2961 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2962 | tile[29] = (ARRAY_MODE(ARRAY_PRT_TILED_THIN1) | | ||
2963 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2964 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2965 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2966 | tile[30] = (ARRAY_MODE(ARRAY_PRT_2D_TILED_THIN1) | | ||
2967 | MICRO_TILE_MODE_NEW(ADDR_SURF_ROTATED_MICRO_TILING) | | ||
2968 | PIPE_CONFIG(ADDR_SURF_P2) | | ||
2969 | SAMPLE_SPLIT(ADDR_SURF_SAMPLE_SPLIT_2)); | ||
2970 | |||
2971 | macrotile[0] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
2972 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
2973 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2974 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2975 | macrotile[1] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
2976 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
2977 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2978 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2979 | macrotile[2] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2980 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
2981 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2982 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2983 | macrotile[3] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2984 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2985 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2986 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2987 | macrotile[4] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2988 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2989 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2990 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2991 | macrotile[5] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2992 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2993 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
2994 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
2995 | macrotile[6] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2996 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2997 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
2998 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
2999 | macrotile[8] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_4) | | ||
3000 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_8) | | ||
3001 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3002 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3003 | macrotile[9] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_4) | | ||
3004 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
3005 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3006 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3007 | macrotile[10] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
3008 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
3009 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3010 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3011 | macrotile[11] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | ||
3012 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
3013 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3014 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3015 | macrotile[12] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3016 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
3017 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3018 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3019 | macrotile[13] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3020 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3021 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) | | ||
3022 | NUM_BANKS(ADDR_SURF_16_BANK)); | ||
3023 | macrotile[14] = (BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
3024 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
3025 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) | | ||
3026 | NUM_BANKS(ADDR_SURF_8_BANK)); | ||
3027 | |||
3028 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) | ||
3029 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), tile[reg_offset]); | ||
3030 | for (reg_offset = 0; reg_offset < num_secondary_tile_mode_states; reg_offset++) | ||
3031 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), macrotile[reg_offset]); | ||
3032 | break; | ||
3033 | |||
3034 | default: | ||
3395 | DRM_ERROR("unknown num pipe config: 0x%x\n", num_pipe_configs); | 3035 | DRM_ERROR("unknown num pipe config: 0x%x\n", num_pipe_configs); |
3036 | } | ||
3396 | } | 3037 | } |
3397 | 3038 | ||
3398 | /** | 3039 | /** |
@@ -9709,13 +9350,13 @@ uint64_t cik_get_gpu_clock_counter(struct radeon_device *rdev) | |||
9709 | mutex_lock(&rdev->gpu_clock_mutex); | 9350 | mutex_lock(&rdev->gpu_clock_mutex); |
9710 | WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1); | 9351 | WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1); |
9711 | clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) | | 9352 | clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) | |
9712 | ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL); | 9353 | ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL); |
9713 | mutex_unlock(&rdev->gpu_clock_mutex); | 9354 | mutex_unlock(&rdev->gpu_clock_mutex); |
9714 | return clock; | 9355 | return clock; |
9715 | } | 9356 | } |
9716 | 9357 | ||
9717 | static int cik_set_uvd_clock(struct radeon_device *rdev, u32 clock, | 9358 | static int cik_set_uvd_clock(struct radeon_device *rdev, u32 clock, |
9718 | u32 cntl_reg, u32 status_reg) | 9359 | u32 cntl_reg, u32 status_reg) |
9719 | { | 9360 | { |
9720 | int r, i; | 9361 | int r, i; |
9721 | struct atom_clock_dividers dividers; | 9362 | struct atom_clock_dividers dividers; |
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index ca058589ddef..a4edd0702718 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
@@ -1620,14 +1620,14 @@ static int cypress_init_smc_table(struct radeon_device *rdev, | |||
1620 | cypress_populate_smc_voltage_tables(rdev, table); | 1620 | cypress_populate_smc_voltage_tables(rdev, table); |
1621 | 1621 | ||
1622 | switch (rdev->pm.int_thermal_type) { | 1622 | switch (rdev->pm.int_thermal_type) { |
1623 | case THERMAL_TYPE_EVERGREEN: | 1623 | case THERMAL_TYPE_EVERGREEN: |
1624 | case THERMAL_TYPE_EMC2103_WITH_INTERNAL: | 1624 | case THERMAL_TYPE_EMC2103_WITH_INTERNAL: |
1625 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL; | 1625 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL; |
1626 | break; | 1626 | break; |
1627 | case THERMAL_TYPE_NONE: | 1627 | case THERMAL_TYPE_NONE: |
1628 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE; | 1628 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE; |
1629 | break; | 1629 | break; |
1630 | default: | 1630 | default: |
1631 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL; | 1631 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL; |
1632 | break; | 1632 | break; |
1633 | } | 1633 | } |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 2ad462896896..76c4bdf21b20 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1140,7 +1140,7 @@ static int sumo_set_uvd_clock(struct radeon_device *rdev, u32 clock, | |||
1140 | int r, i; | 1140 | int r, i; |
1141 | struct atom_clock_dividers dividers; | 1141 | struct atom_clock_dividers dividers; |
1142 | 1142 | ||
1143 | r = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, | 1143 | r = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, |
1144 | clock, false, ÷rs); | 1144 | clock, false, ÷rs); |
1145 | if (r) | 1145 | if (r) |
1146 | return r; | 1146 | return r; |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 46f87d4aaf31..9e93205eb9e4 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
@@ -1816,8 +1816,8 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | offset = reloc->gpu_offset + | 1818 | offset = reloc->gpu_offset + |
1819 | (idx_value & 0xfffffff0) + | 1819 | (idx_value & 0xfffffff0) + |
1820 | ((u64)(tmp & 0xff) << 32); | 1820 | ((u64)(tmp & 0xff) << 32); |
1821 | 1821 | ||
1822 | ib[idx + 0] = offset; | 1822 | ib[idx + 0] = offset; |
1823 | ib[idx + 1] = (tmp & 0xffffff00) | (upper_32_bits(offset) & 0xff); | 1823 | ib[idx + 1] = (tmp & 0xffffff00) | (upper_32_bits(offset) & 0xff); |
@@ -1862,8 +1862,8 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
1862 | } | 1862 | } |
1863 | 1863 | ||
1864 | offset = reloc->gpu_offset + | 1864 | offset = reloc->gpu_offset + |
1865 | idx_value + | 1865 | idx_value + |
1866 | ((u64)(radeon_get_ib_value(p, idx+1) & 0xff) << 32); | 1866 | ((u64)(radeon_get_ib_value(p, idx+1) & 0xff) << 32); |
1867 | 1867 | ||
1868 | ib[idx+0] = offset; | 1868 | ib[idx+0] = offset; |
1869 | ib[idx+1] = upper_32_bits(offset) & 0xff; | 1869 | ib[idx+1] = upper_32_bits(offset) & 0xff; |
@@ -1897,8 +1897,8 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | offset = reloc->gpu_offset + | 1899 | offset = reloc->gpu_offset + |
1900 | idx_value + | 1900 | idx_value + |
1901 | ((u64)(radeon_get_ib_value(p, idx+1) & 0xff) << 32); | 1901 | ((u64)(radeon_get_ib_value(p, idx+1) & 0xff) << 32); |
1902 | 1902 | ||
1903 | ib[idx+0] = offset; | 1903 | ib[idx+0] = offset; |
1904 | ib[idx+1] = upper_32_bits(offset) & 0xff; | 1904 | ib[idx+1] = upper_32_bits(offset) & 0xff; |
@@ -1925,8 +1925,8 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
1925 | } | 1925 | } |
1926 | 1926 | ||
1927 | offset = reloc->gpu_offset + | 1927 | offset = reloc->gpu_offset + |
1928 | radeon_get_ib_value(p, idx+1) + | 1928 | radeon_get_ib_value(p, idx+1) + |
1929 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); | 1929 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); |
1930 | 1930 | ||
1931 | ib[idx+1] = offset; | 1931 | ib[idx+1] = offset; |
1932 | ib[idx+2] = upper_32_bits(offset) & 0xff; | 1932 | ib[idx+2] = upper_32_bits(offset) & 0xff; |
@@ -2098,8 +2098,8 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | offset = reloc->gpu_offset + | 2100 | offset = reloc->gpu_offset + |
2101 | (radeon_get_ib_value(p, idx+1) & 0xfffffffc) + | 2101 | (radeon_get_ib_value(p, idx+1) & 0xfffffffc) + |
2102 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); | 2102 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); |
2103 | 2103 | ||
2104 | ib[idx+1] = (ib[idx+1] & 0x3) | (offset & 0xfffffffc); | 2104 | ib[idx+1] = (ib[idx+1] & 0x3) | (offset & 0xfffffffc); |
2105 | ib[idx+2] = upper_32_bits(offset) & 0xff; | 2105 | ib[idx+2] = upper_32_bits(offset) & 0xff; |
@@ -2239,8 +2239,8 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
2239 | return -EINVAL; | 2239 | return -EINVAL; |
2240 | } | 2240 | } |
2241 | offset = reloc->gpu_offset + | 2241 | offset = reloc->gpu_offset + |
2242 | (radeon_get_ib_value(p, idx+1) & 0xfffffff8) + | 2242 | (radeon_get_ib_value(p, idx+1) & 0xfffffff8) + |
2243 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); | 2243 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); |
2244 | 2244 | ||
2245 | ib[idx+1] = offset & 0xfffffff8; | 2245 | ib[idx+1] = offset & 0xfffffff8; |
2246 | ib[idx+2] = upper_32_bits(offset) & 0xff; | 2246 | ib[idx+2] = upper_32_bits(offset) & 0xff; |
@@ -2261,8 +2261,8 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
2261 | } | 2261 | } |
2262 | 2262 | ||
2263 | offset = reloc->gpu_offset + | 2263 | offset = reloc->gpu_offset + |
2264 | (radeon_get_ib_value(p, idx+1) & 0xfffffffc) + | 2264 | (radeon_get_ib_value(p, idx+1) & 0xfffffffc) + |
2265 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); | 2265 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); |
2266 | 2266 | ||
2267 | ib[idx+1] = offset & 0xfffffffc; | 2267 | ib[idx+1] = offset & 0xfffffffc; |
2268 | ib[idx+2] = (ib[idx+2] & 0xffffff00) | (upper_32_bits(offset) & 0xff); | 2268 | ib[idx+2] = (ib[idx+2] & 0xffffff00) | (upper_32_bits(offset) & 0xff); |
@@ -2283,8 +2283,8 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
2283 | } | 2283 | } |
2284 | 2284 | ||
2285 | offset = reloc->gpu_offset + | 2285 | offset = reloc->gpu_offset + |
2286 | (radeon_get_ib_value(p, idx+1) & 0xfffffffc) + | 2286 | (radeon_get_ib_value(p, idx+1) & 0xfffffffc) + |
2287 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); | 2287 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); |
2288 | 2288 | ||
2289 | ib[idx+1] = offset & 0xfffffffc; | 2289 | ib[idx+1] = offset & 0xfffffffc; |
2290 | ib[idx+2] = (ib[idx+2] & 0xffffff00) | (upper_32_bits(offset) & 0xff); | 2290 | ib[idx+2] = (ib[idx+2] & 0xffffff00) | (upper_32_bits(offset) & 0xff); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 3cf04a2f44bb..f766c967a284 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -206,7 +206,7 @@ void evergreen_hdmi_write_sad_regs(struct drm_encoder *encoder, | |||
206 | * build a AVI Info Frame | 206 | * build a AVI Info Frame |
207 | */ | 207 | */ |
208 | void evergreen_set_avi_packet(struct radeon_device *rdev, u32 offset, | 208 | void evergreen_set_avi_packet(struct radeon_device *rdev, u32 offset, |
209 | unsigned char *buffer, size_t size) | 209 | unsigned char *buffer, size_t size) |
210 | { | 210 | { |
211 | uint8_t *frame = buffer + 3; | 211 | uint8_t *frame = buffer + 3; |
212 | 212 | ||
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 2d71da448487..d0240743a17c 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -2640,7 +2640,7 @@ static int kv_parse_power_table(struct radeon_device *rdev) | |||
2640 | struct _NonClockInfoArray *non_clock_info_array; | 2640 | struct _NonClockInfoArray *non_clock_info_array; |
2641 | union power_info *power_info; | 2641 | union power_info *power_info; |
2642 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 2642 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
2643 | u16 data_offset; | 2643 | u16 data_offset; |
2644 | u8 frev, crev; | 2644 | u8 frev, crev; |
2645 | u8 *power_state_offset; | 2645 | u8 *power_state_offset; |
2646 | struct kv_ps *ps; | 2646 | struct kv_ps *ps; |
@@ -2738,7 +2738,7 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2738 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) | 2738 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
2739 | pi->at[i] = TRINITY_AT_DFLT; | 2739 | pi->at[i] = TRINITY_AT_DFLT; |
2740 | 2740 | ||
2741 | pi->sram_end = SMC_RAM_END; | 2741 | pi->sram_end = SMC_RAM_END; |
2742 | 2742 | ||
2743 | /* Enabling nb dpm on an asrock system prevents dpm from working */ | 2743 | /* Enabling nb dpm on an asrock system prevents dpm from working */ |
2744 | if (rdev->pdev->subsystem_vendor == 0x1849) | 2744 | if (rdev->pdev->subsystem_vendor == 0x1849) |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 158872eb78e4..b88d63c9be99 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1257,7 +1257,7 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
1257 | tmp = RREG32_CG(CG_CGTT_LOCAL_0); | 1257 | tmp = RREG32_CG(CG_CGTT_LOCAL_0); |
1258 | tmp &= ~0x00380000; | 1258 | tmp &= ~0x00380000; |
1259 | WREG32_CG(CG_CGTT_LOCAL_0, tmp); | 1259 | WREG32_CG(CG_CGTT_LOCAL_0, tmp); |
1260 | tmp = RREG32_CG(CG_CGTT_LOCAL_1); | 1260 | tmp = RREG32_CG(CG_CGTT_LOCAL_1); |
1261 | tmp &= ~0x0e000000; | 1261 | tmp &= ~0x0e000000; |
1262 | WREG32_CG(CG_CGTT_LOCAL_1, tmp); | 1262 | WREG32_CG(CG_CGTT_LOCAL_1, tmp); |
1263 | } | 1263 | } |
@@ -2634,7 +2634,7 @@ int tn_set_vce_clocks(struct radeon_device *rdev, u32 evclk, u32 ecclk) | |||
2634 | struct atom_clock_dividers dividers; | 2634 | struct atom_clock_dividers dividers; |
2635 | int r, i; | 2635 | int r, i; |
2636 | 2636 | ||
2637 | r = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, | 2637 | r = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, |
2638 | ecclk, false, ÷rs); | 2638 | ecclk, false, ÷rs); |
2639 | if (r) | 2639 | if (r) |
2640 | return r; | 2640 | return r; |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index c3d531a1114b..4a601f990562 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
@@ -725,9 +725,9 @@ extern int ni_mc_load_microcode(struct radeon_device *rdev); | |||
725 | 725 | ||
726 | struct ni_power_info *ni_get_pi(struct radeon_device *rdev) | 726 | struct ni_power_info *ni_get_pi(struct radeon_device *rdev) |
727 | { | 727 | { |
728 | struct ni_power_info *pi = rdev->pm.dpm.priv; | 728 | struct ni_power_info *pi = rdev->pm.dpm.priv; |
729 | 729 | ||
730 | return pi; | 730 | return pi; |
731 | } | 731 | } |
732 | 732 | ||
733 | struct ni_ps *ni_get_ps(struct radeon_ps *rps) | 733 | struct ni_ps *ni_get_ps(struct radeon_ps *rps) |
@@ -1096,9 +1096,9 @@ static void ni_stop_smc(struct radeon_device *rdev) | |||
1096 | 1096 | ||
1097 | static int ni_process_firmware_header(struct radeon_device *rdev) | 1097 | static int ni_process_firmware_header(struct radeon_device *rdev) |
1098 | { | 1098 | { |
1099 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 1099 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
1100 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 1100 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
1101 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 1101 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
1102 | u32 tmp; | 1102 | u32 tmp; |
1103 | int ret; | 1103 | int ret; |
1104 | 1104 | ||
@@ -1202,14 +1202,14 @@ static int ni_enter_ulp_state(struct radeon_device *rdev) | |||
1202 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 1202 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
1203 | 1203 | ||
1204 | if (pi->gfx_clock_gating) { | 1204 | if (pi->gfx_clock_gating) { |
1205 | WREG32_P(SCLK_PWRMGT_CNTL, 0, ~DYN_GFX_CLK_OFF_EN); | 1205 | WREG32_P(SCLK_PWRMGT_CNTL, 0, ~DYN_GFX_CLK_OFF_EN); |
1206 | WREG32_P(SCLK_PWRMGT_CNTL, GFX_CLK_FORCE_ON, ~GFX_CLK_FORCE_ON); | 1206 | WREG32_P(SCLK_PWRMGT_CNTL, GFX_CLK_FORCE_ON, ~GFX_CLK_FORCE_ON); |
1207 | WREG32_P(SCLK_PWRMGT_CNTL, 0, ~GFX_CLK_FORCE_ON); | 1207 | WREG32_P(SCLK_PWRMGT_CNTL, 0, ~GFX_CLK_FORCE_ON); |
1208 | RREG32(GB_ADDR_CONFIG); | 1208 | RREG32(GB_ADDR_CONFIG); |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | WREG32_P(SMC_MSG, HOST_SMC_MSG(PPSMC_MSG_SwitchToMinimumPower), | 1211 | WREG32_P(SMC_MSG, HOST_SMC_MSG(PPSMC_MSG_SwitchToMinimumPower), |
1212 | ~HOST_SMC_MSG_MASK); | 1212 | ~HOST_SMC_MSG_MASK); |
1213 | 1213 | ||
1214 | udelay(25000); | 1214 | udelay(25000); |
1215 | 1215 | ||
@@ -1321,12 +1321,12 @@ static void ni_populate_mvdd_value(struct radeon_device *rdev, | |||
1321 | u32 mclk, | 1321 | u32 mclk, |
1322 | NISLANDS_SMC_VOLTAGE_VALUE *voltage) | 1322 | NISLANDS_SMC_VOLTAGE_VALUE *voltage) |
1323 | { | 1323 | { |
1324 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 1324 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
1325 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 1325 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
1326 | 1326 | ||
1327 | if (!pi->mvdd_control) { | 1327 | if (!pi->mvdd_control) { |
1328 | voltage->index = eg_pi->mvdd_high_index; | 1328 | voltage->index = eg_pi->mvdd_high_index; |
1329 | voltage->value = cpu_to_be16(MVDD_HIGH_VALUE); | 1329 | voltage->value = cpu_to_be16(MVDD_HIGH_VALUE); |
1330 | return; | 1330 | return; |
1331 | } | 1331 | } |
1332 | 1332 | ||
@@ -1510,47 +1510,47 @@ int ni_copy_and_switch_arb_sets(struct radeon_device *rdev, | |||
1510 | u32 mc_cg_config; | 1510 | u32 mc_cg_config; |
1511 | 1511 | ||
1512 | switch (arb_freq_src) { | 1512 | switch (arb_freq_src) { |
1513 | case MC_CG_ARB_FREQ_F0: | 1513 | case MC_CG_ARB_FREQ_F0: |
1514 | mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING); | 1514 | mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING); |
1515 | mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2); | 1515 | mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2); |
1516 | burst_time = (RREG32(MC_ARB_BURST_TIME) & STATE0_MASK) >> STATE0_SHIFT; | 1516 | burst_time = (RREG32(MC_ARB_BURST_TIME) & STATE0_MASK) >> STATE0_SHIFT; |
1517 | break; | 1517 | break; |
1518 | case MC_CG_ARB_FREQ_F1: | 1518 | case MC_CG_ARB_FREQ_F1: |
1519 | mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING_1); | 1519 | mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING_1); |
1520 | mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2_1); | 1520 | mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2_1); |
1521 | burst_time = (RREG32(MC_ARB_BURST_TIME) & STATE1_MASK) >> STATE1_SHIFT; | 1521 | burst_time = (RREG32(MC_ARB_BURST_TIME) & STATE1_MASK) >> STATE1_SHIFT; |
1522 | break; | 1522 | break; |
1523 | case MC_CG_ARB_FREQ_F2: | 1523 | case MC_CG_ARB_FREQ_F2: |
1524 | mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING_2); | 1524 | mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING_2); |
1525 | mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2_2); | 1525 | mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2_2); |
1526 | burst_time = (RREG32(MC_ARB_BURST_TIME) & STATE2_MASK) >> STATE2_SHIFT; | 1526 | burst_time = (RREG32(MC_ARB_BURST_TIME) & STATE2_MASK) >> STATE2_SHIFT; |
1527 | break; | 1527 | break; |
1528 | case MC_CG_ARB_FREQ_F3: | 1528 | case MC_CG_ARB_FREQ_F3: |
1529 | mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING_3); | 1529 | mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING_3); |
1530 | mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2_3); | 1530 | mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2_3); |
1531 | burst_time = (RREG32(MC_ARB_BURST_TIME) & STATE3_MASK) >> STATE3_SHIFT; | 1531 | burst_time = (RREG32(MC_ARB_BURST_TIME) & STATE3_MASK) >> STATE3_SHIFT; |
1532 | break; | 1532 | break; |
1533 | default: | 1533 | default: |
1534 | return -EINVAL; | 1534 | return -EINVAL; |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | switch (arb_freq_dest) { | 1537 | switch (arb_freq_dest) { |
1538 | case MC_CG_ARB_FREQ_F0: | 1538 | case MC_CG_ARB_FREQ_F0: |
1539 | WREG32(MC_ARB_DRAM_TIMING, mc_arb_dram_timing); | 1539 | WREG32(MC_ARB_DRAM_TIMING, mc_arb_dram_timing); |
1540 | WREG32(MC_ARB_DRAM_TIMING2, mc_arb_dram_timing2); | 1540 | WREG32(MC_ARB_DRAM_TIMING2, mc_arb_dram_timing2); |
1541 | WREG32_P(MC_ARB_BURST_TIME, STATE0(burst_time), ~STATE0_MASK); | 1541 | WREG32_P(MC_ARB_BURST_TIME, STATE0(burst_time), ~STATE0_MASK); |
1542 | break; | 1542 | break; |
1543 | case MC_CG_ARB_FREQ_F1: | 1543 | case MC_CG_ARB_FREQ_F1: |
1544 | WREG32(MC_ARB_DRAM_TIMING_1, mc_arb_dram_timing); | 1544 | WREG32(MC_ARB_DRAM_TIMING_1, mc_arb_dram_timing); |
1545 | WREG32(MC_ARB_DRAM_TIMING2_1, mc_arb_dram_timing2); | 1545 | WREG32(MC_ARB_DRAM_TIMING2_1, mc_arb_dram_timing2); |
1546 | WREG32_P(MC_ARB_BURST_TIME, STATE1(burst_time), ~STATE1_MASK); | 1546 | WREG32_P(MC_ARB_BURST_TIME, STATE1(burst_time), ~STATE1_MASK); |
1547 | break; | 1547 | break; |
1548 | case MC_CG_ARB_FREQ_F2: | 1548 | case MC_CG_ARB_FREQ_F2: |
1549 | WREG32(MC_ARB_DRAM_TIMING_2, mc_arb_dram_timing); | 1549 | WREG32(MC_ARB_DRAM_TIMING_2, mc_arb_dram_timing); |
1550 | WREG32(MC_ARB_DRAM_TIMING2_2, mc_arb_dram_timing2); | 1550 | WREG32(MC_ARB_DRAM_TIMING2_2, mc_arb_dram_timing2); |
1551 | WREG32_P(MC_ARB_BURST_TIME, STATE2(burst_time), ~STATE2_MASK); | 1551 | WREG32_P(MC_ARB_BURST_TIME, STATE2(burst_time), ~STATE2_MASK); |
1552 | break; | 1552 | break; |
1553 | case MC_CG_ARB_FREQ_F3: | 1553 | case MC_CG_ARB_FREQ_F3: |
1554 | WREG32(MC_ARB_DRAM_TIMING_3, mc_arb_dram_timing); | 1554 | WREG32(MC_ARB_DRAM_TIMING_3, mc_arb_dram_timing); |
1555 | WREG32(MC_ARB_DRAM_TIMING2_3, mc_arb_dram_timing2); | 1555 | WREG32(MC_ARB_DRAM_TIMING2_3, mc_arb_dram_timing2); |
1556 | WREG32_P(MC_ARB_BURST_TIME, STATE3(burst_time), ~STATE3_MASK); | 1556 | WREG32_P(MC_ARB_BURST_TIME, STATE3(burst_time), ~STATE3_MASK); |
@@ -1621,9 +1621,7 @@ static int ni_populate_memory_timing_parameters(struct radeon_device *rdev, | |||
1621 | (u8)rv770_calculate_memory_refresh_rate(rdev, pl->sclk); | 1621 | (u8)rv770_calculate_memory_refresh_rate(rdev, pl->sclk); |
1622 | 1622 | ||
1623 | 1623 | ||
1624 | radeon_atom_set_engine_dram_timings(rdev, | 1624 | radeon_atom_set_engine_dram_timings(rdev, pl->sclk, pl->mclk); |
1625 | pl->sclk, | ||
1626 | pl->mclk); | ||
1627 | 1625 | ||
1628 | dram_timing = RREG32(MC_ARB_DRAM_TIMING); | 1626 | dram_timing = RREG32(MC_ARB_DRAM_TIMING); |
1629 | dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2); | 1627 | dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2); |
@@ -1867,9 +1865,9 @@ static int ni_populate_smc_acpi_state(struct radeon_device *rdev, | |||
1867 | 1865 | ||
1868 | mpll_ad_func_cntl_2 |= BIAS_GEN_PDNB | RESET_EN; | 1866 | mpll_ad_func_cntl_2 |= BIAS_GEN_PDNB | RESET_EN; |
1869 | 1867 | ||
1870 | if (pi->mem_gddr5) | 1868 | if (pi->mem_gddr5) |
1871 | mpll_dq_func_cntl &= ~PDNB; | 1869 | mpll_dq_func_cntl &= ~PDNB; |
1872 | mpll_dq_func_cntl_2 |= BIAS_GEN_PDNB | RESET_EN | BYPASS; | 1870 | mpll_dq_func_cntl_2 |= BIAS_GEN_PDNB | RESET_EN | BYPASS; |
1873 | 1871 | ||
1874 | 1872 | ||
1875 | mclk_pwrmgt_cntl |= (MRDCKA0_RESET | | 1873 | mclk_pwrmgt_cntl |= (MRDCKA0_RESET | |
@@ -1891,15 +1889,15 @@ static int ni_populate_smc_acpi_state(struct radeon_device *rdev, | |||
1891 | MRDCKD1_PDNB); | 1889 | MRDCKD1_PDNB); |
1892 | 1890 | ||
1893 | dll_cntl |= (MRDCKA0_BYPASS | | 1891 | dll_cntl |= (MRDCKA0_BYPASS | |
1894 | MRDCKA1_BYPASS | | 1892 | MRDCKA1_BYPASS | |
1895 | MRDCKB0_BYPASS | | 1893 | MRDCKB0_BYPASS | |
1896 | MRDCKB1_BYPASS | | 1894 | MRDCKB1_BYPASS | |
1897 | MRDCKC0_BYPASS | | 1895 | MRDCKC0_BYPASS | |
1898 | MRDCKC1_BYPASS | | 1896 | MRDCKC1_BYPASS | |
1899 | MRDCKD0_BYPASS | | 1897 | MRDCKD0_BYPASS | |
1900 | MRDCKD1_BYPASS); | 1898 | MRDCKD1_BYPASS); |
1901 | 1899 | ||
1902 | spll_func_cntl_2 &= ~SCLK_MUX_SEL_MASK; | 1900 | spll_func_cntl_2 &= ~SCLK_MUX_SEL_MASK; |
1903 | spll_func_cntl_2 |= SCLK_MUX_SEL(4); | 1901 | spll_func_cntl_2 |= SCLK_MUX_SEL(4); |
1904 | 1902 | ||
1905 | table->ACPIState.levels[0].mclk.vMPLL_AD_FUNC_CNTL = cpu_to_be32(mpll_ad_func_cntl); | 1903 | table->ACPIState.levels[0].mclk.vMPLL_AD_FUNC_CNTL = cpu_to_be32(mpll_ad_func_cntl); |
@@ -2089,7 +2087,7 @@ static int ni_populate_sclk_value(struct radeon_device *rdev, | |||
2089 | 2087 | ||
2090 | static int ni_init_smc_spll_table(struct radeon_device *rdev) | 2088 | static int ni_init_smc_spll_table(struct radeon_device *rdev) |
2091 | { | 2089 | { |
2092 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 2090 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
2093 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 2091 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
2094 | SMC_NISLANDS_SPLL_DIV_TABLE *spll_table; | 2092 | SMC_NISLANDS_SPLL_DIV_TABLE *spll_table; |
2095 | NISLANDS_SMC_SCLK_VALUE sclk_params; | 2093 | NISLANDS_SMC_SCLK_VALUE sclk_params; |
@@ -2311,8 +2309,8 @@ static int ni_convert_power_level_to_smc(struct radeon_device *rdev, | |||
2311 | NISLANDS_SMC_HW_PERFORMANCE_LEVEL *level) | 2309 | NISLANDS_SMC_HW_PERFORMANCE_LEVEL *level) |
2312 | { | 2310 | { |
2313 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 2311 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
2314 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 2312 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
2315 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 2313 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
2316 | int ret; | 2314 | int ret; |
2317 | bool dll_state_on; | 2315 | bool dll_state_on; |
2318 | u16 std_vddc; | 2316 | u16 std_vddc; |
@@ -2391,8 +2389,8 @@ static int ni_populate_smc_t(struct radeon_device *rdev, | |||
2391 | struct radeon_ps *radeon_state, | 2389 | struct radeon_ps *radeon_state, |
2392 | NISLANDS_SMC_SWSTATE *smc_state) | 2390 | NISLANDS_SMC_SWSTATE *smc_state) |
2393 | { | 2391 | { |
2394 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 2392 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
2395 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 2393 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
2396 | struct ni_ps *state = ni_get_ps(radeon_state); | 2394 | struct ni_ps *state = ni_get_ps(radeon_state); |
2397 | u32 a_t; | 2395 | u32 a_t; |
2398 | u32 t_l, t_h; | 2396 | u32 t_l, t_h; |
@@ -2451,8 +2449,8 @@ static int ni_populate_power_containment_values(struct radeon_device *rdev, | |||
2451 | struct radeon_ps *radeon_state, | 2449 | struct radeon_ps *radeon_state, |
2452 | NISLANDS_SMC_SWSTATE *smc_state) | 2450 | NISLANDS_SMC_SWSTATE *smc_state) |
2453 | { | 2451 | { |
2454 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 2452 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
2455 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 2453 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
2456 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 2454 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
2457 | struct ni_ps *state = ni_get_ps(radeon_state); | 2455 | struct ni_ps *state = ni_get_ps(radeon_state); |
2458 | u32 prev_sclk; | 2456 | u32 prev_sclk; |
@@ -2595,7 +2593,7 @@ static int ni_enable_power_containment(struct radeon_device *rdev, | |||
2595 | struct radeon_ps *radeon_new_state, | 2593 | struct radeon_ps *radeon_new_state, |
2596 | bool enable) | 2594 | bool enable) |
2597 | { | 2595 | { |
2598 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 2596 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
2599 | PPSMC_Result smc_result; | 2597 | PPSMC_Result smc_result; |
2600 | int ret = 0; | 2598 | int ret = 0; |
2601 | 2599 | ||
@@ -2625,7 +2623,7 @@ static int ni_convert_power_state_to_smc(struct radeon_device *rdev, | |||
2625 | struct radeon_ps *radeon_state, | 2623 | struct radeon_ps *radeon_state, |
2626 | NISLANDS_SMC_SWSTATE *smc_state) | 2624 | NISLANDS_SMC_SWSTATE *smc_state) |
2627 | { | 2625 | { |
2628 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 2626 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
2629 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 2627 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
2630 | struct ni_ps *state = ni_get_ps(radeon_state); | 2628 | struct ni_ps *state = ni_get_ps(radeon_state); |
2631 | int i, ret; | 2629 | int i, ret; |
@@ -2770,46 +2768,46 @@ static bool ni_check_s0_mc_reg_index(u16 in_reg, u16 *out_reg) | |||
2770 | bool result = true; | 2768 | bool result = true; |
2771 | 2769 | ||
2772 | switch (in_reg) { | 2770 | switch (in_reg) { |
2773 | case MC_SEQ_RAS_TIMING >> 2: | 2771 | case MC_SEQ_RAS_TIMING >> 2: |
2774 | *out_reg = MC_SEQ_RAS_TIMING_LP >> 2; | 2772 | *out_reg = MC_SEQ_RAS_TIMING_LP >> 2; |
2775 | break; | 2773 | break; |
2776 | case MC_SEQ_CAS_TIMING >> 2: | 2774 | case MC_SEQ_CAS_TIMING >> 2: |
2777 | *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; | 2775 | *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; |
2778 | break; | 2776 | break; |
2779 | case MC_SEQ_MISC_TIMING >> 2: | 2777 | case MC_SEQ_MISC_TIMING >> 2: |
2780 | *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; | 2778 | *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; |
2781 | break; | 2779 | break; |
2782 | case MC_SEQ_MISC_TIMING2 >> 2: | 2780 | case MC_SEQ_MISC_TIMING2 >> 2: |
2783 | *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2; | 2781 | *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2; |
2784 | break; | 2782 | break; |
2785 | case MC_SEQ_RD_CTL_D0 >> 2: | 2783 | case MC_SEQ_RD_CTL_D0 >> 2: |
2786 | *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2; | 2784 | *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2; |
2787 | break; | 2785 | break; |
2788 | case MC_SEQ_RD_CTL_D1 >> 2: | 2786 | case MC_SEQ_RD_CTL_D1 >> 2: |
2789 | *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2; | 2787 | *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2; |
2790 | break; | 2788 | break; |
2791 | case MC_SEQ_WR_CTL_D0 >> 2: | 2789 | case MC_SEQ_WR_CTL_D0 >> 2: |
2792 | *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2; | 2790 | *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2; |
2793 | break; | 2791 | break; |
2794 | case MC_SEQ_WR_CTL_D1 >> 2: | 2792 | case MC_SEQ_WR_CTL_D1 >> 2: |
2795 | *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2; | 2793 | *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2; |
2796 | break; | 2794 | break; |
2797 | case MC_PMG_CMD_EMRS >> 2: | 2795 | case MC_PMG_CMD_EMRS >> 2: |
2798 | *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2; | 2796 | *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2; |
2799 | break; | 2797 | break; |
2800 | case MC_PMG_CMD_MRS >> 2: | 2798 | case MC_PMG_CMD_MRS >> 2: |
2801 | *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2; | 2799 | *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2; |
2802 | break; | 2800 | break; |
2803 | case MC_PMG_CMD_MRS1 >> 2: | 2801 | case MC_PMG_CMD_MRS1 >> 2: |
2804 | *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2; | 2802 | *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2; |
2805 | break; | 2803 | break; |
2806 | case MC_SEQ_PMG_TIMING >> 2: | 2804 | case MC_SEQ_PMG_TIMING >> 2: |
2807 | *out_reg = MC_SEQ_PMG_TIMING_LP >> 2; | 2805 | *out_reg = MC_SEQ_PMG_TIMING_LP >> 2; |
2808 | break; | 2806 | break; |
2809 | case MC_PMG_CMD_MRS2 >> 2: | 2807 | case MC_PMG_CMD_MRS2 >> 2: |
2810 | *out_reg = MC_SEQ_PMG_CMD_MRS2_LP >> 2; | 2808 | *out_reg = MC_SEQ_PMG_CMD_MRS2_LP >> 2; |
2811 | break; | 2809 | break; |
2812 | default: | 2810 | default: |
2813 | result = false; | 2811 | result = false; |
2814 | break; | 2812 | break; |
2815 | } | 2813 | } |
@@ -2876,9 +2874,9 @@ static int ni_initialize_mc_reg_table(struct radeon_device *rdev) | |||
2876 | struct ni_mc_reg_table *ni_table = &ni_pi->mc_reg_table; | 2874 | struct ni_mc_reg_table *ni_table = &ni_pi->mc_reg_table; |
2877 | u8 module_index = rv770_get_memory_module_index(rdev); | 2875 | u8 module_index = rv770_get_memory_module_index(rdev); |
2878 | 2876 | ||
2879 | table = kzalloc(sizeof(struct atom_mc_reg_table), GFP_KERNEL); | 2877 | table = kzalloc(sizeof(struct atom_mc_reg_table), GFP_KERNEL); |
2880 | if (!table) | 2878 | if (!table) |
2881 | return -ENOMEM; | 2879 | return -ENOMEM; |
2882 | 2880 | ||
2883 | WREG32(MC_SEQ_RAS_TIMING_LP, RREG32(MC_SEQ_RAS_TIMING)); | 2881 | WREG32(MC_SEQ_RAS_TIMING_LP, RREG32(MC_SEQ_RAS_TIMING)); |
2884 | WREG32(MC_SEQ_CAS_TIMING_LP, RREG32(MC_SEQ_CAS_TIMING)); | 2882 | WREG32(MC_SEQ_CAS_TIMING_LP, RREG32(MC_SEQ_CAS_TIMING)); |
@@ -2896,25 +2894,25 @@ static int ni_initialize_mc_reg_table(struct radeon_device *rdev) | |||
2896 | 2894 | ||
2897 | ret = radeon_atom_init_mc_reg_table(rdev, module_index, table); | 2895 | ret = radeon_atom_init_mc_reg_table(rdev, module_index, table); |
2898 | 2896 | ||
2899 | if (ret) | 2897 | if (ret) |
2900 | goto init_mc_done; | 2898 | goto init_mc_done; |
2901 | 2899 | ||
2902 | ret = ni_copy_vbios_mc_reg_table(table, ni_table); | 2900 | ret = ni_copy_vbios_mc_reg_table(table, ni_table); |
2903 | 2901 | ||
2904 | if (ret) | 2902 | if (ret) |
2905 | goto init_mc_done; | 2903 | goto init_mc_done; |
2906 | 2904 | ||
2907 | ni_set_s0_mc_reg_index(ni_table); | 2905 | ni_set_s0_mc_reg_index(ni_table); |
2908 | 2906 | ||
2909 | ret = ni_set_mc_special_registers(rdev, ni_table); | 2907 | ret = ni_set_mc_special_registers(rdev, ni_table); |
2910 | 2908 | ||
2911 | if (ret) | 2909 | if (ret) |
2912 | goto init_mc_done; | 2910 | goto init_mc_done; |
2913 | 2911 | ||
2914 | ni_set_valid_flag(ni_table); | 2912 | ni_set_valid_flag(ni_table); |
2915 | 2913 | ||
2916 | init_mc_done: | 2914 | init_mc_done: |
2917 | kfree(table); | 2915 | kfree(table); |
2918 | 2916 | ||
2919 | return ret; | 2917 | return ret; |
2920 | } | 2918 | } |
@@ -2994,7 +2992,7 @@ static int ni_populate_mc_reg_table(struct radeon_device *rdev, | |||
2994 | { | 2992 | { |
2995 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 2993 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
2996 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 2994 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
2997 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 2995 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
2998 | struct ni_ps *boot_state = ni_get_ps(radeon_boot_state); | 2996 | struct ni_ps *boot_state = ni_get_ps(radeon_boot_state); |
2999 | SMC_NIslands_MCRegisters *mc_reg_table = &ni_pi->smc_mc_reg_table; | 2997 | SMC_NIslands_MCRegisters *mc_reg_table = &ni_pi->smc_mc_reg_table; |
3000 | 2998 | ||
@@ -3025,7 +3023,7 @@ static int ni_upload_mc_reg_table(struct radeon_device *rdev, | |||
3025 | { | 3023 | { |
3026 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 3024 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
3027 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 3025 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
3028 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 3026 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
3029 | struct ni_ps *ni_new_state = ni_get_ps(radeon_new_state); | 3027 | struct ni_ps *ni_new_state = ni_get_ps(radeon_new_state); |
3030 | SMC_NIslands_MCRegisters *mc_reg_table = &ni_pi->smc_mc_reg_table; | 3028 | SMC_NIslands_MCRegisters *mc_reg_table = &ni_pi->smc_mc_reg_table; |
3031 | u16 address; | 3029 | u16 address; |
@@ -3142,7 +3140,7 @@ static int ni_initialize_smc_cac_tables(struct radeon_device *rdev) | |||
3142 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 3140 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
3143 | PP_NIslands_CACTABLES *cac_tables = NULL; | 3141 | PP_NIslands_CACTABLES *cac_tables = NULL; |
3144 | int i, ret; | 3142 | int i, ret; |
3145 | u32 reg; | 3143 | u32 reg; |
3146 | 3144 | ||
3147 | if (ni_pi->enable_cac == false) | 3145 | if (ni_pi->enable_cac == false) |
3148 | return 0; | 3146 | return 0; |
@@ -3422,13 +3420,13 @@ static int ni_pcie_performance_request(struct radeon_device *rdev, | |||
3422 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 3420 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
3423 | 3421 | ||
3424 | if ((perf_req == PCIE_PERF_REQ_PECI_GEN1) || | 3422 | if ((perf_req == PCIE_PERF_REQ_PECI_GEN1) || |
3425 | (perf_req == PCIE_PERF_REQ_PECI_GEN2)) { | 3423 | (perf_req == PCIE_PERF_REQ_PECI_GEN2)) { |
3426 | if (eg_pi->pcie_performance_request_registered == false) | 3424 | if (eg_pi->pcie_performance_request_registered == false) |
3427 | radeon_acpi_pcie_notify_device_ready(rdev); | 3425 | radeon_acpi_pcie_notify_device_ready(rdev); |
3428 | eg_pi->pcie_performance_request_registered = true; | 3426 | eg_pi->pcie_performance_request_registered = true; |
3429 | return radeon_acpi_pcie_performance_request(rdev, perf_req, advertise); | 3427 | return radeon_acpi_pcie_performance_request(rdev, perf_req, advertise); |
3430 | } else if ((perf_req == PCIE_PERF_REQ_REMOVE_REGISTRY) && | 3428 | } else if ((perf_req == PCIE_PERF_REQ_REMOVE_REGISTRY) && |
3431 | eg_pi->pcie_performance_request_registered) { | 3429 | eg_pi->pcie_performance_request_registered) { |
3432 | eg_pi->pcie_performance_request_registered = false; | 3430 | eg_pi->pcie_performance_request_registered = false; |
3433 | return radeon_acpi_pcie_performance_request(rdev, perf_req, advertise); | 3431 | return radeon_acpi_pcie_performance_request(rdev, perf_req, advertise); |
3434 | } | 3432 | } |
@@ -3441,12 +3439,12 @@ static int ni_advertise_gen2_capability(struct radeon_device *rdev) | |||
3441 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 3439 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
3442 | u32 tmp; | 3440 | u32 tmp; |
3443 | 3441 | ||
3444 | tmp = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); | 3442 | tmp = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); |
3445 | 3443 | ||
3446 | if ((tmp & LC_OTHER_SIDE_EVER_SENT_GEN2) && | 3444 | if ((tmp & LC_OTHER_SIDE_EVER_SENT_GEN2) && |
3447 | (tmp & LC_OTHER_SIDE_SUPPORTS_GEN2)) | 3445 | (tmp & LC_OTHER_SIDE_SUPPORTS_GEN2)) |
3448 | pi->pcie_gen2 = true; | 3446 | pi->pcie_gen2 = true; |
3449 | else | 3447 | else |
3450 | pi->pcie_gen2 = false; | 3448 | pi->pcie_gen2 = false; |
3451 | 3449 | ||
3452 | if (!pi->pcie_gen2) | 3450 | if (!pi->pcie_gen2) |
@@ -3458,8 +3456,8 @@ static int ni_advertise_gen2_capability(struct radeon_device *rdev) | |||
3458 | static void ni_enable_bif_dynamic_pcie_gen2(struct radeon_device *rdev, | 3456 | static void ni_enable_bif_dynamic_pcie_gen2(struct radeon_device *rdev, |
3459 | bool enable) | 3457 | bool enable) |
3460 | { | 3458 | { |
3461 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | 3459 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); |
3462 | u32 tmp, bif; | 3460 | u32 tmp, bif; |
3463 | 3461 | ||
3464 | tmp = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); | 3462 | tmp = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); |
3465 | 3463 | ||
@@ -3502,7 +3500,7 @@ static void ni_enable_dynamic_pcie_gen2(struct radeon_device *rdev, | |||
3502 | if (enable) | 3500 | if (enable) |
3503 | WREG32_P(GENERAL_PWRMGT, ENABLE_GEN2PCIE, ~ENABLE_GEN2PCIE); | 3501 | WREG32_P(GENERAL_PWRMGT, ENABLE_GEN2PCIE, ~ENABLE_GEN2PCIE); |
3504 | else | 3502 | else |
3505 | WREG32_P(GENERAL_PWRMGT, 0, ~ENABLE_GEN2PCIE); | 3503 | WREG32_P(GENERAL_PWRMGT, 0, ~ENABLE_GEN2PCIE); |
3506 | } | 3504 | } |
3507 | 3505 | ||
3508 | void ni_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev, | 3506 | void ni_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev, |
@@ -3563,7 +3561,7 @@ void ni_update_current_ps(struct radeon_device *rdev, | |||
3563 | { | 3561 | { |
3564 | struct ni_ps *new_ps = ni_get_ps(rps); | 3562 | struct ni_ps *new_ps = ni_get_ps(rps); |
3565 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 3563 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
3566 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 3564 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
3567 | 3565 | ||
3568 | eg_pi->current_rps = *rps; | 3566 | eg_pi->current_rps = *rps; |
3569 | ni_pi->current_ps = *new_ps; | 3567 | ni_pi->current_ps = *new_ps; |
@@ -3575,7 +3573,7 @@ void ni_update_requested_ps(struct radeon_device *rdev, | |||
3575 | { | 3573 | { |
3576 | struct ni_ps *new_ps = ni_get_ps(rps); | 3574 | struct ni_ps *new_ps = ni_get_ps(rps); |
3577 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); | 3575 | struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); |
3578 | struct ni_power_info *ni_pi = ni_get_pi(rdev); | 3576 | struct ni_power_info *ni_pi = ni_get_pi(rdev); |
3579 | 3577 | ||
3580 | eg_pi->requested_rps = *rps; | 3578 | eg_pi->requested_rps = *rps; |
3581 | ni_pi->requested_ps = *new_ps; | 3579 | ni_pi->requested_ps = *new_ps; |
@@ -3591,8 +3589,8 @@ int ni_dpm_enable(struct radeon_device *rdev) | |||
3591 | 3589 | ||
3592 | if (pi->gfx_clock_gating) | 3590 | if (pi->gfx_clock_gating) |
3593 | ni_cg_clockgating_default(rdev); | 3591 | ni_cg_clockgating_default(rdev); |
3594 | if (btc_dpm_enabled(rdev)) | 3592 | if (btc_dpm_enabled(rdev)) |
3595 | return -EINVAL; | 3593 | return -EINVAL; |
3596 | if (pi->mg_clock_gating) | 3594 | if (pi->mg_clock_gating) |
3597 | ni_mg_clockgating_default(rdev); | 3595 | ni_mg_clockgating_default(rdev); |
3598 | if (eg_pi->ls_clock_gating) | 3596 | if (eg_pi->ls_clock_gating) |
@@ -3991,7 +3989,7 @@ static int ni_parse_power_table(struct radeon_device *rdev) | |||
3991 | union pplib_clock_info *clock_info; | 3989 | union pplib_clock_info *clock_info; |
3992 | union power_info *power_info; | 3990 | union power_info *power_info; |
3993 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 3991 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
3994 | u16 data_offset; | 3992 | u16 data_offset; |
3995 | u8 frev, crev; | 3993 | u8 frev, crev; |
3996 | struct ni_ps *ps; | 3994 | struct ni_ps *ps; |
3997 | 3995 | ||
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index ed121042247f..f86ab695ee8f 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -235,8 +235,8 @@ int r600_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) | |||
235 | fb_div |= 1; | 235 | fb_div |= 1; |
236 | 236 | ||
237 | r = radeon_uvd_send_upll_ctlreq(rdev, CG_UPLL_FUNC_CNTL); | 237 | r = radeon_uvd_send_upll_ctlreq(rdev, CG_UPLL_FUNC_CNTL); |
238 | if (r) | 238 | if (r) |
239 | return r; | 239 | return r; |
240 | 240 | ||
241 | /* assert PLL_RESET */ | 241 | /* assert PLL_RESET */ |
242 | WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_RESET_MASK, ~UPLL_RESET_MASK); | 242 | WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_RESET_MASK, ~UPLL_RESET_MASK); |
@@ -1490,7 +1490,7 @@ static int r600_mc_init(struct radeon_device *rdev) | |||
1490 | rdev->fastfb_working = true; | 1490 | rdev->fastfb_working = true; |
1491 | } | 1491 | } |
1492 | } | 1492 | } |
1493 | } | 1493 | } |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | radeon_update_bandwidth_info(rdev); | 1496 | radeon_update_bandwidth_info(rdev); |
@@ -4574,7 +4574,7 @@ uint64_t r600_get_gpu_clock_counter(struct radeon_device *rdev) | |||
4574 | mutex_lock(&rdev->gpu_clock_mutex); | 4574 | mutex_lock(&rdev->gpu_clock_mutex); |
4575 | WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1); | 4575 | WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1); |
4576 | clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) | | 4576 | clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) | |
4577 | ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL); | 4577 | ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL); |
4578 | mutex_unlock(&rdev->gpu_clock_mutex); | 4578 | mutex_unlock(&rdev->gpu_clock_mutex); |
4579 | return clock; | 4579 | return clock; |
4580 | } | 4580 | } |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 2f36fa1576e0..b69c8de35bd3 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -1671,8 +1671,8 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
1671 | } | 1671 | } |
1672 | 1672 | ||
1673 | offset = reloc->gpu_offset + | 1673 | offset = reloc->gpu_offset + |
1674 | (idx_value & 0xfffffff0) + | 1674 | (idx_value & 0xfffffff0) + |
1675 | ((u64)(tmp & 0xff) << 32); | 1675 | ((u64)(tmp & 0xff) << 32); |
1676 | 1676 | ||
1677 | ib[idx + 0] = offset; | 1677 | ib[idx + 0] = offset; |
1678 | ib[idx + 1] = (tmp & 0xffffff00) | (upper_32_bits(offset) & 0xff); | 1678 | ib[idx + 1] = (tmp & 0xffffff00) | (upper_32_bits(offset) & 0xff); |
@@ -1712,8 +1712,8 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
1712 | } | 1712 | } |
1713 | 1713 | ||
1714 | offset = reloc->gpu_offset + | 1714 | offset = reloc->gpu_offset + |
1715 | idx_value + | 1715 | idx_value + |
1716 | ((u64)(radeon_get_ib_value(p, idx+1) & 0xff) << 32); | 1716 | ((u64)(radeon_get_ib_value(p, idx+1) & 0xff) << 32); |
1717 | 1717 | ||
1718 | ib[idx+0] = offset; | 1718 | ib[idx+0] = offset; |
1719 | ib[idx+1] = upper_32_bits(offset) & 0xff; | 1719 | ib[idx+1] = upper_32_bits(offset) & 0xff; |
@@ -1764,8 +1764,8 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | offset = reloc->gpu_offset + | 1766 | offset = reloc->gpu_offset + |
1767 | (radeon_get_ib_value(p, idx+1) & 0xfffffff0) + | 1767 | (radeon_get_ib_value(p, idx+1) & 0xfffffff0) + |
1768 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); | 1768 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); |
1769 | 1769 | ||
1770 | ib[idx+1] = (ib[idx+1] & 0x3) | (offset & 0xfffffff0); | 1770 | ib[idx+1] = (ib[idx+1] & 0x3) | (offset & 0xfffffff0); |
1771 | ib[idx+2] = upper_32_bits(offset) & 0xff; | 1771 | ib[idx+2] = upper_32_bits(offset) & 0xff; |
@@ -1876,8 +1876,8 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
1876 | return -EINVAL; | 1876 | return -EINVAL; |
1877 | } | 1877 | } |
1878 | offset = reloc->gpu_offset + | 1878 | offset = reloc->gpu_offset + |
1879 | (radeon_get_ib_value(p, idx+1) & 0xfffffff8) + | 1879 | (radeon_get_ib_value(p, idx+1) & 0xfffffff8) + |
1880 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); | 1880 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); |
1881 | 1881 | ||
1882 | ib[idx+1] = offset & 0xfffffff8; | 1882 | ib[idx+1] = offset & 0xfffffff8; |
1883 | ib[idx+2] = upper_32_bits(offset) & 0xff; | 1883 | ib[idx+2] = upper_32_bits(offset) & 0xff; |
@@ -1898,8 +1898,8 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
1898 | } | 1898 | } |
1899 | 1899 | ||
1900 | offset = reloc->gpu_offset + | 1900 | offset = reloc->gpu_offset + |
1901 | (radeon_get_ib_value(p, idx+1) & 0xfffffffc) + | 1901 | (radeon_get_ib_value(p, idx+1) & 0xfffffffc) + |
1902 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); | 1902 | ((u64)(radeon_get_ib_value(p, idx+2) & 0xff) << 32); |
1903 | 1903 | ||
1904 | ib[idx+1] = offset & 0xfffffffc; | 1904 | ib[idx+1] = offset & 0xfffffffc; |
1905 | ib[idx+2] = (ib[idx+2] & 0xffffff00) | (upper_32_bits(offset) & 0xff); | 1905 | ib[idx+2] = (ib[idx+2] & 0xffffff00) | (upper_32_bits(offset) & 0xff); |
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index fa2154493cf1..6a4b020dd0b4 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
@@ -844,7 +844,7 @@ int r600_get_platform_caps(struct radeon_device *rdev) | |||
844 | struct radeon_mode_info *mode_info = &rdev->mode_info; | 844 | struct radeon_mode_info *mode_info = &rdev->mode_info; |
845 | union power_info *power_info; | 845 | union power_info *power_info; |
846 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 846 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
847 | u16 data_offset; | 847 | u16 data_offset; |
848 | u8 frev, crev; | 848 | u8 frev, crev; |
849 | 849 | ||
850 | if (!atom_parse_data_header(mode_info->atom_context, index, NULL, | 850 | if (!atom_parse_data_header(mode_info->atom_context, index, NULL, |
@@ -874,7 +874,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev) | |||
874 | union fan_info *fan_info; | 874 | union fan_info *fan_info; |
875 | ATOM_PPLIB_Clock_Voltage_Dependency_Table *dep_table; | 875 | ATOM_PPLIB_Clock_Voltage_Dependency_Table *dep_table; |
876 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 876 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
877 | u16 data_offset; | 877 | u16 data_offset; |
878 | u8 frev, crev; | 878 | u8 frev, crev; |
879 | int ret, i; | 879 | int ret, i; |
880 | 880 | ||
@@ -1070,7 +1070,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev) | |||
1070 | ext_hdr->usVCETableOffset) { | 1070 | ext_hdr->usVCETableOffset) { |
1071 | VCEClockInfoArray *array = (VCEClockInfoArray *) | 1071 | VCEClockInfoArray *array = (VCEClockInfoArray *) |
1072 | (mode_info->atom_context->bios + data_offset + | 1072 | (mode_info->atom_context->bios + data_offset + |
1073 | le16_to_cpu(ext_hdr->usVCETableOffset) + 1); | 1073 | le16_to_cpu(ext_hdr->usVCETableOffset) + 1); |
1074 | ATOM_PPLIB_VCE_Clock_Voltage_Limit_Table *limits = | 1074 | ATOM_PPLIB_VCE_Clock_Voltage_Limit_Table *limits = |
1075 | (ATOM_PPLIB_VCE_Clock_Voltage_Limit_Table *) | 1075 | (ATOM_PPLIB_VCE_Clock_Voltage_Limit_Table *) |
1076 | (mode_info->atom_context->bios + data_offset + | 1076 | (mode_info->atom_context->bios + data_offset + |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index e85894ade95c..e82a99cb2459 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -215,7 +215,7 @@ void r600_hdmi_update_acr(struct drm_encoder *encoder, long offset, | |||
215 | * build a HDMI Video Info Frame | 215 | * build a HDMI Video Info Frame |
216 | */ | 216 | */ |
217 | void r600_set_avi_packet(struct radeon_device *rdev, u32 offset, | 217 | void r600_set_avi_packet(struct radeon_device *rdev, u32 offset, |
218 | unsigned char *buffer, size_t size) | 218 | unsigned char *buffer, size_t size) |
219 | { | 219 | { |
220 | uint8_t *frame = buffer + 3; | 220 | uint8_t *frame = buffer + 3; |
221 | 221 | ||
@@ -312,7 +312,7 @@ void r600_hdmi_audio_workaround(struct drm_encoder *encoder) | |||
312 | } | 312 | } |
313 | 313 | ||
314 | void r600_hdmi_audio_set_dto(struct radeon_device *rdev, | 314 | void r600_hdmi_audio_set_dto(struct radeon_device *rdev, |
315 | struct radeon_crtc *crtc, unsigned int clock) | 315 | struct radeon_crtc *crtc, unsigned int clock) |
316 | { | 316 | { |
317 | struct radeon_encoder *radeon_encoder; | 317 | struct radeon_encoder *radeon_encoder; |
318 | struct radeon_encoder_atom_dig *dig; | 318 | struct radeon_encoder_atom_dig *dig; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index de9a2ffcf5f7..f8097a0e7a79 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -2095,7 +2095,7 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
2095 | struct radeon_i2c_bus_rec i2c_bus; | 2095 | struct radeon_i2c_bus_rec i2c_bus; |
2096 | union power_info *power_info; | 2096 | union power_info *power_info; |
2097 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 2097 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
2098 | u16 data_offset; | 2098 | u16 data_offset; |
2099 | u8 frev, crev; | 2099 | u8 frev, crev; |
2100 | 2100 | ||
2101 | if (!atom_parse_data_header(mode_info->atom_context, index, NULL, | 2101 | if (!atom_parse_data_header(mode_info->atom_context, index, NULL, |
@@ -2575,7 +2575,7 @@ static int radeon_atombios_parse_power_table_4_5(struct radeon_device *rdev) | |||
2575 | bool valid; | 2575 | bool valid; |
2576 | union power_info *power_info; | 2576 | union power_info *power_info; |
2577 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 2577 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
2578 | u16 data_offset; | 2578 | u16 data_offset; |
2579 | u8 frev, crev; | 2579 | u8 frev, crev; |
2580 | 2580 | ||
2581 | if (!atom_parse_data_header(mode_info->atom_context, index, NULL, | 2581 | if (!atom_parse_data_header(mode_info->atom_context, index, NULL, |
@@ -2666,7 +2666,7 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev) | |||
2666 | bool valid; | 2666 | bool valid; |
2667 | union power_info *power_info; | 2667 | union power_info *power_info; |
2668 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 2668 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
2669 | u16 data_offset; | 2669 | u16 data_offset; |
2670 | u8 frev, crev; | 2670 | u8 frev, crev; |
2671 | u8 *power_state_offset; | 2671 | u8 *power_state_offset; |
2672 | 2672 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index e2396336f9e8..4fd1a961012d 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1161,9 +1161,9 @@ static void radeon_check_arguments(struct radeon_device *rdev) | |||
1161 | radeon_vm_size = 4; | 1161 | radeon_vm_size = 4; |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | /* | 1164 | /* |
1165 | * Max GPUVM size for Cayman, SI and CI are 40 bits. | 1165 | * Max GPUVM size for Cayman, SI and CI are 40 bits. |
1166 | */ | 1166 | */ |
1167 | if (radeon_vm_size > 1024) { | 1167 | if (radeon_vm_size > 1024) { |
1168 | dev_warn(rdev->dev, "VM size (%d) too large, max is 1TB\n", | 1168 | dev_warn(rdev->dev, "VM size (%d) too large, max is 1TB\n", |
1169 | radeon_vm_size); | 1169 | radeon_vm_size); |
@@ -1901,7 +1901,7 @@ int radeon_debugfs_add_files(struct radeon_device *rdev, | |||
1901 | if (i > RADEON_DEBUGFS_MAX_COMPONENTS) { | 1901 | if (i > RADEON_DEBUGFS_MAX_COMPONENTS) { |
1902 | DRM_ERROR("Reached maximum number of debugfs components.\n"); | 1902 | DRM_ERROR("Reached maximum number of debugfs components.\n"); |
1903 | DRM_ERROR("Report so we increase " | 1903 | DRM_ERROR("Report so we increase " |
1904 | "RADEON_DEBUGFS_MAX_COMPONENTS.\n"); | 1904 | "RADEON_DEBUGFS_MAX_COMPONENTS.\n"); |
1905 | return -EINVAL; | 1905 | return -EINVAL; |
1906 | } | 1906 | } |
1907 | rdev->debugfs[rdev->debugfs_count].files = files; | 1907 | rdev->debugfs[rdev->debugfs_count].files = files; |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index e29096b2fa6b..fcc7483d3f7b 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -407,7 +407,7 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
407 | unsigned repcnt = 4; | 407 | unsigned repcnt = 4; |
408 | struct drm_vblank_crtc *vblank = &crtc->dev->vblank[work->crtc_id]; | 408 | struct drm_vblank_crtc *vblank = &crtc->dev->vblank[work->crtc_id]; |
409 | 409 | ||
410 | down_read(&rdev->exclusive_lock); | 410 | down_read(&rdev->exclusive_lock); |
411 | if (work->fence) { | 411 | if (work->fence) { |
412 | struct radeon_fence *fence; | 412 | struct radeon_fence *fence; |
413 | 413 | ||
@@ -919,7 +919,7 @@ static void avivo_reduce_ratio(unsigned *nom, unsigned *den, | |||
919 | *den /= tmp; | 919 | *den /= tmp; |
920 | 920 | ||
921 | /* make sure nominator is large enough */ | 921 | /* make sure nominator is large enough */ |
922 | if (*nom < nom_min) { | 922 | if (*nom < nom_min) { |
923 | tmp = DIV_ROUND_UP(nom_min, *nom); | 923 | tmp = DIV_ROUND_UP(nom_min, *nom); |
924 | *nom *= tmp; | 924 | *nom *= tmp; |
925 | *den *= tmp; | 925 | *den *= tmp; |
@@ -959,7 +959,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div, | |||
959 | *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den); | 959 | *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den); |
960 | 960 | ||
961 | /* limit fb divider to its maximum */ | 961 | /* limit fb divider to its maximum */ |
962 | if (*fb_div > fb_div_max) { | 962 | if (*fb_div > fb_div_max) { |
963 | *ref_div = DIV_ROUND_CLOSEST(*ref_div * fb_div_max, *fb_div); | 963 | *ref_div = DIV_ROUND_CLOSEST(*ref_div * fb_div_max, *fb_div); |
964 | *fb_div = fb_div_max; | 964 | *fb_div = fb_div_max; |
965 | } | 965 | } |
@@ -1683,10 +1683,8 @@ int radeon_modeset_init(struct radeon_device *rdev) | |||
1683 | /* setup afmt */ | 1683 | /* setup afmt */ |
1684 | radeon_afmt_init(rdev); | 1684 | radeon_afmt_init(rdev); |
1685 | 1685 | ||
1686 | if (!list_empty(&rdev->ddev->mode_config.connector_list)) { | 1686 | radeon_fbdev_init(rdev); |
1687 | radeon_fbdev_init(rdev); | 1687 | drm_kms_helper_poll_init(rdev->ddev); |
1688 | drm_kms_helper_poll_init(rdev->ddev); | ||
1689 | } | ||
1690 | 1688 | ||
1691 | /* do pm late init */ | 1689 | /* do pm late init */ |
1692 | ret = radeon_pm_late_init(rdev); | 1690 | ret = radeon_pm_late_init(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index d2e628eea53d..0e3143acb565 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -38,9 +38,9 @@ | |||
38 | #include <linux/vga_switcheroo.h> | 38 | #include <linux/vga_switcheroo.h> |
39 | 39 | ||
40 | /* object hierarchy - | 40 | /* object hierarchy - |
41 | this contains a helper + a radeon fb | 41 | * this contains a helper + a radeon fb |
42 | the helper contains a pointer to radeon framebuffer baseclass. | 42 | * the helper contains a pointer to radeon framebuffer baseclass. |
43 | */ | 43 | */ |
44 | struct radeon_fbdev { | 44 | struct radeon_fbdev { |
45 | struct drm_fb_helper helper; | 45 | struct drm_fb_helper helper; |
46 | struct radeon_framebuffer rfb; | 46 | struct radeon_framebuffer rfb; |
@@ -292,7 +292,8 @@ out_unref: | |||
292 | 292 | ||
293 | void radeon_fb_output_poll_changed(struct radeon_device *rdev) | 293 | void radeon_fb_output_poll_changed(struct radeon_device *rdev) |
294 | { | 294 | { |
295 | drm_fb_helper_hotplug_event(&rdev->mode_info.rfbdev->helper); | 295 | if (rdev->mode_info.rfbdev) |
296 | drm_fb_helper_hotplug_event(&rdev->mode_info.rfbdev->helper); | ||
296 | } | 297 | } |
297 | 298 | ||
298 | static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdev) | 299 | static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdev) |
@@ -325,6 +326,10 @@ int radeon_fbdev_init(struct radeon_device *rdev) | |||
325 | int bpp_sel = 32; | 326 | int bpp_sel = 32; |
326 | int ret; | 327 | int ret; |
327 | 328 | ||
329 | /* don't enable fbdev if no connectors */ | ||
330 | if (list_empty(&rdev->ddev->mode_config.connector_list)) | ||
331 | return 0; | ||
332 | |||
328 | /* select 8 bpp console on RN50 or 16MB cards */ | 333 | /* select 8 bpp console on RN50 or 16MB cards */ |
329 | if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) | 334 | if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024)) |
330 | bpp_sel = 8; | 335 | bpp_sel = 8; |
@@ -377,11 +382,15 @@ void radeon_fbdev_fini(struct radeon_device *rdev) | |||
377 | 382 | ||
378 | void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state) | 383 | void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state) |
379 | { | 384 | { |
380 | fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state); | 385 | if (rdev->mode_info.rfbdev) |
386 | fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state); | ||
381 | } | 387 | } |
382 | 388 | ||
383 | bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj) | 389 | bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj) |
384 | { | 390 | { |
391 | if (!rdev->mode_info.rfbdev) | ||
392 | return false; | ||
393 | |||
385 | if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj)) | 394 | if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj)) |
386 | return true; | 395 | return true; |
387 | return false; | 396 | return false; |
@@ -389,12 +398,14 @@ bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj) | |||
389 | 398 | ||
390 | void radeon_fb_add_connector(struct radeon_device *rdev, struct drm_connector *connector) | 399 | void radeon_fb_add_connector(struct radeon_device *rdev, struct drm_connector *connector) |
391 | { | 400 | { |
392 | drm_fb_helper_add_one_connector(&rdev->mode_info.rfbdev->helper, connector); | 401 | if (rdev->mode_info.rfbdev) |
402 | drm_fb_helper_add_one_connector(&rdev->mode_info.rfbdev->helper, connector); | ||
393 | } | 403 | } |
394 | 404 | ||
395 | void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector *connector) | 405 | void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector *connector) |
396 | { | 406 | { |
397 | drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector); | 407 | if (rdev->mode_info.rfbdev) |
408 | drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector); | ||
398 | } | 409 | } |
399 | 410 | ||
400 | void radeon_fbdev_restore_mode(struct radeon_device *rdev) | 411 | void radeon_fbdev_restore_mode(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/radeon_ib.c b/drivers/gpu/drm/radeon/radeon_ib.c index c39ce1f05703..92ce0e533bc0 100644 --- a/drivers/gpu/drm/radeon/radeon_ib.c +++ b/drivers/gpu/drm/radeon/radeon_ib.c | |||
@@ -274,7 +274,7 @@ int radeon_ib_ring_tests(struct radeon_device *rdev) | |||
274 | if (i == RADEON_RING_TYPE_GFX_INDEX) { | 274 | if (i == RADEON_RING_TYPE_GFX_INDEX) { |
275 | /* oh, oh, that's really bad */ | 275 | /* oh, oh, that's really bad */ |
276 | DRM_ERROR("radeon: failed testing IB on GFX ring (%d).\n", r); | 276 | DRM_ERROR("radeon: failed testing IB on GFX ring (%d).\n", r); |
277 | rdev->accel_working = false; | 277 | rdev->accel_working = false; |
278 | return r; | 278 | return r; |
279 | 279 | ||
280 | } else { | 280 | } else { |
@@ -304,7 +304,7 @@ static int radeon_debugfs_sa_info(struct seq_file *m, void *data) | |||
304 | } | 304 | } |
305 | 305 | ||
306 | static struct drm_info_list radeon_debugfs_sa_list[] = { | 306 | static struct drm_info_list radeon_debugfs_sa_list[] = { |
307 | {"radeon_sa_info", &radeon_debugfs_sa_info, 0, NULL}, | 307 | {"radeon_sa_info", &radeon_debugfs_sa_info, 0, NULL}, |
308 | }; | 308 | }; |
309 | 309 | ||
310 | #endif | 310 | #endif |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 88dc973fb209..868c3ba2efaa 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -818,52 +818,52 @@ static void radeon_legacy_tmds_int_mode_set(struct drm_encoder *encoder, | |||
818 | tmds_transmitter_cntl = RREG32(RADEON_TMDS_TRANSMITTER_CNTL) & | 818 | tmds_transmitter_cntl = RREG32(RADEON_TMDS_TRANSMITTER_CNTL) & |
819 | ~(RADEON_TMDS_TRANSMITTER_PLLRST); | 819 | ~(RADEON_TMDS_TRANSMITTER_PLLRST); |
820 | 820 | ||
821 | if (rdev->family == CHIP_R200 || | 821 | if (rdev->family == CHIP_R200 || |
822 | rdev->family == CHIP_R100 || | 822 | rdev->family == CHIP_R100 || |
823 | ASIC_IS_R300(rdev)) | 823 | ASIC_IS_R300(rdev)) |
824 | tmds_transmitter_cntl &= ~(RADEON_TMDS_TRANSMITTER_PLLEN); | 824 | tmds_transmitter_cntl &= ~(RADEON_TMDS_TRANSMITTER_PLLEN); |
825 | else /* RV chips got this bit reversed */ | 825 | else /* RV chips got this bit reversed */ |
826 | tmds_transmitter_cntl |= RADEON_TMDS_TRANSMITTER_PLLEN; | 826 | tmds_transmitter_cntl |= RADEON_TMDS_TRANSMITTER_PLLEN; |
827 | 827 | ||
828 | fp_gen_cntl = (RREG32(RADEON_FP_GEN_CNTL) | | 828 | fp_gen_cntl = (RREG32(RADEON_FP_GEN_CNTL) | |
829 | (RADEON_FP_CRTC_DONT_SHADOW_VPAR | | 829 | (RADEON_FP_CRTC_DONT_SHADOW_VPAR | |
830 | RADEON_FP_CRTC_DONT_SHADOW_HEND)); | 830 | RADEON_FP_CRTC_DONT_SHADOW_HEND)); |
831 | 831 | ||
832 | fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); | 832 | fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN); |
833 | 833 | ||
834 | fp_gen_cntl &= ~(RADEON_FP_RMX_HVSYNC_CONTROL_EN | | 834 | fp_gen_cntl &= ~(RADEON_FP_RMX_HVSYNC_CONTROL_EN | |
835 | RADEON_FP_DFP_SYNC_SEL | | 835 | RADEON_FP_DFP_SYNC_SEL | |
836 | RADEON_FP_CRT_SYNC_SEL | | 836 | RADEON_FP_CRT_SYNC_SEL | |
837 | RADEON_FP_CRTC_LOCK_8DOT | | 837 | RADEON_FP_CRTC_LOCK_8DOT | |
838 | RADEON_FP_USE_SHADOW_EN | | 838 | RADEON_FP_USE_SHADOW_EN | |
839 | RADEON_FP_CRTC_USE_SHADOW_VEND | | 839 | RADEON_FP_CRTC_USE_SHADOW_VEND | |
840 | RADEON_FP_CRT_SYNC_ALT); | 840 | RADEON_FP_CRT_SYNC_ALT); |
841 | 841 | ||
842 | if (1) /* FIXME rgbBits == 8 */ | 842 | if (1) /* FIXME rgbBits == 8 */ |
843 | fp_gen_cntl |= RADEON_FP_PANEL_FORMAT; /* 24 bit format */ | 843 | fp_gen_cntl |= RADEON_FP_PANEL_FORMAT; /* 24 bit format */ |
844 | else | 844 | else |
845 | fp_gen_cntl &= ~RADEON_FP_PANEL_FORMAT;/* 18 bit format */ | 845 | fp_gen_cntl &= ~RADEON_FP_PANEL_FORMAT;/* 18 bit format */ |
846 | 846 | ||
847 | if (radeon_crtc->crtc_id == 0) { | 847 | if (radeon_crtc->crtc_id == 0) { |
848 | if (ASIC_IS_R300(rdev) || rdev->family == CHIP_R200) { | 848 | if (ASIC_IS_R300(rdev) || rdev->family == CHIP_R200) { |
849 | fp_gen_cntl &= ~R200_FP_SOURCE_SEL_MASK; | 849 | fp_gen_cntl &= ~R200_FP_SOURCE_SEL_MASK; |
850 | if (radeon_encoder->rmx_type != RMX_OFF) | 850 | if (radeon_encoder->rmx_type != RMX_OFF) |
851 | fp_gen_cntl |= R200_FP_SOURCE_SEL_RMX; | 851 | fp_gen_cntl |= R200_FP_SOURCE_SEL_RMX; |
852 | else | 852 | else |
853 | fp_gen_cntl |= R200_FP_SOURCE_SEL_CRTC1; | 853 | fp_gen_cntl |= R200_FP_SOURCE_SEL_CRTC1; |
854 | } else | 854 | } else |
855 | fp_gen_cntl &= ~RADEON_FP_SEL_CRTC2; | 855 | fp_gen_cntl &= ~RADEON_FP_SEL_CRTC2; |
856 | } else { | 856 | } else { |
857 | if (ASIC_IS_R300(rdev) || rdev->family == CHIP_R200) { | 857 | if (ASIC_IS_R300(rdev) || rdev->family == CHIP_R200) { |
858 | fp_gen_cntl &= ~R200_FP_SOURCE_SEL_MASK; | 858 | fp_gen_cntl &= ~R200_FP_SOURCE_SEL_MASK; |
859 | fp_gen_cntl |= R200_FP_SOURCE_SEL_CRTC2; | 859 | fp_gen_cntl |= R200_FP_SOURCE_SEL_CRTC2; |
860 | } else | 860 | } else |
861 | fp_gen_cntl |= RADEON_FP_SEL_CRTC2; | 861 | fp_gen_cntl |= RADEON_FP_SEL_CRTC2; |
862 | } | 862 | } |
863 | 863 | ||
864 | WREG32(RADEON_TMDS_PLL_CNTL, tmds_pll_cntl); | 864 | WREG32(RADEON_TMDS_PLL_CNTL, tmds_pll_cntl); |
865 | WREG32(RADEON_TMDS_TRANSMITTER_CNTL, tmds_transmitter_cntl); | 865 | WREG32(RADEON_TMDS_TRANSMITTER_CNTL, tmds_transmitter_cntl); |
866 | WREG32(RADEON_FP_GEN_CNTL, fp_gen_cntl); | 866 | WREG32(RADEON_FP_GEN_CNTL, fp_gen_cntl); |
867 | 867 | ||
868 | if (rdev->is_atom_bios) | 868 | if (rdev->is_atom_bios) |
869 | radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); | 869 | radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index fb6ad143873f..dd46c38676db 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -214,8 +214,8 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
214 | INIT_LIST_HEAD(&bo->list); | 214 | INIT_LIST_HEAD(&bo->list); |
215 | INIT_LIST_HEAD(&bo->va); | 215 | INIT_LIST_HEAD(&bo->va); |
216 | bo->initial_domain = domain & (RADEON_GEM_DOMAIN_VRAM | | 216 | bo->initial_domain = domain & (RADEON_GEM_DOMAIN_VRAM | |
217 | RADEON_GEM_DOMAIN_GTT | | 217 | RADEON_GEM_DOMAIN_GTT | |
218 | RADEON_GEM_DOMAIN_CPU); | 218 | RADEON_GEM_DOMAIN_CPU); |
219 | 219 | ||
220 | bo->flags = flags; | 220 | bo->flags = flags; |
221 | /* PCI GART is always snooped */ | 221 | /* PCI GART is always snooped */ |
@@ -848,7 +848,7 @@ int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, bool no_wait) | |||
848 | * | 848 | * |
849 | */ | 849 | */ |
850 | void radeon_bo_fence(struct radeon_bo *bo, struct radeon_fence *fence, | 850 | void radeon_bo_fence(struct radeon_bo *bo, struct radeon_fence *fence, |
851 | bool shared) | 851 | bool shared) |
852 | { | 852 | { |
853 | struct reservation_object *resv = bo->tbo.resv; | 853 | struct reservation_object *resv = bo->tbo.resv; |
854 | 854 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 7a98823bacd1..38226d925a5b 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -79,7 +79,7 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev) | |||
79 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | 79 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); |
80 | } | 80 | } |
81 | mutex_unlock(&rdev->pm.mutex); | 81 | mutex_unlock(&rdev->pm.mutex); |
82 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | 82 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { |
83 | if (rdev->pm.profile == PM_PROFILE_AUTO) { | 83 | if (rdev->pm.profile == PM_PROFILE_AUTO) { |
84 | mutex_lock(&rdev->pm.mutex); | 84 | mutex_lock(&rdev->pm.mutex); |
85 | radeon_pm_update_profile(rdev); | 85 | radeon_pm_update_profile(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c index e6ad54cdfa62..b0eb28e8fb73 100644 --- a/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c | |||
@@ -56,7 +56,7 @@ int radeon_semaphore_create(struct radeon_device *rdev, | |||
56 | } | 56 | } |
57 | 57 | ||
58 | bool radeon_semaphore_emit_signal(struct radeon_device *rdev, int ridx, | 58 | bool radeon_semaphore_emit_signal(struct radeon_device *rdev, int ridx, |
59 | struct radeon_semaphore *semaphore) | 59 | struct radeon_semaphore *semaphore) |
60 | { | 60 | { |
61 | struct radeon_ring *ring = &rdev->ring[ridx]; | 61 | struct radeon_ring *ring = &rdev->ring[ridx]; |
62 | 62 | ||
@@ -73,7 +73,7 @@ bool radeon_semaphore_emit_signal(struct radeon_device *rdev, int ridx, | |||
73 | } | 73 | } |
74 | 74 | ||
75 | bool radeon_semaphore_emit_wait(struct radeon_device *rdev, int ridx, | 75 | bool radeon_semaphore_emit_wait(struct radeon_device *rdev, int ridx, |
76 | struct radeon_semaphore *semaphore) | 76 | struct radeon_semaphore *semaphore) |
77 | { | 77 | { |
78 | struct radeon_ring *ring = &rdev->ring[ridx]; | 78 | struct radeon_ring *ring = &rdev->ring[ridx]; |
79 | 79 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 6edcb5485092..6fe9e4e76284 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -722,9 +722,11 @@ static int radeon_uvd_send_msg(struct radeon_device *rdev, | |||
722 | return r; | 722 | return r; |
723 | } | 723 | } |
724 | 724 | ||
725 | /* multiple fence commands without any stream commands in between can | 725 | /* |
726 | crash the vcpu so just try to emmit a dummy create/destroy msg to | 726 | * multiple fence commands without any stream commands in between can |
727 | avoid this */ | 727 | * crash the vcpu so just try to emmit a dummy create/destroy msg to |
728 | * avoid this | ||
729 | */ | ||
728 | int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring, | 730 | int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring, |
729 | uint32_t handle, struct radeon_fence **fence) | 731 | uint32_t handle, struct radeon_fence **fence) |
730 | { | 732 | { |
diff --git a/drivers/gpu/drm/radeon/radeon_vce.c b/drivers/gpu/drm/radeon/radeon_vce.c index 566a1a01f6d1..c1c619facb47 100644 --- a/drivers/gpu/drm/radeon/radeon_vce.c +++ b/drivers/gpu/drm/radeon/radeon_vce.c | |||
@@ -166,7 +166,7 @@ int radeon_vce_init(struct radeon_device *rdev) | |||
166 | for (i = 0; i < RADEON_MAX_VCE_HANDLES; ++i) { | 166 | for (i = 0; i < RADEON_MAX_VCE_HANDLES; ++i) { |
167 | atomic_set(&rdev->vce.handles[i], 0); | 167 | atomic_set(&rdev->vce.handles[i], 0); |
168 | rdev->vce.filp[i] = NULL; | 168 | rdev->vce.filp[i] = NULL; |
169 | } | 169 | } |
170 | 170 | ||
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
@@ -389,7 +389,7 @@ int radeon_vce_get_create_msg(struct radeon_device *rdev, int ring, | |||
389 | 389 | ||
390 | r = radeon_ib_schedule(rdev, &ib, NULL, false); | 390 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
391 | if (r) { | 391 | if (r) { |
392 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 392 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
393 | } | 393 | } |
394 | 394 | ||
395 | if (fence) | 395 | if (fence) |
@@ -446,7 +446,7 @@ int radeon_vce_get_destroy_msg(struct radeon_device *rdev, int ring, | |||
446 | 446 | ||
447 | r = radeon_ib_schedule(rdev, &ib, NULL, false); | 447 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
448 | if (r) { | 448 | if (r) { |
449 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); | 449 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
450 | } | 450 | } |
451 | 451 | ||
452 | if (fence) | 452 | if (fence) |
@@ -769,18 +769,18 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
769 | radeon_ring_unlock_commit(rdev, ring, false); | 769 | radeon_ring_unlock_commit(rdev, ring, false); |
770 | 770 | ||
771 | for (i = 0; i < rdev->usec_timeout; i++) { | 771 | for (i = 0; i < rdev->usec_timeout; i++) { |
772 | if (vce_v1_0_get_rptr(rdev, ring) != rptr) | 772 | if (vce_v1_0_get_rptr(rdev, ring) != rptr) |
773 | break; | 773 | break; |
774 | DRM_UDELAY(1); | 774 | DRM_UDELAY(1); |
775 | } | 775 | } |
776 | 776 | ||
777 | if (i < rdev->usec_timeout) { | 777 | if (i < rdev->usec_timeout) { |
778 | DRM_INFO("ring test on %d succeeded in %d usecs\n", | 778 | DRM_INFO("ring test on %d succeeded in %d usecs\n", |
779 | ring->idx, i); | 779 | ring->idx, i); |
780 | } else { | 780 | } else { |
781 | DRM_ERROR("radeon: ring %d test failed\n", | 781 | DRM_ERROR("radeon: ring %d test failed\n", |
782 | ring->idx); | 782 | ring->idx); |
783 | r = -ETIMEDOUT; | 783 | r = -ETIMEDOUT; |
784 | } | 784 | } |
785 | 785 | ||
786 | return r; | 786 | return r; |
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index 3979632b9225..a1358748cea5 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
@@ -611,15 +611,16 @@ uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr) | |||
611 | */ | 611 | */ |
612 | static uint32_t radeon_vm_page_flags(uint32_t flags) | 612 | static uint32_t radeon_vm_page_flags(uint32_t flags) |
613 | { | 613 | { |
614 | uint32_t hw_flags = 0; | 614 | uint32_t hw_flags = 0; |
615 | hw_flags |= (flags & RADEON_VM_PAGE_VALID) ? R600_PTE_VALID : 0; | 615 | |
616 | hw_flags |= (flags & RADEON_VM_PAGE_READABLE) ? R600_PTE_READABLE : 0; | 616 | hw_flags |= (flags & RADEON_VM_PAGE_VALID) ? R600_PTE_VALID : 0; |
617 | hw_flags |= (flags & RADEON_VM_PAGE_WRITEABLE) ? R600_PTE_WRITEABLE : 0; | 617 | hw_flags |= (flags & RADEON_VM_PAGE_READABLE) ? R600_PTE_READABLE : 0; |
618 | if (flags & RADEON_VM_PAGE_SYSTEM) { | 618 | hw_flags |= (flags & RADEON_VM_PAGE_WRITEABLE) ? R600_PTE_WRITEABLE : 0; |
619 | hw_flags |= R600_PTE_SYSTEM; | 619 | if (flags & RADEON_VM_PAGE_SYSTEM) { |
620 | hw_flags |= (flags & RADEON_VM_PAGE_SNOOPED) ? R600_PTE_SNOOPED : 0; | 620 | hw_flags |= R600_PTE_SYSTEM; |
621 | } | 621 | hw_flags |= (flags & RADEON_VM_PAGE_SNOOPED) ? R600_PTE_SNOOPED : 0; |
622 | return hw_flags; | 622 | } |
623 | return hw_flags; | ||
623 | } | 624 | } |
624 | 625 | ||
625 | /** | 626 | /** |
diff --git a/drivers/gpu/drm/radeon/rs780_dpm.c b/drivers/gpu/drm/radeon/rs780_dpm.c index cb0afe78abed..94b48fc1e266 100644 --- a/drivers/gpu/drm/radeon/rs780_dpm.c +++ b/drivers/gpu/drm/radeon/rs780_dpm.c | |||
@@ -795,7 +795,7 @@ static int rs780_parse_power_table(struct radeon_device *rdev) | |||
795 | union pplib_clock_info *clock_info; | 795 | union pplib_clock_info *clock_info; |
796 | union power_info *power_info; | 796 | union power_info *power_info; |
797 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 797 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
798 | u16 data_offset; | 798 | u16 data_offset; |
799 | u8 frev, crev; | 799 | u8 frev, crev; |
800 | struct igp_ps *ps; | 800 | struct igp_ps *ps; |
801 | 801 | ||
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index 97e5a6f1ce58..25e29303b119 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c | |||
@@ -209,7 +209,7 @@ static struct rv6xx_sclk_stepping rv6xx_next_vco_step(struct radeon_device *rdev | |||
209 | 209 | ||
210 | static bool rv6xx_can_step_post_div(struct radeon_device *rdev, | 210 | static bool rv6xx_can_step_post_div(struct radeon_device *rdev, |
211 | struct rv6xx_sclk_stepping *cur, | 211 | struct rv6xx_sclk_stepping *cur, |
212 | struct rv6xx_sclk_stepping *target) | 212 | struct rv6xx_sclk_stepping *target) |
213 | { | 213 | { |
214 | return (cur->post_divider > target->post_divider) && | 214 | return (cur->post_divider > target->post_divider) && |
215 | ((cur->vco_frequency * target->post_divider) <= | 215 | ((cur->vco_frequency * target->post_divider) <= |
@@ -239,7 +239,7 @@ static bool rv6xx_reached_stepping_target(struct radeon_device *rdev, | |||
239 | 239 | ||
240 | static void rv6xx_generate_steps(struct radeon_device *rdev, | 240 | static void rv6xx_generate_steps(struct radeon_device *rdev, |
241 | u32 low, u32 high, | 241 | u32 low, u32 high, |
242 | u32 start_index, u8 *end_index) | 242 | u32 start_index, u8 *end_index) |
243 | { | 243 | { |
244 | struct rv6xx_sclk_stepping cur; | 244 | struct rv6xx_sclk_stepping cur; |
245 | struct rv6xx_sclk_stepping target; | 245 | struct rv6xx_sclk_stepping target; |
@@ -1356,23 +1356,23 @@ static void rv6xx_set_dpm_event_sources(struct radeon_device *rdev, u32 sources) | |||
1356 | enum radeon_dpm_event_src dpm_event_src; | 1356 | enum radeon_dpm_event_src dpm_event_src; |
1357 | 1357 | ||
1358 | switch (sources) { | 1358 | switch (sources) { |
1359 | case 0: | 1359 | case 0: |
1360 | default: | 1360 | default: |
1361 | want_thermal_protection = false; | 1361 | want_thermal_protection = false; |
1362 | break; | 1362 | break; |
1363 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL): | 1363 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL): |
1364 | want_thermal_protection = true; | 1364 | want_thermal_protection = true; |
1365 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGITAL; | 1365 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGITAL; |
1366 | break; | 1366 | break; |
1367 | 1367 | ||
1368 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL): | 1368 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL): |
1369 | want_thermal_protection = true; | 1369 | want_thermal_protection = true; |
1370 | dpm_event_src = RADEON_DPM_EVENT_SRC_EXTERNAL; | 1370 | dpm_event_src = RADEON_DPM_EVENT_SRC_EXTERNAL; |
1371 | break; | 1371 | break; |
1372 | 1372 | ||
1373 | case ((1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL) | | 1373 | case ((1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL) | |
1374 | (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL)): | 1374 | (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL)): |
1375 | want_thermal_protection = true; | 1375 | want_thermal_protection = true; |
1376 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL; | 1376 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL; |
1377 | break; | 1377 | break; |
1378 | } | 1378 | } |
@@ -1879,7 +1879,7 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev) | |||
1879 | union pplib_clock_info *clock_info; | 1879 | union pplib_clock_info *clock_info; |
1880 | union power_info *power_info; | 1880 | union power_info *power_info; |
1881 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 1881 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
1882 | u16 data_offset; | 1882 | u16 data_offset; |
1883 | u8 frev, crev; | 1883 | u8 frev, crev; |
1884 | struct rv6xx_ps *ps; | 1884 | struct rv6xx_ps *ps; |
1885 | 1885 | ||
diff --git a/drivers/gpu/drm/radeon/rv740_dpm.c b/drivers/gpu/drm/radeon/rv740_dpm.c index c4c8da501da8..4b850824fe06 100644 --- a/drivers/gpu/drm/radeon/rv740_dpm.c +++ b/drivers/gpu/drm/radeon/rv740_dpm.c | |||
@@ -36,28 +36,28 @@ u32 rv740_get_decoded_reference_divider(u32 encoded_ref) | |||
36 | u32 ref = 0; | 36 | u32 ref = 0; |
37 | 37 | ||
38 | switch (encoded_ref) { | 38 | switch (encoded_ref) { |
39 | case 0: | 39 | case 0: |
40 | ref = 1; | 40 | ref = 1; |
41 | break; | 41 | break; |
42 | case 16: | 42 | case 16: |
43 | ref = 2; | 43 | ref = 2; |
44 | break; | 44 | break; |
45 | case 17: | 45 | case 17: |
46 | ref = 3; | 46 | ref = 3; |
47 | break; | 47 | break; |
48 | case 18: | 48 | case 18: |
49 | ref = 2; | 49 | ref = 2; |
50 | break; | 50 | break; |
51 | case 19: | 51 | case 19: |
52 | ref = 3; | 52 | ref = 3; |
53 | break; | 53 | break; |
54 | case 20: | 54 | case 20: |
55 | ref = 4; | 55 | ref = 4; |
56 | break; | 56 | break; |
57 | case 21: | 57 | case 21: |
58 | ref = 5; | 58 | ref = 5; |
59 | break; | 59 | break; |
60 | default: | 60 | default: |
61 | DRM_ERROR("Invalid encoded Reference Divider\n"); | 61 | DRM_ERROR("Invalid encoded Reference Divider\n"); |
62 | ref = 0; | 62 | ref = 0; |
63 | break; | 63 | break; |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index e830c8935db0..a010decf59af 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c | |||
@@ -345,27 +345,27 @@ static int rv770_encode_yclk_post_div(u32 postdiv, u32 *encoded_postdiv) | |||
345 | int ret = 0; | 345 | int ret = 0; |
346 | 346 | ||
347 | switch (postdiv) { | 347 | switch (postdiv) { |
348 | case 1: | 348 | case 1: |
349 | *encoded_postdiv = 0; | 349 | *encoded_postdiv = 0; |
350 | break; | 350 | break; |
351 | case 2: | 351 | case 2: |
352 | *encoded_postdiv = 1; | 352 | *encoded_postdiv = 1; |
353 | break; | 353 | break; |
354 | case 4: | 354 | case 4: |
355 | *encoded_postdiv = 2; | 355 | *encoded_postdiv = 2; |
356 | break; | 356 | break; |
357 | case 8: | 357 | case 8: |
358 | *encoded_postdiv = 3; | 358 | *encoded_postdiv = 3; |
359 | break; | 359 | break; |
360 | case 16: | 360 | case 16: |
361 | *encoded_postdiv = 4; | 361 | *encoded_postdiv = 4; |
362 | break; | 362 | break; |
363 | default: | 363 | default: |
364 | ret = -EINVAL; | 364 | ret = -EINVAL; |
365 | break; | 365 | break; |
366 | } | 366 | } |
367 | 367 | ||
368 | return ret; | 368 | return ret; |
369 | } | 369 | } |
370 | 370 | ||
371 | u32 rv770_map_clkf_to_ibias(struct radeon_device *rdev, u32 clkf) | 371 | u32 rv770_map_clkf_to_ibias(struct radeon_device *rdev, u32 clkf) |
@@ -1175,15 +1175,15 @@ static int rv770_init_smc_table(struct radeon_device *rdev, | |||
1175 | rv770_populate_smc_mvdd_table(rdev, table); | 1175 | rv770_populate_smc_mvdd_table(rdev, table); |
1176 | 1176 | ||
1177 | switch (rdev->pm.int_thermal_type) { | 1177 | switch (rdev->pm.int_thermal_type) { |
1178 | case THERMAL_TYPE_RV770: | 1178 | case THERMAL_TYPE_RV770: |
1179 | case THERMAL_TYPE_ADT7473_WITH_INTERNAL: | 1179 | case THERMAL_TYPE_ADT7473_WITH_INTERNAL: |
1180 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL; | 1180 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL; |
1181 | break; | 1181 | break; |
1182 | case THERMAL_TYPE_NONE: | 1182 | case THERMAL_TYPE_NONE: |
1183 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE; | 1183 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE; |
1184 | break; | 1184 | break; |
1185 | case THERMAL_TYPE_EXTERNAL_GPIO: | 1185 | case THERMAL_TYPE_EXTERNAL_GPIO: |
1186 | default: | 1186 | default: |
1187 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL; | 1187 | table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL; |
1188 | break; | 1188 | break; |
1189 | } | 1189 | } |
@@ -1567,18 +1567,18 @@ void rv770_reset_smio_status(struct radeon_device *rdev) | |||
1567 | sw_smio_index = | 1567 | sw_smio_index = |
1568 | (RREG32(GENERAL_PWRMGT) & SW_SMIO_INDEX_MASK) >> SW_SMIO_INDEX_SHIFT; | 1568 | (RREG32(GENERAL_PWRMGT) & SW_SMIO_INDEX_MASK) >> SW_SMIO_INDEX_SHIFT; |
1569 | switch (sw_smio_index) { | 1569 | switch (sw_smio_index) { |
1570 | case 3: | 1570 | case 3: |
1571 | vid_smio_cntl = RREG32(S3_VID_LOWER_SMIO_CNTL); | 1571 | vid_smio_cntl = RREG32(S3_VID_LOWER_SMIO_CNTL); |
1572 | break; | 1572 | break; |
1573 | case 2: | 1573 | case 2: |
1574 | vid_smio_cntl = RREG32(S2_VID_LOWER_SMIO_CNTL); | 1574 | vid_smio_cntl = RREG32(S2_VID_LOWER_SMIO_CNTL); |
1575 | break; | 1575 | break; |
1576 | case 1: | 1576 | case 1: |
1577 | vid_smio_cntl = RREG32(S1_VID_LOWER_SMIO_CNTL); | 1577 | vid_smio_cntl = RREG32(S1_VID_LOWER_SMIO_CNTL); |
1578 | break; | 1578 | break; |
1579 | case 0: | 1579 | case 0: |
1580 | return; | 1580 | return; |
1581 | default: | 1581 | default: |
1582 | vid_smio_cntl = pi->s0_vid_lower_smio_cntl; | 1582 | vid_smio_cntl = pi->s0_vid_lower_smio_cntl; |
1583 | break; | 1583 | break; |
1584 | } | 1584 | } |
@@ -1817,21 +1817,21 @@ static void rv770_set_dpm_event_sources(struct radeon_device *rdev, u32 sources) | |||
1817 | enum radeon_dpm_event_src dpm_event_src; | 1817 | enum radeon_dpm_event_src dpm_event_src; |
1818 | 1818 | ||
1819 | switch (sources) { | 1819 | switch (sources) { |
1820 | case 0: | 1820 | case 0: |
1821 | default: | 1821 | default: |
1822 | want_thermal_protection = false; | 1822 | want_thermal_protection = false; |
1823 | break; | 1823 | break; |
1824 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL): | 1824 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL): |
1825 | want_thermal_protection = true; | 1825 | want_thermal_protection = true; |
1826 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGITAL; | 1826 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGITAL; |
1827 | break; | 1827 | break; |
1828 | 1828 | ||
1829 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL): | 1829 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL): |
1830 | want_thermal_protection = true; | 1830 | want_thermal_protection = true; |
1831 | dpm_event_src = RADEON_DPM_EVENT_SRC_EXTERNAL; | 1831 | dpm_event_src = RADEON_DPM_EVENT_SRC_EXTERNAL; |
1832 | break; | 1832 | break; |
1833 | 1833 | ||
1834 | case ((1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL) | | 1834 | case ((1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL) | |
1835 | (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL)): | 1835 | (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL)): |
1836 | want_thermal_protection = true; | 1836 | want_thermal_protection = true; |
1837 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL; | 1837 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL; |
@@ -2273,7 +2273,7 @@ int rv7xx_parse_power_table(struct radeon_device *rdev) | |||
2273 | union pplib_clock_info *clock_info; | 2273 | union pplib_clock_info *clock_info; |
2274 | union power_info *power_info; | 2274 | union power_info *power_info; |
2275 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 2275 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
2276 | u16 data_offset; | 2276 | u16 data_offset; |
2277 | u8 frev, crev; | 2277 | u8 frev, crev; |
2278 | struct rv7xx_ps *ps; | 2278 | struct rv7xx_ps *ps; |
2279 | 2279 | ||
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index f878d6962da5..ae21550fe767 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -1307,7 +1307,7 @@ int si_get_allowed_info_register(struct radeon_device *rdev, | |||
1307 | */ | 1307 | */ |
1308 | u32 si_get_xclk(struct radeon_device *rdev) | 1308 | u32 si_get_xclk(struct radeon_device *rdev) |
1309 | { | 1309 | { |
1310 | u32 reference_clock = rdev->clock.spll.reference_freq; | 1310 | u32 reference_clock = rdev->clock.spll.reference_freq; |
1311 | u32 tmp; | 1311 | u32 tmp; |
1312 | 1312 | ||
1313 | tmp = RREG32(CG_CLKPIN_CNTL_2); | 1313 | tmp = RREG32(CG_CLKPIN_CNTL_2); |
@@ -2442,8 +2442,10 @@ void dce6_bandwidth_update(struct radeon_device *rdev) | |||
2442 | */ | 2442 | */ |
2443 | static void si_tiling_mode_table_init(struct radeon_device *rdev) | 2443 | static void si_tiling_mode_table_init(struct radeon_device *rdev) |
2444 | { | 2444 | { |
2445 | const u32 num_tile_mode_states = 32; | 2445 | u32 *tile = rdev->config.si.tile_mode_array; |
2446 | u32 reg_offset, gb_tile_moden, split_equal_to_row_size; | 2446 | const u32 num_tile_mode_states = |
2447 | ARRAY_SIZE(rdev->config.si.tile_mode_array); | ||
2448 | u32 reg_offset, split_equal_to_row_size; | ||
2447 | 2449 | ||
2448 | switch (rdev->config.si.mem_row_size_in_kb) { | 2450 | switch (rdev->config.si.mem_row_size_in_kb) { |
2449 | case 1: | 2451 | case 1: |
@@ -2458,491 +2460,442 @@ static void si_tiling_mode_table_init(struct radeon_device *rdev) | |||
2458 | break; | 2460 | break; |
2459 | } | 2461 | } |
2460 | 2462 | ||
2461 | if ((rdev->family == CHIP_TAHITI) || | 2463 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) |
2462 | (rdev->family == CHIP_PITCAIRN)) { | 2464 | tile[reg_offset] = 0; |
2463 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { | 2465 | |
2464 | switch (reg_offset) { | 2466 | switch(rdev->family) { |
2465 | case 0: /* non-AA compressed depth or any compressed stencil */ | 2467 | case CHIP_TAHITI: |
2466 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2468 | case CHIP_PITCAIRN: |
2467 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2469 | /* non-AA compressed depth or any compressed stencil */ |
2468 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2470 | tile[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2469 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2471 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2470 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2472 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2471 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2473 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2472 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2474 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2473 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2475 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2474 | break; | 2476 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2475 | case 1: /* 2xAA/4xAA compressed depth only */ | 2477 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2476 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2478 | /* 2xAA/4xAA compressed depth only */ |
2477 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2479 | tile[1] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2478 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2480 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2479 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) | | 2481 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2480 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2482 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) | |
2481 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2483 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2482 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2484 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2483 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2485 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2484 | break; | 2486 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2485 | case 2: /* 8xAA compressed depth only */ | 2487 | /* 8xAA compressed depth only */ |
2486 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2488 | tile[2] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2487 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2489 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2488 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2490 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2489 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2491 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2490 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2492 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2491 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2493 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2492 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2494 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2493 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2495 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2494 | break; | 2496 | /* 2xAA/4xAA compressed depth with stencil (for depth buffer) */ |
2495 | case 3: /* 2xAA/4xAA compressed depth with stencil (for depth buffer) */ | 2497 | tile[3] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2496 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2498 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2497 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2499 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2498 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2500 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) | |
2499 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) | | 2501 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2500 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2502 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2501 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2503 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2502 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2504 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2503 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2505 | /* Maps w/ a dimension less than the 2D macro-tile dimensions (for mipmapped depth textures) */ |
2504 | break; | 2506 | tile[4] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2505 | case 4: /* Maps w/ a dimension less than the 2D macro-tile dimensions (for mipmapped depth textures) */ | 2507 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2506 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2508 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2507 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2509 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2508 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2510 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2509 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2511 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2510 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2512 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2511 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2513 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2512 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2514 | /* Uncompressed 16bpp depth - and stencil buffer allocated with it */ |
2513 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2515 | tile[5] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2514 | break; | 2516 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2515 | case 5: /* Uncompressed 16bpp depth - and stencil buffer allocated with it */ | 2517 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2516 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2518 | TILE_SPLIT(split_equal_to_row_size) | |
2517 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2519 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2518 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2520 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2519 | TILE_SPLIT(split_equal_to_row_size) | | 2521 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2520 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2522 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2521 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2523 | /* Uncompressed 32bpp depth - and stencil buffer allocated with it */ |
2522 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2524 | tile[6] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2523 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2525 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2524 | break; | 2526 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2525 | case 6: /* Uncompressed 32bpp depth - and stencil buffer allocated with it */ | 2527 | TILE_SPLIT(split_equal_to_row_size) | |
2526 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2528 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2527 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2529 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2528 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2530 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2529 | TILE_SPLIT(split_equal_to_row_size) | | 2531 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); |
2530 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2532 | /* Uncompressed 8bpp stencil without depth (drivers typically do not use) */ |
2531 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2533 | tile[7] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2532 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2534 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2533 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); | 2535 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2534 | break; | 2536 | TILE_SPLIT(split_equal_to_row_size) | |
2535 | case 7: /* Uncompressed 8bpp stencil without depth (drivers typically do not use) */ | 2537 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2536 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2538 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2537 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2539 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2538 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2540 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2539 | TILE_SPLIT(split_equal_to_row_size) | | 2541 | /* 1D and 1D Array Surfaces */ |
2540 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2542 | tile[8] = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | |
2541 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2543 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2542 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2544 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2543 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2545 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2544 | break; | 2546 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2545 | case 8: /* 1D and 1D Array Surfaces */ | 2547 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2546 | gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | | 2548 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2547 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2549 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2548 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2550 | /* Displayable maps. */ |
2549 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2551 | tile[9] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2550 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2552 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2551 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2553 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2552 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2554 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2553 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2555 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2554 | break; | 2556 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2555 | case 9: /* Displayable maps. */ | 2557 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2556 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2558 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2557 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2559 | /* Display 8bpp. */ |
2558 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2560 | tile[10] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2559 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2561 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2560 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2562 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2561 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2563 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2562 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2564 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2563 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2565 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2564 | break; | 2566 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2565 | case 10: /* Display 8bpp. */ | 2567 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2566 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2568 | /* Display 16bpp. */ |
2567 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2569 | tile[11] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2568 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2570 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2569 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2571 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2570 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2572 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2571 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2573 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2572 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2574 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2573 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2575 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2574 | break; | 2576 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2575 | case 11: /* Display 16bpp. */ | 2577 | /* Display 32bpp. */ |
2576 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2578 | tile[12] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2577 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2579 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2578 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2580 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2579 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2581 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | |
2580 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2582 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2581 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2583 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2582 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2584 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2583 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2585 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); |
2584 | break; | 2586 | /* Thin. */ |
2585 | case 12: /* Display 32bpp. */ | 2587 | tile[13] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2586 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2588 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2587 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2589 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2588 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2590 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2589 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | | 2591 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2590 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2592 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2591 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2593 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2592 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2594 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2593 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); | 2595 | /* Thin 8 bpp. */ |
2594 | break; | 2596 | tile[14] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2595 | case 13: /* Thin. */ | 2597 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2596 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2598 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2597 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2599 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2598 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2600 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2599 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2601 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2600 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2602 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2601 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2603 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); |
2602 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2604 | /* Thin 16 bpp. */ |
2603 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2605 | tile[15] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2604 | break; | 2606 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2605 | case 14: /* Thin 8 bpp. */ | 2607 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2606 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2608 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2607 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2609 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2608 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2610 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2609 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2611 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2610 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2612 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); |
2611 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2613 | /* Thin 32 bpp. */ |
2612 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2614 | tile[16] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2613 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); | 2615 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2614 | break; | 2616 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2615 | case 15: /* Thin 16 bpp. */ | 2617 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | |
2616 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2618 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2617 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2619 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2618 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2620 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2619 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2621 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); |
2620 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2622 | /* Thin 64 bpp. */ |
2621 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2623 | tile[17] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2622 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2624 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2623 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); | 2625 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2624 | break; | 2626 | TILE_SPLIT(split_equal_to_row_size) | |
2625 | case 16: /* Thin 32 bpp. */ | 2627 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2626 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2628 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2627 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2629 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2628 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2630 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); |
2629 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | | 2631 | /* 8 bpp PRT. */ |
2630 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2632 | tile[21] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2631 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2633 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2632 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2634 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2633 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); | 2635 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2634 | break; | 2636 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2635 | case 17: /* Thin 64 bpp. */ | 2637 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | |
2636 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2638 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2637 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2639 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2638 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2640 | /* 16 bpp PRT */ |
2639 | TILE_SPLIT(split_equal_to_row_size) | | 2641 | tile[22] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2640 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2642 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2641 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2643 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2642 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2644 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2643 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); | 2645 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2644 | break; | 2646 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2645 | case 21: /* 8 bpp PRT. */ | 2647 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2646 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2648 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); |
2647 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2649 | /* 32 bpp PRT */ |
2648 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2650 | tile[23] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2649 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2651 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2650 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2652 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2651 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | 2653 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2652 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2654 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2653 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2655 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2654 | break; | 2656 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2655 | case 22: /* 16 bpp PRT */ | 2657 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2656 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2658 | /* 64 bpp PRT */ |
2657 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2659 | tile[24] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2658 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2660 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2659 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2661 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2660 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2662 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | |
2661 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2663 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2662 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2664 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2663 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); | 2665 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2664 | break; | 2666 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2665 | case 23: /* 32 bpp PRT */ | 2667 | /* 128 bpp PRT */ |
2666 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2668 | tile[25] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2667 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2669 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2668 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2670 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2669 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2671 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) | |
2670 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2672 | NUM_BANKS(ADDR_SURF_8_BANK) | |
2671 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2673 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2672 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2674 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2673 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2675 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); |
2674 | break; | 2676 | |
2675 | case 24: /* 64 bpp PRT */ | 2677 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) |
2676 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2678 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), tile[reg_offset]); |
2677 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2679 | break; |
2678 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2680 | |
2679 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | | 2681 | case CHIP_VERDE: |
2680 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2682 | case CHIP_OLAND: |
2681 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2683 | case CHIP_HAINAN: |
2682 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2684 | /* non-AA compressed depth or any compressed stencil */ |
2683 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2685 | tile[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2684 | break; | 2686 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2685 | case 25: /* 128 bpp PRT */ | 2687 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2686 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2688 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2687 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2689 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2688 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2690 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2689 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) | | 2691 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2690 | NUM_BANKS(ADDR_SURF_8_BANK) | | 2692 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); |
2691 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2693 | /* 2xAA/4xAA compressed depth only */ |
2692 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2694 | tile[1] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2693 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); | 2695 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2694 | break; | 2696 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2695 | default: | 2697 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) | |
2696 | gb_tile_moden = 0; | 2698 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2697 | break; | 2699 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2698 | } | 2700 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2699 | rdev->config.si.tile_mode_array[reg_offset] = gb_tile_moden; | 2701 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); |
2700 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); | 2702 | /* 8xAA compressed depth only */ |
2701 | } | 2703 | tile[2] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2702 | } else if ((rdev->family == CHIP_VERDE) || | 2704 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2703 | (rdev->family == CHIP_OLAND) || | 2705 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2704 | (rdev->family == CHIP_HAINAN)) { | 2706 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2705 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { | 2707 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2706 | switch (reg_offset) { | 2708 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2707 | case 0: /* non-AA compressed depth or any compressed stencil */ | 2709 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2708 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2710 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); |
2709 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2711 | /* 2xAA/4xAA compressed depth with stencil (for depth buffer) */ |
2710 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2712 | tile[3] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2711 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2713 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2712 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2714 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2713 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2715 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) | |
2714 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2716 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2715 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); | 2717 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2716 | break; | 2718 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2717 | case 1: /* 2xAA/4xAA compressed depth only */ | 2719 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); |
2718 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2720 | /* Maps w/ a dimension less than the 2D macro-tile dimensions (for mipmapped depth textures) */ |
2719 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2721 | tile[4] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2720 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2722 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2721 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) | | 2723 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2722 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2724 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2723 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2725 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2724 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2726 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2725 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); | 2727 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2726 | break; | 2728 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2727 | case 2: /* 8xAA compressed depth only */ | 2729 | /* Uncompressed 16bpp depth - and stencil buffer allocated with it */ |
2728 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2730 | tile[5] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2729 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2731 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2730 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2732 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2731 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2733 | TILE_SPLIT(split_equal_to_row_size) | |
2732 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2734 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2733 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2735 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2734 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2736 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2735 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); | 2737 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2736 | break; | 2738 | /* Uncompressed 32bpp depth - and stencil buffer allocated with it */ |
2737 | case 3: /* 2xAA/4xAA compressed depth with stencil (for depth buffer) */ | 2739 | tile[6] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2738 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2740 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2739 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2741 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2740 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2742 | TILE_SPLIT(split_equal_to_row_size) | |
2741 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) | | 2743 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2742 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2744 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2743 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2745 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2744 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2746 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2745 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); | 2747 | /* Uncompressed 8bpp stencil without depth (drivers typically do not use) */ |
2746 | break; | 2748 | tile[7] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2747 | case 4: /* Maps w/ a dimension less than the 2D macro-tile dimensions (for mipmapped depth textures) */ | 2749 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | |
2748 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2750 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2749 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2751 | TILE_SPLIT(split_equal_to_row_size) | |
2750 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2752 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2751 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2753 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2752 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2754 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2753 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2755 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); |
2754 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2756 | /* 1D and 1D Array Surfaces */ |
2755 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2757 | tile[8] = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | |
2756 | break; | 2758 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2757 | case 5: /* Uncompressed 16bpp depth - and stencil buffer allocated with it */ | 2759 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2758 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2760 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2759 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2761 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2760 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2762 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2761 | TILE_SPLIT(split_equal_to_row_size) | | 2763 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2762 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2764 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2763 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2765 | /* Displayable maps. */ |
2764 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2766 | tile[9] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2765 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2767 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2766 | break; | 2768 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2767 | case 6: /* Uncompressed 32bpp depth - and stencil buffer allocated with it */ | 2769 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2768 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2770 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2769 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2771 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2770 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2772 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2771 | TILE_SPLIT(split_equal_to_row_size) | | 2773 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2772 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2774 | /* Display 8bpp. */ |
2773 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2775 | tile[10] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2774 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2776 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2775 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2777 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2776 | break; | 2778 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2777 | case 7: /* Uncompressed 8bpp stencil without depth (drivers typically do not use) */ | 2779 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2778 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2780 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2779 | MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) | | 2781 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2780 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2782 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); |
2781 | TILE_SPLIT(split_equal_to_row_size) | | 2783 | /* Display 16bpp. */ |
2782 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2784 | tile[11] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2783 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2785 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2784 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2786 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2785 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); | 2787 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2786 | break; | 2788 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2787 | case 8: /* 1D and 1D Array Surfaces */ | 2789 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2788 | gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) | | 2790 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2789 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2791 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2790 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2792 | /* Display 32bpp. */ |
2791 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2793 | tile[12] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2792 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2794 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | |
2793 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2795 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2794 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2796 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | |
2795 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2797 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2796 | break; | 2798 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2797 | case 9: /* Displayable maps. */ | 2799 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2798 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2800 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2799 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2801 | /* Thin. */ |
2800 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2802 | tile[13] = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | |
2801 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2803 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2802 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2804 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2803 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2805 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | |
2804 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2806 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2805 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2807 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2806 | break; | 2808 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2807 | case 10: /* Display 8bpp. */ | 2809 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2808 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2810 | /* Thin 8 bpp. */ |
2809 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2811 | tile[14] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2810 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2812 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2811 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2813 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2812 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2814 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2813 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2815 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2814 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2816 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2815 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); | 2817 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2816 | break; | 2818 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2817 | case 11: /* Display 16bpp. */ | 2819 | /* Thin 16 bpp. */ |
2818 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2820 | tile[15] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2819 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2821 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2820 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2822 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2821 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2823 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2822 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2824 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2823 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2825 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2824 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2826 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2825 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2827 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2826 | break; | 2828 | /* Thin 32 bpp. */ |
2827 | case 12: /* Display 32bpp. */ | 2829 | tile[16] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2828 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2830 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2829 | MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) | | 2831 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2830 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2832 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | |
2831 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | | 2833 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2832 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2834 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2833 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2835 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2834 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2836 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2835 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2837 | /* Thin 64 bpp. */ |
2836 | break; | 2838 | tile[17] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2837 | case 13: /* Thin. */ | 2839 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2838 | gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) | | 2840 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | |
2839 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2841 | TILE_SPLIT(split_equal_to_row_size) | |
2840 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2842 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2841 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) | | 2843 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2842 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2844 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2843 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2845 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2844 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2846 | /* 8 bpp PRT. */ |
2845 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2847 | tile[21] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2846 | break; | 2848 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2847 | case 14: /* Thin 8 bpp. */ | 2849 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2848 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2850 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2849 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2851 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2850 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2852 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | |
2851 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2853 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2852 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2854 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2853 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2855 | /* 16 bpp PRT */ |
2854 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2856 | tile[22] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2855 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2857 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2856 | break; | 2858 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2857 | case 15: /* Thin 16 bpp. */ | 2859 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2858 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2860 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2859 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2861 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2860 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2862 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | |
2861 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2863 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); |
2862 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2864 | /* 32 bpp PRT */ |
2863 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2865 | tile[23] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2864 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | 2866 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2865 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2867 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2866 | break; | 2868 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | |
2867 | case 16: /* Thin 32 bpp. */ | 2869 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2868 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2870 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2869 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2871 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | |
2870 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2872 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2871 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | | 2873 | /* 64 bpp PRT */ |
2872 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2874 | tile[24] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2873 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2875 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2874 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2876 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2875 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2877 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | |
2876 | break; | 2878 | NUM_BANKS(ADDR_SURF_16_BANK) | |
2877 | case 17: /* Thin 64 bpp. */ | 2879 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2878 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2880 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2879 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2881 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); |
2880 | PIPE_CONFIG(ADDR_SURF_P4_8x16) | | 2882 | /* 128 bpp PRT */ |
2881 | TILE_SPLIT(split_equal_to_row_size) | | 2883 | tile[25] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | |
2882 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2884 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | |
2883 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | 2885 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | |
2884 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | 2886 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) | |
2885 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | 2887 | NUM_BANKS(ADDR_SURF_8_BANK) | |
2886 | break; | 2888 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | |
2887 | case 21: /* 8 bpp PRT. */ | 2889 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | |
2888 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | 2890 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); |
2889 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | 2891 | |
2890 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | 2892 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) |
2891 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | 2893 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), tile[reg_offset]); |
2892 | NUM_BANKS(ADDR_SURF_16_BANK) | | 2894 | break; |
2893 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) | | 2895 | |
2894 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | 2896 | default: |
2895 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | ||
2896 | break; | ||
2897 | case 22: /* 16 bpp PRT */ | ||
2898 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2899 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | ||
2900 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | ||
2901 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | ||
2902 | NUM_BANKS(ADDR_SURF_16_BANK) | | ||
2903 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2904 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) | | ||
2905 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4)); | ||
2906 | break; | ||
2907 | case 23: /* 32 bpp PRT */ | ||
2908 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2909 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | ||
2910 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | ||
2911 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) | | ||
2912 | NUM_BANKS(ADDR_SURF_16_BANK) | | ||
2913 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2914 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) | | ||
2915 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | ||
2916 | break; | ||
2917 | case 24: /* 64 bpp PRT */ | ||
2918 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2919 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | ||
2920 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | ||
2921 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) | | ||
2922 | NUM_BANKS(ADDR_SURF_16_BANK) | | ||
2923 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2924 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2925 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2)); | ||
2926 | break; | ||
2927 | case 25: /* 128 bpp PRT */ | ||
2928 | gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) | | ||
2929 | MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) | | ||
2930 | PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) | | ||
2931 | TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) | | ||
2932 | NUM_BANKS(ADDR_SURF_8_BANK) | | ||
2933 | BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) | | ||
2934 | BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) | | ||
2935 | MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1)); | ||
2936 | break; | ||
2937 | default: | ||
2938 | gb_tile_moden = 0; | ||
2939 | break; | ||
2940 | } | ||
2941 | rdev->config.si.tile_mode_array[reg_offset] = gb_tile_moden; | ||
2942 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); | ||
2943 | } | ||
2944 | } else | ||
2945 | DRM_ERROR("unknown asic: 0x%x\n", rdev->family); | 2897 | DRM_ERROR("unknown asic: 0x%x\n", rdev->family); |
2898 | } | ||
2946 | } | 2899 | } |
2947 | 2900 | ||
2948 | static void si_select_se_sh(struct radeon_device *rdev, | 2901 | static void si_select_se_sh(struct radeon_device *rdev, |
@@ -7314,7 +7267,7 @@ uint64_t si_get_gpu_clock_counter(struct radeon_device *rdev) | |||
7314 | mutex_lock(&rdev->gpu_clock_mutex); | 7267 | mutex_lock(&rdev->gpu_clock_mutex); |
7315 | WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1); | 7268 | WREG32(RLC_CAPTURE_GPU_CLOCK_COUNT, 1); |
7316 | clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) | | 7269 | clock = (uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_LSB) | |
7317 | ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL); | 7270 | ((uint64_t)RREG32(RLC_GPU_CLOCK_COUNT_MSB) << 32ULL); |
7318 | mutex_unlock(&rdev->gpu_clock_mutex); | 7271 | mutex_unlock(&rdev->gpu_clock_mutex); |
7319 | return clock; | 7272 | return clock; |
7320 | } | 7273 | } |
@@ -7775,33 +7728,33 @@ static void si_program_aspm(struct radeon_device *rdev) | |||
7775 | 7728 | ||
7776 | int si_vce_send_vcepll_ctlreq(struct radeon_device *rdev) | 7729 | int si_vce_send_vcepll_ctlreq(struct radeon_device *rdev) |
7777 | { | 7730 | { |
7778 | unsigned i; | 7731 | unsigned i; |
7779 | 7732 | ||
7780 | /* make sure VCEPLL_CTLREQ is deasserted */ | 7733 | /* make sure VCEPLL_CTLREQ is deasserted */ |
7781 | WREG32_SMC_P(CG_VCEPLL_FUNC_CNTL, 0, ~UPLL_CTLREQ_MASK); | 7734 | WREG32_SMC_P(CG_VCEPLL_FUNC_CNTL, 0, ~UPLL_CTLREQ_MASK); |
7782 | 7735 | ||
7783 | mdelay(10); | 7736 | mdelay(10); |
7784 | 7737 | ||
7785 | /* assert UPLL_CTLREQ */ | 7738 | /* assert UPLL_CTLREQ */ |
7786 | WREG32_SMC_P(CG_VCEPLL_FUNC_CNTL, UPLL_CTLREQ_MASK, ~UPLL_CTLREQ_MASK); | 7739 | WREG32_SMC_P(CG_VCEPLL_FUNC_CNTL, UPLL_CTLREQ_MASK, ~UPLL_CTLREQ_MASK); |
7787 | 7740 | ||
7788 | /* wait for CTLACK and CTLACK2 to get asserted */ | 7741 | /* wait for CTLACK and CTLACK2 to get asserted */ |
7789 | for (i = 0; i < 100; ++i) { | 7742 | for (i = 0; i < 100; ++i) { |
7790 | uint32_t mask = UPLL_CTLACK_MASK | UPLL_CTLACK2_MASK; | 7743 | uint32_t mask = UPLL_CTLACK_MASK | UPLL_CTLACK2_MASK; |
7791 | if ((RREG32_SMC(CG_VCEPLL_FUNC_CNTL) & mask) == mask) | 7744 | if ((RREG32_SMC(CG_VCEPLL_FUNC_CNTL) & mask) == mask) |
7792 | break; | 7745 | break; |
7793 | mdelay(10); | 7746 | mdelay(10); |
7794 | } | 7747 | } |
7795 | 7748 | ||
7796 | /* deassert UPLL_CTLREQ */ | 7749 | /* deassert UPLL_CTLREQ */ |
7797 | WREG32_SMC_P(CG_VCEPLL_FUNC_CNTL, 0, ~UPLL_CTLREQ_MASK); | 7750 | WREG32_SMC_P(CG_VCEPLL_FUNC_CNTL, 0, ~UPLL_CTLREQ_MASK); |
7798 | 7751 | ||
7799 | if (i == 100) { | 7752 | if (i == 100) { |
7800 | DRM_ERROR("Timeout setting UVD clocks!\n"); | 7753 | DRM_ERROR("Timeout setting UVD clocks!\n"); |
7801 | return -ETIMEDOUT; | 7754 | return -ETIMEDOUT; |
7802 | } | 7755 | } |
7803 | 7756 | ||
7804 | return 0; | 7757 | return 0; |
7805 | } | 7758 | } |
7806 | 7759 | ||
7807 | int si_set_vce_clocks(struct radeon_device *rdev, u32 evclk, u32 ecclk) | 7760 | int si_set_vce_clocks(struct radeon_device *rdev, u32 evclk, u32 ecclk) |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index a82b891ae1fe..cb75ab72098a 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -499,7 +499,7 @@ static const struct si_cac_config_reg lcac_pitcairn[] = | |||
499 | 499 | ||
500 | static const struct si_cac_config_reg cac_override_pitcairn[] = | 500 | static const struct si_cac_config_reg cac_override_pitcairn[] = |
501 | { | 501 | { |
502 | { 0xFFFFFFFF } | 502 | { 0xFFFFFFFF } |
503 | }; | 503 | }; |
504 | 504 | ||
505 | static const struct si_powertune_data powertune_data_pitcairn = | 505 | static const struct si_powertune_data powertune_data_pitcairn = |
@@ -991,7 +991,7 @@ static const struct si_cac_config_reg lcac_cape_verde[] = | |||
991 | 991 | ||
992 | static const struct si_cac_config_reg cac_override_cape_verde[] = | 992 | static const struct si_cac_config_reg cac_override_cape_verde[] = |
993 | { | 993 | { |
994 | { 0xFFFFFFFF } | 994 | { 0xFFFFFFFF } |
995 | }; | 995 | }; |
996 | 996 | ||
997 | static const struct si_powertune_data powertune_data_cape_verde = | 997 | static const struct si_powertune_data powertune_data_cape_verde = |
@@ -1762,9 +1762,9 @@ static void si_fan_ctrl_set_default_mode(struct radeon_device *rdev); | |||
1762 | 1762 | ||
1763 | static struct si_power_info *si_get_pi(struct radeon_device *rdev) | 1763 | static struct si_power_info *si_get_pi(struct radeon_device *rdev) |
1764 | { | 1764 | { |
1765 | struct si_power_info *pi = rdev->pm.dpm.priv; | 1765 | struct si_power_info *pi = rdev->pm.dpm.priv; |
1766 | 1766 | ||
1767 | return pi; | 1767 | return pi; |
1768 | } | 1768 | } |
1769 | 1769 | ||
1770 | static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coeffients *coeff, | 1770 | static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coeffients *coeff, |
@@ -3150,9 +3150,9 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
3150 | } | 3150 | } |
3151 | } | 3151 | } |
3152 | 3152 | ||
3153 | for (i = 0; i < ps->performance_level_count; i++) | 3153 | for (i = 0; i < ps->performance_level_count; i++) |
3154 | btc_adjust_clock_combinations(rdev, max_limits, | 3154 | btc_adjust_clock_combinations(rdev, max_limits, |
3155 | &ps->performance_levels[i]); | 3155 | &ps->performance_levels[i]); |
3156 | 3156 | ||
3157 | for (i = 0; i < ps->performance_level_count; i++) { | 3157 | for (i = 0; i < ps->performance_level_count; i++) { |
3158 | if (ps->performance_levels[i].vddc < min_vce_voltage) | 3158 | if (ps->performance_levels[i].vddc < min_vce_voltage) |
@@ -3291,7 +3291,7 @@ static void si_set_dpm_event_sources(struct radeon_device *rdev, u32 sources) | |||
3291 | case 0: | 3291 | case 0: |
3292 | default: | 3292 | default: |
3293 | want_thermal_protection = false; | 3293 | want_thermal_protection = false; |
3294 | break; | 3294 | break; |
3295 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL): | 3295 | case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL): |
3296 | want_thermal_protection = true; | 3296 | want_thermal_protection = true; |
3297 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGITAL; | 3297 | dpm_event_src = RADEON_DPM_EVENT_SRC_DIGITAL; |
@@ -3493,7 +3493,7 @@ static int si_process_firmware_header(struct radeon_device *rdev) | |||
3493 | if (ret) | 3493 | if (ret) |
3494 | return ret; | 3494 | return ret; |
3495 | 3495 | ||
3496 | si_pi->state_table_start = tmp; | 3496 | si_pi->state_table_start = tmp; |
3497 | 3497 | ||
3498 | ret = si_read_smc_sram_dword(rdev, | 3498 | ret = si_read_smc_sram_dword(rdev, |
3499 | SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + | 3499 | SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + |
@@ -3652,7 +3652,7 @@ static void si_program_response_times(struct radeon_device *rdev) | |||
3652 | si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_mvdd_chg_time, 1); | 3652 | si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_mvdd_chg_time, 1); |
3653 | 3653 | ||
3654 | voltage_response_time = (u32)rdev->pm.dpm.voltage_response_time; | 3654 | voltage_response_time = (u32)rdev->pm.dpm.voltage_response_time; |
3655 | backbias_response_time = (u32)rdev->pm.dpm.backbias_response_time; | 3655 | backbias_response_time = (u32)rdev->pm.dpm.backbias_response_time; |
3656 | 3656 | ||
3657 | if (voltage_response_time == 0) | 3657 | if (voltage_response_time == 0) |
3658 | voltage_response_time = 1000; | 3658 | voltage_response_time = 1000; |
@@ -3760,7 +3760,7 @@ static void si_setup_bsp(struct radeon_device *rdev) | |||
3760 | &pi->pbsu); | 3760 | &pi->pbsu); |
3761 | 3761 | ||
3762 | 3762 | ||
3763 | pi->dsp = BSP(pi->bsp) | BSU(pi->bsu); | 3763 | pi->dsp = BSP(pi->bsp) | BSU(pi->bsu); |
3764 | pi->psp = BSP(pi->pbsp) | BSU(pi->pbsu); | 3764 | pi->psp = BSP(pi->pbsp) | BSU(pi->pbsu); |
3765 | 3765 | ||
3766 | WREG32(CG_BSP, pi->dsp); | 3766 | WREG32(CG_BSP, pi->dsp); |
@@ -4308,7 +4308,7 @@ static int si_populate_memory_timing_parameters(struct radeon_device *rdev, | |||
4308 | 4308 | ||
4309 | radeon_atom_set_engine_dram_timings(rdev, | 4309 | radeon_atom_set_engine_dram_timings(rdev, |
4310 | pl->sclk, | 4310 | pl->sclk, |
4311 | pl->mclk); | 4311 | pl->mclk); |
4312 | 4312 | ||
4313 | dram_timing = RREG32(MC_ARB_DRAM_TIMING); | 4313 | dram_timing = RREG32(MC_ARB_DRAM_TIMING); |
4314 | dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2); | 4314 | dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2); |
@@ -4343,7 +4343,7 @@ static int si_do_program_memory_timing_parameters(struct radeon_device *rdev, | |||
4343 | si_pi->sram_end); | 4343 | si_pi->sram_end); |
4344 | if (ret) | 4344 | if (ret) |
4345 | break; | 4345 | break; |
4346 | } | 4346 | } |
4347 | 4347 | ||
4348 | return ret; | 4348 | return ret; |
4349 | } | 4349 | } |
@@ -4821,9 +4821,9 @@ static int si_calculate_sclk_params(struct radeon_device *rdev, | |||
4821 | spll_func_cntl_2 &= ~SCLK_MUX_SEL_MASK; | 4821 | spll_func_cntl_2 &= ~SCLK_MUX_SEL_MASK; |
4822 | spll_func_cntl_2 |= SCLK_MUX_SEL(2); | 4822 | spll_func_cntl_2 |= SCLK_MUX_SEL(2); |
4823 | 4823 | ||
4824 | spll_func_cntl_3 &= ~SPLL_FB_DIV_MASK; | 4824 | spll_func_cntl_3 &= ~SPLL_FB_DIV_MASK; |
4825 | spll_func_cntl_3 |= SPLL_FB_DIV(fbdiv); | 4825 | spll_func_cntl_3 |= SPLL_FB_DIV(fbdiv); |
4826 | spll_func_cntl_3 |= SPLL_DITHEN; | 4826 | spll_func_cntl_3 |= SPLL_DITHEN; |
4827 | 4827 | ||
4828 | if (pi->sclk_ss) { | 4828 | if (pi->sclk_ss) { |
4829 | struct radeon_atom_ss ss; | 4829 | struct radeon_atom_ss ss; |
@@ -4930,15 +4930,15 @@ static int si_populate_mclk_value(struct radeon_device *rdev, | |||
4930 | tmp = freq_nom / reference_clock; | 4930 | tmp = freq_nom / reference_clock; |
4931 | tmp = tmp * tmp; | 4931 | tmp = tmp * tmp; |
4932 | if (radeon_atombios_get_asic_ss_info(rdev, &ss, | 4932 | if (radeon_atombios_get_asic_ss_info(rdev, &ss, |
4933 | ASIC_INTERNAL_MEMORY_SS, freq_nom)) { | 4933 | ASIC_INTERNAL_MEMORY_SS, freq_nom)) { |
4934 | u32 clks = reference_clock * 5 / ss.rate; | 4934 | u32 clks = reference_clock * 5 / ss.rate; |
4935 | u32 clkv = (u32)((((131 * ss.percentage * ss.rate) / 100) * tmp) / freq_nom); | 4935 | u32 clkv = (u32)((((131 * ss.percentage * ss.rate) / 100) * tmp) / freq_nom); |
4936 | 4936 | ||
4937 | mpll_ss1 &= ~CLKV_MASK; | 4937 | mpll_ss1 &= ~CLKV_MASK; |
4938 | mpll_ss1 |= CLKV(clkv); | 4938 | mpll_ss1 |= CLKV(clkv); |
4939 | 4939 | ||
4940 | mpll_ss2 &= ~CLKS_MASK; | 4940 | mpll_ss2 &= ~CLKS_MASK; |
4941 | mpll_ss2 |= CLKS(clks); | 4941 | mpll_ss2 |= CLKS(clks); |
4942 | } | 4942 | } |
4943 | } | 4943 | } |
4944 | 4944 | ||
@@ -5265,7 +5265,7 @@ static int si_convert_power_state_to_smc(struct radeon_device *rdev, | |||
5265 | ni_pi->enable_power_containment = false; | 5265 | ni_pi->enable_power_containment = false; |
5266 | 5266 | ||
5267 | ret = si_populate_sq_ramping_values(rdev, radeon_state, smc_state); | 5267 | ret = si_populate_sq_ramping_values(rdev, radeon_state, smc_state); |
5268 | if (ret) | 5268 | if (ret) |
5269 | ni_pi->enable_sq_ramping = false; | 5269 | ni_pi->enable_sq_ramping = false; |
5270 | 5270 | ||
5271 | return si_populate_smc_t(rdev, radeon_state, smc_state); | 5271 | return si_populate_smc_t(rdev, radeon_state, smc_state); |
@@ -5436,46 +5436,46 @@ static bool si_check_s0_mc_reg_index(u16 in_reg, u16 *out_reg) | |||
5436 | case MC_SEQ_RAS_TIMING >> 2: | 5436 | case MC_SEQ_RAS_TIMING >> 2: |
5437 | *out_reg = MC_SEQ_RAS_TIMING_LP >> 2; | 5437 | *out_reg = MC_SEQ_RAS_TIMING_LP >> 2; |
5438 | break; | 5438 | break; |
5439 | case MC_SEQ_CAS_TIMING >> 2: | 5439 | case MC_SEQ_CAS_TIMING >> 2: |
5440 | *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; | 5440 | *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; |
5441 | break; | 5441 | break; |
5442 | case MC_SEQ_MISC_TIMING >> 2: | 5442 | case MC_SEQ_MISC_TIMING >> 2: |
5443 | *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; | 5443 | *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; |
5444 | break; | 5444 | break; |
5445 | case MC_SEQ_MISC_TIMING2 >> 2: | 5445 | case MC_SEQ_MISC_TIMING2 >> 2: |
5446 | *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2; | 5446 | *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2; |
5447 | break; | 5447 | break; |
5448 | case MC_SEQ_RD_CTL_D0 >> 2: | 5448 | case MC_SEQ_RD_CTL_D0 >> 2: |
5449 | *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2; | 5449 | *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2; |
5450 | break; | 5450 | break; |
5451 | case MC_SEQ_RD_CTL_D1 >> 2: | 5451 | case MC_SEQ_RD_CTL_D1 >> 2: |
5452 | *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2; | 5452 | *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2; |
5453 | break; | 5453 | break; |
5454 | case MC_SEQ_WR_CTL_D0 >> 2: | 5454 | case MC_SEQ_WR_CTL_D0 >> 2: |
5455 | *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2; | 5455 | *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2; |
5456 | break; | 5456 | break; |
5457 | case MC_SEQ_WR_CTL_D1 >> 2: | 5457 | case MC_SEQ_WR_CTL_D1 >> 2: |
5458 | *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2; | 5458 | *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2; |
5459 | break; | 5459 | break; |
5460 | case MC_PMG_CMD_EMRS >> 2: | 5460 | case MC_PMG_CMD_EMRS >> 2: |
5461 | *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2; | 5461 | *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2; |
5462 | break; | 5462 | break; |
5463 | case MC_PMG_CMD_MRS >> 2: | 5463 | case MC_PMG_CMD_MRS >> 2: |
5464 | *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2; | 5464 | *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2; |
5465 | break; | 5465 | break; |
5466 | case MC_PMG_CMD_MRS1 >> 2: | 5466 | case MC_PMG_CMD_MRS1 >> 2: |
5467 | *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2; | 5467 | *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2; |
5468 | break; | 5468 | break; |
5469 | case MC_SEQ_PMG_TIMING >> 2: | 5469 | case MC_SEQ_PMG_TIMING >> 2: |
5470 | *out_reg = MC_SEQ_PMG_TIMING_LP >> 2; | 5470 | *out_reg = MC_SEQ_PMG_TIMING_LP >> 2; |
5471 | break; | 5471 | break; |
5472 | case MC_PMG_CMD_MRS2 >> 2: | 5472 | case MC_PMG_CMD_MRS2 >> 2: |
5473 | *out_reg = MC_SEQ_PMG_CMD_MRS2_LP >> 2; | 5473 | *out_reg = MC_SEQ_PMG_CMD_MRS2_LP >> 2; |
5474 | break; | 5474 | break; |
5475 | case MC_SEQ_WR_CTL_2 >> 2: | 5475 | case MC_SEQ_WR_CTL_2 >> 2: |
5476 | *out_reg = MC_SEQ_WR_CTL_2_LP >> 2; | 5476 | *out_reg = MC_SEQ_WR_CTL_2_LP >> 2; |
5477 | break; | 5477 | break; |
5478 | default: | 5478 | default: |
5479 | result = false; | 5479 | result = false; |
5480 | break; | 5480 | break; |
5481 | } | 5481 | } |
@@ -5562,19 +5562,19 @@ static int si_initialize_mc_reg_table(struct radeon_device *rdev) | |||
5562 | WREG32(MC_SEQ_PMG_CMD_MRS2_LP, RREG32(MC_PMG_CMD_MRS2)); | 5562 | WREG32(MC_SEQ_PMG_CMD_MRS2_LP, RREG32(MC_PMG_CMD_MRS2)); |
5563 | WREG32(MC_SEQ_WR_CTL_2_LP, RREG32(MC_SEQ_WR_CTL_2)); | 5563 | WREG32(MC_SEQ_WR_CTL_2_LP, RREG32(MC_SEQ_WR_CTL_2)); |
5564 | 5564 | ||
5565 | ret = radeon_atom_init_mc_reg_table(rdev, module_index, table); | 5565 | ret = radeon_atom_init_mc_reg_table(rdev, module_index, table); |
5566 | if (ret) | 5566 | if (ret) |
5567 | goto init_mc_done; | 5567 | goto init_mc_done; |
5568 | 5568 | ||
5569 | ret = si_copy_vbios_mc_reg_table(table, si_table); | 5569 | ret = si_copy_vbios_mc_reg_table(table, si_table); |
5570 | if (ret) | 5570 | if (ret) |
5571 | goto init_mc_done; | 5571 | goto init_mc_done; |
5572 | 5572 | ||
5573 | si_set_s0_mc_reg_index(si_table); | 5573 | si_set_s0_mc_reg_index(si_table); |
5574 | 5574 | ||
5575 | ret = si_set_mc_special_registers(rdev, si_table); | 5575 | ret = si_set_mc_special_registers(rdev, si_table); |
5576 | if (ret) | 5576 | if (ret) |
5577 | goto init_mc_done; | 5577 | goto init_mc_done; |
5578 | 5578 | ||
5579 | si_set_valid_flag(si_table); | 5579 | si_set_valid_flag(si_table); |
5580 | 5580 | ||
@@ -5715,10 +5715,10 @@ static int si_upload_mc_reg_table(struct radeon_device *rdev, | |||
5715 | 5715 | ||
5716 | static void si_enable_voltage_control(struct radeon_device *rdev, bool enable) | 5716 | static void si_enable_voltage_control(struct radeon_device *rdev, bool enable) |
5717 | { | 5717 | { |
5718 | if (enable) | 5718 | if (enable) |
5719 | WREG32_P(GENERAL_PWRMGT, VOLT_PWRMGT_EN, ~VOLT_PWRMGT_EN); | 5719 | WREG32_P(GENERAL_PWRMGT, VOLT_PWRMGT_EN, ~VOLT_PWRMGT_EN); |
5720 | else | 5720 | else |
5721 | WREG32_P(GENERAL_PWRMGT, 0, ~VOLT_PWRMGT_EN); | 5721 | WREG32_P(GENERAL_PWRMGT, 0, ~VOLT_PWRMGT_EN); |
5722 | } | 5722 | } |
5723 | 5723 | ||
5724 | static enum radeon_pcie_gen si_get_maximum_link_speed(struct radeon_device *rdev, | 5724 | static enum radeon_pcie_gen si_get_maximum_link_speed(struct radeon_device *rdev, |
@@ -6820,7 +6820,7 @@ static int si_parse_power_table(struct radeon_device *rdev) | |||
6820 | struct _NonClockInfoArray *non_clock_info_array; | 6820 | struct _NonClockInfoArray *non_clock_info_array; |
6821 | union power_info *power_info; | 6821 | union power_info *power_info; |
6822 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 6822 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
6823 | u16 data_offset; | 6823 | u16 data_offset; |
6824 | u8 frev, crev; | 6824 | u8 frev, crev; |
6825 | u8 *power_state_offset; | 6825 | u8 *power_state_offset; |
6826 | struct ni_ps *ps; | 6826 | struct ni_ps *ps; |
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c index cd0862809adf..f0d5c1724f55 100644 --- a/drivers/gpu/drm/radeon/sumo_dpm.c +++ b/drivers/gpu/drm/radeon/sumo_dpm.c | |||
@@ -787,8 +787,8 @@ static void sumo_program_acpi_power_level(struct radeon_device *rdev) | |||
787 | struct atom_clock_dividers dividers; | 787 | struct atom_clock_dividers dividers; |
788 | int ret; | 788 | int ret; |
789 | 789 | ||
790 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, | 790 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, |
791 | pi->acpi_pl.sclk, | 791 | pi->acpi_pl.sclk, |
792 | false, ÷rs); | 792 | false, ÷rs); |
793 | if (ret) | 793 | if (ret) |
794 | return; | 794 | return; |
@@ -1462,7 +1462,7 @@ static int sumo_parse_power_table(struct radeon_device *rdev) | |||
1462 | struct _NonClockInfoArray *non_clock_info_array; | 1462 | struct _NonClockInfoArray *non_clock_info_array; |
1463 | union power_info *power_info; | 1463 | union power_info *power_info; |
1464 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 1464 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
1465 | u16 data_offset; | 1465 | u16 data_offset; |
1466 | u8 frev, crev; | 1466 | u8 frev, crev; |
1467 | u8 *power_state_offset; | 1467 | u8 *power_state_offset; |
1468 | struct sumo_ps *ps; | 1468 | struct sumo_ps *ps; |
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index d34bfcdab9be..6730367ac228 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
@@ -369,8 +369,8 @@ static void trinity_gfx_powergating_initialize(struct radeon_device *rdev) | |||
369 | int ret; | 369 | int ret; |
370 | u32 hw_rev = (RREG32(HW_REV) & ATI_REV_ID_MASK) >> ATI_REV_ID_SHIFT; | 370 | u32 hw_rev = (RREG32(HW_REV) & ATI_REV_ID_MASK) >> ATI_REV_ID_SHIFT; |
371 | 371 | ||
372 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, | 372 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, |
373 | 25000, false, ÷rs); | 373 | 25000, false, ÷rs); |
374 | if (ret) | 374 | if (ret) |
375 | return; | 375 | return; |
376 | 376 | ||
@@ -587,8 +587,8 @@ static void trinity_set_divider_value(struct radeon_device *rdev, | |||
587 | u32 value; | 587 | u32 value; |
588 | u32 ix = index * TRINITY_SIZEOF_DPM_STATE_TABLE; | 588 | u32 ix = index * TRINITY_SIZEOF_DPM_STATE_TABLE; |
589 | 589 | ||
590 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, | 590 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, |
591 | sclk, false, ÷rs); | 591 | sclk, false, ÷rs); |
592 | if (ret) | 592 | if (ret) |
593 | return; | 593 | return; |
594 | 594 | ||
@@ -597,8 +597,8 @@ static void trinity_set_divider_value(struct radeon_device *rdev, | |||
597 | value |= CLK_DIVIDER(dividers.post_div); | 597 | value |= CLK_DIVIDER(dividers.post_div); |
598 | WREG32_SMC(SMU_SCLK_DPM_STATE_0_CNTL_0 + ix, value); | 598 | WREG32_SMC(SMU_SCLK_DPM_STATE_0_CNTL_0 + ix, value); |
599 | 599 | ||
600 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, | 600 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, |
601 | sclk/2, false, ÷rs); | 601 | sclk/2, false, ÷rs); |
602 | if (ret) | 602 | if (ret) |
603 | return; | 603 | return; |
604 | 604 | ||
@@ -1045,14 +1045,14 @@ static int trinity_set_thermal_temperature_range(struct radeon_device *rdev, | |||
1045 | int low_temp = 0 * 1000; | 1045 | int low_temp = 0 * 1000; |
1046 | int high_temp = 255 * 1000; | 1046 | int high_temp = 255 * 1000; |
1047 | 1047 | ||
1048 | if (low_temp < min_temp) | 1048 | if (low_temp < min_temp) |
1049 | low_temp = min_temp; | 1049 | low_temp = min_temp; |
1050 | if (high_temp > max_temp) | 1050 | if (high_temp > max_temp) |
1051 | high_temp = max_temp; | 1051 | high_temp = max_temp; |
1052 | if (high_temp < low_temp) { | 1052 | if (high_temp < low_temp) { |
1053 | DRM_ERROR("invalid thermal range: %d - %d\n", low_temp, high_temp); | 1053 | DRM_ERROR("invalid thermal range: %d - %d\n", low_temp, high_temp); |
1054 | return -EINVAL; | 1054 | return -EINVAL; |
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | WREG32_P(CG_THERMAL_INT_CTRL, DIG_THERM_INTH(49 + (high_temp / 1000)), ~DIG_THERM_INTH_MASK); | 1057 | WREG32_P(CG_THERMAL_INT_CTRL, DIG_THERM_INTH(49 + (high_temp / 1000)), ~DIG_THERM_INTH_MASK); |
1058 | WREG32_P(CG_THERMAL_INT_CTRL, DIG_THERM_INTL(49 + (low_temp / 1000)), ~DIG_THERM_INTL_MASK); | 1058 | WREG32_P(CG_THERMAL_INT_CTRL, DIG_THERM_INTL(49 + (low_temp / 1000)), ~DIG_THERM_INTL_MASK); |
@@ -1737,7 +1737,7 @@ static int trinity_parse_power_table(struct radeon_device *rdev) | |||
1737 | struct _NonClockInfoArray *non_clock_info_array; | 1737 | struct _NonClockInfoArray *non_clock_info_array; |
1738 | union power_info *power_info; | 1738 | union power_info *power_info; |
1739 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); | 1739 | int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); |
1740 | u16 data_offset; | 1740 | u16 data_offset; |
1741 | u8 frev, crev; | 1741 | u8 frev, crev; |
1742 | u8 *power_state_offset; | 1742 | u8 *power_state_offset; |
1743 | struct sumo_ps *ps; | 1743 | struct sumo_ps *ps; |
diff --git a/drivers/gpu/drm/radeon/vce_v2_0.c b/drivers/gpu/drm/radeon/vce_v2_0.c index cdeaab7c7b1e..fce214482e72 100644 --- a/drivers/gpu/drm/radeon/vce_v2_0.c +++ b/drivers/gpu/drm/radeon/vce_v2_0.c | |||
@@ -53,7 +53,7 @@ static void vce_v2_0_set_sw_cg(struct radeon_device *rdev, bool gated) | |||
53 | WREG32(VCE_UENC_REG_CLOCK_GATING, tmp); | 53 | WREG32(VCE_UENC_REG_CLOCK_GATING, tmp); |
54 | 54 | ||
55 | WREG32(VCE_CGTT_CLK_OVERRIDE, 0); | 55 | WREG32(VCE_CGTT_CLK_OVERRIDE, 0); |
56 | } else { | 56 | } else { |
57 | tmp = RREG32(VCE_CLOCK_GATING_B); | 57 | tmp = RREG32(VCE_CLOCK_GATING_B); |
58 | tmp |= 0xe7; | 58 | tmp |= 0xe7; |
59 | tmp &= ~0xe70000; | 59 | tmp &= ~0xe70000; |