diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 235 |
1 files changed, 118 insertions, 117 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 138b95216d8d..1dc3a4aba020 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -94,33 +94,38 @@ extern int radeon_disp_priority; | |||
94 | extern int radeon_hw_i2c; | 94 | extern int radeon_hw_i2c; |
95 | extern int radeon_pcie_gen2; | 95 | extern int radeon_pcie_gen2; |
96 | extern int radeon_msi; | 96 | extern int radeon_msi; |
97 | extern int radeon_lockup_timeout; | ||
97 | 98 | ||
98 | /* | 99 | /* |
99 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 100 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
100 | * symbol; | 101 | * symbol; |
101 | */ | 102 | */ |
102 | #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ | 103 | #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ |
103 | #define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) | 104 | #define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) |
104 | /* RADEON_IB_POOL_SIZE must be a power of 2 */ | 105 | /* RADEON_IB_POOL_SIZE must be a power of 2 */ |
105 | #define RADEON_IB_POOL_SIZE 16 | 106 | #define RADEON_IB_POOL_SIZE 16 |
106 | #define RADEON_DEBUGFS_MAX_COMPONENTS 32 | 107 | #define RADEON_DEBUGFS_MAX_COMPONENTS 32 |
107 | #define RADEONFB_CONN_LIMIT 4 | 108 | #define RADEONFB_CONN_LIMIT 4 |
108 | #define RADEON_BIOS_NUM_SCRATCH 8 | 109 | #define RADEON_BIOS_NUM_SCRATCH 8 |
109 | 110 | ||
110 | /* max number of rings */ | 111 | /* max number of rings */ |
111 | #define RADEON_NUM_RINGS 3 | 112 | #define RADEON_NUM_RINGS 3 |
113 | |||
114 | /* fence seq are set to this number when signaled */ | ||
115 | #define RADEON_FENCE_SIGNALED_SEQ 0LL | ||
116 | #define RADEON_FENCE_NOTEMITED_SEQ (~0LL) | ||
112 | 117 | ||
113 | /* internal ring indices */ | 118 | /* internal ring indices */ |
114 | /* r1xx+ has gfx CP ring */ | 119 | /* r1xx+ has gfx CP ring */ |
115 | #define RADEON_RING_TYPE_GFX_INDEX 0 | 120 | #define RADEON_RING_TYPE_GFX_INDEX 0 |
116 | 121 | ||
117 | /* cayman has 2 compute CP rings */ | 122 | /* cayman has 2 compute CP rings */ |
118 | #define CAYMAN_RING_TYPE_CP1_INDEX 1 | 123 | #define CAYMAN_RING_TYPE_CP1_INDEX 1 |
119 | #define CAYMAN_RING_TYPE_CP2_INDEX 2 | 124 | #define CAYMAN_RING_TYPE_CP2_INDEX 2 |
120 | 125 | ||
121 | /* hardcode those limit for now */ | 126 | /* hardcode those limit for now */ |
122 | #define RADEON_VA_RESERVED_SIZE (8 << 20) | 127 | #define RADEON_VA_RESERVED_SIZE (8 << 20) |
123 | #define RADEON_IB_VM_MAX_SIZE (64 << 10) | 128 | #define RADEON_IB_VM_MAX_SIZE (64 << 10) |
124 | 129 | ||
125 | /* | 130 | /* |
126 | * Errata workarounds. | 131 | * Errata workarounds. |
@@ -253,28 +258,20 @@ struct radeon_fence_driver { | |||
253 | uint32_t scratch_reg; | 258 | uint32_t scratch_reg; |
254 | uint64_t gpu_addr; | 259 | uint64_t gpu_addr; |
255 | volatile uint32_t *cpu_addr; | 260 | volatile uint32_t *cpu_addr; |
256 | atomic_t seq; | 261 | /* seq is protected by ring emission lock */ |
257 | uint32_t last_seq; | 262 | uint64_t seq; |
258 | unsigned long last_jiffies; | 263 | atomic64_t last_seq; |
259 | unsigned long last_timeout; | 264 | unsigned long last_activity; |
260 | wait_queue_head_t queue; | ||
261 | struct list_head created; | ||
262 | struct list_head emitted; | ||
263 | struct list_head signaled; | ||
264 | bool initialized; | 265 | bool initialized; |
265 | }; | 266 | }; |
266 | 267 | ||
267 | struct radeon_fence { | 268 | struct radeon_fence { |
268 | struct radeon_device *rdev; | 269 | struct radeon_device *rdev; |
269 | struct kref kref; | 270 | struct kref kref; |
270 | struct list_head list; | ||
271 | /* protected by radeon_fence.lock */ | 271 | /* protected by radeon_fence.lock */ |
272 | uint32_t seq; | 272 | uint64_t seq; |
273 | bool emitted; | ||
274 | bool signaled; | ||
275 | /* RB, DMA, etc. */ | 273 | /* RB, DMA, etc. */ |
276 | int ring; | 274 | unsigned ring; |
277 | struct radeon_semaphore *semaphore; | ||
278 | }; | 275 | }; |
279 | 276 | ||
280 | int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring); | 277 | int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring); |
@@ -285,11 +282,14 @@ int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence); | |||
285 | void radeon_fence_process(struct radeon_device *rdev, int ring); | 282 | void radeon_fence_process(struct radeon_device *rdev, int ring); |
286 | bool radeon_fence_signaled(struct radeon_fence *fence); | 283 | bool radeon_fence_signaled(struct radeon_fence *fence); |
287 | int radeon_fence_wait(struct radeon_fence *fence, bool interruptible); | 284 | int radeon_fence_wait(struct radeon_fence *fence, bool interruptible); |
288 | int radeon_fence_wait_next(struct radeon_device *rdev, int ring); | 285 | int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring); |
289 | int radeon_fence_wait_last(struct radeon_device *rdev, int ring); | 286 | int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring); |
287 | int radeon_fence_wait_any(struct radeon_device *rdev, | ||
288 | struct radeon_fence **fences, | ||
289 | bool intr); | ||
290 | struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); | 290 | struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); |
291 | void radeon_fence_unref(struct radeon_fence **fence); | 291 | void radeon_fence_unref(struct radeon_fence **fence); |
292 | int radeon_fence_count_emitted(struct radeon_device *rdev, int ring); | 292 | unsigned radeon_fence_count_emitted(struct radeon_device *rdev, int ring); |
293 | 293 | ||
294 | /* | 294 | /* |
295 | * Tiling registers | 295 | * Tiling registers |
@@ -382,8 +382,11 @@ struct radeon_bo_list { | |||
382 | * alignment). | 382 | * alignment). |
383 | */ | 383 | */ |
384 | struct radeon_sa_manager { | 384 | struct radeon_sa_manager { |
385 | spinlock_t lock; | ||
385 | struct radeon_bo *bo; | 386 | struct radeon_bo *bo; |
386 | struct list_head sa_bo; | 387 | struct list_head *hole; |
388 | struct list_head flist[RADEON_NUM_RINGS]; | ||
389 | struct list_head olist; | ||
387 | unsigned size; | 390 | unsigned size; |
388 | uint64_t gpu_addr; | 391 | uint64_t gpu_addr; |
389 | void *cpu_ptr; | 392 | void *cpu_ptr; |
@@ -394,10 +397,12 @@ struct radeon_sa_bo; | |||
394 | 397 | ||
395 | /* sub-allocation buffer */ | 398 | /* sub-allocation buffer */ |
396 | struct radeon_sa_bo { | 399 | struct radeon_sa_bo { |
397 | struct list_head list; | 400 | struct list_head olist; |
401 | struct list_head flist; | ||
398 | struct radeon_sa_manager *manager; | 402 | struct radeon_sa_manager *manager; |
399 | unsigned offset; | 403 | unsigned soffset; |
400 | unsigned size; | 404 | unsigned eoffset; |
405 | struct radeon_fence *fence; | ||
401 | }; | 406 | }; |
402 | 407 | ||
403 | /* | 408 | /* |
@@ -428,42 +433,26 @@ int radeon_mode_dumb_destroy(struct drm_file *file_priv, | |||
428 | /* | 433 | /* |
429 | * Semaphores. | 434 | * Semaphores. |
430 | */ | 435 | */ |
431 | struct radeon_ring; | ||
432 | |||
433 | #define RADEON_SEMAPHORE_BO_SIZE 256 | ||
434 | |||
435 | struct radeon_semaphore_driver { | ||
436 | rwlock_t lock; | ||
437 | struct list_head bo; | ||
438 | }; | ||
439 | |||
440 | struct radeon_semaphore_bo; | ||
441 | |||
442 | /* everything here is constant */ | 436 | /* everything here is constant */ |
443 | struct radeon_semaphore { | 437 | struct radeon_semaphore { |
444 | struct list_head list; | 438 | struct radeon_sa_bo *sa_bo; |
439 | signed waiters; | ||
445 | uint64_t gpu_addr; | 440 | uint64_t gpu_addr; |
446 | uint32_t *cpu_ptr; | ||
447 | struct radeon_semaphore_bo *bo; | ||
448 | }; | 441 | }; |
449 | 442 | ||
450 | struct radeon_semaphore_bo { | ||
451 | struct list_head list; | ||
452 | struct radeon_ib *ib; | ||
453 | struct list_head free; | ||
454 | struct radeon_semaphore semaphores[RADEON_SEMAPHORE_BO_SIZE/8]; | ||
455 | unsigned nused; | ||
456 | }; | ||
457 | |||
458 | void radeon_semaphore_driver_fini(struct radeon_device *rdev); | ||
459 | int radeon_semaphore_create(struct radeon_device *rdev, | 443 | int radeon_semaphore_create(struct radeon_device *rdev, |
460 | struct radeon_semaphore **semaphore); | 444 | struct radeon_semaphore **semaphore); |
461 | void radeon_semaphore_emit_signal(struct radeon_device *rdev, int ring, | 445 | void radeon_semaphore_emit_signal(struct radeon_device *rdev, int ring, |
462 | struct radeon_semaphore *semaphore); | 446 | struct radeon_semaphore *semaphore); |
463 | void radeon_semaphore_emit_wait(struct radeon_device *rdev, int ring, | 447 | void radeon_semaphore_emit_wait(struct radeon_device *rdev, int ring, |
464 | struct radeon_semaphore *semaphore); | 448 | struct radeon_semaphore *semaphore); |
449 | int radeon_semaphore_sync_rings(struct radeon_device *rdev, | ||
450 | struct radeon_semaphore *semaphore, | ||
451 | bool sync_to[RADEON_NUM_RINGS], | ||
452 | int dst_ring); | ||
465 | void radeon_semaphore_free(struct radeon_device *rdev, | 453 | void radeon_semaphore_free(struct radeon_device *rdev, |
466 | struct radeon_semaphore *semaphore); | 454 | struct radeon_semaphore *semaphore, |
455 | struct radeon_fence *fence); | ||
467 | 456 | ||
468 | /* | 457 | /* |
469 | * GART structures, functions & helpers | 458 | * GART structures, functions & helpers |
@@ -560,6 +549,7 @@ struct radeon_unpin_work { | |||
560 | 549 | ||
561 | struct r500_irq_stat_regs { | 550 | struct r500_irq_stat_regs { |
562 | u32 disp_int; | 551 | u32 disp_int; |
552 | u32 hdmi0_status; | ||
563 | }; | 553 | }; |
564 | 554 | ||
565 | struct r600_irq_stat_regs { | 555 | struct r600_irq_stat_regs { |
@@ -568,6 +558,8 @@ struct r600_irq_stat_regs { | |||
568 | u32 disp_int_cont2; | 558 | u32 disp_int_cont2; |
569 | u32 d1grph_int; | 559 | u32 d1grph_int; |
570 | u32 d2grph_int; | 560 | u32 d2grph_int; |
561 | u32 hdmi0_status; | ||
562 | u32 hdmi1_status; | ||
571 | }; | 563 | }; |
572 | 564 | ||
573 | struct evergreen_irq_stat_regs { | 565 | struct evergreen_irq_stat_regs { |
@@ -583,6 +575,12 @@ struct evergreen_irq_stat_regs { | |||
583 | u32 d4grph_int; | 575 | u32 d4grph_int; |
584 | u32 d5grph_int; | 576 | u32 d5grph_int; |
585 | u32 d6grph_int; | 577 | u32 d6grph_int; |
578 | u32 afmt_status1; | ||
579 | u32 afmt_status2; | ||
580 | u32 afmt_status3; | ||
581 | u32 afmt_status4; | ||
582 | u32 afmt_status5; | ||
583 | u32 afmt_status6; | ||
586 | }; | 584 | }; |
587 | 585 | ||
588 | union radeon_irq_stat_regs { | 586 | union radeon_irq_stat_regs { |
@@ -593,7 +591,7 @@ union radeon_irq_stat_regs { | |||
593 | 591 | ||
594 | #define RADEON_MAX_HPD_PINS 6 | 592 | #define RADEON_MAX_HPD_PINS 6 |
595 | #define RADEON_MAX_CRTCS 6 | 593 | #define RADEON_MAX_CRTCS 6 |
596 | #define RADEON_MAX_HDMI_BLOCKS 2 | 594 | #define RADEON_MAX_AFMT_BLOCKS 6 |
597 | 595 | ||
598 | struct radeon_irq { | 596 | struct radeon_irq { |
599 | bool installed; | 597 | bool installed; |
@@ -605,7 +603,7 @@ struct radeon_irq { | |||
605 | bool gui_idle; | 603 | bool gui_idle; |
606 | bool gui_idle_acked; | 604 | bool gui_idle_acked; |
607 | wait_queue_head_t idle_queue; | 605 | wait_queue_head_t idle_queue; |
608 | bool hdmi[RADEON_MAX_HDMI_BLOCKS]; | 606 | bool afmt[RADEON_MAX_AFMT_BLOCKS]; |
609 | spinlock_t sw_lock; | 607 | spinlock_t sw_lock; |
610 | int sw_refcount[RADEON_NUM_RINGS]; | 608 | int sw_refcount[RADEON_NUM_RINGS]; |
611 | union radeon_irq_stat_regs stat_regs; | 609 | union radeon_irq_stat_regs stat_regs; |
@@ -625,26 +623,14 @@ void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc); | |||
625 | */ | 623 | */ |
626 | 624 | ||
627 | struct radeon_ib { | 625 | struct radeon_ib { |
628 | struct radeon_sa_bo sa_bo; | 626 | struct radeon_sa_bo *sa_bo; |
629 | unsigned idx; | 627 | uint32_t length_dw; |
630 | uint32_t length_dw; | 628 | uint64_t gpu_addr; |
631 | uint64_t gpu_addr; | 629 | uint32_t *ptr; |
632 | uint32_t *ptr; | 630 | struct radeon_fence *fence; |
633 | struct radeon_fence *fence; | 631 | unsigned vm_id; |
634 | unsigned vm_id; | 632 | bool is_const_ib; |
635 | bool is_const_ib; | 633 | struct radeon_semaphore *semaphore; |
636 | }; | ||
637 | |||
638 | /* | ||
639 | * locking - | ||
640 | * mutex protects scheduled_ibs, ready, alloc_bm | ||
641 | */ | ||
642 | struct radeon_ib_pool { | ||
643 | struct radeon_mutex mutex; | ||
644 | struct radeon_sa_manager sa_manager; | ||
645 | struct radeon_ib ibs[RADEON_IB_POOL_SIZE]; | ||
646 | bool ready; | ||
647 | unsigned head_id; | ||
648 | }; | 634 | }; |
649 | 635 | ||
650 | struct radeon_ring { | 636 | struct radeon_ring { |
@@ -659,10 +645,11 @@ struct radeon_ring { | |||
659 | unsigned ring_size; | 645 | unsigned ring_size; |
660 | unsigned ring_free_dw; | 646 | unsigned ring_free_dw; |
661 | int count_dw; | 647 | int count_dw; |
648 | unsigned long last_activity; | ||
649 | unsigned last_rptr; | ||
662 | uint64_t gpu_addr; | 650 | uint64_t gpu_addr; |
663 | uint32_t align_mask; | 651 | uint32_t align_mask; |
664 | uint32_t ptr_mask; | 652 | uint32_t ptr_mask; |
665 | struct mutex mutex; | ||
666 | bool ready; | 653 | bool ready; |
667 | u32 ptr_reg_shift; | 654 | u32 ptr_reg_shift; |
668 | u32 ptr_reg_mask; | 655 | u32 ptr_reg_mask; |
@@ -679,7 +666,7 @@ struct radeon_vm { | |||
679 | unsigned last_pfn; | 666 | unsigned last_pfn; |
680 | u64 pt_gpu_addr; | 667 | u64 pt_gpu_addr; |
681 | u64 *pt; | 668 | u64 *pt; |
682 | struct radeon_sa_bo sa_bo; | 669 | struct radeon_sa_bo *sa_bo; |
683 | struct mutex mutex; | 670 | struct mutex mutex; |
684 | /* last fence for cs using this vm */ | 671 | /* last fence for cs using this vm */ |
685 | struct radeon_fence *fence; | 672 | struct radeon_fence *fence; |
@@ -756,7 +743,6 @@ struct r600_blit_cp_primitives { | |||
756 | }; | 743 | }; |
757 | 744 | ||
758 | struct r600_blit { | 745 | struct r600_blit { |
759 | struct mutex mutex; | ||
760 | struct radeon_bo *shader_obj; | 746 | struct radeon_bo *shader_obj; |
761 | struct r600_blit_cp_primitives primitives; | 747 | struct r600_blit_cp_primitives primitives; |
762 | int max_dim; | 748 | int max_dim; |
@@ -766,8 +752,6 @@ struct r600_blit { | |||
766 | u32 vs_offset, ps_offset; | 752 | u32 vs_offset, ps_offset; |
767 | u32 state_offset; | 753 | u32 state_offset; |
768 | u32 state_len; | 754 | u32 state_len; |
769 | u32 vb_used, vb_total; | ||
770 | struct radeon_ib *vb_ib; | ||
771 | }; | 755 | }; |
772 | 756 | ||
773 | void r600_blit_suspend(struct radeon_device *rdev); | 757 | void r600_blit_suspend(struct radeon_device *rdev); |
@@ -785,14 +769,14 @@ struct si_rlc { | |||
785 | }; | 769 | }; |
786 | 770 | ||
787 | int radeon_ib_get(struct radeon_device *rdev, int ring, | 771 | int radeon_ib_get(struct radeon_device *rdev, int ring, |
788 | struct radeon_ib **ib, unsigned size); | 772 | struct radeon_ib *ib, unsigned size); |
789 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib); | 773 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib); |
790 | bool radeon_ib_try_free(struct radeon_device *rdev, struct radeon_ib *ib); | ||
791 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); | 774 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); |
792 | int radeon_ib_pool_init(struct radeon_device *rdev); | 775 | int radeon_ib_pool_init(struct radeon_device *rdev); |
793 | void radeon_ib_pool_fini(struct radeon_device *rdev); | 776 | void radeon_ib_pool_fini(struct radeon_device *rdev); |
794 | int radeon_ib_pool_start(struct radeon_device *rdev); | 777 | int radeon_ib_pool_start(struct radeon_device *rdev); |
795 | int radeon_ib_pool_suspend(struct radeon_device *rdev); | 778 | int radeon_ib_pool_suspend(struct radeon_device *rdev); |
779 | int radeon_ib_ring_tests(struct radeon_device *rdev); | ||
796 | /* Ring access between begin & end cannot sleep */ | 780 | /* Ring access between begin & end cannot sleep */ |
797 | int radeon_ring_index(struct radeon_device *rdev, struct radeon_ring *cp); | 781 | int radeon_ring_index(struct radeon_device *rdev, struct radeon_ring *cp); |
798 | void radeon_ring_free_size(struct radeon_device *rdev, struct radeon_ring *cp); | 782 | void radeon_ring_free_size(struct radeon_device *rdev, struct radeon_ring *cp); |
@@ -800,8 +784,12 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *cp, unsign | |||
800 | int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); | 784 | int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); |
801 | void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp); | 785 | void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp); |
802 | void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp); | 786 | void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp); |
787 | void radeon_ring_undo(struct radeon_ring *ring); | ||
803 | void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp); | 788 | void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp); |
804 | int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp); | 789 | int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp); |
790 | void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring *ring); | ||
791 | void radeon_ring_lockup_update(struct radeon_ring *ring); | ||
792 | bool radeon_ring_test_lockup(struct radeon_device *rdev, struct radeon_ring *ring); | ||
805 | int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ring_size, | 793 | int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ring_size, |
806 | unsigned rptr_offs, unsigned rptr_reg, unsigned wptr_reg, | 794 | unsigned rptr_offs, unsigned rptr_reg, unsigned wptr_reg, |
807 | u32 ptr_reg_shift, u32 ptr_reg_mask, u32 nop); | 795 | u32 ptr_reg_shift, u32 ptr_reg_mask, u32 nop); |
@@ -850,8 +838,8 @@ struct radeon_cs_parser { | |||
850 | int chunk_relocs_idx; | 838 | int chunk_relocs_idx; |
851 | int chunk_flags_idx; | 839 | int chunk_flags_idx; |
852 | int chunk_const_ib_idx; | 840 | int chunk_const_ib_idx; |
853 | struct radeon_ib *ib; | 841 | struct radeon_ib ib; |
854 | struct radeon_ib *const_ib; | 842 | struct radeon_ib const_ib; |
855 | void *track; | 843 | void *track; |
856 | unsigned family; | 844 | unsigned family; |
857 | int parser_error; | 845 | int parser_error; |
@@ -1105,6 +1093,14 @@ int radeon_pm_get_type_index(struct radeon_device *rdev, | |||
1105 | enum radeon_pm_state_type ps_type, | 1093 | enum radeon_pm_state_type ps_type, |
1106 | int instance); | 1094 | int instance); |
1107 | 1095 | ||
1096 | struct r600_audio { | ||
1097 | int channels; | ||
1098 | int rate; | ||
1099 | int bits_per_sample; | ||
1100 | u8 status_bits; | ||
1101 | u8 category_code; | ||
1102 | }; | ||
1103 | |||
1108 | /* | 1104 | /* |
1109 | * Benchmarking | 1105 | * Benchmarking |
1110 | */ | 1106 | */ |
@@ -1144,7 +1140,6 @@ struct radeon_asic { | |||
1144 | int (*resume)(struct radeon_device *rdev); | 1140 | int (*resume)(struct radeon_device *rdev); |
1145 | int (*suspend)(struct radeon_device *rdev); | 1141 | int (*suspend)(struct radeon_device *rdev); |
1146 | void (*vga_set_state)(struct radeon_device *rdev, bool state); | 1142 | void (*vga_set_state)(struct radeon_device *rdev, bool state); |
1147 | bool (*gpu_is_lockup)(struct radeon_device *rdev, struct radeon_ring *cp); | ||
1148 | int (*asic_reset)(struct radeon_device *rdev); | 1143 | int (*asic_reset)(struct radeon_device *rdev); |
1149 | /* ioctl hw specific callback. Some hw might want to perform special | 1144 | /* ioctl hw specific callback. Some hw might want to perform special |
1150 | * operation on specific ioctl. For instance on wait idle some hw | 1145 | * operation on specific ioctl. For instance on wait idle some hw |
@@ -1173,6 +1168,7 @@ struct radeon_asic { | |||
1173 | void (*ring_start)(struct radeon_device *rdev, struct radeon_ring *cp); | 1168 | void (*ring_start)(struct radeon_device *rdev, struct radeon_ring *cp); |
1174 | int (*ring_test)(struct radeon_device *rdev, struct radeon_ring *cp); | 1169 | int (*ring_test)(struct radeon_device *rdev, struct radeon_ring *cp); |
1175 | int (*ib_test)(struct radeon_device *rdev, struct radeon_ring *cp); | 1170 | int (*ib_test)(struct radeon_device *rdev, struct radeon_ring *cp); |
1171 | bool (*is_lockup)(struct radeon_device *rdev, struct radeon_ring *cp); | ||
1176 | } ring[RADEON_NUM_RINGS]; | 1172 | } ring[RADEON_NUM_RINGS]; |
1177 | /* irqs */ | 1173 | /* irqs */ |
1178 | struct { | 1174 | struct { |
@@ -1251,16 +1247,10 @@ struct radeon_asic { | |||
1251 | /* | 1247 | /* |
1252 | * Asic structures | 1248 | * Asic structures |
1253 | */ | 1249 | */ |
1254 | struct r100_gpu_lockup { | ||
1255 | unsigned long last_jiffies; | ||
1256 | u32 last_cp_rptr; | ||
1257 | }; | ||
1258 | |||
1259 | struct r100_asic { | 1250 | struct r100_asic { |
1260 | const unsigned *reg_safe_bm; | 1251 | const unsigned *reg_safe_bm; |
1261 | unsigned reg_safe_bm_size; | 1252 | unsigned reg_safe_bm_size; |
1262 | u32 hdp_cntl; | 1253 | u32 hdp_cntl; |
1263 | struct r100_gpu_lockup lockup; | ||
1264 | }; | 1254 | }; |
1265 | 1255 | ||
1266 | struct r300_asic { | 1256 | struct r300_asic { |
@@ -1268,7 +1258,6 @@ struct r300_asic { | |||
1268 | unsigned reg_safe_bm_size; | 1258 | unsigned reg_safe_bm_size; |
1269 | u32 resync_scratch; | 1259 | u32 resync_scratch; |
1270 | u32 hdp_cntl; | 1260 | u32 hdp_cntl; |
1271 | struct r100_gpu_lockup lockup; | ||
1272 | }; | 1261 | }; |
1273 | 1262 | ||
1274 | struct r600_asic { | 1263 | struct r600_asic { |
@@ -1290,7 +1279,6 @@ struct r600_asic { | |||
1290 | unsigned tiling_group_size; | 1279 | unsigned tiling_group_size; |
1291 | unsigned tile_config; | 1280 | unsigned tile_config; |
1292 | unsigned backend_map; | 1281 | unsigned backend_map; |
1293 | struct r100_gpu_lockup lockup; | ||
1294 | }; | 1282 | }; |
1295 | 1283 | ||
1296 | struct rv770_asic { | 1284 | struct rv770_asic { |
@@ -1316,7 +1304,6 @@ struct rv770_asic { | |||
1316 | unsigned tiling_group_size; | 1304 | unsigned tiling_group_size; |
1317 | unsigned tile_config; | 1305 | unsigned tile_config; |
1318 | unsigned backend_map; | 1306 | unsigned backend_map; |
1319 | struct r100_gpu_lockup lockup; | ||
1320 | }; | 1307 | }; |
1321 | 1308 | ||
1322 | struct evergreen_asic { | 1309 | struct evergreen_asic { |
@@ -1343,7 +1330,6 @@ struct evergreen_asic { | |||
1343 | unsigned tiling_group_size; | 1330 | unsigned tiling_group_size; |
1344 | unsigned tile_config; | 1331 | unsigned tile_config; |
1345 | unsigned backend_map; | 1332 | unsigned backend_map; |
1346 | struct r100_gpu_lockup lockup; | ||
1347 | }; | 1333 | }; |
1348 | 1334 | ||
1349 | struct cayman_asic { | 1335 | struct cayman_asic { |
@@ -1382,7 +1368,6 @@ struct cayman_asic { | |||
1382 | unsigned multi_gpu_tile_size; | 1368 | unsigned multi_gpu_tile_size; |
1383 | 1369 | ||
1384 | unsigned tile_config; | 1370 | unsigned tile_config; |
1385 | struct r100_gpu_lockup lockup; | ||
1386 | }; | 1371 | }; |
1387 | 1372 | ||
1388 | struct si_asic { | 1373 | struct si_asic { |
@@ -1413,7 +1398,6 @@ struct si_asic { | |||
1413 | unsigned multi_gpu_tile_size; | 1398 | unsigned multi_gpu_tile_size; |
1414 | 1399 | ||
1415 | unsigned tile_config; | 1400 | unsigned tile_config; |
1416 | struct r100_gpu_lockup lockup; | ||
1417 | }; | 1401 | }; |
1418 | 1402 | ||
1419 | union radeon_asic_config { | 1403 | union radeon_asic_config { |
@@ -1516,11 +1500,12 @@ struct radeon_device { | |||
1516 | struct radeon_mode_info mode_info; | 1500 | struct radeon_mode_info mode_info; |
1517 | struct radeon_scratch scratch; | 1501 | struct radeon_scratch scratch; |
1518 | struct radeon_mman mman; | 1502 | struct radeon_mman mman; |
1519 | rwlock_t fence_lock; | ||
1520 | struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; | 1503 | struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; |
1521 | struct radeon_semaphore_driver semaphore_drv; | 1504 | wait_queue_head_t fence_queue; |
1505 | struct mutex ring_lock; | ||
1522 | struct radeon_ring ring[RADEON_NUM_RINGS]; | 1506 | struct radeon_ring ring[RADEON_NUM_RINGS]; |
1523 | struct radeon_ib_pool ib_pool; | 1507 | bool ib_pool_ready; |
1508 | struct radeon_sa_manager ring_tmp_bo; | ||
1524 | struct radeon_irq irq; | 1509 | struct radeon_irq irq; |
1525 | struct radeon_asic *asic; | 1510 | struct radeon_asic *asic; |
1526 | struct radeon_gem gem; | 1511 | struct radeon_gem gem; |
@@ -1529,7 +1514,6 @@ struct radeon_device { | |||
1529 | struct radeon_mutex cs_mutex; | 1514 | struct radeon_mutex cs_mutex; |
1530 | struct radeon_wb wb; | 1515 | struct radeon_wb wb; |
1531 | struct radeon_dummy_page dummy_page; | 1516 | struct radeon_dummy_page dummy_page; |
1532 | bool gpu_lockup; | ||
1533 | bool shutdown; | 1517 | bool shutdown; |
1534 | bool suspend; | 1518 | bool suspend; |
1535 | bool need_dma32; | 1519 | bool need_dma32; |
@@ -1546,19 +1530,12 @@ struct radeon_device { | |||
1546 | struct r600_ih ih; /* r6/700 interrupt ring */ | 1530 | struct r600_ih ih; /* r6/700 interrupt ring */ |
1547 | struct si_rlc rlc; | 1531 | struct si_rlc rlc; |
1548 | struct work_struct hotplug_work; | 1532 | struct work_struct hotplug_work; |
1533 | struct work_struct audio_work; | ||
1549 | int num_crtc; /* number of crtcs */ | 1534 | int num_crtc; /* number of crtcs */ |
1550 | struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */ | 1535 | struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */ |
1551 | struct mutex vram_mutex; | 1536 | struct mutex vram_mutex; |
1552 | 1537 | bool audio_enabled; | |
1553 | /* audio stuff */ | 1538 | struct r600_audio audio_status; /* audio stuff */ |
1554 | bool audio_enabled; | ||
1555 | struct timer_list audio_timer; | ||
1556 | int audio_channels; | ||
1557 | int audio_rate; | ||
1558 | int audio_bits_per_sample; | ||
1559 | uint8_t audio_status_bits; | ||
1560 | uint8_t audio_category_code; | ||
1561 | |||
1562 | struct notifier_block acpi_nb; | 1539 | struct notifier_block acpi_nb; |
1563 | /* only one userspace can use Hyperz features or CMASK at a time */ | 1540 | /* only one userspace can use Hyperz features or CMASK at a time */ |
1564 | struct drm_file *hyperz_filp; | 1541 | struct drm_file *hyperz_filp; |
@@ -1730,7 +1707,6 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v); | |||
1730 | #define radeon_suspend(rdev) (rdev)->asic->suspend((rdev)) | 1707 | #define radeon_suspend(rdev) (rdev)->asic->suspend((rdev)) |
1731 | #define radeon_cs_parse(rdev, r, p) (rdev)->asic->ring[(r)].cs_parse((p)) | 1708 | #define radeon_cs_parse(rdev, r, p) (rdev)->asic->ring[(r)].cs_parse((p)) |
1732 | #define radeon_vga_set_state(rdev, state) (rdev)->asic->vga_set_state((rdev), (state)) | 1709 | #define radeon_vga_set_state(rdev, state) (rdev)->asic->vga_set_state((rdev), (state)) |
1733 | #define radeon_gpu_is_lockup(rdev, cp) (rdev)->asic->gpu_is_lockup((rdev), (cp)) | ||
1734 | #define radeon_asic_reset(rdev) (rdev)->asic->asic_reset((rdev)) | 1710 | #define radeon_asic_reset(rdev) (rdev)->asic->asic_reset((rdev)) |
1735 | #define radeon_gart_tlb_flush(rdev) (rdev)->asic->gart.tlb_flush((rdev)) | 1711 | #define radeon_gart_tlb_flush(rdev) (rdev)->asic->gart.tlb_flush((rdev)) |
1736 | #define radeon_gart_set_page(rdev, i, p) (rdev)->asic->gart.set_page((rdev), (i), (p)) | 1712 | #define radeon_gart_set_page(rdev, i, p) (rdev)->asic->gart.set_page((rdev), (i), (p)) |
@@ -1739,6 +1715,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v); | |||
1739 | #define radeon_ib_test(rdev, r, cp) (rdev)->asic->ring[(r)].ib_test((rdev), (cp)) | 1715 | #define radeon_ib_test(rdev, r, cp) (rdev)->asic->ring[(r)].ib_test((rdev), (cp)) |
1740 | #define radeon_ring_ib_execute(rdev, r, ib) (rdev)->asic->ring[(r)].ib_execute((rdev), (ib)) | 1716 | #define radeon_ring_ib_execute(rdev, r, ib) (rdev)->asic->ring[(r)].ib_execute((rdev), (ib)) |
1741 | #define radeon_ring_ib_parse(rdev, r, ib) (rdev)->asic->ring[(r)].ib_parse((rdev), (ib)) | 1717 | #define radeon_ring_ib_parse(rdev, r, ib) (rdev)->asic->ring[(r)].ib_parse((rdev), (ib)) |
1718 | #define radeon_ring_is_lockup(rdev, r, cp) (rdev)->asic->ring[(r)].is_lockup((rdev), (cp)) | ||
1742 | #define radeon_irq_set(rdev) (rdev)->asic->irq.set((rdev)) | 1719 | #define radeon_irq_set(rdev) (rdev)->asic->irq.set((rdev)) |
1743 | #define radeon_irq_process(rdev) (rdev)->asic->irq.process((rdev)) | 1720 | #define radeon_irq_process(rdev) (rdev)->asic->irq.process((rdev)) |
1744 | #define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->display.get_vblank_counter((rdev), (crtc)) | 1721 | #define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->display.get_vblank_counter((rdev), (crtc)) |
@@ -1828,6 +1805,8 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev, | |||
1828 | struct radeon_vm *vm, | 1805 | struct radeon_vm *vm, |
1829 | struct radeon_bo *bo); | 1806 | struct radeon_bo *bo); |
1830 | 1807 | ||
1808 | /* audio */ | ||
1809 | void r600_audio_update_hdmi(struct work_struct *work); | ||
1831 | 1810 | ||
1832 | /* | 1811 | /* |
1833 | * R600 vram scratch functions | 1812 | * R600 vram scratch functions |
@@ -1848,10 +1827,32 @@ int r600_fmt_get_nblocksy(u32 format, u32 h); | |||
1848 | /* | 1827 | /* |
1849 | * r600 functions used by radeon_encoder.c | 1828 | * r600 functions used by radeon_encoder.c |
1850 | */ | 1829 | */ |
1830 | struct radeon_hdmi_acr { | ||
1831 | u32 clock; | ||
1832 | |||
1833 | int n_32khz; | ||
1834 | int cts_32khz; | ||
1835 | |||
1836 | int n_44_1khz; | ||
1837 | int cts_44_1khz; | ||
1838 | |||
1839 | int n_48khz; | ||
1840 | int cts_48khz; | ||
1841 | |||
1842 | }; | ||
1843 | |||
1844 | extern struct radeon_hdmi_acr r600_hdmi_acr(uint32_t clock); | ||
1845 | |||
1851 | extern void r600_hdmi_enable(struct drm_encoder *encoder); | 1846 | extern void r600_hdmi_enable(struct drm_encoder *encoder); |
1852 | extern void r600_hdmi_disable(struct drm_encoder *encoder); | 1847 | extern void r600_hdmi_disable(struct drm_encoder *encoder); |
1853 | extern void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode); | 1848 | extern void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode); |
1854 | 1849 | ||
1850 | /* | ||
1851 | * evergreen functions used by radeon_encoder.c | ||
1852 | */ | ||
1853 | |||
1854 | extern void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode); | ||
1855 | |||
1855 | extern int ni_init_microcode(struct radeon_device *rdev); | 1856 | extern int ni_init_microcode(struct radeon_device *rdev); |
1856 | extern int ni_mc_load_microcode(struct radeon_device *rdev); | 1857 | extern int ni_mc_load_microcode(struct radeon_device *rdev); |
1857 | 1858 | ||