aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-10-27 20:35:59 -0400
committerDave Airlie <airlied@redhat.com>2016-10-27 20:35:59 -0400
commita1873c62710b23e9afbd2faeed5f28649cbe4739 (patch)
treefd07fb6b1dc0c61a15ba563cad3ef2e46687f45c /drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
parent5481e27f6fd06b7cb902072e81d6b083db8155eb (diff)
parent3495a103579380288a130dc1862488cd8a4293f5 (diff)
Merge branch 'drm-next-4.10' of git://people.freedesktop.org/~agd5f/linux into drm-next
First new feature pull for 4.10. Highlights: - Support for multple virtual displays in the virtual dce component - New VM mgr to support non-contiguous vram buffers - Support for UVD powergating on additional asics - Power management improvements - lots of code cleanup and bug fixes * 'drm-next-4.10' of git://people.freedesktop.org/~agd5f/linux: (107 commits) drm/amdgpu: turn on/off uvd clock when dpm enable/disable on CI drm/amdgpu: disable dpm before turn off clock when vce idle. drm/amdgpu: enable uvd bypass mode for CI/VI. drm/amdgpu: just not load smc firmware if smu is already running drm/amdgpu: when suspend, set boot state instand of disable dpm. drm/amdgpu: use failed label to handle context init failure drm/amdgpu: add amdgpu_ttm_bo_eviction_valuable callback drm/ttm: make eviction decision a driver callback v2 drm/ttm: fix coding style in ttm_bo_driver.h drm/radeon/pm: autoswitch power state when in balanced mode drm/amd/powerplay: fix spelling mistake and add KERN_WARNING to printks drm/amdgpu:new ids flag for preempt drm/amdgpu: mark symbols static where possible drm/amdgpu: change function declarations and add missing header dependencies drm/amdgpu: s/amdgpuCrtc/amdgpu_crtc/ in pageflip code drm/amdgpu/atom: remove a bunch of unused functions drm/amdgpu: consolidate atom scratch reg handling for hangs drm/amdgpu: use amdgpu_bo_[create|free]_kernel for wb drm/amdgpu: add VCE VM session tracking drm/amdgpu: improve parse_cs handling a bit ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c21
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 */
107void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib) 107void 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 */
165int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, 166int 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) {