summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-01-18 14:26:21 -0800
committerEric Anholt <eric@anholt.net>2007-01-18 14:26:21 -0800
commit74ebff6732b9bfcf8c865b52cbebfd9bf6b73eb2 (patch)
tree2b947b57dd9ea8d3e61a1c43455c0fd6b216b6f9
parent8759f4d89a141f7d69f1894ec3059ba6bd1cf86b (diff)
Allocate separate cursor memory per CRTC and rotate cursors appropriately.
Also, add bind/unbind of the shadow rotate buffers, which was missed in a previous commit.
-rw-r--r--src/i830.h4
-rw-r--r--src/i830_cursor.c101
-rw-r--r--src/i830_driver.c31
-rw-r--r--src/i830_memory.c206
4 files changed, 197 insertions, 145 deletions
diff --git a/src/i830.h b/src/i830.h
index c7920730..a7c889d4 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -200,6 +200,8 @@ typedef struct _I830CrtcPrivateRec {
CARD8 lut_r[256], lut_g[256], lut_b[256];
I830MemRange rotate_mem;
+ I830MemRange cursor_mem;
+ I830MemRange cursor_mem_argb;
} I830CrtcPrivateRec, *I830CrtcPrivatePtr;
#define I830CrtcPrivate(c) ((I830CrtcPrivatePtr) (c)->driver_private)
@@ -276,8 +278,6 @@ typedef struct _I830Rec {
I830MemRange EXAStateMem; /* specific exa state for G965 */
#endif
/* Regions allocated either from the above pools, or from agpgart. */
- I830MemRange *CursorMem;
- I830MemRange *CursorMemARGB;
I830RingBuffer *LpRing;
#if REMAP_RESERVED
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 364320e8..bb5bc38d 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -94,9 +94,9 @@ I830SetPipeCursorBase (xf86CrtcPtr crtc)
FatalError("Bad pipe number for cursor base setting\n");
if (pI830->CursorIsARGB)
- cursor_mem = pI830->CursorMemARGB;
+ cursor_mem = &intel_crtc->cursor_mem_argb;
else
- cursor_mem = pI830->CursorMem;
+ cursor_mem = &intel_crtc->cursor_mem;
if (pI830->CursorNeedsPhysical) {
OUTREG(cursor_base, cursor_mem->Physical);
@@ -251,21 +251,13 @@ I830CursorInit(ScreenPtr pScreen)
infoPtr->HideCursor = I830HideCursor;
infoPtr->ShowCursor = I830ShowCursor;
infoPtr->UseHWCursor = I830UseHWCursor;
-
- pI830->pCurs = NULL;
-
#ifdef ARGB_CURSOR
- pI830->CursorIsARGB = FALSE;
-
- if (pI830->CursorMemARGB->Start) {
- /* Use ARGB if we were able to allocate the 16kb needed */
- infoPtr->UseHWCursorARGB = I830UseHWCursorARGB;
- infoPtr->LoadCursorARGB = I830LoadCursorARGB;
- }
+ infoPtr->UseHWCursorARGB = I830UseHWCursorARGB;
+ infoPtr->LoadCursorARGB = I830LoadCursorARGB;
#endif
- if (pI830->CursorNeedsPhysical && !pI830->CursorMem->Physical)
- return FALSE;
+ pI830->pCurs = NULL;
+
I830HideCursor(pScrn);
@@ -280,18 +272,16 @@ I830UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
pI830->pCurs = pCurs;
- DPRINTF(PFX, "I830UseHWCursor\n");
- if (pI830->CursorNeedsPhysical && !pI830->CursorMem->Physical)
- return FALSE;
-
return TRUE;
}
static void
-I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+I830CRTCLoadCursorImage(xf86CrtcPtr crtc, unsigned char *src)
{
+ ScrnInfoPtr pScrn = crtc->scrn;
I830Ptr pI830 = I830PTR(pScrn);
- CARD8 *pcurs = (CARD8 *) (pI830->FbBase + pI830->CursorMem->Start);
+ I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+ CARD8 *pcurs = (CARD8 *) (pI830->FbBase + intel_crtc->cursor_mem.Start);
int x, y;
DPRINTF(PFX, "I830LoadCursorImage\n");
@@ -310,7 +300,7 @@ I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
(*(image + (x) / 8 + (y) * (128/8)) |=\
(int) (1 << (7-((x) % 8))))
- switch (pI830->rotation) {
+ switch (crtc->rotation) {
case RR_Rotate_90:
for (y = 0; y < 64; y++) {
for (x = 0; x < 64; x++) {
@@ -353,6 +343,17 @@ I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
}
}
+static void
+I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int pipe;
+
+ for (pipe = 0; pipe < xf86_config->num_crtc; pipe++) {
+ I830CRTCLoadCursorImage(xf86_config->crtc[pipe], src);
+ }
+}
+
#ifdef ARGB_CURSOR
#include "cursorstr.h"
@@ -360,15 +361,22 @@ static Bool I830UseHWCursorARGB (ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
DPRINTF(PFX, "I830UseHWCursorARGB\n");
pI830->pCurs = pCurs;
- if (pScrn->bitsPerPixel == 8)
- return FALSE;
+ /* Check that our ARGB allocations succeeded */
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
+
+ if (!intel_crtc->cursor_mem_argb.Start)
+ return FALSE;
+ }
- if (pI830->CursorNeedsPhysical && !pI830->CursorMemARGB->Physical)
+ if (pScrn->bitsPerPixel == 8)
return FALSE;
if (pCurs->bits->height <= 64 && pCurs->bits->width <= 64)
@@ -377,10 +385,11 @@ static Bool I830UseHWCursorARGB (ScreenPtr pScreen, CursorPtr pCurs)
return FALSE;
}
-static void I830LoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs)
+static void I830CRTCLoadCursorARGB (xf86CrtcPtr crtc, CursorPtr pCurs)
{
- I830Ptr pI830 = I830PTR(pScrn);
- CARD32 *dst = (CARD32 *) (pI830->FbBase + pI830->CursorMemARGB->Start);
+ I830Ptr pI830 = I830PTR(crtc->scrn);
+ I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+ CARD32 *dst = (CARD32 *) (pI830->FbBase + intel_crtc->cursor_mem.Start);
CARD32 *image = (CARD32 *)pCurs->bits->argb;
int x, y, w, h;
@@ -394,7 +403,7 @@ static void I830LoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs)
w = pCurs->bits->width;
h = pCurs->bits->height;
- switch (pI830->rotation) {
+ switch (crtc->rotation) {
case RR_Rotate_90:
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++)
@@ -447,12 +456,23 @@ static void I830LoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs)
*dst++ = 0;
}
}
+
+static void
+I830LoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int pipe;
+
+ for (pipe = 0; pipe < xf86_config->num_crtc; pipe++) {
+ I830CRTCLoadCursorARGB(xf86_config->crtc[pipe], pCurs);
+ }
+}
#endif
static void
I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
CARD32 temp;
Bool inrange;
@@ -473,7 +493,6 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
if (!crtc->enabled)
continue;
- /* XXX: deal with hotspot issues */
switch (crtc->rotation) {
case RR_Rotate_0:
thisx = (root_x - crtc->x);
@@ -482,18 +501,18 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
case RR_Rotate_90:
thisx = (root_y - crtc->y);
thisy = mode->VDisplay - (root_x - crtc->x);
- /*hotspoty = I810_CURSOR_X;*/
+ hotspoty = I810_CURSOR_X;
break;
case RR_Rotate_180:
thisx = mode->HDisplay - (root_x - crtc->x);
thisy = mode->VDisplay - (root_y - crtc->y);
- /*hotspotx = I810_CURSOR_X;
- hotspoty = I810_CURSOR_Y;*/
+ hotspotx = I810_CURSOR_X;
+ hotspoty = I810_CURSOR_Y;
break;
case RR_Rotate_270:
thisx = mode->VDisplay - (root_y - crtc->y);
thisy = (root_x - crtc->x);
- /*hotspotx = I810_CURSOR_Y;*/
+ hotspotx = I810_CURSOR_Y;
break;
}
@@ -542,19 +561,11 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
static void
I830ShowCursor(ScrnInfoPtr pScrn)
{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- I830Ptr pI830 = I830PTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ I830Ptr pI830 = I830PTR(pScrn);
int pipe;
- DPRINTF(PFX, "I830ShowCursor\n");
- DPRINTF(PFX,
- "Value of CursorMem->Physical is %x, "
- " Value of CursorMem->Start is %x ",
- pI830->CursorMem->Physical, pI830->CursorMem->Start);
- DPRINTF(PFX,
- "Value of CursorMemARGB->Physical is %x, "
- " Value of CursorMemARGB->Start is %x ",
- pI830->CursorMemARGB->Physical, pI830->CursorMemARGB->Start);
+ DPRINTF(PFX, "I830ShowCursor\n");
pI830->cursorOn = TRUE;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 84fd9d86..644ea57f 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -765,12 +765,6 @@ PreInitCleanup(ScrnInfoPtr pScrn)
if (pI830->LpRing)
xfree(pI830->LpRing);
pI830->LpRing = NULL;
- if (pI830->CursorMem)
- xfree(pI830->CursorMem);
- pI830->CursorMem = NULL;
- if (pI830->CursorMemARGB)
- xfree(pI830->CursorMemARGB);
- pI830->CursorMemARGB = NULL;
if (pI830->OverlayMem)
xfree(pI830->OverlayMem);
pI830->OverlayMem = NULL;
@@ -1527,12 +1521,10 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
/* Alloc our pointers for the primary head */
if (I830IsPrimary(pScrn)) {
pI830->LpRing = xalloc(sizeof(I830RingBuffer));
- pI830->CursorMem = xalloc(sizeof(I830MemRange));
- pI830->CursorMemARGB = xalloc(sizeof(I830MemRange));
pI830->OverlayMem = xalloc(sizeof(I830MemRange));
pI830->overlayOn = xalloc(sizeof(Bool));
pI830->used3D = xalloc(sizeof(int));
- if (!pI830->LpRing || !pI830->CursorMem || !pI830->CursorMemARGB ||
+ if (!pI830->LpRing ||
!pI830->OverlayMem || !pI830->overlayOn || !pI830->used3D) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Could not allocate primary data structures.\n");
@@ -2583,17 +2575,13 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (I830IsPrimary(pScrn)) {
if (!pI830->LpRing)
pI830->LpRing = xalloc(sizeof(I830RingBuffer));
- if (!pI830->CursorMem)
- pI830->CursorMem = xalloc(sizeof(I830MemRange));
- if (!pI830->CursorMemARGB)
- pI830->CursorMemARGB = xalloc(sizeof(I830MemRange));
if (!pI830->OverlayMem)
pI830->OverlayMem = xalloc(sizeof(I830MemRange));
if (!pI830->overlayOn)
pI830->overlayOn = xalloc(sizeof(Bool));
if (!pI830->used3D)
pI830->used3D = xalloc(sizeof(int));
- if (!pI830->LpRing || !pI830->CursorMem || !pI830->CursorMemARGB ||
+ if (!pI830->LpRing ||
!pI830->OverlayMem || !pI830->overlayOn || !pI830->used3D) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Could not allocate primary data structures.\n");
@@ -2608,8 +2596,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!I830IsPrimary(pScrn)) {
pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
pI830->LpRing = pI8301->LpRing;
- pI830->CursorMem = pI8301->CursorMem;
- pI830->CursorMemARGB = pI8301->CursorMemARGB;
pI830->OverlayMem = pI8301->OverlayMem;
pI830->overlayOn = pI8301->overlayOn;
pI830->used3D = pI8301->used3D;
@@ -2658,15 +2644,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
- if (!pI830->SWCursor) {
- if (pI830->CursorMem->Size == 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Disabling HW cursor because the cursor memory "
- "allocation failed.\n");
- pI830->SWCursor = TRUE;
- }
- }
-
#ifdef I830_XV
if (pI830->XvEnabled) {
if (pI830->noAccel) {
@@ -3354,10 +3331,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
xfree(pI830->LpRing);
pI830->LpRing = NULL;
- xfree(pI830->CursorMem);
- pI830->CursorMem = NULL;
- xfree(pI830->CursorMemARGB);
- pI830->CursorMemARGB = NULL;
xfree(pI830->OverlayMem);
pI830->OverlayMem = NULL;
xfree(pI830->overlayOn);
diff --git a/src/i830_memory.c b/src/i830_memory.c
index ae14c06c..14dacc86 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -826,6 +826,91 @@ I830AllocateRotateBuffers(xf86CrtcPtr crtc, const int flags)
return TRUE;
}
+static Bool
+I830AllocateCursorBuffers(xf86CrtcPtr crtc, const int flags)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+ I830Ptr pI830 = I830PTR(pScrn);
+ Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
+ int verbosity = dryrun ? 4 : 1;
+ const char *s = dryrun ? "[dryrun] " : "";
+ long size, alloced;
+ int cursFlags = 0;
+
+ /* Clear cursor info */
+ memset(&intel_crtc->cursor_mem, 0, sizeof(I830MemRange));
+ intel_crtc->cursor_mem.Key = -1;
+ memset(&intel_crtc->cursor_mem_argb, 0, sizeof(I830MemRange));
+ intel_crtc->cursor_mem_argb.Key = -1;
+
+ if (pI830->SWCursor)
+ return FALSE;
+
+ /*
+ * Mouse cursor -- The i810-i830 need a physical address in system
+ * memory from which to upload the cursor. We get this from
+ * the agpgart module using a special memory type.
+ */
+
+ size = HWCURSOR_SIZE;
+ cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP;
+ if (pI830->CursorNeedsPhysical)
+ cursFlags |= NEED_PHYSICAL_ADDR;
+
+ alloced = I830AllocVidMem(pScrn, &intel_crtc->cursor_mem,
+ &pI830->StolenPool, size,
+ GTT_PAGE_SIZE, flags | cursFlags);
+ if (alloced < size ||
+ (pI830->CursorNeedsPhysical && !intel_crtc->cursor_mem.Physical))
+ {
+ if (!dryrun) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate HW cursor space.\n");
+ return FALSE;
+ }
+ } else {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
+ "%sAllocated %ld kB for HW cursor at 0x%lx", s,
+ alloced / 1024, intel_crtc->cursor_mem.Start);
+ if (pI830->CursorNeedsPhysical) {
+ xf86ErrorFVerb(verbosity, " (0x%08lx)",
+ intel_crtc->cursor_mem.Physical);
+ }
+ xf86ErrorFVerb(verbosity, "\n");
+ }
+
+ /* Allocate the ARGB cursor space. Its success is optional -- we won't set
+ * SWCursor if it fails.
+ */
+ size = HWCURSOR_SIZE_ARGB;
+ cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP;
+ if (pI830->CursorNeedsPhysical)
+ cursFlags |= NEED_PHYSICAL_ADDR;
+
+ alloced = I830AllocVidMem(pScrn, &intel_crtc->cursor_mem_argb,
+ &pI830->StolenPool, size,
+ GTT_PAGE_SIZE, flags | cursFlags);
+ if (alloced < size ||
+ (pI830->CursorNeedsPhysical && !intel_crtc->cursor_mem_argb.Physical)) {
+ if (!dryrun) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate HW (ARGB) cursor space.\n");
+ }
+ } else {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
+ "%sAllocated %ld kB for HW (ARGB) cursor at 0x%lx", s,
+ alloced / 1024, intel_crtc->cursor_mem_argb.Start);
+ if (pI830->CursorNeedsPhysical) {
+ xf86ErrorFVerb(verbosity, " (0x%08lx)",
+ intel_crtc->cursor_mem_argb.Physical);
+ }
+ xf86ErrorFVerb(verbosity, "\n");
+ }
+
+ return FALSE;
+}
+
/*
* Allocate memory for 2D operation. This includes the (front) framebuffer,
* ring buffer, scratch memory, HW cursor.
@@ -834,6 +919,7 @@ Bool
I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
{
I830Ptr pI830 = I830PTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
long size, alloced;
Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
int verbosity = dryrun ? 4 : 1;
@@ -871,8 +957,6 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
pI830->StolenPool.Free.Size);
if (flags & ALLOC_INITIAL) {
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-
if (pI830->NeedRingBufferLow)
AllocateRingBuffer(pScrn, flags | FORCE_LOW);
@@ -1041,63 +1125,18 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
}
#endif
- /* Clear cursor info */
- memset(pI830->CursorMem, 0, sizeof(I830MemRange));
- pI830->CursorMem->Key = -1;
- memset(pI830->CursorMemARGB, 0, sizeof(I830MemRange));
- pI830->CursorMemARGB->Key = -1;
-
- if (!pI830->SWCursor) {
- int cursFlags = 0;
- /*
- * Mouse cursor -- The i810-i830 need a physical address in system
- * memory from which to upload the cursor. We get this from
- * the agpgart module using a special memory type.
- */
-
- size = HWCURSOR_SIZE;
- cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP;
- if (pI830->CursorNeedsPhysical)
- cursFlags |= NEED_PHYSICAL_ADDR;
-
- alloced = I830AllocVidMem(pScrn, pI830->CursorMem,
- &(pI830->StolenPool), size,
- GTT_PAGE_SIZE, flags | cursFlags);
- if (alloced < size) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate HW cursor space.\n");
- }
- } else {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
- "%sAllocated %ld kB for HW cursor at 0x%lx", s,
- alloced / 1024, pI830->CursorMem->Start);
- if (pI830->CursorNeedsPhysical)
- xf86ErrorFVerb(verbosity, " (0x%08lx)", pI830->CursorMem->Physical);
- xf86ErrorFVerb(verbosity, "\n");
- }
-
- size = HWCURSOR_SIZE_ARGB;
- cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP;
- if (pI830->CursorNeedsPhysical)
- cursFlags |= NEED_PHYSICAL_ADDR;
-
- alloced = I830AllocVidMem(pScrn, pI830->CursorMemARGB,
- &(pI830->StolenPool), size,
- GTT_PAGE_SIZE, flags | cursFlags);
- if (alloced < size) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate HW (ARGB) cursor space.\n");
- }
- } else {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
- "%sAllocated %ld kB for HW (ARGB) cursor at 0x%lx", s,
- alloced / 1024, pI830->CursorMemARGB->Start);
- if (pI830->CursorNeedsPhysical)
- xf86ErrorFVerb(verbosity, " (0x%08lx)", pI830->CursorMemARGB->Physical);
- xf86ErrorFVerb(verbosity, "\n");
- }
+ if (!pI830->SWCursor && !dryrun) {
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ if (!I830AllocateCursorBuffers(xf86_config->crtc[i], flags) &&
+ pI830->SWCursor)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Disabling HW cursor because the cursor memory "
+ "allocation failed.\n");
+ pI830->SWCursor = TRUE;
+ break;
+ }
+ }
}
#ifdef I830_XV
@@ -1567,6 +1606,8 @@ Bool
I830FixupOffsets(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
DPRINTF(PFX, "I830FixupOffsets\n");
@@ -1574,8 +1615,15 @@ I830FixupOffsets(ScrnInfoPtr pScrn)
if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2)
I830FixOffset(pScrn, &(pI830->FrontBuffer2));
I830FixOffset(pScrn, &(pI830->FrontBuffer));
- I830FixOffset(pScrn, pI830->CursorMem);
- I830FixOffset(pScrn, pI830->CursorMemARGB);
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
+
+ I830FixOffset(pScrn, &intel_crtc->rotate_mem);
+ I830FixOffset(pScrn, &intel_crtc->cursor_mem);
+ I830FixOffset(pScrn, &intel_crtc->cursor_mem_argb);
+ }
+
I830FixOffset(pScrn, &(pI830->LpRing->mem));
I830FixOffset(pScrn, &(pI830->Scratch));
if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2)
@@ -1958,6 +2006,9 @@ I830BindAGPMemory(ScrnInfoPtr pScrn)
return TRUE;
if (xf86AgpGARTSupported() && !pI830->GttBound) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
+
if (!xf86AcquireGART(pScrn->scrnIndex))
return FALSE;
@@ -1973,10 +2024,17 @@ I830BindAGPMemory(ScrnInfoPtr pScrn)
return FALSE;
if (!BindMemRange(pScrn, &(pI830->FrontBuffer)))
return FALSE;
- if (!BindMemRange(pScrn, pI830->CursorMem))
- return FALSE;
- if (!BindMemRange(pScrn, pI830->CursorMemARGB))
- return FALSE;
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
+
+ if (!BindMemRange(pScrn, &intel_crtc->rotate_mem))
+ return FALSE;
+ if (!BindMemRange(pScrn, &intel_crtc->cursor_mem))
+ return FALSE;
+ if (!BindMemRange(pScrn, &intel_crtc->cursor_mem_argb))
+ return FALSE;
+ }
if (!BindMemRange(pScrn, &(pI830->LpRing->mem)))
return FALSE;
if (!BindMemRange(pScrn, &(pI830->Scratch)))
@@ -2053,6 +2111,8 @@ I830UnbindAGPMemory(ScrnInfoPtr pScrn)
return TRUE;
if (xf86AgpGARTSupported() && pI830->GttBound) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
#if REMAP_RESERVED
/* "unbind" the pre-allocated region. */
@@ -2066,10 +2126,18 @@ I830UnbindAGPMemory(ScrnInfoPtr pScrn)
return FALSE;
if (!UnbindMemRange(pScrn, &(pI830->FrontBuffer)))
return FALSE;
- if (!UnbindMemRange(pScrn, pI830->CursorMem))
- return FALSE;
- if (!UnbindMemRange(pScrn, pI830->CursorMemARGB))
- return FALSE;
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
+
+ if (!UnbindMemRange(pScrn, &intel_crtc->rotate_mem))
+ return FALSE;
+ if (!UnbindMemRange(pScrn, &intel_crtc->cursor_mem))
+ return FALSE;
+ if (!UnbindMemRange(pScrn, &intel_crtc->cursor_mem_argb))
+ return FALSE;
+ }
+
if (!UnbindMemRange(pScrn, &(pI830->LpRing->mem)))
return FALSE;
if (!UnbindMemRange(pScrn, &(pI830->Scratch)))