Skip to content

Commit 12dfc84

Browse files
agd5fairlied
authored andcommitted
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>
1 parent a70882a commit 12dfc84

1 file changed

Lines changed: 44 additions & 45 deletions

File tree

‎drivers/gpu/drm/radeon/evergreen.c‎

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
353353
struct drm_display_mode *mode,
354354
struct drm_display_mode *other_mode)
355355
{
356-
u32 tmp = 0;
356+
u32 tmp;
357357
/*
358358
* Line Buffer Setup
359359
* 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,
363363
* first display controller
364364
* 0 - first half of lb (3840 * 2)
365365
* 1 - first 3/4 of lb (5760 * 2)
366-
* 2 - whole lb (7680 * 2)
366+
* 2 - whole lb (7680 * 2), other crtc must be disabled
367367
* 3 - first 1/4 of lb (1920 * 2)
368368
* second display controller
369369
* 4 - second half of lb (3840 * 2)
370370
* 5 - second 3/4 of lb (5760 * 2)
371-
* 6 - whole lb (7680 * 2)
371+
* 6 - whole lb (7680 * 2), other crtc must be disabled
372372
* 7 - last 1/4 of lb (1920 * 2)
373373
*/
374-
if (mode && other_mode) {
375-
if (mode->hdisplay > other_mode->hdisplay) {
376-
if (mode->hdisplay > 2560)
377-
tmp = 1; /* 3/4 */
378-
else
379-
tmp = 0; /* 1/2 */
380-
} else if (other_mode->hdisplay > mode->hdisplay) {
381-
if (other_mode->hdisplay > 2560)
382-
tmp = 3; /* 1/4 */
383-
else
384-
tmp = 0; /* 1/2 */
385-
} else
374+
/* this can get tricky if we have two large displays on a paired group
375+
* of crtcs. Ideally for multiple large displays we'd assign them to
376+
* non-linked crtcs for maximum line buffer allocation.
377+
*/
378+
if (radeon_crtc->base.enabled && mode) {
379+
if (other_mode)
386380
tmp = 0; /* 1/2 */
387-
} else if (mode)
388-
tmp = 2; /* whole */
389-
else if (other_mode)
390-
tmp = 3; /* 1/4 */
381+
else
382+
tmp = 2; /* whole */
383+
} else
384+
tmp = 0;
391385

392386
/* second controller of the pair uses second half of the lb */
393387
if (radeon_crtc->crtc_id % 2)
394388
tmp += 4;
395389
WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp);
396390

397-
switch (tmp) {
398-
case 0:
399-
case 4:
400-
default:
401-
if (ASIC_IS_DCE5(rdev))
402-
return 4096 * 2;
403-
else
404-
return 3840 * 2;
405-
case 1:
406-
case 5:
407-
if (ASIC_IS_DCE5(rdev))
408-
return 6144 * 2;
409-
else
410-
return 5760 * 2;
411-
case 2:
412-
case 6:
413-
if (ASIC_IS_DCE5(rdev))
414-
return 8192 * 2;
415-
else
416-
return 7680 * 2;
417-
case 3:
418-
case 7:
419-
if (ASIC_IS_DCE5(rdev))
420-
return 2048 * 2;
421-
else
422-
return 1920 * 2;
391+
if (radeon_crtc->base.enabled && mode) {
392+
switch (tmp) {
393+
case 0:
394+
case 4:
395+
default:
396+
if (ASIC_IS_DCE5(rdev))
397+
return 4096 * 2;
398+
else
399+
return 3840 * 2;
400+
case 1:
401+
case 5:
402+
if (ASIC_IS_DCE5(rdev))
403+
return 6144 * 2;
404+
else
405+
return 5760 * 2;
406+
case 2:
407+
case 6:
408+
if (ASIC_IS_DCE5(rdev))
409+
return 8192 * 2;
410+
else
411+
return 7680 * 2;
412+
case 3:
413+
case 7:
414+
if (ASIC_IS_DCE5(rdev))
415+
return 2048 * 2;
416+
else
417+
return 1920 * 2;
418+
}
423419
}
420+
421+
/* controller not enabled, so no lb used */
422+
return 0;
424423
}
425424

426425
static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev)

0 commit comments

Comments
 (0)