kms: recalculate the flush limits after screen resize.

When we resize the front buffer we need to reduce the flush limits
appropriately.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie
2009-11-20 09:23:31 +10:00
committed by Dave Airlie
parent f7f58ef4c0
commit eb9bc133fc
3 changed files with 26 additions and 6 deletions

View File

@@ -1095,6 +1095,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
if (old_front)
radeon_bo_unref(old_front);
radeon_kms_update_vram_limit(scrn, screen_size);
return TRUE;
fail:

View File

@@ -1282,6 +1282,7 @@ extern void radeon_cs_flush_indirect(ScrnInfoPtr pScrn);
extern void radeon_ddx_cs_start(ScrnInfoPtr pScrn,
int num, const char *file,
const char *func, int line);
void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, int new_fb_size);
#endif
struct radeon_bo *radeon_get_pixmap_bo(PixmapPtr pPix);
void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo);

View File

@@ -946,13 +946,31 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Front buffer size: %dK\n", info->front_bo->size/1024);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Remaining VRAM size (used for pixmaps): %dK\n", remain_size_bytes/1024);
/* set the emit limit at 90% of VRAM */
remain_size_bytes = (remain_size_bytes / 10) * 9;
radeon_cs_set_limit(info->cs, RADEON_GEM_DOMAIN_VRAM, remain_size_bytes);
radeon_kms_update_vram_limit(pScrn, screen_size);
return TRUE;
}
void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, int new_fb_size)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
RADEONInfoPtr info = RADEONPTR(pScrn);
int remain_size_bytes;
int total_size_bytes;
int c;
for (c = 0; c < xf86_config->num_crtc; c++) {
if (info->cursor_bo[c] != NULL) {
total_size_bytes += (64 * 4 * 64);
}
}
total_size_bytes += new_fb_size;
remain_size_bytes = info->vram_size - new_fb_size;
remain_size_bytes = (remain_size_bytes / 10) * 9;
radeon_cs_set_limit(info->cs, RADEON_GEM_DOMAIN_VRAM, remain_size_bytes);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VRAM usage limit set to %dK\n", remain_size_bytes / 1024);
}
#endif