History

Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm radeon fixes from Dave Airlie: "One core fix, but mostly radeon fixes for s/r and big endian UVD support, and a fix to stop the GPU being reset for no good reason, and crashing people's machines." * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/radeon: update lockup tracking when scheduling in empty ring drm/prime: Honor requested file flags when exporting a buffer drm/radeon: fix UVD on big endian drm/radeon: fix write back suspend regression with uvd v2 drm/radeon: do not try to uselessly update virtual memory pagetable

Linus Torvalds committed 13 years ago

Commit e61cd5e2 parents 64a2f30 9aa36877 files · +85 −55Browse files

Unified · Split

7 files
  1. drivers/gpu/drm/drm_prime.c +1 −2
  2. drivers/gpu/drm/radeon/r600.c +10 −3
  3. drivers/gpu/drm/radeon/radeon_device.c +24 −29
  4. drivers/gpu/drm/radeon/radeon_fence.c +8 −2
  5. drivers/gpu/drm/radeon/radeon_gart.c +4 −2
  6. drivers/gpu/drm/radeon/radeon_ring.c +7 −0
  7. drivers/gpu/drm/radeon/radeon_uvd.c +31 −17
drivers/gpu/drm/drm_prime.c+1−2
@@ -190,8 +190,7 @@ struct dma_buf *drm_gem_prime_export(struct drm_device *dev, · 189 unmodified lines
190190 if (ret)
191191 return ERR_PTR(ret);
192192 }
193− return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size,
194− 0600);
193+ return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size, flags);
195194 }
196195 EXPORT_SYMBOL(drm_gem_prime_export);
197196
drivers/gpu/drm/radeon/r600.c+10−3
@@ -2687,6 +2687,9 @@ void r600_uvd_rbc_stop(struct radeon_device *rdev) · 2686 unmodified lines
26872687 int r600_uvd_init(struct radeon_device *rdev)
26882688 {
26892689 int i, j, r;
2690+ /* disable byte swapping */
2691+ u32 lmi_swap_cntl = 0;
2692+ u32 mp_swap_cntl = 0;
26902693
26912694 /* raise clocks while booting up the VCPU */
26922695 radeon_set_uvd_clocks(rdev, 53300, 40000);
@@ -2711,9 +2714,13 @@ int r600_uvd_init(struct radeon_device *rdev) · 18 unmodified lines
27112714 WREG32(UVD_LMI_CTRL, 0x40 | (1 << 8) | (1 << 13) |
27122715 (1 << 21) | (1 << 9) | (1 << 20));
27132716
2714− /* disable byte swapping */
2715− WREG32(UVD_LMI_SWAP_CNTL, 0);
2716− WREG32(UVD_MP_SWAP_CNTL, 0);
2717+#ifdef __BIG_ENDIAN
2718+ /* swap (8 in 32) RB and IB */
2719+ lmi_swap_cntl = 0xa;
2720+ mp_swap_cntl = 0;
2721+#endif
2722+ WREG32(UVD_LMI_SWAP_CNTL, lmi_swap_cntl);
2723+ WREG32(UVD_MP_SWAP_CNTL, mp_swap_cntl);
27172724
27182725 WREG32(UVD_MPC_SET_MUXA0, 0x40c2040);
27192726 WREG32(UVD_MPC_SET_MUXA1, 0x0);
drivers/gpu/drm/radeon/radeon_device.c+24−29
@@ -244,16 +244,6 @@ void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg) · 243 unmodified lines
244244 */
245245 void radeon_wb_disable(struct radeon_device *rdev)
246246 {
247− int r;
248−
249− if (rdev->wb.wb_obj) {
250− r = radeon_bo_reserve(rdev->wb.wb_obj, false);
251− if (unlikely(r != 0))
252− return;
253− radeon_bo_kunmap(rdev->wb.wb_obj);
254− radeon_bo_unpin(rdev->wb.wb_obj);
255− radeon_bo_unreserve(rdev->wb.wb_obj);
256− }
257247 rdev->wb.enabled = false;
258248 }
259249
@@ -269,6 +259,11 @@ void radeon_wb_fini(struct radeon_device *rdev) · 9 unmodified lines
269259 {
270260 radeon_wb_disable(rdev);
271261 if (rdev->wb.wb_obj) {
262+ if (!radeon_bo_reserve(rdev->wb.wb_obj, false)) {
263+ radeon_bo_kunmap(rdev->wb.wb_obj);
264+ radeon_bo_unpin(rdev->wb.wb_obj);
265+ radeon_bo_unreserve(rdev->wb.wb_obj);
266+ }
272267 radeon_bo_unref(&rdev->wb.wb_obj);
273268 rdev->wb.wb = NULL;
274269 rdev->wb.wb_obj = NULL;
@@ -295,26 +290,26 @@ int radeon_wb_init(struct radeon_device *rdev) · 20 unmodified lines
295290 dev_warn(rdev->dev, "(%d) create WB bo failed\n", r);
296291 return r;
297292 }
298− }
299− r = radeon_bo_reserve(rdev->wb.wb_obj, false);
300− if (unlikely(r != 0)) {
301− radeon_wb_fini(rdev);
302− return r;
303− }
304− r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT,
305− &rdev->wb.gpu_addr);
306− if (r) {
293+ r = radeon_bo_reserve(rdev->wb.wb_obj, false);
294+ if (unlikely(r != 0)) {
295+ radeon_wb_fini(rdev);
296+ return r;
297+ }
298+ r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT,
299+ &rdev->wb.gpu_addr);
300+ if (r) {
301+ radeon_bo_unreserve(rdev->wb.wb_obj);
302+ dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r);
303+ radeon_wb_fini(rdev);
304+ return r;
305+ }
306+ r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb);
307307 radeon_bo_unreserve(rdev->wb.wb_obj);
308− dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r);
309− radeon_wb_fini(rdev);
310− return r;
311− }
312− r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb);
313− radeon_bo_unreserve(rdev->wb.wb_obj);
314− if (r) {
315− dev_warn(rdev->dev, "(%d) map WB bo failed\n", r);
316− radeon_wb_fini(rdev);
317− return r;
308+ if (r) {
309+ dev_warn(rdev->dev, "(%d) map WB bo failed\n", r);
310+ radeon_wb_fini(rdev);
311+ return r;
312+ }
318313 }
319314
320315 /* clear wb memory */
drivers/gpu/drm/radeon/radeon_fence.c+8−2
@@ -63,7 +63,9 @@ static void radeon_fence_write(struct radeon_device *rdev, u32 seq, int ring) · 62 unmodified lines
6363 {
6464 struct radeon_fence_driver *drv = &rdev->fence_drv[ring];
6565 if (likely(rdev->wb.enabled || !drv->scratch_reg)) {
66− *drv->cpu_addr = cpu_to_le32(seq);
66+ if (drv->cpu_addr) {
67+ *drv->cpu_addr = cpu_to_le32(seq);
68+ }
6769 } else {
6870 WREG32(drv->scratch_reg, seq);
6971 }
@@ -84,7 +86,11 @@ static u32 radeon_fence_read(struct radeon_device *rdev, int ring) · 14 unmodified lines
8486 u32 seq = 0;
8587
8688 if (likely(rdev->wb.enabled || !drv->scratch_reg)) {
87− seq = le32_to_cpu(*drv->cpu_addr);
89+ if (drv->cpu_addr) {
90+ seq = le32_to_cpu(*drv->cpu_addr);
91+ } else {
92+ seq = lower_32_bits(atomic64_read(&drv->last_seq));
93+ }
8894 } else {
8995 seq = RREG32(drv->scratch_reg);
9096 }
drivers/gpu/drm/radeon/radeon_gart.c+4−2
@@ -1197,11 +1197,13 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, · 1196 unmodified lines
11971197 int radeon_vm_bo_rmv(struct radeon_device *rdev,
11981198 struct radeon_bo_va *bo_va)
11991199 {
1200− int r;
1200+ int r = 0;
12011201
12021202 mutex_lock(&rdev->vm_manager.lock);
12031203 mutex_lock(&bo_va->vm->mutex);
1204− r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL);
1204+ if (bo_va->soffset) {
1205+ r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL);
1206+ }
12051207 mutex_unlock(&rdev->vm_manager.lock);
12061208 list_del(&bo_va->vm_list);
12071209 mutex_unlock(&bo_va->vm->mutex);
drivers/gpu/drm/radeon/radeon_ring.c+7−0
@@ -402,6 +402,13 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi · 401 unmodified lines
402402 return -ENOMEM;
403403 /* Align requested size with padding so unlock_commit can
404404 * pad safely */
405+ radeon_ring_free_size(rdev, ring);
406+ if (ring->ring_free_dw == (ring->ring_size / 4)) {
407+ /* This is an empty ring update lockup info to avoid
408+ * false positive.
409+ */
410+ radeon_ring_lockup_update(ring);
411+ }
405412 ndw = (ndw + ring->align_mask) & ~ring->align_mask;
406413 while (ndw > (ring->ring_free_dw - 1)) {
407414 radeon_ring_free_size(rdev, ring);
drivers/gpu/drm/radeon/radeon_uvd.c+31−17
@@ -159,7 +159,17 @@ int radeon_uvd_suspend(struct radeon_device *rdev) · 158 unmodified lines
159159 if (!r) {
160160 radeon_bo_kunmap(rdev->uvd.vcpu_bo);
161161 radeon_bo_unpin(rdev->uvd.vcpu_bo);
162+ rdev->uvd.cpu_addr = NULL;
163+ if (!radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_CPU, NULL)) {
164+ radeon_bo_kmap(rdev->uvd.vcpu_bo, &rdev->uvd.cpu_addr);
165+ }
162166 radeon_bo_unreserve(rdev->uvd.vcpu_bo);
167+
168+ if (rdev->uvd.cpu_addr) {
169+ radeon_fence_driver_start_ring(rdev, R600_RING_TYPE_UVD_INDEX);
170+ } else {
171+ rdev->fence_drv[R600_RING_TYPE_UVD_INDEX].cpu_addr = NULL;
172+ }
163173 }
164174 return r;
165175 }
@@ -178,6 +188,10 @@ int radeon_uvd_resume(struct radeon_device *rdev) · 12 unmodified lines
178188 return r;
179189 }
180190
191+ /* Have been pin in cpu unmap unpin */
192+ radeon_bo_kunmap(rdev->uvd.vcpu_bo);
193+ radeon_bo_unpin(rdev->uvd.vcpu_bo);
194+
181195 r = radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_VRAM,
182196 &rdev->uvd.gpu_addr);
183197 if (r) {
@@ -613,19 +627,19 @@ int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring, · 429 unmodified lines
613627 }
614628
615629 /* stitch together an UVD create msg */
616− msg[0] = 0x00000de4;
617− msg[1] = 0x00000000;
618− msg[2] = handle;
619− msg[3] = 0x00000000;
620− msg[4] = 0x00000000;
621− msg[5] = 0x00000000;
622− msg[6] = 0x00000000;
623− msg[7] = 0x00000780;
624− msg[8] = 0x00000440;
625− msg[9] = 0x00000000;
626− msg[10] = 0x01b37000;
630+ msg[0] = cpu_to_le32(0x00000de4);
631+ msg[1] = cpu_to_le32(0x00000000);
632+ msg[2] = cpu_to_le32(handle);
633+ msg[3] = cpu_to_le32(0x00000000);
634+ msg[4] = cpu_to_le32(0x00000000);
635+ msg[5] = cpu_to_le32(0x00000000);
636+ msg[6] = cpu_to_le32(0x00000000);
637+ msg[7] = cpu_to_le32(0x00000780);
638+ msg[8] = cpu_to_le32(0x00000440);
639+ msg[9] = cpu_to_le32(0x00000000);
640+ msg[10] = cpu_to_le32(0x01b37000);
627641 for (i = 11; i < 1024; ++i)
628− msg[i] = 0x0;
642+ msg[i] = cpu_to_le32(0x0);
629643
630644 radeon_bo_kunmap(bo);
631645 radeon_bo_unreserve(bo);
@@ -659,12 +673,12 @@ int radeon_uvd_get_destroy_msg(struct radeon_device *rdev, int ring, · 27 unmodified lines
659673 }
660674
661675 /* stitch together an UVD destroy msg */
662− msg[0] = 0x00000de4;
663− msg[1] = 0x00000002;
664− msg[2] = handle;
665− msg[3] = 0x00000000;
676+ msg[0] = cpu_to_le32(0x00000de4);
677+ msg[1] = cpu_to_le32(0x00000002);
678+ msg[2] = cpu_to_le32(handle);
679+ msg[3] = cpu_to_le32(0x00000000);
666680 for (i = 4; i < 1024; ++i)
667− msg[i] = 0x0;
681+ msg[i] = cpu_to_le32(0x0);
668682
669683 radeon_bo_kunmap(bo);
670684 radeon_bo_unreserve(bo);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t