aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r100.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-04 02:29:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-04 02:29:23 -0400
commit612a9aab56a93533e76e3ad91642db7033e03b69 (patch)
tree8402096973f67af941f9392f7da06cca03e0b58a /drivers/gpu/drm/radeon/r100.c
parent3a494318b14b1bc0f59d2d6ce84c505c74d82d2a (diff)
parent268d28371cd326be4dfcd7eba5917bf4b9d30c8f (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm merge (part 1) from Dave Airlie: "So first of all my tree and uapi stuff has a conflict mess, its my fault as the nouveau stuff didn't hit -next as were trying to rebase regressions out of it before we merged. Highlights: - SH mobile modesetting driver and associated helpers - some DRM core documentation - i915 modesetting rework, haswell hdmi, haswell and vlv fixes, write combined pte writing, ilk rc6 support, - nouveau: major driver rework into a hw core driver, makes features like SLI a lot saner to implement, - psb: add eDP/DP support for Cedarview - radeon: 2 layer page tables, async VM pte updates, better PLL selection for > 2 screens, better ACPI interactions The rest is general grab bag of fixes. So why part 1? well I have the exynos pull req which came in a bit late but was waiting for me to do something they shouldn't have and it looks fairly safe, and David Howells has some more header cleanups he'd like me to pull, that seem like a good idea, but I'd like to get this merge out of the way so -next dosen't get blocked." Tons of conflicts mostly due to silly include line changes, but mostly mindless. A few other small semantic conflicts too, noted from Dave's pre-merged branch. * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (447 commits) drm/nv98/crypt: fix fuc build with latest envyas drm/nouveau/devinit: fixup various issues with subdev ctor/init ordering drm/nv41/vm: fix and enable use of "real" pciegart drm/nv44/vm: fix and enable use of "real" pciegart drm/nv04/dmaobj: fixup vm target handling in preparation for nv4x pcie drm/nouveau: store supported dma mask in vmmgr drm/nvc0/ibus: initial implementation of subdev drm/nouveau/therm: add support for fan-control modes drm/nouveau/hwmon: rename pwm0* to pmw1* to follow hwmon's rules drm/nouveau/therm: calculate the pwm divisor on nv50+ drm/nouveau/fan: rewrite the fan tachometer driver to get more precision, faster drm/nouveau/therm: move thermal-related functions to the therm subdev drm/nouveau/bios: parse the pwm divisor from the perf table drm/nouveau/therm: use the EXTDEV table to detect i2c monitoring devices drm/nouveau/therm: rework thermal table parsing drm/nouveau/gpio: expose the PWM/TOGGLE parameter found in the gpio vbios table drm/nouveau: fix pm initialization order drm/nouveau/bios: check that fixed tvdac gpio data is valid before using it drm/nouveau: log channel debug/error messages from client object rather than drm client drm/nouveau: have drm debugging macros build on top of core macros ...
Diffstat (limited to 'drivers/gpu/drm/radeon/r100.c')
-rw-r--r--drivers/gpu/drm/radeon/r100.c96
1 files changed, 19 insertions, 77 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 3183a815f71c..376884f1bcd2 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -79,10 +79,12 @@ MODULE_FIRMWARE(FIRMWARE_R520);
79 */ 79 */
80void r100_wait_for_vblank(struct radeon_device *rdev, int crtc) 80void r100_wait_for_vblank(struct radeon_device *rdev, int crtc)
81{ 81{
82 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
83 int i; 82 int i;
84 83
85 if (radeon_crtc->crtc_id == 0) { 84 if (crtc >= rdev->num_crtc)
85 return;
86
87 if (crtc == 0) {
86 if (RREG32(RADEON_CRTC_GEN_CNTL) & RADEON_CRTC_EN) { 88 if (RREG32(RADEON_CRTC_GEN_CNTL) & RADEON_CRTC_EN) {
87 for (i = 0; i < rdev->usec_timeout; i++) { 89 for (i = 0; i < rdev->usec_timeout; i++) {
88 if (!(RREG32(RADEON_CRTC_STATUS) & RADEON_CRTC_VBLANK_CUR)) 90 if (!(RREG32(RADEON_CRTC_STATUS) & RADEON_CRTC_VBLANK_CUR))
@@ -697,9 +699,6 @@ int r100_irq_set(struct radeon_device *rdev)
697 if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) { 699 if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) {
698 tmp |= RADEON_SW_INT_ENABLE; 700 tmp |= RADEON_SW_INT_ENABLE;
699 } 701 }
700 if (rdev->irq.gui_idle) {
701 tmp |= RADEON_GUI_IDLE_MASK;
702 }
703 if (rdev->irq.crtc_vblank_int[0] || 702 if (rdev->irq.crtc_vblank_int[0] ||
704 atomic_read(&rdev->irq.pflip[0])) { 703 atomic_read(&rdev->irq.pflip[0])) {
705 tmp |= RADEON_CRTC_VBLANK_MASK; 704 tmp |= RADEON_CRTC_VBLANK_MASK;
@@ -736,12 +735,6 @@ static uint32_t r100_irq_ack(struct radeon_device *rdev)
736 RADEON_CRTC_VBLANK_STAT | RADEON_CRTC2_VBLANK_STAT | 735 RADEON_CRTC_VBLANK_STAT | RADEON_CRTC2_VBLANK_STAT |
737 RADEON_FP_DETECT_STAT | RADEON_FP2_DETECT_STAT; 736 RADEON_FP_DETECT_STAT | RADEON_FP2_DETECT_STAT;
738 737
739 /* the interrupt works, but the status bit is permanently asserted */
740 if (rdev->irq.gui_idle && radeon_gui_idle(rdev)) {
741 if (!rdev->irq.gui_idle_acked)
742 irq_mask |= RADEON_GUI_IDLE_STAT;
743 }
744
745 if (irqs) { 738 if (irqs) {
746 WREG32(RADEON_GEN_INT_STATUS, irqs); 739 WREG32(RADEON_GEN_INT_STATUS, irqs);
747 } 740 }
@@ -753,9 +746,6 @@ int r100_irq_process(struct radeon_device *rdev)
753 uint32_t status, msi_rearm; 746 uint32_t status, msi_rearm;
754 bool queue_hotplug = false; 747 bool queue_hotplug = false;
755 748
756 /* reset gui idle ack. the status bit is broken */
757 rdev->irq.gui_idle_acked = false;
758
759 status = r100_irq_ack(rdev); 749 status = r100_irq_ack(rdev);
760 if (!status) { 750 if (!status) {
761 return IRQ_NONE; 751 return IRQ_NONE;
@@ -768,11 +758,6 @@ int r100_irq_process(struct radeon_device *rdev)
768 if (status & RADEON_SW_INT_TEST) { 758 if (status & RADEON_SW_INT_TEST) {
769 radeon_fence_process(rdev, RADEON_RING_TYPE_GFX_INDEX); 759 radeon_fence_process(rdev, RADEON_RING_TYPE_GFX_INDEX);
770 } 760 }
771 /* gui idle interrupt */
772 if (status & RADEON_GUI_IDLE_STAT) {
773 rdev->irq.gui_idle_acked = true;
774 wake_up(&rdev->irq.idle_queue);
775 }
776 /* Vertical blank interrupts */ 761 /* Vertical blank interrupts */
777 if (status & RADEON_CRTC_VBLANK_STAT) { 762 if (status & RADEON_CRTC_VBLANK_STAT) {
778 if (rdev->irq.crtc_vblank_int[0]) { 763 if (rdev->irq.crtc_vblank_int[0]) {
@@ -802,8 +787,6 @@ int r100_irq_process(struct radeon_device *rdev)
802 } 787 }
803 status = r100_irq_ack(rdev); 788 status = r100_irq_ack(rdev);
804 } 789 }
805 /* reset gui idle ack. the status bit is broken */
806 rdev->irq.gui_idle_acked = false;
807 if (queue_hotplug) 790 if (queue_hotplug)
808 schedule_work(&rdev->hotplug_work); 791 schedule_work(&rdev->hotplug_work);
809 if (rdev->msi_enabled) { 792 if (rdev->msi_enabled) {
@@ -2529,7 +2512,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track
2529/* 2512/*
2530 * Global GPU functions 2513 * Global GPU functions
2531 */ 2514 */
2532void r100_errata(struct radeon_device *rdev) 2515static void r100_errata(struct radeon_device *rdev)
2533{ 2516{
2534 rdev->pll_errata = 0; 2517 rdev->pll_errata = 0;
2535 2518
@@ -2544,51 +2527,7 @@ void r100_errata(struct radeon_device *rdev)
2544 } 2527 }
2545} 2528}
2546 2529
2547/* Wait for vertical sync on primary CRTC */ 2530static int r100_rbbm_fifo_wait_for_entry(struct radeon_device *rdev, unsigned n)
2548void r100_gpu_wait_for_vsync(struct radeon_device *rdev)
2549{
2550 uint32_t crtc_gen_cntl, tmp;
2551 int i;
2552
2553 crtc_gen_cntl = RREG32(RADEON_CRTC_GEN_CNTL);
2554 if ((crtc_gen_cntl & RADEON_CRTC_DISP_REQ_EN_B) ||
2555 !(crtc_gen_cntl & RADEON_CRTC_EN)) {
2556 return;
2557 }
2558 /* Clear the CRTC_VBLANK_SAVE bit */
2559 WREG32(RADEON_CRTC_STATUS, RADEON_CRTC_VBLANK_SAVE_CLEAR);
2560 for (i = 0; i < rdev->usec_timeout; i++) {
2561 tmp = RREG32(RADEON_CRTC_STATUS);
2562 if (tmp & RADEON_CRTC_VBLANK_SAVE) {
2563 return;
2564 }
2565 DRM_UDELAY(1);
2566 }
2567}
2568
2569/* Wait for vertical sync on secondary CRTC */
2570void r100_gpu_wait_for_vsync2(struct radeon_device *rdev)
2571{
2572 uint32_t crtc2_gen_cntl, tmp;
2573 int i;
2574
2575 crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
2576 if ((crtc2_gen_cntl & RADEON_CRTC2_DISP_REQ_EN_B) ||
2577 !(crtc2_gen_cntl & RADEON_CRTC2_EN))
2578 return;
2579
2580 /* Clear the CRTC_VBLANK_SAVE bit */
2581 WREG32(RADEON_CRTC2_STATUS, RADEON_CRTC2_VBLANK_SAVE_CLEAR);
2582 for (i = 0; i < rdev->usec_timeout; i++) {
2583 tmp = RREG32(RADEON_CRTC2_STATUS);
2584 if (tmp & RADEON_CRTC2_VBLANK_SAVE) {
2585 return;
2586 }
2587 DRM_UDELAY(1);
2588 }
2589}
2590
2591int r100_rbbm_fifo_wait_for_entry(struct radeon_device *rdev, unsigned n)
2592{ 2531{
2593 unsigned i; 2532 unsigned i;
2594 uint32_t tmp; 2533 uint32_t tmp;
@@ -2949,7 +2888,7 @@ void r100_vga_set_state(struct radeon_device *rdev, bool state)
2949 WREG32(RADEON_CONFIG_CNTL, temp); 2888 WREG32(RADEON_CONFIG_CNTL, temp);
2950} 2889}
2951 2890
2952void r100_mc_init(struct radeon_device *rdev) 2891static void r100_mc_init(struct radeon_device *rdev)
2953{ 2892{
2954 u64 base; 2893 u64 base;
2955 2894
@@ -3021,7 +2960,7 @@ void r100_pll_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
3021 r100_pll_errata_after_data(rdev); 2960 r100_pll_errata_after_data(rdev);
3022} 2961}
3023 2962
3024void r100_set_safe_registers(struct radeon_device *rdev) 2963static void r100_set_safe_registers(struct radeon_device *rdev)
3025{ 2964{
3026 if (ASIC_IS_RN50(rdev)) { 2965 if (ASIC_IS_RN50(rdev)) {
3027 rdev->config.r100.reg_safe_bm = rn50_reg_safe_bm; 2966 rdev->config.r100.reg_safe_bm = rn50_reg_safe_bm;
@@ -3816,9 +3755,10 @@ int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
3816 return r; 3755 return r;
3817 } 3756 }
3818 WREG32(scratch, 0xCAFEDEAD); 3757 WREG32(scratch, 0xCAFEDEAD);
3819 r = radeon_ib_get(rdev, RADEON_RING_TYPE_GFX_INDEX, &ib, 256); 3758 r = radeon_ib_get(rdev, RADEON_RING_TYPE_GFX_INDEX, &ib, NULL, 256);
3820 if (r) { 3759 if (r) {
3821 return r; 3760 DRM_ERROR("radeon: failed to get ib (%d).\n", r);
3761 goto free_scratch;
3822 } 3762 }
3823 ib.ptr[0] = PACKET0(scratch, 0); 3763 ib.ptr[0] = PACKET0(scratch, 0);
3824 ib.ptr[1] = 0xDEADBEEF; 3764 ib.ptr[1] = 0xDEADBEEF;
@@ -3831,13 +3771,13 @@ int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
3831 ib.length_dw = 8; 3771 ib.length_dw = 8;
3832 r = radeon_ib_schedule(rdev, &ib, NULL); 3772 r = radeon_ib_schedule(rdev, &ib, NULL);
3833 if (r) { 3773 if (r) {
3834 radeon_scratch_free(rdev, scratch); 3774 DRM_ERROR("radeon: failed to schedule ib (%d).\n", r);
3835 radeon_ib_free(rdev, &ib); 3775 goto free_ib;
3836 return r;
3837 } 3776 }
3838 r = radeon_fence_wait(ib.fence, false); 3777 r = radeon_fence_wait(ib.fence, false);
3839 if (r) { 3778 if (r) {
3840 return r; 3779 DRM_ERROR("radeon: fence wait failed (%d).\n", r);
3780 goto free_ib;
3841 } 3781 }
3842 for (i = 0; i < rdev->usec_timeout; i++) { 3782 for (i = 0; i < rdev->usec_timeout; i++) {
3843 tmp = RREG32(scratch); 3783 tmp = RREG32(scratch);
@@ -3853,8 +3793,10 @@ int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
3853 scratch, tmp); 3793 scratch, tmp);
3854 r = -EINVAL; 3794 r = -EINVAL;
3855 } 3795 }
3856 radeon_scratch_free(rdev, scratch); 3796free_ib:
3857 radeon_ib_free(rdev, &ib); 3797 radeon_ib_free(rdev, &ib);
3798free_scratch:
3799 radeon_scratch_free(rdev, scratch);
3858 return r; 3800 return r;
3859} 3801}
3860 3802
@@ -3963,7 +3905,7 @@ static void r100_mc_program(struct radeon_device *rdev)
3963 r100_mc_resume(rdev, &save); 3905 r100_mc_resume(rdev, &save);
3964} 3906}
3965 3907
3966void r100_clock_startup(struct radeon_device *rdev) 3908static void r100_clock_startup(struct radeon_device *rdev)
3967{ 3909{
3968 u32 tmp; 3910 u32 tmp;
3969 3911