From ea5105230c7c3519730b8d3c250e9ba9a4e4374a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 3 Jul 2006 00:03:22 +0200 Subject: Reserve HW cursor memory statically instead of from EXA offscreen. As a result, quite a bit of code can be removed that attempted to deal with the EXA offscreen memory disappearing, with varying success. Because the HW cursor memory is now always immediately after the front buffer and before the back buffer, this also fixes bug #6808. As the HW cursor memory is now reserved statically with EXA and XAA, change RADEONUseHWCursor() to check info->cursor instead of info->cursor_offset, for which 0 might become valid with HW cursor enabled in the future. Change info->cursor_offset from unsigned long to CARD32 as the corresponding register is 32 bits wide, and to avoid issues with printf. --- src/radeon_cursor.c | 65 +---------------------------------------------------- 1 file changed, 1 insertion(+), 64 deletions(-) (limited to 'src/radeon_cursor.c') diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c index d7a38917..0154c300 100644 --- a/src/radeon_cursor.c +++ b/src/radeon_cursor.c @@ -106,45 +106,6 @@ static CARD32 mono_cursor_color[] = { #endif -#ifdef USE_EXA -static void -RADEONCursorSave(ScreenPtr pScreen, ExaOffscreenArea *area) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - - info->cursorArea = NULL; - info->cursor_offset = 0; -} - -static void -RADEONCursorAllocEXA(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RADEONInfoPtr info = RADEONPTR(pScrn); - - info->cursorArea = exaOffscreenAlloc(pScreen, - CURSOR_WIDTH * 4 * CURSOR_HEIGHT, - 128, TRUE, RADEONCursorSave, info); - - if (!info->cursorArea) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Hardware cursor temporarily disabled" - " due to insufficient offscreen memory\n"); - info->cursor_offset = 0; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using hardware cursor\n"); - info->cursor_offset = info->cursorArea->offset; - - RADEONCTRACE(("%s (0x%08x-0x%08x)\n", __func__, - info->cursor_offset, - info->cursor_offset + info->cursorArea->size)); - } -} -#endif - - /* Set cursor foreground and background colors */ static void RADEONSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { @@ -155,9 +116,6 @@ static void RADEONSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) RADEONCTRACE(("RADEONSetCursorColors\n")); - if (info->cursor_offset == 0) - return; - #ifdef ARGB_CURSOR /* Don't recolour cursors set with SetCursorARGB. */ if (info->cursor_argb) @@ -200,9 +158,6 @@ static void RADEONSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) int total_y = pScrn->frameY1 - pScrn->frameY0; int stride = 256; - if (info->cursor_offset == 0) - return; - if(info->MergedFB) { RADEONCTRACE(("RADEONSetCursorPositionMerged\n")); RADEONSetCursorPositionMerged(pScrn, x, y); @@ -255,9 +210,6 @@ static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image) CARD8 chunk; CARD32 i, j; - if (info->cursor_offset == 0) - return; - RADEONCTRACE(("RADEONLoadCursorImage (at %x)\n", info->cursor_offset)); if (!info->IsSecondary) { @@ -342,14 +294,7 @@ static Bool RADEONUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); - #ifdef USE_EXA - if (!info->cursor_offset && info->useEXA && info->cursor) - { - RADEONCursorAllocEXA(pScreen); - } -#endif - - return info->cursor_offset ? TRUE : FALSE; + return info->cursor ? TRUE : FALSE; } #ifdef ARGB_CURSOR @@ -376,9 +321,6 @@ static void RADEONLoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs) RADEONCTRACE(("RADEONLoadCursorARGB\n")); - if (info->cursor_offset == 0) - return; - if (!info->IsSecondary) { save1 = INREG(RADEON_CRTC_GEN_CNTL) & ~(CARD32) (3 << 20); save1 |= (CARD32) (2 << 20); @@ -474,11 +416,6 @@ Bool RADEONCursorInit(ScreenPtr pScreen) width_bytes = width * (pScrn->bitsPerPixel / 8); height = (size_bytes + width_bytes - 1) / width_bytes; -#ifdef USE_EXA - if (info->useEXA) { - RADEONCursorAllocEXA(pScreen); - } -#endif /* USE_EXA */ #ifdef USE_XAA if (!info->useEXA) { FBAreaPtr fbarea; -- cgit v1.2.3