summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2006-07-03 00:03:22 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2006-07-03 00:03:22 +0200
commitea5105230c7c3519730b8d3c250e9ba9a4e4374a (patch)
tree82d48a72830f10c749b7b5af58ca33f17d80e03c
parent66586f905857ea5bf37cb5d34949cd450a9ed067 (diff)
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.
-rw-r--r--src/radeon.h73
-rw-r--r--src/radeon_cursor.c65
-rw-r--r--src/radeon_driver.c68
-rw-r--r--src/radeon_exa.c13
4 files changed, 83 insertions, 136 deletions
diff --git a/src/radeon.h b/src/radeon.h
index 7368308e..6402e488 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -79,6 +79,74 @@
#include "picturestr.h"
#endif
+typedef enum {
+ OPTION_NOACCEL,
+ OPTION_SW_CURSOR,
+ OPTION_DAC_6BIT,
+ OPTION_DAC_8BIT,
+#ifdef XF86DRI
+ OPTION_BUS_TYPE,
+ OPTION_CP_PIO,
+ OPTION_USEC_TIMEOUT,
+ OPTION_AGP_MODE,
+ OPTION_AGP_FW,
+ OPTION_GART_SIZE,
+ OPTION_GART_SIZE_OLD,
+ OPTION_RING_SIZE,
+ OPTION_BUFFER_SIZE,
+ OPTION_DEPTH_MOVE,
+ OPTION_PAGE_FLIP,
+ OPTION_NO_BACKBUFFER,
+ OPTION_XV_DMA,
+ OPTION_FBTEX_PERCENT,
+ OPTION_DEPTH_BITS,
+#ifdef USE_EXA
+ OPTION_ACCEL_DFS,
+#endif
+#endif
+ OPTION_PANEL_OFF,
+ OPTION_DDC_MODE,
+ OPTION_MONITOR_LAYOUT,
+ OPTION_IGNORE_EDID,
+ OPTION_FBDEV,
+ OPTION_MERGEDFB,
+ OPTION_CRT2HSYNC,
+ OPTION_CRT2VREFRESH,
+ OPTION_CRT2POS,
+ OPTION_METAMODES,
+ OPTION_MERGEDDPI,
+ OPTION_RADEONXINERAMA,
+ OPTION_CRT2ISSCRN0,
+ OPTION_MERGEDFBNONRECT,
+ OPTION_MERGEDFBMOUSER,
+ OPTION_DISP_PRIORITY,
+ OPTION_PANEL_SIZE,
+ OPTION_MIN_DOTCLOCK,
+ OPTION_COLOR_TILING,
+#ifdef XvExtension
+ OPTION_VIDEO_KEY,
+ OPTION_RAGE_THEATRE_CRYSTAL,
+ OPTION_RAGE_THEATRE_TUNER_PORT,
+ OPTION_RAGE_THEATRE_COMPOSITE_PORT,
+ OPTION_RAGE_THEATRE_SVIDEO_PORT,
+ OPTION_TUNER_TYPE,
+ OPTION_RAGE_THEATRE_MICROC_PATH,
+ OPTION_RAGE_THEATRE_MICROC_TYPE,
+#endif
+#ifdef RENDER
+ OPTION_RENDER_ACCEL,
+ OPTION_SUBPIXEL_ORDER,
+#endif
+ OPTION_SHOWCACHE,
+ OPTION_DYNAMIC_CLOCKS,
+ OPTION_BIOS_HOTKEYS,
+ OPTION_VGA_ACCESS,
+ OPTION_REVERSE_DDC,
+ OPTION_LVDS_PROBE_PLL,
+ OPTION_ACCELMETHOD,
+ OPTION_CONSTANTDPI
+} RADEONOpts;
+
/* ------- mergedfb support ------------- */
/* Psuedo Xinerama support */
#define NEED_REPLIES /* ? */
@@ -426,10 +494,7 @@ typedef struct {
#endif
Bool accelOn;
xf86CursorInfoPtr cursor;
-#ifdef USE_EXA
- ExaOffscreenArea *cursorArea;
-#endif
- unsigned long cursor_offset;
+ CARD32 cursor_offset;
#ifdef USE_XAA
unsigned long cursor_end;
#endif
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;
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index a3aae4b9..85c5c771 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -145,74 +145,6 @@ static void RADEONAdjustMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save);
extern Bool RADEONnoPanoramiXExtension;
-typedef enum {
- OPTION_NOACCEL,
- OPTION_SW_CURSOR,
- OPTION_DAC_6BIT,
- OPTION_DAC_8BIT,
-#ifdef XF86DRI
- OPTION_BUS_TYPE,
- OPTION_CP_PIO,
- OPTION_USEC_TIMEOUT,
- OPTION_AGP_MODE,
- OPTION_AGP_FW,
- OPTION_GART_SIZE,
- OPTION_GART_SIZE_OLD,
- OPTION_RING_SIZE,
- OPTION_BUFFER_SIZE,
- OPTION_DEPTH_MOVE,
- OPTION_PAGE_FLIP,
- OPTION_NO_BACKBUFFER,
- OPTION_XV_DMA,
- OPTION_FBTEX_PERCENT,
- OPTION_DEPTH_BITS,
-#ifdef USE_EXA
- OPTION_ACCEL_DFS,
-#endif
-#endif
- OPTION_PANEL_OFF,
- OPTION_DDC_MODE,
- OPTION_MONITOR_LAYOUT,
- OPTION_IGNORE_EDID,
- OPTION_FBDEV,
- OPTION_MERGEDFB,
- OPTION_CRT2HSYNC,
- OPTION_CRT2VREFRESH,
- OPTION_CRT2POS,
- OPTION_METAMODES,
- OPTION_MERGEDDPI,
- OPTION_RADEONXINERAMA,
- OPTION_CRT2ISSCRN0,
- OPTION_MERGEDFBNONRECT,
- OPTION_MERGEDFBMOUSER,
- OPTION_DISP_PRIORITY,
- OPTION_PANEL_SIZE,
- OPTION_MIN_DOTCLOCK,
- OPTION_COLOR_TILING,
-#ifdef XvExtension
- OPTION_VIDEO_KEY,
- OPTION_RAGE_THEATRE_CRYSTAL,
- OPTION_RAGE_THEATRE_TUNER_PORT,
- OPTION_RAGE_THEATRE_COMPOSITE_PORT,
- OPTION_RAGE_THEATRE_SVIDEO_PORT,
- OPTION_TUNER_TYPE,
- OPTION_RAGE_THEATRE_MICROC_PATH,
- OPTION_RAGE_THEATRE_MICROC_TYPE,
-#endif
-#ifdef RENDER
- OPTION_RENDER_ACCEL,
- OPTION_SUBPIXEL_ORDER,
-#endif
- OPTION_SHOWCACHE,
- OPTION_DYNAMIC_CLOCKS,
- OPTION_BIOS_HOTKEYS,
- OPTION_VGA_ACCESS,
- OPTION_REVERSE_DDC,
- OPTION_LVDS_PROBE_PLL,
- OPTION_ACCELMETHOD,
- OPTION_CONSTANTDPI
-} RADEONOpts;
-
static const OptionInfoRec RADEONOptions[] = {
{ OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE },
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 5bbce877..0d72005d 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -398,6 +398,19 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
"Will use %d kb for front buffer at offset 0x%08x\n",
screen_size / 1024, 0);
+ /* Reserve static area for hardware cursor */
+ if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
+ int cursor_size = 64 * 4 * 64;
+
+ info->cursor_offset = info->exa->offScreenBase;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Will use %d kb for hardware cursor at offset 0x%08x\n",
+ cursor_size / 1024, (unsigned int)info->cursor_offset);
+
+ info->exa->offScreenBase += cursor_size;
+ }
+
#if defined(XF86DRI)
if (info->directRenderingEnabled) {
int depthCpp = (info->depthBits - 8) / 4, l, next, depth_size;