diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2011-04-02 09:15:50 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-04-03 20:08:35 -0400 |
commit | fb9674bd2cd3c18f6c756ee123967e43be501263 (patch) | |
tree | 6f72538672862de7b8bee00616c4449e6b0ccbcb /drivers | |
parent | beb47274116b36e17cf52869a2004e7d12a4ef1d (diff) |
drm/radeon/kms: pageflipping cleanup for avivo+
Avoid touching the flip setup regs while
acceleration is running. Set them at modeset
rather than during pageflip. Touching these
regs while acceleration is active caused hangs
on pre-avivo chips. These chips do not seem
to be affected, but better safe than sorry,
plus it avoids repeatedly reprogramming the
regs every flip.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs600.c | 11 |
3 files changed, 20 insertions, 22 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 10e41af6b026..b41ec59c7100 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1009,6 +1009,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1009 | uint64_t fb_location; | 1009 | uint64_t fb_location; |
1010 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1010 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
1011 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); | 1011 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); |
1012 | u32 tmp; | ||
1012 | int r; | 1013 | int r; |
1013 | 1014 | ||
1014 | /* no fb bound */ | 1015 | /* no fb bound */ |
@@ -1137,6 +1138,15 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1137 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1138 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1138 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); | 1139 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); |
1139 | 1140 | ||
1141 | /* pageflip setup */ | ||
1142 | /* make sure flip is at vb rather than hb */ | ||
1143 | tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset); | ||
1144 | tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN; | ||
1145 | WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); | ||
1146 | |||
1147 | /* set pageflip to happen anywhere in vblank interval */ | ||
1148 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); | ||
1149 | |||
1140 | if (!atomic && fb && fb != crtc->fb) { | 1150 | if (!atomic && fb && fb != crtc->fb) { |
1141 | radeon_fb = to_radeon_framebuffer(fb); | 1151 | radeon_fb = to_radeon_framebuffer(fb); |
1142 | rbo = gem_to_radeon_bo(radeon_fb->obj); | 1152 | rbo = gem_to_radeon_bo(radeon_fb->obj); |
@@ -1167,6 +1177,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1167 | uint64_t fb_location; | 1177 | uint64_t fb_location; |
1168 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1178 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
1169 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; | 1179 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; |
1180 | u32 tmp; | ||
1170 | int r; | 1181 | int r; |
1171 | 1182 | ||
1172 | /* no fb bound */ | 1183 | /* no fb bound */ |
@@ -1294,6 +1305,15 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1294 | WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1305 | WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1295 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); | 1306 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); |
1296 | 1307 | ||
1308 | /* pageflip setup */ | ||
1309 | /* make sure flip is at vb rather than hb */ | ||
1310 | tmp = RREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset); | ||
1311 | tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; | ||
1312 | WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); | ||
1313 | |||
1314 | /* set pageflip to happen anywhere in vblank interval */ | ||
1315 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); | ||
1316 | |||
1297 | if (!atomic && fb && fb != crtc->fb) { | 1317 | if (!atomic && fb && fb != crtc->fb) { |
1298 | radeon_fb = to_radeon_framebuffer(fb); | 1318 | radeon_fb = to_radeon_framebuffer(fb); |
1299 | rbo = gem_to_radeon_bo(radeon_fb->obj); | 1319 | rbo = gem_to_radeon_bo(radeon_fb->obj); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 941080a77940..0b0cc74c08c0 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -43,17 +43,6 @@ static void evergreen_pcie_gen2_enable(struct radeon_device *rdev); | |||
43 | 43 | ||
44 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) | 44 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) |
45 | { | 45 | { |
46 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc]; | ||
47 | u32 tmp; | ||
48 | |||
49 | /* make sure flip is at vb rather than hb */ | ||
50 | tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset); | ||
51 | tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN; | ||
52 | WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); | ||
53 | |||
54 | /* set pageflip to happen anywhere in vblank interval */ | ||
55 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); | ||
56 | |||
57 | /* enable the pflip int */ | 46 | /* enable the pflip int */ |
58 | radeon_irq_kms_pflip_irq_get(rdev, crtc); | 47 | radeon_irq_kms_pflip_irq_get(rdev, crtc); |
59 | } | 48 | } |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 19763f5df5e1..876cebc4b8ba 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -48,17 +48,6 @@ int rs600_mc_wait_for_idle(struct radeon_device *rdev); | |||
48 | 48 | ||
49 | void rs600_pre_page_flip(struct radeon_device *rdev, int crtc) | 49 | void rs600_pre_page_flip(struct radeon_device *rdev, int crtc) |
50 | { | 50 | { |
51 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc]; | ||
52 | u32 tmp; | ||
53 | |||
54 | /* make sure flip is at vb rather than hb */ | ||
55 | tmp = RREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset); | ||
56 | tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; | ||
57 | WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); | ||
58 | |||
59 | /* set pageflip to happen anywhere in vblank interval */ | ||
60 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); | ||
61 | |||
62 | /* enable the pflip int */ | 51 | /* enable the pflip int */ |
63 | radeon_irq_kms_pflip_irq_get(rdev, crtc); | 52 | radeon_irq_kms_pflip_irq_get(rdev, crtc); |
64 | } | 53 | } |