From b6cd47ec007af2022af180f537a7ba01244b2c88 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 8 May 2009 12:21:33 -0400 Subject: AVIVO: fix cursor corruption bands for real Don't have to leave both cursors enabled, just have to use the same mode for both cursors whether or not they are enabled. --- src/radeon_cursor.c | 48 +++++++----------------------------------------- src/radeon_probe.h | 1 - 2 files changed, 7 insertions(+), 42 deletions(-) diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c index 4f646bc8..59df1323 100644 --- a/src/radeon_cursor.c +++ b/src/radeon_cursor.c @@ -100,7 +100,10 @@ avivo_setup_cursor(xf86CrtcPtr crtc, Bool enable) RADEONInfoPtr info = RADEONPTR(crtc->scrn); unsigned char *RADEONMMIO = info->MMIO; - OUTREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, 0); + /* always use the same cursor mode even if the cursor is disabled, + * otherwise you may end up with cursor curruption bands + */ + OUTREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); if (enable) { OUTREG(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, @@ -156,7 +159,6 @@ radeon_crtc_show_cursor (xf86CrtcPtr crtc) OUTREGP(RADEON_MM_DATA, RADEON_CRTC_CUR_EN | 2 << 20, ~(RADEON_CRTC_CUR_EN | RADEON_CRTC_CUR_MODE_MASK)); } - radeon_crtc->cursor_enabled = TRUE; } void @@ -169,18 +171,7 @@ radeon_crtc_hide_cursor (xf86CrtcPtr crtc) unsigned char *RADEONMMIO = info->MMIO; if (IS_AVIVO_VARIANT) { - DisplayModePtr mode = &crtc->mode; - avivo_lock_cursor(crtc, TRUE); - /* Set position offscreen. This will prevent the cursor - * from showing up even if it's enabled to work-around - * corruption issues. - */ - if (mode) { - OUTREG(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, - ((crtc->x + mode->CrtcHDisplay) << 16) | (crtc->y + mode->CrtcVDisplay)); - OUTREG(AVIVO_D1CUR_HOT_SPOT + radeon_crtc->crtc_offset, 0); - } avivo_setup_cursor(crtc, FALSE); avivo_lock_cursor(crtc, FALSE); } else { @@ -197,13 +188,13 @@ radeon_crtc_hide_cursor (xf86CrtcPtr crtc) OUTREGP(RADEON_MM_DATA, 0, ~RADEON_CRTC_CUR_EN); } - radeon_crtc->cursor_enabled = FALSE; } void radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) { ScrnInfoPtr pScrn = crtc->scrn; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; int crtc_id = radeon_crtc->crtc_id; RADEONInfoPtr info = RADEONPTR(pScrn); @@ -218,9 +209,7 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) if (yorigin >= CURSOR_HEIGHT) yorigin = CURSOR_HEIGHT - 1; if (IS_AVIVO_VARIANT) { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int w = CURSOR_WIDTH; - int i; /* avivo cursor spans the full fb width */ if (crtc->rotatedData == NULL) { @@ -228,15 +217,8 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) y += crtc->y; } - for (i = 0; i < xf86_config->num_crtc; i++) { - xf86CrtcPtr crtc = xf86_config->crtc[i]; - RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; - - if (!radeon_crtc->enabled) - break; - } - - if (i == xf86_config->num_crtc) { + if (pRADEONEnt->Controller[0]->enabled && + pRADEONEnt->Controller[1]->enabled) { int cursor_end, frame_end; cursor_end = x - xorigin + w; @@ -252,22 +234,6 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) } if (w <= 0) w = 1; - - /* both cursors should be enabled when dualhead is active - * or you may get corruption bands - */ - if (!pRADEONEnt->Controller[0]->cursor_enabled) { - avivo_lock_cursor(pRADEONEnt->pCrtc[0], TRUE); - avivo_setup_cursor(pRADEONEnt->pCrtc[0], TRUE); - avivo_lock_cursor(pRADEONEnt->pCrtc[0], FALSE); - pRADEONEnt->Controller[0]->cursor_enabled = TRUE; - } - if (!pRADEONEnt->Controller[1]->cursor_enabled) { - avivo_lock_cursor(pRADEONEnt->pCrtc[1], TRUE); - avivo_setup_cursor(pRADEONEnt->pCrtc[1], TRUE); - avivo_lock_cursor(pRADEONEnt->pCrtc[1], FALSE); - pRADEONEnt->Controller[1]->cursor_enabled = TRUE; - } } avivo_lock_cursor(crtc, TRUE); diff --git a/src/radeon_probe.h b/src/radeon_probe.h index dbccd857..3e4f47c3 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -159,7 +159,6 @@ typedef struct _RADEONCrtcPrivateRec { int can_tile; Bool enabled; Bool initialized; - Bool cursor_enabled; } RADEONCrtcPrivateRec, *RADEONCrtcPrivatePtr; typedef struct _radeon_encoder { -- cgit v1.2.3