summaryrefslogtreecommitdiff
path: root/src/i830_driver.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-03-05 13:05:20 +0100
committerMichel Dänzer <michel@tungstengraphics.com>2007-03-05 13:05:20 +0100
commit330815251dee808754b328cd2fd60db39f2460eb (patch)
tree13a4831687d37f3a34b0835b34cb48374346617f /src/i830_driver.c
parent50ba1fff886a7f51b178ac6d3a1ba79a3014b214 (diff)
parent015027034e970f1e3bb6ab239f7e0119235e404f (diff)
Merge remote branch 'origin/master' into i830-pageflip
Conflicts: src/i830.h src/i830_dri.c src/i830_dri.h src/i830_driver.c src/i830_memory.c src/i830_xaa.c
Diffstat (limited to 'src/i830_driver.c')
-rw-r--r--src/i830_driver.c880
1 files changed, 358 insertions, 522 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c
index c9501497..8379b6b4 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -536,7 +536,7 @@ I830MapMem(ScrnInfoPtr pScrn)
return FALSE;
if (I830IsPrimary(pScrn))
- pI830->LpRing->virtual_start = pI830->FbBase + pI830->LpRing->mem.Start;
+ pI830->LpRing->virtual_start = pI830->FbBase + pI830->LpRing->mem->offset;
return TRUE;
}
@@ -754,18 +754,6 @@ PreInitCleanup(ScrnInfoPtr pScrn)
if (I830IsPrimary(pScrn)) {
if (pI830->entityPrivate)
pI830->entityPrivate->pScrn_1 = NULL;
- if (pI830->LpRing)
- xfree(pI830->LpRing);
- pI830->LpRing = NULL;
- if (pI830->OverlayMem)
- xfree(pI830->OverlayMem);
- pI830->OverlayMem = NULL;
- if (pI830->overlayOn)
- xfree(pI830->overlayOn);
- pI830->overlayOn = NULL;
- if (pI830->used3D)
- xfree(pI830->used3D);
- pI830->used3D = NULL;
} else {
if (pI830->entityPrivate)
pI830->entityPrivate->pScrn_2 = NULL;
@@ -792,6 +780,18 @@ I830IsPrimary(ScrnInfoPtr pScrn)
return TRUE;
}
+static Bool
+i830_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
+{
+ scrn->virtualX = width;
+ scrn->virtualY = height;
+ return TRUE;
+}
+
+static const xf86CrtcConfigFuncsRec i830_xf86crtc_config_funcs = {
+ i830_xf86crtc_resize
+};
+
#define HOTKEY_BIOS_SWITCH 0
#define HOTKEY_DRIVER_NOTIFY 1
@@ -817,27 +817,13 @@ i830SetHotkeyControl(ScrnInfoPtr pScrn, int mode)
pI830->writeControl(pI830, GRX, 0x18, gr18);
}
-#ifdef XF86DRI
-static void
-I830ReduceMMSize(ScrnInfoPtr pScrn, unsigned long newSize,
- const char *reason)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- newSize = ROUND_DOWN_TO(newSize, GTT_PAGE_SIZE);
- if (newSize / GTT_PAGE_SIZE > I830_MM_MINPAGES) {
- pI830->mmSize = newSize / 1024;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "DRM memory manager aperture size is reduced to %d kiB\n"
- "\t%s\n", pI830->mmSize, reason);
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "DRM memory manager will be disabled\n\t%s\n", reason);
- pI830->mmSize = 0;
- }
-}
-#endif
-
+/**
+ * This is called per zaphod head (so usually just once) to do initialization
+ * before the Screen is created.
+ *
+ * This code generally covers probing, module loading, option handling
+ * card mapping, and RandR setup.
+ */
static Bool
I830PreInit(ScrnInfoPtr pScrn, int flags)
{
@@ -848,7 +834,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
rgb defaultWeight = { 0, 0, 0 };
EntityInfoPtr pEnt;
I830EntPtr pI830Ent = NULL;
- int mem;
int flags24;
int i;
char *s;
@@ -856,9 +841,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
const char *chipname;
int num_pipe;
int max_width, max_height;
-#ifdef XF86DRI
- unsigned long savedMMSize;
-#endif
if (pScrn->numEntities != 1)
return FALSE;
@@ -897,7 +879,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->SaveGeneration = -1;
pI830->pEnt = pEnt;
- pI830->displayWidth = 640; /* default it */
+ pScrn->displayWidth = 640; /* default it */
if (pI830->pEnt->location.type != BUS_PCI)
return FALSE;
@@ -1122,7 +1104,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
(unsigned long)pI830->MMIOAddr);
/* Allocate an xf86CrtcConfig */
- xf86CrtcConfigInit (pScrn);
+ xf86CrtcConfigInit (pScrn, &i830_xf86crtc_config_funcs);
xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
/* See i830_exa.c comments for why we limit the framebuffer size like this.
@@ -1188,41 +1170,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%d display pipe%s available.\n",
num_pipe, num_pipe > 1 ? "s" : "");
- /*
- * Get the pre-allocated (stolen) memory size.
- */
- pI830->StolenMemory.Size = I830DetectMemory(pScrn);
- pI830->StolenMemory.Start = 0;
- pI830->StolenMemory.End = pI830->StolenMemory.Size;
-
- /* Find the maximum amount of agpgart memory available. */
- if (I830IsPrimary(pScrn)) {
- mem = I830CheckAvailableMemory(pScrn);
- pI830->StolenOnly = FALSE;
- } else {
- /* videoRam isn't used on the second head, but faked */
- mem = pI830->entityPrivate->pScrn_1->videoRam;
- pI830->StolenOnly = TRUE;
- }
-
- if (mem <= 0) {
- if (pI830->StolenMemory.Size <= 0) {
- /* Shouldn't happen. */
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "/dev/agpgart is either not available, or no memory "
- "is available\nfor allocation, "
- "and no pre-allocated memory is available.\n");
- PreInitCleanup(pScrn);
- return FALSE;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "/dev/agpgart is either not available, or no memory "
- "is available\nfor allocation. "
- "Using pre-allocated memory only.\n");
- mem = 0;
- pI830->StolenOnly = TRUE;
- }
-
if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) {
pI830->noAccel = TRUE;
}
@@ -1286,8 +1233,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
if (!pI830->directRenderingDisabled) {
Bool tmp = FALSE;
- if (IS_I965G(pI830))
- pI830->mmModeFlags |= I830_KERNEL_TEX;
+ pI830->mmModeFlags |= I830_KERNEL_TEX;
+#ifdef XF86DRI_MM
+ if (!IS_I965G(pI830))
+ pI830->mmModeFlags |= I830_KERNEL_MM;
+#endif
from = X_PROBED;
if (xf86GetOptValBool(pI830->Options,
@@ -1299,14 +1249,12 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->mmModeFlags &= ~I830_KERNEL_TEX;
}
}
- if (from == X_CONFIG ||
- (pI830->mmModeFlags & I830_KERNEL_TEX)) {
- xf86DrvMsg(pScrn->scrnIndex, from,
- "Will %stry to allocate texture pool "
- "for old Mesa 3D driver.\n",
- (pI830->mmModeFlags & I830_KERNEL_TEX) ?
- "" : "not ");
- }
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Will %stry to allocate texture pool "
+ "for old Mesa 3D driver.\n",
+ (pI830->mmModeFlags & I830_KERNEL_TEX) ?
+ "" : "not ");
+
pI830->mmSize = I830_MM_MAXSIZE;
from = X_INFO;
if (xf86GetOptValInteger(pI830->Options, OPTION_INTELMMSIZE,
@@ -1325,10 +1273,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->LinearAlloc = 0;
if (xf86GetOptValULong(pI830->Options, OPTION_LINEARALLOC,
&(pI830->LinearAlloc))) {
- if (pI830->LinearAlloc > 0)
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Allocating %luKbytes of memory\n",
- pI830->LinearAlloc);
- else
+ if (pI830->LinearAlloc < 0)
pI830->LinearAlloc = 0;
}
@@ -1350,7 +1295,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
output->status = (*output->funcs->detect) (output);
}
- if (!xf86InitialConfiguration (pScrn))
+ if (!xf86InitialConfiguration (pScrn, FALSE))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
RestoreHWState(pScrn);
@@ -1359,8 +1304,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
}
RestoreHWState(pScrn);
- pScrn->displayWidth = (pScrn->virtualX + 63) & ~63;
-
/* XXX This should go away, replaced by xf86Crtc.c support for it */
pI830->rotation = RR_Rotate_0;
@@ -1385,77 +1328,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
} else
pI830->checkDevices = FALSE;
- /*
- * The "VideoRam" config file parameter specifies the maximum amount of
- * memory that will be used/allocated. When not present, we allow the
- * driver to allocate as much memory as it wishes to satisfy its
- * allocations, but if agpgart support isn't available (StolenOnly == TRUE),
- * it gets limited to the amount of pre-allocated ("stolen") memory.
- */
- if (!pI830->pEnt->device->videoRam) {
- from = X_DEFAULT;
- pScrn->videoRam = pI830->FbMapSize / KB(1);
- } else {
- from = X_CONFIG;
- pScrn->videoRam = pI830->pEnt->device->videoRam;
- }
-
- /* Make sure it's on a page boundary */
- if (pScrn->videoRam & 3) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VideoRam reduced to %d KB "
- "(page aligned - was %d KB)\n",
- pScrn->videoRam & ~3, pScrn->videoRam);
- pScrn->videoRam &= ~3;
- }
-
- DPRINTF(PFX,
- "Available memory: %dk\n"
- "Requested memory: %dk\n", mem, pScrn->videoRam);
-
-
- if (mem + (pI830->StolenMemory.Size / 1024) < pScrn->videoRam) {
- pScrn->videoRam = mem + (pI830->StolenMemory.Size / 1024);
- from = X_PROBED;
- if (mem + (pI830->StolenMemory.Size / 1024) <
- pI830->pEnt->device->videoRam) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "VideoRAM reduced to %d kByte "
- "(limited to available sysmem)\n", pScrn->videoRam);
- }
- }
-
- if (pScrn->videoRam > pI830->FbMapSize / 1024) {
- pScrn->videoRam = pI830->FbMapSize / 1024;
- if (pI830->FbMapSize / 1024 < pI830->pEnt->device->videoRam)
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "VideoRam reduced to %d kByte (limited to aperture size)\n",
- pScrn->videoRam);
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Pre-allocated VideoRam: %ld kByte\n",
- pI830->StolenMemory.Size / 1024);
- xf86DrvMsg(pScrn->scrnIndex, from, "Potential VideoRam: %d kByte\n",
- pScrn->videoRam);
-
- pI830->TotalVideoRam = KB(pScrn->videoRam);
-
- /*
- * If the requested videoRam amount is less than the stolen memory size,
- * reduce the stolen memory size accordingly.
- */
- if (pI830->StolenMemory.Size > pI830->TotalVideoRam) {
- pI830->StolenMemory.Size = pI830->TotalVideoRam;
- pI830->StolenMemory.End = pI830->TotalVideoRam;
- }
-
- if (xf86GetOptValInteger(pI830->Options, OPTION_CACHE_LINES,
- &(pI830->CacheLines))) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Requested %d cache lines\n",
- pI830->CacheLines);
- } else {
- pI830->CacheLines = -1;
- }
+ pI830->stolen_size = I830DetectMemory(pScrn);
pI830->XvDisabled =
!xf86ReturnOptValBool(pI830->Options, OPTION_XVIDEO, TRUE);
@@ -1511,24 +1384,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
}
}
- /* Alloc our pointers for the primary head */
- if (I830IsPrimary(pScrn)) {
- pI830->LpRing = xalloc(sizeof(I830RingBuffer));
- pI830->OverlayMem = xalloc(sizeof(I830MemRange));
- pI830->overlayOn = xalloc(sizeof(Bool));
- pI830->used3D = xalloc(sizeof(int));
- if (!pI830->LpRing ||
- !pI830->OverlayMem || !pI830->overlayOn || !pI830->used3D) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Could not allocate primary data structures.\n");
- PreInitCleanup(pScrn);
- return FALSE;
- }
- *pI830->overlayOn = FALSE;
- if (pI830->entityPrivate)
- pI830->entityPrivate->XvInUse = -1;
- }
-
/* Check if the HW cursor needs physical address. */
if (IS_MOBILE(pI830) || IS_I9XX(pI830))
pI830->CursorNeedsPhysical = TRUE;
@@ -1538,9 +1393,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
if (IS_I965G(pI830))
pI830->CursorNeedsPhysical = FALSE;
- /* Force ring buffer to be in low memory for all chipsets */
- pI830->NeedRingBufferLow = TRUE;
-
/*
* XXX If we knew the pre-initialised GTT format for certain, we could
* probably figure out the physical address even in the StolenOnly case.
@@ -1559,21 +1411,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->SWCursor = TRUE;
}
- /*
- * Reduce the maximum videoram available for video modes by the ring buffer,
- * minimum scratch space and HW cursor amounts.
- */
- if (!pI830->SWCursor) {
- pScrn->videoRam -= (HWCURSOR_SIZE / 1024);
- pScrn->videoRam -= (HWCURSOR_SIZE_ARGB / 1024);
- }
- if (!pI830->XvDisabled)
- pScrn->videoRam -= (OVERLAY_SIZE / 1024);
- if (!pI830->noAccel) {
- pScrn->videoRam -= (PRIMARY_RINGBUFFER_SIZE / 1024);
- pScrn->videoRam -= (MIN_SCRATCH_BUFFER_SIZE / 1024);
- }
-
if (!xf86RandR12PreInit (pScrn))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "RandR initialization failure\n");
@@ -1588,190 +1425,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
}
pScrn->currentMode = pScrn->modes;
- pI830->disableTiling = FALSE;
-
- /*
- * If DRI is potentially usable, check if there is enough memory available
- * for it, and if there's also enough to allow tiling to be enabled.
- */
-
-#if defined(XF86DRI)
- if (!I830CheckDRIAvailable(pScrn)) {
- pI830->directRenderingDisabled = TRUE;
- pI830->mmSize = 0;
- } else if (pScrn->videoRam > pI830->FbMapSize / 1024 - pI830->mmSize) {
- I830ReduceMMSize(pScrn, pI830->FbMapSize - KB(pScrn->videoRam),
- "to make room for video memory");
- }
-
- if (I830IsPrimary(pScrn) && !pI830->directRenderingDisabled) {
- int savedDisplayWidth = pScrn->displayWidth;
- int memNeeded = 0;
- Bool tiled = FALSE;
-
-#ifdef I830_XV
- /*
- * Set this so that the overlay allocation is factored in when
- * appropriate.
- */
- pI830->XvEnabled = !pI830->XvDisabled;
-#endif
-
- if (IS_I965G(pI830)) {
- int tile_pixels = 512 / pI830->cpp;
- pScrn->displayWidth = (pScrn->displayWidth + tile_pixels - 1) &
- ~(tile_pixels - 1);
- tiled = TRUE;
- } else {
- /* Good pitches to allow tiling. Don't care about pitches < 1024. */
- static const int pitches[] = {
- KB(1),
- KB(2),
- KB(4),
- KB(8),
- 0
- };
-
- for (i = 0; pitches[i] != 0; i++) {
- if (pitches[i] >= pScrn->displayWidth) {
- pScrn->displayWidth = pitches[i];
- tiled = TRUE;
- break;
- }
- }
- }
-
- /*
- * If the displayWidth is a tilable pitch, test if there's enough
- * memory available to enable tiling.
- */
- savedMMSize = pI830->mmSize;
- if (tiled) {
- retry_dryrun:
- I830ResetAllocations(pScrn, 0);
- if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) &&
- I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN)) {
- memNeeded = I830GetExcessMemoryAllocations(pScrn);
- if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) {
- if (memNeeded > 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%d kBytes additional video memory is "
- "required to\n\tenable tiling mode for DRI.\n",
- (memNeeded + 1023) / 1024);
- }
- if (pI830->MemoryAperture.Size < 0) {
- if (KB(pI830->mmSize) > I830_MM_MINPAGES * GTT_PAGE_SIZE) {
- I830ReduceMMSize(pScrn, I830_MM_MINPAGES * GTT_PAGE_SIZE,
- "to make room in AGP aperture for tiling.");
- goto retry_dryrun;
- }
- /* XXX */
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Allocation with DRI tiling enabled would "
- "exceed the\n"
- "\tmemory aperture size (%ld kB) by %ld kB.\n"
- "\tReduce VideoRam amount to avoid this!\n",
- pI830->FbMapSize / 1024,
- -pI830->MemoryAperture.Size / 1024);
- }
- pScrn->displayWidth = savedDisplayWidth;
- if (pI830->allowPageFlip)
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Can't enable page flipping due to the above\n");
- pI830->allowPageFlip = FALSE;
- } else if (pScrn->displayWidth != savedDisplayWidth) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Increasing the scanline pitch to allow tiling mode "
- "(%d -> %d).\n",
- savedDisplayWidth, pScrn->displayWidth);
- }
- } else {
- memNeeded = 0;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unexpected dry run allocation failure (1).\n");
- }
- }
- if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) {
- /*
- * Tiling can't be enabled. Check if there's enough memory for DRI
- * without tiling.
- */
- pI830->mmSize = savedMMSize;
- pI830->disableTiling = TRUE;
- retry_dryrun2:
- I830ResetAllocations(pScrn, 0);
- if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) &&
- I830Allocate3DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_NO_TILING)) {
- memNeeded = I830GetExcessMemoryAllocations(pScrn);
- if (memNeeded > 0 || pI830->MemoryAperture.Size < 0) {
- if (memNeeded > 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%d kBytes additional video memory is required "
- "to enable DRI.\n",
- (memNeeded + 1023) / 1024);
- }
- if (pI830->MemoryAperture.Size < 0) {
- if (KB(pI830->mmSize) > I830_MM_MINPAGES * GTT_PAGE_SIZE) {
- I830ReduceMMSize(pScrn, I830_MM_MINPAGES * GTT_PAGE_SIZE,
- "to save AGP aperture space for video memory.");
- goto retry_dryrun2;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Allocation with DRI enabled would "
- "exceed the\n"
- "\tmemory aperture size (%ld kB) by %ld kB.\n"
- "\tReduce VideoRam amount to avoid this!\n",
- pI830->FbMapSize / 1024,
- -pI830->MemoryAperture.Size / 1024);
- }
- pI830->mmSize = 0;
- pI830->directRenderingDisabled = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n");
- }
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unexpected dry run allocation failure (2).\n");
- }
- }
- } else
-#endif
- pI830->disableTiling = TRUE; /* no DRI - so disableTiling */
-
- if (pI830->pEnt->device->videoRam == 0) {
- int default_videoram;
-
- /* Now that we've sized the allocations, reduce our default VideoRam
- * allocation from the aperture size to just what we need to cover our
- * allocations. Only, put in some slop for alignment and such.
- */
- default_videoram = pI830->StolenPool.Total.Size + pI830->allocatedMemory;
- default_videoram += KB(512); /* slop */
- /* align to 1MB increments */
- default_videoram = (default_videoram + MB(1) - 1) / MB(1) * MB(1);
-
- if (default_videoram < KB(pScrn->videoRam)) {
- pScrn->videoRam = default_videoram / KB(1);
- pI830->TotalVideoRam = KB(pScrn->videoRam);
- }
- }
- xf86DrvMsg(pScrn->scrnIndex,
- pI830->pEnt->device->videoRam ? X_CONFIG : X_DEFAULT,
- "VideoRam: %d KB\n", pScrn->videoRam);
-
- if (!IS_I965G(pI830) && pScrn->displayWidth > 2048) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Cannot support DRI with frame buffer width > 2048.\n");
- pI830->disableTiling = TRUE;
- pI830->directRenderingDisabled = TRUE;
- }
-
if (!IS_I965G(pI830) && pScrn->virtualY > 2048) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot support > 2048 vertical lines. disabling acceleration.\n");
pI830->noAccel = TRUE;
}
- pI830->displayWidth = pScrn->displayWidth;
-
/* Don't need MMIO access anymore. */
if (pI830->swfSaved) {
OUTREG(SWF0, pI830->saveSWF0);
@@ -1948,18 +1606,18 @@ SetFenceRegs(ScrnInfoPtr pScrn)
if (IS_I965G(pI830)) {
for (i = 0; i < FENCE_NEW_NR; i++) {
- OUTREG(FENCE_NEW + i * 8, pI830->ModeReg.Fence[i]);
- OUTREG(FENCE_NEW + 4 + i * 8, pI830->ModeReg.Fence[i+FENCE_NEW_NR]);
+ OUTREG(FENCE_NEW + i * 8, pI830->fence[i]);
+ OUTREG(FENCE_NEW + 4 + i * 8, pI830->fence[i+FENCE_NEW_NR]);
if (I810_DEBUG & DEBUG_VERBOSE_VGA) {
- ErrorF("Fence Start Register : %x\n", pI830->ModeReg.Fence[i]);
- ErrorF("Fence End Register : %x\n", pI830->ModeReg.Fence[i+FENCE_NEW_NR]);
+ ErrorF("Fence Start Register : %x\n", pI830->fence[i]);
+ ErrorF("Fence End Register : %x\n", pI830->fence[i+FENCE_NEW_NR]);
}
}
} else {
for (i = 0; i < FENCE_NR; i++) {
- OUTREG(FENCE + i * 4, pI830->ModeReg.Fence[i]);
+ OUTREG(FENCE + i * 4, pI830->fence[i]);
if (I810_DEBUG & DEBUG_VERBOSE_VGA)
- ErrorF("Fence Register : %x\n", pI830->ModeReg.Fence[i]);
+ ErrorF("Fence Register : %x\n", pI830->fence[i]);
}
}
}
@@ -1984,25 +1642,22 @@ SetRingRegs(ScrnInfoPtr pScrn)
OUTREG(LP_RING + RING_TAIL, 0);
OUTREG(LP_RING + RING_HEAD, 0);
- if ((long)(pI830->LpRing->mem.Start & I830_RING_START_MASK) !=
- pI830->LpRing->mem.Start) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "I830SetRingRegs: Ring buffer start (%lx) violates its "
- "mask (%x)\n", pI830->LpRing->mem.Start, I830_RING_START_MASK);
- }
+ assert((pI830->LpRing->mem->offset & I830_RING_START_MASK) ==
+ pI830->LpRing->mem->offset);
+
/* Don't care about the old value. Reserved bits must be zero anyway. */
- itemp = pI830->LpRing->mem.Start & I830_RING_START_MASK;
+ itemp = pI830->LpRing->mem->offset;
OUTREG(LP_RING + RING_START, itemp);
- if (((pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES) !=
- pI830->LpRing->mem.Size - 4096) {
+ if (((pI830->LpRing->mem->size - 4096) & I830_RING_NR_PAGES) !=
+ pI830->LpRing->mem->size - 4096) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its "
- "mask (%x)\n", pI830->LpRing->mem.Size - 4096,
+ "mask (%x)\n", pI830->LpRing->mem->size - 4096,
I830_RING_NR_PAGES);
}
/* Don't care about the old value. Reserved bits must be zero anyway. */
- itemp = (pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES;
+ itemp = (pI830->LpRing->mem->size - 4096) & I830_RING_NR_PAGES;
itemp |= (RING_NO_REPORT | RING_VALID);
OUTREG(LP_RING + RING_LEN, itemp);
I830RefreshRing(pScrn);
@@ -2260,13 +1915,12 @@ static void
InitRegisterRec(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
- I830RegPtr i830Reg = &pI830->ModeReg;
int i;
if (!I830IsPrimary(pScrn)) return;
for (i = 0; i < 8; i++)
- i830Reg->Fence[i] = 0;
+ pI830->fence[i] = 0;
}
static void
@@ -2362,7 +2016,7 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
drmI830Sarea *sarea;
#endif
- if (pI830->noAccel)
+ if (pI830->noAccel || !I830IsPrimary(pScrn))
return;
#ifdef XF86DRI
@@ -2375,14 +2029,12 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
}
#endif
- ctx_addr = pI830->ContextMem.Start;
- /* Align to a 2k boundry */
- ctx_addr = ((ctx_addr + 2048 - 1) / 2048) * 2048;
-
+ ctx_addr = pI830->logical_context->offset;
+ assert((pI830->logical_context->offset & 2047) == 0);
{
BEGIN_LP_RING(2);
OUT_RING(MI_SET_CONTEXT);
- OUT_RING(ctx_addr |
+ OUT_RING(pI830->logical_context->offset |
CTXT_NO_RESTORE |
CTXT_PALETTE_SAVE_DISABLE | CTXT_PALETTE_RESTORE_DISABLE);
ADVANCE_LP_RING();
@@ -2482,15 +2134,267 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
I830Ptr pI830;
VisualPtr visual;
I830Ptr pI8301 = NULL;
+ unsigned long sys_mem;
+ int i;
+ Bool allocation_done = FALSE;
+ MessageType from;
#ifdef XF86DRI
Bool driDisabled;
+ unsigned long savedMMSize;
#endif
pScrn = xf86Screens[pScreen->myNum];
pI830 = I830PTR(pScrn);
hwp = VGAHWPTR(pScrn);
- pScrn->displayWidth = pI830->displayWidth;
+ pScrn->displayWidth = (pScrn->virtualX + 63) & ~63;
+
+ /*
+ * The "VideoRam" config file parameter specifies the maximum amount of
+ * memory that will be used/allocated. When not present, we allow the
+ * driver to allocate as much memory as it wishes to satisfy its
+ * allocations, but if agpgart support isn't available, it gets limited
+ * to the amount of pre-allocated ("stolen") memory.
+ *
+ * Note that in using this value for allocator initialization, we're
+ * limiting aperture allocation to the VideoRam option, rather than limiting
+ * actual memory allocation, so alignment and things will cause less than
+ * VideoRam to be actually used.
+ */
+ if (pI830->pEnt->device->videoRam == 0) {
+ from = X_DEFAULT;
+ pScrn->videoRam = pI830->FbMapSize / KB(1);
+ } else {
+ from = X_CONFIG;
+ pScrn->videoRam = pI830->pEnt->device->videoRam;
+ }
+
+ /* Limit videoRam to how much we might be able to allocate from AGP */
+ sys_mem = I830CheckAvailableMemory(pScrn);
+ if (sys_mem == -1) {
+ if (pScrn->videoRam > pI830->stolen_size / KB(1)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "/dev/agpgart is either not available, or no memory "
+ "is available\nfor allocation. "
+ "Using pre-allocated memory only.\n");
+ pScrn->videoRam = pI830->stolen_size / KB(1);
+ }
+ pI830->StolenOnly = TRUE;
+ } else {
+ if (sys_mem + (pI830->stolen_size / 1024) < pScrn->videoRam) {
+ pScrn->videoRam = sys_mem + (pI830->stolen_size / 1024);
+ from = X_PROBED;
+ if (sys_mem + (pI830->stolen_size / 1024) <
+ pI830->pEnt->device->videoRam)
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "VideoRAM reduced to %d kByte "
+ "(limited to available sysmem)\n", pScrn->videoRam);
+ }
+ }
+ }
+
+ /* Limit video RAM to the actual aperture size */
+ if (pScrn->videoRam > pI830->FbMapSize / 1024) {
+ pScrn->videoRam = pI830->FbMapSize / 1024;
+ if (pI830->FbMapSize / 1024 < pI830->pEnt->device->videoRam) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "VideoRam reduced to %d kByte (limited to aperture "
+ "size)\n",
+ pScrn->videoRam);
+ }
+ }
+
+ /* Make sure it's on a page boundary */
+ if (pScrn->videoRam & 3) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VideoRam reduced to %d KB "
+ "(page aligned - was %d KB)\n",
+ pScrn->videoRam & ~3, pScrn->videoRam);
+ pScrn->videoRam &= ~3;
+ }
+
+ /* Set up our video memory allocator for the chosen videoRam */
+ if (!i830_allocator_init(pScrn, 0, pScrn->videoRam * KB(1))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't initialize video memory allocator\n");
+ PreInitCleanup(pScrn);
+ return FALSE;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex,
+ pI830->pEnt->device->videoRam ? X_CONFIG : X_DEFAULT,
+ "VideoRam: %d KB\n", pScrn->videoRam);
+
+ if (xf86GetOptValInteger(pI830->Options, OPTION_CACHE_LINES,
+ &(pI830->CacheLines))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Requested %d cache lines\n",
+ pI830->CacheLines);
+ } else {
+ pI830->CacheLines = -1;
+ }
+
+ pI830->disableTiling = FALSE;
+
+ if (I830IsPrimary(pScrn)) {
+ /* Alloc our pointers for the primary head */
+ if (!pI830->LpRing)
+ pI830->LpRing = xcalloc(1, sizeof(I830RingBuffer));
+ if (!pI830->overlayOn)
+ pI830->overlayOn = xalloc(sizeof(Bool));
+ if (!pI830->used3D)
+ pI830->used3D = xalloc(sizeof(int));
+ if (!pI830->LpRing || !pI830->overlayOn || !pI830->used3D) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Could not allocate primary data structures.\n");
+ return FALSE;
+ }
+ *pI830->overlayOn = FALSE;
+ if (pI830->entityPrivate)
+ pI830->entityPrivate->XvInUse = -1;
+ } else {
+ /* Make our second head point to the first heads structures */
+ pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
+ pI830->LpRing = pI8301->LpRing;
+ pI830->overlay_regs = pI8301->overlay_regs;
+ pI830->overlayOn = pI8301->overlayOn;
+ pI830->used3D = pI8301->used3D;
+ }
+
+#if defined(XF86DRI)
+ /*
+ * If DRI is potentially usable, check if there is enough memory available
+ * for it, and if there's also enough to allow tiling to be enabled.
+ */
+
+ if (!I830CheckDRIAvailable(pScrn)) {
+ pI830->directRenderingDisabled = TRUE;
+ pI830->mmSize = 0;
+ }
+
+ if (!pI830->directRenderingDisabled) {
+ int savedDisplayWidth = pScrn->displayWidth;
+ Bool tiled = FALSE;
+
+#ifdef I830_XV
+ /*
+ * Set this so that the overlay allocation is factored in when
+ * appropriate.
+ */
+ pI830->XvEnabled = !pI830->XvDisabled;
+#endif
+
+ if (IS_I965G(pI830)) {
+ int tile_pixels = 512 / pI830->cpp;
+ pScrn->displayWidth = (pScrn->displayWidth + tile_pixels - 1) &
+ ~(tile_pixels - 1);
+ tiled = TRUE;
+ } else {
+ /* Good pitches to allow tiling. Don't care about pitches < 1024
+ * pixels.
+ */
+ static const int pitches[] = {
+ 1024,
+ 2048,
+ 4096,
+ 8192,
+ 0
+ };
+
+ for (i = 0; pitches[i] != 0; i++) {
+ if (pitches[i] >= pScrn->displayWidth) {
+ pScrn->displayWidth = pitches[i];
+ tiled = TRUE;
+ break;
+ }
+ }
+ }
+
+ /* Attempt several rounds of allocation to get 2d and 3d memory to fit:
+ *
+ * 0: tiled, large memory manager
+ * 1: tiled, small memory manager
+ * 2: untiled, large
+ * 3: untiled, small
+ */
+
+ pI830->disableTiling = FALSE;
+ savedMMSize = pI830->mmSize;
+ for (i = 0; i < 4; i++) {
+ if (!tiled && i < 2)
+ continue;
+
+ if (i >= 2) {
+ /* For further allocations, disable tiling */
+ pI830->disableTiling = TRUE;
+ pScrn->displayWidth = savedDisplayWidth;
+ if (pI830->allowPageFlip)
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Couldn't allocate tiled memory, page flipping "
+ "disabled\n");
+ pI830->allowPageFlip = FALSE;
+ }
+
+ if (i & 1) {
+ /* For this allocation, switch to a smaller DRI memory manager
+ * size.
+ */
+ pI830->mmSize = I830_MM_MINPAGES * GTT_PAGE_SIZE;
+ } else {
+ pI830->mmSize = savedMMSize;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Attempting memory allocation with %s buffers and \n"
+ "\t %s DRI memory manager reservation:\n",
+ (i & 2) ? "untiled" : "tiled",
+ (i & 1) ? "small" : "large");
+
+ if (i830_allocate_2d_memory(pScrn) &&
+ i830_allocate_3d_memory(pScrn))
+ {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Success.\n");
+ if (pScrn->displayWidth != savedDisplayWidth) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Increasing the scanline pitch to allow tiling mode "
+ "(%d -> %d).\n",
+ savedDisplayWidth, pScrn->displayWidth);
+ }
+ allocation_done = TRUE;
+ break;
+ }
+
+ i830_reset_allocations(pScrn);
+ }
+
+ if (i == 4) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Not enough video memory. Disabling DRI.\n");
+ pI830->mmSize = 0;
+ pI830->directRenderingDisabled = TRUE;
+ }
+ } else
+#endif
+ pI830->disableTiling = TRUE; /* no DRI - so disableTiling */
+
+ if (!allocation_done) {
+ if (!i830_allocate_2d_memory(pScrn)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't allocate video memory\n");
+ return FALSE;
+ }
+ allocation_done = TRUE;
+ }
+
+ i830_describe_allocations(pScrn, 1, "");
+
+ if (!IS_I965G(pI830) && pScrn->displayWidth > 2048) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Cannot support DRI with frame buffer width > 2048.\n");
+ pI830->disableTiling = TRUE;
+ pI830->directRenderingDisabled = TRUE;
+ }
+
+ pScrn->displayWidth = pScrn->displayWidth;
#ifdef HAS_MTRR_SUPPORT
{
@@ -2535,36 +2439,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->starting = TRUE;
- /* Alloc our pointers for the primary head */
- if (I830IsPrimary(pScrn)) {
- if (!pI830->LpRing)
- pI830->LpRing = xalloc(sizeof(I830RingBuffer));
- 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->OverlayMem || !pI830->overlayOn || !pI830->used3D) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Could not allocate primary data structures.\n");
- return FALSE;
- }
- *pI830->overlayOn = FALSE;
- if (pI830->entityPrivate)
- pI830->entityPrivate->XvInUse = -1;
- }
-
- /* Make our second head point to the first heads structures */
- if (!I830IsPrimary(pScrn)) {
- pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
- pI830->LpRing = pI8301->LpRing;
- pI830->OverlayMem = pI8301->OverlayMem;
- pI830->overlayOn = pI8301->overlayOn;
- pI830->used3D = pI8301->used3D;
- }
-
miClearVisualTypes();
if (!miSetVisualTypes(pScrn->depth,
miGetDefaultVisualMask(pScrn->depth),
@@ -2592,15 +2466,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->XvEnabled = FALSE;
#endif
- if (I830IsPrimary(pScrn)) {
- I830ResetAllocations(pScrn, 0);
-
- if (!I830Allocate2DMemory(pScrn, ALLOC_INITIAL))
- return FALSE;
- }
-
if (!pI830->noAccel) {
- if (pI830->LpRing->mem.Size == 0) {
+ if (pI830->LpRing->mem->size == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling acceleration because the ring buffer "
"allocation failed.\n");
@@ -2615,7 +2482,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
"needs 2D acceleration.\n");
pI830->XvEnabled = FALSE;
}
- if (pI830->OverlayMem->Physical == 0) {
+ if (!IS_I9XX(pI830) && pI830->overlay_regs == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling Xv because the overlay register buffer "
"allocation failed.\n");
@@ -2643,6 +2510,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DRI is disabled because it "
"needs HW cursor, 2D accel and AGPGART.\n");
pI830->directRenderingEnabled = FALSE;
+ i830_free_3d_memory(pScrn);
}
}
@@ -2651,39 +2519,17 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (pI830->directRenderingEnabled)
pI830->directRenderingEnabled = I830DRIScreenInit(pScreen);
- if (pI830->directRenderingEnabled) {
- pI830->directRenderingEnabled =
- I830Allocate3DMemory(pScrn,
- pI830->disableTiling ? ALLOC_NO_TILING : 0);
- if (!pI830->directRenderingEnabled)
- I830DRICloseScreen(pScreen);
+ if (!pI830->directRenderingEnabled) {
+ i830_free_3d_memory(pScrn);
}
#else
pI830->directRenderingEnabled = FALSE;
#endif
- /*
- * After the 3D allocations have been done, see if there's any free space
- * that can be added to the framebuffer allocation.
- */
- if (I830IsPrimary(pScrn)) {
- I830Allocate2DMemory(pScrn, 0);
-
- DPRINTF(PFX, "assert(if(!I830DoPoolAllocation(pScrn, pI830->StolenPool)))\n");
- if (!I830DoPoolAllocation(pScrn, &(pI830->StolenPool)))
- return FALSE;
-
- DPRINTF(PFX, "assert( if(!I830FixupOffsets(pScrn)) )\n");
- if (!I830FixupOffsets(pScrn))
- return FALSE;
- }
-
#ifdef XF86DRI
- if (pI830->directRenderingEnabled) {
- I830SetupMemoryTiling(pScrn);
+ if (pI830->directRenderingEnabled)
pI830->directRenderingEnabled = I830DRIDoMappings(pScreen);
- }
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Page Flipping %sabled\n",
pI830->allowPageFlip ? "en" : "dis");
@@ -2696,9 +2542,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->memPhysBase = (unsigned long)pI830->FbBase;
if (I830IsPrimary(pScrn)) {
- pScrn->fbOffset = pI830->FrontBuffer.Start;
+ pScrn->fbOffset = pI830->front_buffer->offset;
} else {
- pScrn->fbOffset = pI8301->FrontBuffer2.Start;
+ pScrn->fbOffset = pI8301->front_buffer_2->offset;
}
pI830->xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth;
@@ -2712,8 +2558,30 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
DPRINTF(PFX, "assert( if(!I830EnterVT(scrnIndex, 0)) )\n");
- if (!I830EnterVT(scrnIndex, 0))
- return FALSE;
+ if (!pI830->useEXA) {
+ if (I830IsPrimary(pScrn)) {
+ if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to init memory manager\n");
+ }
+
+ if (pI830->LinearAlloc &&
+ xf86InitFBManagerLinear(pScreen,
+ pI830->xaa_linear->offset / pI830->cpp,
+ pI830->xaa_linear->size / pI830->cpp))
+ {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using %ld bytes of offscreen memory for linear "
+ "(offset=0x%lx)\n", pI830->xaa_linear->size,
+ pI830->xaa_linear->offset);
+ }
+ } else {
+ if (!I830InitFBManager(pScreen, &(pI8301->FbMemBox2))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to init memory manager\n");
+ }
+ }
+ }
if (pScrn->virtualX > pScrn->displayWidth)
pScrn->displayWidth = pScrn->virtualX;
@@ -2744,34 +2612,10 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86SetBlackWhitePixels(pScreen);
- I830DGAInit(pScreen);
+ xf86DiDGAInit (pScreen, pI830->LinearAddr + pScrn->fbOffset);
DPRINTF(PFX,
"assert( if(!I830InitFBManager(pScreen, &(pI830->FbMemBox))) )\n");
- if (!pI830->useEXA) {
- if (I830IsPrimary(pScrn)) {
- if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to init memory manager\n");
- }
-
- if (pI830->LinearAlloc &&
- xf86InitFBManagerLinear(pScreen,
- pI830->LinearMem.Offset / pI830->cpp,
- pI830->LinearMem.Size / pI830->cpp))
- {
- xf86DrvMsg(scrnIndex, X_INFO,
- "Using %ld bytes of offscreen memory for linear "
- "(offset=0x%lx)\n", pI830->LinearMem.Size,
- pI830->LinearMem.Offset);
- }
- } else {
- if (!I830InitFBManager(pScreen, &(pI8301->FbMemBox2))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to init memory manager\n");
- }
- }
- }
if (!pI830->noAccel) {
if (!I830AccelInit(pScreen)) {
@@ -2780,6 +2624,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
+ if (!I830EnterVT(scrnIndex, 0))
+ return FALSE;
+
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
@@ -2894,27 +2741,24 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->suspended = FALSE;
#ifdef XF86DRI_MM
- if (pI830->directRenderingEnabled && (pI830->mmModeFlags & I830_KERNEL_MM)) {
- unsigned long aperEnd = ROUND_DOWN_TO(pI830->FbMapSize, GTT_PAGE_SIZE)
- / GTT_PAGE_SIZE;
- unsigned long aperStart = ROUND_TO(pI830->FbMapSize - KB(pI830->mmSize), GTT_PAGE_SIZE)
- / GTT_PAGE_SIZE;
-
- if (aperEnd < aperStart || aperEnd - aperStart < I830_MM_MINPAGES) {
+ if (pI830->directRenderingEnabled && (pI830->mmModeFlags & I830_KERNEL_MM))
+ {
+ if (pI830->memory_manager == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Too little AGP aperture space for DRM memory manager.\n"
- "\tPlease increase AGP aperture size from BIOS configuration screen\n"
- "\tor decrease the amount of video RAM using option \"VideoRam\".\n"
+ "\tPlease increase AGP aperture size from BIOS configuration screen.\n"
"\tDisabling DRI.\n");
pI830->directRenderingOpen = FALSE;
I830DRICloseScreen(pScreen);
pI830->directRenderingEnabled = FALSE;
} else {
#ifndef XSERVER_LIBDRM_MM
- if (I830DrmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart,
+ if (I830DrmMMInit(pI830->drmSubFD, pI830->memory_manager->offset,
+ pI830->memory_manager->size,
DRM_BO_MEM_TT)) {
#else
- if (drmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart,
+ if (drmMMInit(pI830->drmSubFD, pI830->memory_manager->offset,
+ pI830->memory_manager->size,
DRM_BO_MEM_TT)) {
#endif
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -2923,12 +2767,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->directRenderingOpen = FALSE;
I830DRICloseScreen(pScreen);
pI830->directRenderingEnabled = FALSE;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Initialized DRM memory manager, %ld AGP pages\n"
- "\tat AGP offset 0x%lx\n",
- aperEnd - aperStart,
- aperStart);
}
}
}
@@ -2985,7 +2823,7 @@ I830LeaveVT(int scrnIndex, int flags)
if (!I830IsPrimary(pScrn)) {
I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
- if (!pI8301->GttBound) {
+ if (!pI8301->gtt_acquired) {
return;
}
}
@@ -3019,7 +2857,7 @@ I830LeaveVT(int scrnIndex, int flags)
i830DumpRegs (pScrn);
if (I830IsPrimary(pScrn))
- I830UnbindAGPMemory(pScrn);
+ i830_unbind_all_memory(pScrn);
if (pI830->AccelInfoRec)
pI830->AccelInfoRec->NeedToSync = FALSE;
}
@@ -3055,7 +2893,7 @@ I830EnterVT(int scrnIndex, int flags)
#endif
if (I830IsPrimary(pScrn))
- if (!I830BindAGPMemory(pScrn))
+ if (!i830_bind_all_memory(pScrn))
return FALSE;
if (i830_check_error_state(pScrn)) {
@@ -3066,8 +2904,6 @@ I830EnterVT(int scrnIndex, int flags)
ResetState(pScrn, FALSE);
SetHWOperatingState(pScrn);
- xf86DisableUnusedFunctions(pScrn);
-
for (i = 0; i < xf86_config->num_crtc; i++)
{
xf86CrtcPtr crtc = xf86_config->crtc[i];
@@ -3087,6 +2923,8 @@ I830EnterVT(int scrnIndex, int flags)
return FALSE;
}
+ xf86DisableUnusedFunctions(pScrn);
+
i830DumpRegs (pScrn);
i830DescribeOutputConfiguration(pScrn);
@@ -3245,8 +3083,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
xfree(pI830->LpRing);
pI830->LpRing = NULL;
- xfree(pI830->OverlayMem);
- pI830->OverlayMem = NULL;
xfree(pI830->overlayOn);
pI830->overlayOn = NULL;
xfree(pI830->used3D);
@@ -3415,7 +3251,7 @@ I830CheckDevicesTimer(OsTimerPtr timer, CARD32 now, pointer arg)
xf86ProbeOutputModes (pScrn, 0, 0);
xf86SetScrnInfoModes (pScrn);
- I830DGAReInit (pScrn->pScreen);
+ xf86DiDGAReInit (pScrn->pScreen);
xf86SwitchMode(pScrn->pScreen, pScrn->currentMode);
/* Clear the BIOS's hotkey press flags */