diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 3cb5e903cd62..4c992826d2d6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | |||
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned ndw) | |||
65 | { | 65 | { |
66 | /* Align requested size with padding so unlock_commit can | 66 | /* Align requested size with padding so unlock_commit can |
67 | * pad safely */ | 67 | * pad safely */ |
68 | ndw = (ndw + ring->align_mask) & ~ring->align_mask; | 68 | ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask; |
69 | 69 | ||
70 | /* Make sure we aren't trying to allocate more space | 70 | /* Make sure we aren't trying to allocate more space |
71 | * than the maximum for one submission | 71 | * than the maximum for one submission |
@@ -94,7 +94,7 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count) | |||
94 | int i; | 94 | int i; |
95 | 95 | ||
96 | for (i = 0; i < count; i++) | 96 | for (i = 0; i < count; i++) |
97 | amdgpu_ring_write(ring, ring->nop); | 97 | amdgpu_ring_write(ring, ring->funcs->nop); |
98 | } | 98 | } |
99 | 99 | ||
100 | /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets | 100 | /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets |
@@ -106,8 +106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count) | |||
106 | */ | 106 | */ |
107 | void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib) | 107 | void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib) |
108 | { | 108 | { |
109 | while (ib->length_dw & ring->align_mask) | 109 | while (ib->length_dw & ring->funcs->align_mask) |
110 | ib->ptr[ib->length_dw++] = ring->nop; | 110 | ib->ptr[ib->length_dw++] = ring->funcs->nop; |
111 | } | 111 | } |
112 | 112 | ||
113 | /** | 113 | /** |
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring) | |||
125 | uint32_t count; | 125 | uint32_t count; |
126 | 126 | ||
127 | /* We pad to match fetch size */ | 127 | /* We pad to match fetch size */ |
128 | count = ring->align_mask + 1 - (ring->wptr & ring->align_mask); | 128 | count = ring->funcs->align_mask + 1 - |
129 | count %= ring->align_mask + 1; | 129 | (ring->wptr & ring->funcs->align_mask); |
130 | count %= ring->funcs->align_mask + 1; | ||
130 | ring->funcs->insert_nop(ring, count); | 131 | ring->funcs->insert_nop(ring, count); |
131 | 132 | ||
132 | mb(); | 133 | mb(); |
@@ -163,9 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring) | |||
163 | * Returns 0 on success, error on failure. | 164 | * Returns 0 on success, error on failure. |
164 | */ | 165 | */ |
165 | int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | 166 | int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, |
166 | unsigned max_dw, u32 nop, u32 align_mask, | 167 | unsigned max_dw, struct amdgpu_irq_src *irq_src, |
167 | struct amdgpu_irq_src *irq_src, unsigned irq_type, | 168 | unsigned irq_type) |
168 | enum amdgpu_ring_type ring_type) | ||
169 | { | 169 | { |
170 | int r; | 170 | int r; |
171 | 171 | ||
@@ -216,9 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
216 | 216 | ||
217 | ring->ring_size = roundup_pow_of_two(max_dw * 4 * | 217 | ring->ring_size = roundup_pow_of_two(max_dw * 4 * |
218 | amdgpu_sched_hw_submission); | 218 | amdgpu_sched_hw_submission); |
219 | ring->align_mask = align_mask; | ||
220 | ring->nop = nop; | ||
221 | ring->type = ring_type; | ||
222 | 219 | ||
223 | /* Allocate ring buffer */ | 220 | /* Allocate ring buffer */ |
224 | if (ring->ring_obj == NULL) { | 221 | if (ring->ring_obj == NULL) { |