summaryrefslogtreecommitdiff
path: root/src/radeon_cursor.c
diff options
context:
space:
mode:
authorMichel Daenzer <michel@daenzer.net>2005-11-08 09:44:41 +0000
committerMichel Daenzer <michel@daenzer.net>2005-11-08 09:44:41 +0000
commit23911421ffa7bdd2e191a72c41bf1f26c92c1a67 (patch)
tree2acb606c0510ec92a13d3188c153c27fc9883ffc /src/radeon_cursor.c
parente1259c0117a190cf4c6e7be07d5aa83e03afb3a0 (diff)
bugzilla #4951 (https://bugs.freedesktop.org/show_bug.cgi?id=4951)
attachment #3689 (http://bugs.freedesktop.org/attachment.cgi?id=3689) Fix HW cursor getting silently disabled with EXA.
Diffstat (limited to 'src/radeon_cursor.c')
-rw-r--r--src/radeon_cursor.c76
1 files changed, 48 insertions, 28 deletions
diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
index fc249ffe..67ec5526 100644
--- a/src/radeon_cursor.c
+++ b/src/radeon_cursor.c
@@ -102,6 +102,45 @@ 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);
+
+ RADEONTRACE(("%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)
{
@@ -277,6 +316,13 @@ 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;
}
@@ -288,7 +334,7 @@ static Bool RADEONUseHWCursorARGB (ScreenPtr pScreen, CursorPtr pCurs)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
RADEONInfoPtr info = RADEONPTR(pScrn);
- if (info->cursor_offset &&
+ if (RADEONUseHWCursor(pScreen, pCurs) &&
pCurs->bits->height <= CURSOR_HEIGHT && pCurs->bits->width <= CURSOR_WIDTH)
return TRUE;
return FALSE;
@@ -359,18 +405,6 @@ static void RADEONLoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs)
#endif
-#ifdef USE_EXA
-static void
-ATICursorSave(ScreenPtr pScreen, ExaOffscreenArea *area)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- RADEONInfoPtr info = RADEONPTR(pScrn);
-
- info->cursorArea = NULL;
- info->cursor_offset = 0;
-}
-#endif
-
/* Initialize hardware cursor support. */
Bool RADEONCursorInit(ScreenPtr pScreen)
@@ -417,21 +451,7 @@ Bool RADEONCursorInit(ScreenPtr pScreen)
#ifdef USE_EXA
if (info->useEXA) {
- info->cursorArea = exaOffscreenAlloc(pScreen, size_bytes,
- 128, TRUE, ATICursorSave, info);
-
- if (!info->cursorArea) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Hardware cursor disabled"
- " due to insufficient offscreen memory\n");
- info->cursor_offset = 0;
- } else {
- info->cursor_offset = info->cursorArea->offset;
- }
-
- RADEONTRACE(("RADEONCursorInit (0x%08x-0x%08x)\n",
- info->cursor_offset,
- info->cursor_offset + info->cursorArea->size));
+ RADEONCursorAllocEXA(pScreen);
}
#endif /* USE_EXA */
#ifdef USE_XAA