summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deucher <alex@t41p.hsd1.va.comcast.net>2007-12-12 18:50:18 -0500
committerAlex Deucher <alex@t41p.hsd1.va.comcast.net>2007-12-12 18:50:18 -0500
commit33a39947f7f79533cd90007a17d57b20126642c6 (patch)
treeadb2cb7ccad2c2c8b8ffa034cc30f0aeaadec2e8 /src
parent9e5efdecd12092031a4aebce58747cb4a6f48f28 (diff)
RADEON: fix cursors when using rotation
allocate separate cursor buffers for each crtc
Diffstat (limited to 'src')
-rw-r--r--src/radeon.h4
-rw-r--r--src/radeon_cursor.c47
-rw-r--r--src/radeon_driver.c5
-rw-r--r--src/radeon_exa.c20
-rw-r--r--src/radeon_probe.h1
5 files changed, 47 insertions, 30 deletions
diff --git a/src/radeon.h b/src/radeon.h
index b7f92888..960266ec 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -557,10 +557,6 @@ typedef struct {
#endif
Bool accelOn;
xf86CursorInfoPtr cursor;
- CARD32 cursor_offset;
-#ifdef USE_XAA
- unsigned long cursor_end;
-#endif
Bool allowColorTiling;
Bool tilingEnabled; /* mirror of sarea->tiling_enabled */
#ifdef ARGB_CURSOR
diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
index b8cfffd2..9dd6eb85 100644
--- a/src/radeon_cursor.c
+++ b/src/radeon_cursor.c
@@ -166,9 +166,9 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
| ((xorigin ? 0 : x) << 16)
| (yorigin ? 0 : y)));
RADEONCTRACE(("cursor_offset: 0x%x, yorigin: %d, stride: %d, temp %08X\n",
- info->cursor_offset + pScrn->fbOffset, yorigin, stride, temp));
+ radeon_crtc->cursor_offset + pScrn->fbOffset, yorigin, stride, temp));
OUTREG(RADEON_CUR_OFFSET,
- info->cursor_offset + pScrn->fbOffset + yorigin * stride);
+ radeon_crtc->cursor_offset + pScrn->fbOffset + yorigin * stride);
} else if (crtc_id == 1) {
OUTREG(RADEON_CUR2_HORZ_VERT_OFF, (RADEON_CUR2_LOCK
| (xorigin << 16)
@@ -177,9 +177,9 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
| ((xorigin ? 0 : x) << 16)
| (yorigin ? 0 : y)));
RADEONCTRACE(("cursor_offset2: 0x%x, yorigin: %d, stride: %d, temp %08X\n",
- info->cursor_offset + pScrn->fbOffset, yorigin, stride, temp));
+ radeon_crtc->cursor_offset + pScrn->fbOffset, yorigin, stride, temp));
OUTREG(RADEON_CUR2_OFFSET,
- info->cursor_offset + pScrn->fbOffset + yorigin * stride);
+ radeon_crtc->cursor_offset + pScrn->fbOffset + yorigin * stride);
}
}
@@ -188,8 +188,9 @@ void
radeon_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg)
{
ScrnInfoPtr pScrn = crtc->scrn;
+ RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
RADEONInfoPtr info = RADEONPTR(pScrn);
- CARD32 *pixels = (CARD32 *)(pointer)(info->FB + info->cursor_offset + pScrn->fbOffset);
+ CARD32 *pixels = (CARD32 *)(pointer)(info->FB + radeon_crtc->cursor_offset + pScrn->fbOffset);
int pixel, i;
CURSOR_SWAPPING_DECL_MMIO
@@ -229,9 +230,10 @@ void
radeon_crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
{
ScrnInfoPtr pScrn = crtc->scrn;
+ RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
- CARD32 *d = (CARD32 *)(pointer)(info->FB + info->cursor_offset + pScrn->fbOffset);
+ CARD32 *d = (CARD32 *)(pointer)(info->FB + radeon_crtc->cursor_offset + pScrn->fbOffset);
RADEONCTRACE(("RADEONLoadCursorARGB\n"));
@@ -252,16 +254,18 @@ Bool RADEONCursorInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
RADEONInfoPtr info = RADEONPTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int width;
int width_bytes;
int height;
int size_bytes;
-
+ CARD32 cursor_offset = 0;
+ int c;
size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT;
width = pScrn->displayWidth;
width_bytes = width * (pScrn->bitsPerPixel / 8);
- height = (size_bytes + width_bytes - 1) / width_bytes;
+ height = ((size_bytes * xf86_config->num_crtc) + width_bytes - 1) / width_bytes;
#ifdef USE_XAA
if (!info->useEXA) {
@@ -271,19 +275,30 @@ Bool RADEONCursorInit(ScreenPtr pScreen)
256, NULL, NULL, NULL);
if (!fbarea) {
- info->cursor_offset = 0;
+ cursor_offset = 0;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Hardware cursor disabled"
" due to insufficient offscreen memory\n");
+ return FALSE;
} else {
- info->cursor_offset = RADEON_ALIGN((fbarea->box.x1 +
- fbarea->box.y1 * width) *
- info->CurrentLayout.pixel_bytes,
- 256);
- info->cursor_end = info->cursor_offset + size_bytes;
+ cursor_offset = RADEON_ALIGN((fbarea->box.x1 +
+ fbarea->box.y1 * width) *
+ info->CurrentLayout.pixel_bytes,
+ 256);
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+ RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
+
+ radeon_crtc->cursor_offset = cursor_offset + (c * size_bytes);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using hardware cursor %d (scanline %u)\n", c,
+ (unsigned)(radeon_crtc->cursor_offset / pScrn->displayWidth
+ / info->CurrentLayout.pixel_bytes));
+ }
+
}
- RADEONCTRACE(("RADEONCursorInit (0x%08x-0x%08x)\n",
- info->cursor_offset, info->cursor_end));
}
#endif
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 4b5008e5..122c5827 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -3542,10 +3542,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
if (!info->useEXA) {
int width, height;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using hardware cursor (scanline %u)\n",
- (unsigned)(info->cursor_offset / pScrn->displayWidth
- / info->CurrentLayout.pixel_bytes));
if (xf86QueryLargestOffscreenArea(pScreen, &width, &height,
0, 0, 0)) {
xf86DrvMsg(scrnIndex, X_INFO,
@@ -3560,7 +3556,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n");
}
} else {
- info->cursor_offset = 0;
xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n");
}
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 8a12e1b2..4da4841a 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -374,6 +374,7 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
RADEONInfoPtr info = RADEONPTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int cpp = info->CurrentLayout.pixel_bytes;
int screen_size;
int byteStride = pScrn->displayWidth * cpp;
@@ -405,14 +406,23 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
/* Reserve static area for hardware cursor */
if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
int cursor_size = 64 * 4 * 64;
+ int c;
- info->cursor_offset = info->exa->offScreenBase;
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+ RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
+
+ radeon_crtc->cursor_offset = info->exa->offScreenBase;
+ info->exa->offScreenBase += cursor_size;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Will use %d kb for hardware cursor %d at offset 0x%08x\n",
+ (cursor_size * xf86_config->num_crtc) / 1024,
+ c,
+ (unsigned int)radeon_crtc->cursor_offset);
+ }
- 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)
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 66ece941..7f8ce450 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -166,6 +166,7 @@ typedef struct _RADEONCrtcPrivateRec {
#endif
int crtc_id;
int binding;
+ CARD32 cursor_offset;
/* Lookup table values to be set when the CRTC is enabled */
CARD8 lut_r[256], lut_g[256], lut_b[256];
} RADEONCrtcPrivateRec, *RADEONCrtcPrivatePtr;