summaryrefslogtreecommitdiff
path: root/src/radeon_kms.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-12-21 18:04:21 +0100
committerMichel Dänzer <michel@daenzer.net>2018-12-28 12:10:19 +0100
commit803f872f7d4b2d80be434bb42ce64dfd295b122c (patch)
treee1e5fac1e873c792637306f311a2e3c0e5e419b3 /src/radeon_kms.c
parent91e557f78ad261e76a1829f54722c2c0781742d2 (diff)
Use two HW cursor buffers per CRTC
Switch to the other buffer when xf86_config->cursor changes. Avoids these issues possible when re-using the same buffer: * The HW may intermittently display a mix of the old and new cursor images. * If the hotspot changes, the HW may intermittently display the new cursor image at the location corresponding to the old image's hotspot. Bugzilla: https://bugs.freedesktop.org/108832 (Ported from amdgpu commit 0d60233d26ec70d4e1faa343b438e33829c6d5e4)
Diffstat (limited to 'src/radeon_kms.c')
-rw-r--r--src/radeon_kms.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 27a02109..bb6885fb 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -2755,27 +2755,29 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
{
int cursor_size;
- int c;
+ int c, i;
cursor_size = info->cursor_w * info->cursor_h * 4;
cursor_size = RADEON_ALIGN(cursor_size, RADEON_GPU_PAGE_SIZE);
for (c = 0; c < xf86_config->num_crtc; c++) {
drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[c]->driver_private;
- if (!drmmode_crtc->cursor_bo) {
- drmmode_crtc->cursor_bo = radeon_bo_open(info->bufmgr, 0,
- cursor_size, 0,
- RADEON_GEM_DOMAIN_VRAM, 0);
- if (!(drmmode_crtc->cursor_bo)) {
- ErrorF("Failed to allocate cursor buffer memory\n");
- return FALSE;
- }
-
- if (radeon_bo_map(drmmode_crtc->cursor_bo, 1)) {
- ErrorF("Failed to map cursor buffer memory\n");
- }
- }
- }
+ for (i = 0; i < 2; i++) {
+ if (!drmmode_crtc->cursor_bo[i]) {
+ drmmode_crtc->cursor_bo[i] =
+ radeon_bo_open(info->bufmgr, 0, cursor_size, 0,
+ RADEON_GEM_DOMAIN_VRAM, 0);
+
+ if (!(drmmode_crtc->cursor_bo[i])) {
+ ErrorF("Failed to allocate cursor buffer memory\n");
+ return FALSE;
+ }
+
+ if (radeon_bo_map(drmmode_crtc->cursor_bo[i], 1))
+ ErrorF("Failed to map cursor buffer memory\n");
+ }
+ }
+ }
}
if (!info->front_buffer) {
@@ -2841,7 +2843,7 @@ void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, uint32_t new_fb_size)
for (c = 0; c < xf86_config->num_crtc; c++) {
drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[c]->driver_private;
- if (drmmode_crtc->cursor_bo)
+ if (drmmode_crtc->cursor_bo[0])
new_fb_size += (64 * 4 * 64);
}