drm/radeon/kms: adjust evergreen display watermark setup

This patch fixes two issues:
- A disabled crtc does not use any lb, so return 0 for
lb size.  This makes the display priority calculation
more exact.
- Only use 1/2 and whole lb partitions. Using smaller
partitions can cause underflow to one of the displays
if you have multiple large displays on the same lb.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=34534

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Alex Deucher 2011-04-14 19:07:34 -04:00 committed by Dave Airlie
parent a70882aa31
commit 12dfc843f4

View file

@ -353,7 +353,7 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
struct drm_display_mode *mode, struct drm_display_mode *mode,
struct drm_display_mode *other_mode) struct drm_display_mode *other_mode)
{ {
u32 tmp = 0; u32 tmp;
/* /*
* Line Buffer Setup * Line Buffer Setup
* There are 3 line buffers, each one shared by 2 display controllers. * There are 3 line buffers, each one shared by 2 display controllers.
@ -363,64 +363,63 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
* first display controller * first display controller
* 0 - first half of lb (3840 * 2) * 0 - first half of lb (3840 * 2)
* 1 - first 3/4 of lb (5760 * 2) * 1 - first 3/4 of lb (5760 * 2)
* 2 - whole lb (7680 * 2) * 2 - whole lb (7680 * 2), other crtc must be disabled
* 3 - first 1/4 of lb (1920 * 2) * 3 - first 1/4 of lb (1920 * 2)
* second display controller * second display controller
* 4 - second half of lb (3840 * 2) * 4 - second half of lb (3840 * 2)
* 5 - second 3/4 of lb (5760 * 2) * 5 - second 3/4 of lb (5760 * 2)
* 6 - whole lb (7680 * 2) * 6 - whole lb (7680 * 2), other crtc must be disabled
* 7 - last 1/4 of lb (1920 * 2) * 7 - last 1/4 of lb (1920 * 2)
*/ */
if (mode && other_mode) { /* this can get tricky if we have two large displays on a paired group
if (mode->hdisplay > other_mode->hdisplay) { * of crtcs. Ideally for multiple large displays we'd assign them to
if (mode->hdisplay > 2560) * non-linked crtcs for maximum line buffer allocation.
tmp = 1; /* 3/4 */ */
else if (radeon_crtc->base.enabled && mode) {
tmp = 0; /* 1/2 */ if (other_mode)
} else if (other_mode->hdisplay > mode->hdisplay) {
if (other_mode->hdisplay > 2560)
tmp = 3; /* 1/4 */
else
tmp = 0; /* 1/2 */
} else
tmp = 0; /* 1/2 */ tmp = 0; /* 1/2 */
} else if (mode) else
tmp = 2; /* whole */ tmp = 2; /* whole */
else if (other_mode) } else
tmp = 3; /* 1/4 */ tmp = 0;
/* second controller of the pair uses second half of the lb */ /* second controller of the pair uses second half of the lb */
if (radeon_crtc->crtc_id % 2) if (radeon_crtc->crtc_id % 2)
tmp += 4; tmp += 4;
WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp); WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp);
switch (tmp) { if (radeon_crtc->base.enabled && mode) {
case 0: switch (tmp) {
case 4: case 0:
default: case 4:
if (ASIC_IS_DCE5(rdev)) default:
return 4096 * 2; if (ASIC_IS_DCE5(rdev))
else return 4096 * 2;
return 3840 * 2; else
case 1: return 3840 * 2;
case 5: case 1:
if (ASIC_IS_DCE5(rdev)) case 5:
return 6144 * 2; if (ASIC_IS_DCE5(rdev))
else return 6144 * 2;
return 5760 * 2; else
case 2: return 5760 * 2;
case 6: case 2:
if (ASIC_IS_DCE5(rdev)) case 6:
return 8192 * 2; if (ASIC_IS_DCE5(rdev))
else return 8192 * 2;
return 7680 * 2; else
case 3: return 7680 * 2;
case 7: case 3:
if (ASIC_IS_DCE5(rdev)) case 7:
return 2048 * 2; if (ASIC_IS_DCE5(rdev))
else return 2048 * 2;
return 1920 * 2; else
return 1920 * 2;
}
} }
/* controller not enabled, so no lb used */
return 0;
} }
static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev)