aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r600.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/r600.c')
-rw-r--r--drivers/gpu/drm/radeon/r600.c77
1 files changed, 43 insertions, 34 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index c66952d4b00c..e616eb5f6e7a 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -968,7 +968,6 @@ static int r600_pcie_gart_enable(struct radeon_device *rdev)
968 r = radeon_gart_table_vram_pin(rdev); 968 r = radeon_gart_table_vram_pin(rdev);
969 if (r) 969 if (r)
970 return r; 970 return r;
971 radeon_gart_restore(rdev);
972 971
973 /* Setup L2 cache */ 972 /* Setup L2 cache */
974 WREG32(VM_L2_CNTL, ENABLE_L2_CACHE | ENABLE_L2_FRAGMENT_PROCESSING | 973 WREG32(VM_L2_CNTL, ENABLE_L2_CACHE | ENABLE_L2_FRAGMENT_PROCESSING |
@@ -1339,7 +1338,7 @@ int r600_vram_scratch_init(struct radeon_device *rdev)
1339 if (rdev->vram_scratch.robj == NULL) { 1338 if (rdev->vram_scratch.robj == NULL) {
1340 r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE, 1339 r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE,
1341 PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, 1340 PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM,
1342 NULL, &rdev->vram_scratch.robj); 1341 0, NULL, &rdev->vram_scratch.robj);
1343 if (r) { 1342 if (r) {
1344 return r; 1343 return r;
1345 } 1344 }
@@ -1813,7 +1812,6 @@ static void r600_gpu_init(struct radeon_device *rdev)
1813{ 1812{
1814 u32 tiling_config; 1813 u32 tiling_config;
1815 u32 ramcfg; 1814 u32 ramcfg;
1816 u32 cc_rb_backend_disable;
1817 u32 cc_gc_shader_pipe_config; 1815 u32 cc_gc_shader_pipe_config;
1818 u32 tmp; 1816 u32 tmp;
1819 int i, j; 1817 int i, j;
@@ -1940,29 +1938,20 @@ static void r600_gpu_init(struct radeon_device *rdev)
1940 } 1938 }
1941 tiling_config |= BANK_SWAPS(1); 1939 tiling_config |= BANK_SWAPS(1);
1942 1940
1943 cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000;
1944 tmp = R6XX_MAX_BACKENDS -
1945 r600_count_pipe_bits((cc_rb_backend_disable >> 16) & R6XX_MAX_BACKENDS_MASK);
1946 if (tmp < rdev->config.r600.max_backends) {
1947 rdev->config.r600.max_backends = tmp;
1948 }
1949
1950 cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0x00ffff00; 1941 cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0x00ffff00;
1951 tmp = R6XX_MAX_PIPES -
1952 r600_count_pipe_bits((cc_gc_shader_pipe_config >> 8) & R6XX_MAX_PIPES_MASK);
1953 if (tmp < rdev->config.r600.max_pipes) {
1954 rdev->config.r600.max_pipes = tmp;
1955 }
1956 tmp = R6XX_MAX_SIMDS -
1957 r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK);
1958 if (tmp < rdev->config.r600.max_simds) {
1959 rdev->config.r600.max_simds = tmp;
1960 }
1961 tmp = rdev->config.r600.max_simds - 1942 tmp = rdev->config.r600.max_simds -
1962 r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK); 1943 r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK);
1963 rdev->config.r600.active_simds = tmp; 1944 rdev->config.r600.active_simds = tmp;
1964 1945
1965 disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R6XX_MAX_BACKENDS_MASK; 1946 disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R6XX_MAX_BACKENDS_MASK;
1947 tmp = 0;
1948 for (i = 0; i < rdev->config.r600.max_backends; i++)
1949 tmp |= (1 << i);
1950 /* if all the backends are disabled, fix it up here */
1951 if ((disabled_rb_mask & tmp) == tmp) {
1952 for (i = 0; i < rdev->config.r600.max_backends; i++)
1953 disabled_rb_mask &= ~(1 << i);
1954 }
1966 tmp = (tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; 1955 tmp = (tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT;
1967 tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.r600.max_backends, 1956 tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.r600.max_backends,
1968 R6XX_MAX_BACKENDS, disabled_rb_mask); 1957 R6XX_MAX_BACKENDS, disabled_rb_mask);
@@ -2548,7 +2537,7 @@ int r600_cp_start(struct radeon_device *rdev)
2548 radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); 2537 radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1));
2549 radeon_ring_write(ring, 0); 2538 radeon_ring_write(ring, 0);
2550 radeon_ring_write(ring, 0); 2539 radeon_ring_write(ring, 0);
2551 radeon_ring_unlock_commit(rdev, ring); 2540 radeon_ring_unlock_commit(rdev, ring, false);
2552 2541
2553 cp_me = 0xff; 2542 cp_me = 0xff;
2554 WREG32(R_0086D8_CP_ME_CNTL, cp_me); 2543 WREG32(R_0086D8_CP_ME_CNTL, cp_me);
@@ -2684,7 +2673,7 @@ int r600_ring_test(struct radeon_device *rdev, struct radeon_ring *ring)
2684 radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); 2673 radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1));
2685 radeon_ring_write(ring, ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); 2674 radeon_ring_write(ring, ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2));
2686 radeon_ring_write(ring, 0xDEADBEEF); 2675 radeon_ring_write(ring, 0xDEADBEEF);
2687 radeon_ring_unlock_commit(rdev, ring); 2676 radeon_ring_unlock_commit(rdev, ring, false);
2688 for (i = 0; i < rdev->usec_timeout; i++) { 2677 for (i = 0; i < rdev->usec_timeout; i++) {
2689 tmp = RREG32(scratch); 2678 tmp = RREG32(scratch);
2690 if (tmp == 0xDEADBEEF) 2679 if (tmp == 0xDEADBEEF)
@@ -2754,6 +2743,17 @@ void r600_fence_ring_emit(struct radeon_device *rdev,
2754 } 2743 }
2755} 2744}
2756 2745
2746/**
2747 * r600_semaphore_ring_emit - emit a semaphore on the CP ring
2748 *
2749 * @rdev: radeon_device pointer
2750 * @ring: radeon ring buffer object
2751 * @semaphore: radeon semaphore object
2752 * @emit_wait: Is this a sempahore wait?
2753 *
2754 * Emits a semaphore signal/wait packet to the CP ring and prevents the PFP
2755 * from running ahead of semaphore waits.
2756 */
2757bool r600_semaphore_ring_emit(struct radeon_device *rdev, 2757bool r600_semaphore_ring_emit(struct radeon_device *rdev,
2758 struct radeon_ring *ring, 2758 struct radeon_ring *ring,
2759 struct radeon_semaphore *semaphore, 2759 struct radeon_semaphore *semaphore,
@@ -2769,6 +2769,13 @@ bool r600_semaphore_ring_emit(struct radeon_device *rdev,
2769 radeon_ring_write(ring, lower_32_bits(addr)); 2769 radeon_ring_write(ring, lower_32_bits(addr));
2770 radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); 2770 radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel);
2771 2771
2772 /* PFP_SYNC_ME packet only exists on 7xx+ */
2773 if (emit_wait && (rdev->family >= CHIP_RV770)) {
2774 /* Prevent the PFP from running ahead of the semaphore wait */
2775 radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0));
2776 radeon_ring_write(ring, 0x0);
2777 }
2778
2772 return true; 2779 return true;
2773} 2780}
2774 2781
@@ -2846,7 +2853,7 @@ int r600_copy_cpdma(struct radeon_device *rdev,
2846 return r; 2853 return r;
2847 } 2854 }
2848 2855
2849 radeon_ring_unlock_commit(rdev, ring); 2856 radeon_ring_unlock_commit(rdev, ring, false);
2850 radeon_semaphore_free(rdev, &sem, *fence); 2857 radeon_semaphore_free(rdev, &sem, *fence);
2851 2858
2852 return r; 2859 return r;
@@ -3166,7 +3173,7 @@ int r600_ib_test(struct radeon_device *rdev, struct radeon_ring *ring)
3166 ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); 3173 ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2);
3167 ib.ptr[2] = 0xDEADBEEF; 3174 ib.ptr[2] = 0xDEADBEEF;
3168 ib.length_dw = 3; 3175 ib.length_dw = 3;
3169 r = radeon_ib_schedule(rdev, &ib, NULL); 3176 r = radeon_ib_schedule(rdev, &ib, NULL, false);
3170 if (r) { 3177 if (r) {
3171 DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); 3178 DRM_ERROR("radeon: failed to schedule ib (%d).\n", r);
3172 goto free_ib; 3179 goto free_ib;
@@ -3227,7 +3234,7 @@ int r600_ih_ring_alloc(struct radeon_device *rdev)
3227 if (rdev->ih.ring_obj == NULL) { 3234 if (rdev->ih.ring_obj == NULL) {
3228 r = radeon_bo_create(rdev, rdev->ih.ring_size, 3235 r = radeon_bo_create(rdev, rdev->ih.ring_size,
3229 PAGE_SIZE, true, 3236 PAGE_SIZE, true,
3230 RADEON_GEM_DOMAIN_GTT, 3237 RADEON_GEM_DOMAIN_GTT, 0,
3231 NULL, &rdev->ih.ring_obj); 3238 NULL, &rdev->ih.ring_obj);
3232 if (r) { 3239 if (r) {
3233 DRM_ERROR("radeon: failed to create ih ring buffer (%d).\n", r); 3240 DRM_ERROR("radeon: failed to create ih ring buffer (%d).\n", r);
@@ -3795,6 +3802,7 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev)
3795 tmp = RREG32(IH_RB_CNTL); 3802 tmp = RREG32(IH_RB_CNTL);
3796 tmp |= IH_WPTR_OVERFLOW_CLEAR; 3803 tmp |= IH_WPTR_OVERFLOW_CLEAR;
3797 WREG32(IH_RB_CNTL, tmp); 3804 WREG32(IH_RB_CNTL, tmp);
3805 wptr &= ~RB_OVERFLOW;
3798 } 3806 }
3799 return (wptr & rdev->ih.ptr_mask); 3807 return (wptr & rdev->ih.ptr_mask);
3800} 3808}
@@ -3923,11 +3931,13 @@ restart_ih:
3923 break; 3931 break;
3924 case 9: /* D1 pflip */ 3932 case 9: /* D1 pflip */
3925 DRM_DEBUG("IH: D1 flip\n"); 3933 DRM_DEBUG("IH: D1 flip\n");
3926 radeon_crtc_handle_flip(rdev, 0); 3934 if (radeon_use_pflipirq > 0)
3935 radeon_crtc_handle_flip(rdev, 0);
3927 break; 3936 break;
3928 case 11: /* D2 pflip */ 3937 case 11: /* D2 pflip */
3929 DRM_DEBUG("IH: D2 flip\n"); 3938 DRM_DEBUG("IH: D2 flip\n");
3930 radeon_crtc_handle_flip(rdev, 1); 3939 if (radeon_use_pflipirq > 0)
3940 radeon_crtc_handle_flip(rdev, 1);
3931 break; 3941 break;
3932 case 19: /* HPD/DAC hotplug */ 3942 case 19: /* HPD/DAC hotplug */
3933 switch (src_data) { 3943 switch (src_data) {
@@ -4088,16 +4098,15 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev)
4088} 4098}
4089 4099
4090/** 4100/**
4091 * r600_ioctl_wait_idle - flush host path cache on wait idle ioctl 4101 * r600_mmio_hdp_flush - flush Host Data Path cache via MMIO
4092 * rdev: radeon device structure 4102 * rdev: radeon device structure
4093 * bo: buffer object struct which userspace is waiting for idle
4094 * 4103 *
4095 * Some R6XX/R7XX doesn't seems to take into account HDP flush performed 4104 * Some R6XX/R7XX don't seem to take into account HDP flushes performed
4096 * through ring buffer, this leads to corruption in rendering, see 4105 * through the ring buffer. This leads to corruption in rendering, see
4097 * http://bugzilla.kernel.org/show_bug.cgi?id=15186 to avoid this we 4106 * http://bugzilla.kernel.org/show_bug.cgi?id=15186 . To avoid this, we
4098 * directly perform HDP flush by writing register through MMIO. 4107 * directly perform the HDP flush by writing the register through MMIO.
4099 */ 4108 */
4100void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) 4109void r600_mmio_hdp_flush(struct radeon_device *rdev)
4101{ 4110{
4102 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read 4111 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read
4103 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL. 4112 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL.