summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i830.h11
-rw-r--r--src/i830_display.c4
-rw-r--r--src/i830_dri.c10
-rw-r--r--src/i830_driver.c465
-rw-r--r--src/i830_memory.c267
5 files changed, 342 insertions, 415 deletions
diff --git a/src/i830.h b/src/i830.h
index f779978c..38d49bed 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -291,7 +291,6 @@ typedef struct _I830Rec {
unsigned long LinearAlloc;
XF86ModReqInfo shadowReq; /* to test for later libshadow */
Rotation rotation;
- int displayWidth;
void (*PointerMoved)(int, int, int);
CreateScreenResourcesProcPtr CreateScreenResources;
int *used3D;
@@ -579,9 +578,10 @@ Bool i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset,
void i830_describe_allocations(ScrnInfoPtr pScrn, int verbosity,
const char *prefix);
void i830_reset_allocations(ScrnInfoPtr pScrn);
+void i830_free_3d_memory(ScrnInfoPtr pScrn);
extern long I830CheckAvailableMemory(ScrnInfoPtr pScrn);
-Bool i830_allocate_2d_memory(ScrnInfoPtr pScrn, const int flags);
-Bool i830_allocate_3d_memory(ScrnInfoPtr pScrn, const int flags);
+Bool i830_allocate_2d_memory(ScrnInfoPtr pScrn);
+Bool i830_allocate_3d_memory(ScrnInfoPtr pScrn);
extern Bool I830IsPrimary(ScrnInfoPtr pScrn);
@@ -666,11 +666,6 @@ extern const int I830CopyROP[16];
#define NEED_PHYSICAL_ADDR 0x00000001
#define ALIGN_BOTH_ENDS 0x00000002
-#define ALLOC_NO_TILING 0x00001000
-#define ALLOC_INITIAL 0x00002000
-
-#define ALLOCATE_DRY_RUN 0x80000000
-
/* Chipset registers for VIDEO BIOS memory RW access */
#define _855_DRAM_RW_CONTROL 0x58
#define _845_DRAM_RW_CONTROL 0x90
diff --git a/src/i830_display.c b/src/i830_display.c
index a09d96ae..f3beb572 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -972,7 +972,7 @@ i830_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height)
unsigned long rotate_offset;
int align = KB(4), size;
- rotate_pitch = pI830->displayWidth * pI830->cpp;
+ rotate_pitch = pScrn->displayWidth * pI830->cpp;
size = rotate_pitch * height;
#ifdef I830_USE_EXA
@@ -1034,7 +1034,7 @@ i830_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
if (!data)
data = i830_crtc_shadow_allocate (crtc, width, height);
- rotate_pitch = pI830->displayWidth * pI830->cpp;
+ rotate_pitch = pScrn->displayWidth * pI830->cpp;
rotate_pixmap = GetScratchPixmapHeader(pScrn->pScreen,
width, height,
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 9e3f3786..9ea86aea 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -158,9 +158,9 @@ I830InitDma(ScrnInfoPtr pScrn)
info.depth_offset = pI830->depth_buffer->offset;
info.w = pScrn->virtualX;
info.h = pScrn->virtualY;
- info.pitch = pI830->displayWidth;
- info.back_pitch = pI830->displayWidth;
- info.depth_pitch = pI830->displayWidth;
+ info.pitch = pScrn->displayWidth;
+ info.back_pitch = pScrn->displayWidth;
+ info.depth_pitch = pScrn->displayWidth;
info.cpp = pI830->cpp;
if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT,
@@ -1452,7 +1452,7 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
/* Don't use front_buffer->size here as it includes the pixmap cache area
* Instead, calculate the entire framebuffer.
*/
- sarea->front_size = pI830->displayWidth * pScrn->virtualY * pI830->cpp;
+ sarea->front_size = pScrn->displayWidth * pScrn->virtualY * pI830->cpp;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[drm] init sarea width,height = %d x %d (pitch %d)\n",
@@ -1477,7 +1477,7 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
sarea->rotation = 0;
sarea->rotated_offset = -1;
sarea->rotated_size = 0;
- sarea->rotated_pitch = pI830->displayWidth;
+ sarea->rotated_pitch = pScrn->displayWidth;
success = I830DRIMapScreenRegions(pScrn, sarea);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 50fe2a6d..88fee86f 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -837,8 +837,8 @@ I830ReduceMMSize(ScrnInfoPtr pScrn, unsigned long newSize,
* 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,
- * initial memory layout measurement, card mapping, and RandR setup.
+ * This code generally covers probing, module loading, option handling
+ * card mapping, and RandR setup.
*/
static Bool
I830PreInit(ScrnInfoPtr pScrn, int flags)
@@ -850,18 +850,14 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
rgb defaultWeight = { 0, 0, 0 };
EntityInfoPtr pEnt;
I830EntPtr pI830Ent = NULL;
- int sys_mem;
int flags24;
int i;
char *s;
pointer pVBEModule = NULL;
- Bool enable, allocation_done;
const char *chipname;
+ Bool enable;
int num_pipe;
int max_width, max_height;
-#ifdef XF86DRI
- unsigned long savedMMSize;
-#endif
if (pScrn->numEntities != 1)
return FALSE;
@@ -900,7 +896,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;
@@ -1293,10 +1289,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;
}
@@ -1351,91 +1344,8 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
} else
pI830->checkDevices = FALSE;
- pScrn->displayWidth = (pScrn->virtualX + 63) & ~63;
-
pI830->stolen_size = I830DetectMemory(pScrn);
- /*
- * 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) {
- from = X_DEFAULT;
- pScrn->videoRam = pI830->FbMapSize / KB(1);
- } else {
- from = X_CONFIG;
- pScrn->videoRam = pI830->pEnt->device->videoRam;
- }
-
- 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);
- }
- }
- }
-
- 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;
- }
-
- 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->XvDisabled =
!xf86ReturnOptValBool(pI830->Options, OPTION_XVIDEO, TRUE);
@@ -1537,137 +1447,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
}
pScrn->currentMode = pScrn->modes;
- pI830->disableTiling = FALSE;
-
-#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 (I830IsPrimary(pScrn) && !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;
- }
- }
- }
-
- allocation_done = FALSE;
- /*
- * If the displayWidth is a tilable pitch, test if there's enough
- * memory available to enable tiling.
- */
- savedMMSize = pI830->mmSize;
- if (tiled) {
-retry_dryrun:
- i830_reset_allocations(pScrn);
- if (!i830_allocate_2d_memory(pScrn,
- ALLOCATE_DRY_RUN | ALLOC_INITIAL) ||
- !i830_allocate_3d_memory(pScrn, ALLOCATE_DRY_RUN))
- {
- /* Failure to set up allocations, so try reducing the DRI memory
- * manager's size if we haven't yet.
- */
- if (KB(pI830->mmSize) > I830_MM_MINPAGES * GTT_PAGE_SIZE) {
- I830ReduceMMSize(pScrn, I830_MM_MINPAGES * GTT_PAGE_SIZE,
- "to make room for tiling.");
- goto retry_dryrun;
- }
- /* Otherwise, disable tiling. */
- pScrn->displayWidth = savedDisplayWidth;
- 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);
- allocation_done = TRUE;
- }
- }
- if (!allocation_done) {
- /*
- * Tiling can't be enabled. Check if there's enough memory for DRI
- * without tiling.
- */
- pI830->mmSize = savedMMSize;
- pI830->disableTiling = TRUE;
-retry_dryrun2:
- i830_reset_allocations(pScrn);
- if (!i830_allocate_2d_memory(pScrn,
- ALLOCATE_DRY_RUN | ALLOC_INITIAL) ||
- !i830_allocate_3d_memory(pScrn, ALLOCATE_DRY_RUN))
- {
- /* Failure to set up allocations, so try reducing the DRI memory
- * manager's size if we haven't yet.
- */
- 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,
- "Not enough video memory. Disabling DRI.");
- pI830->mmSize = 0;
- pI830->directRenderingDisabled = TRUE;
- } else {
- allocation_done = TRUE;
- }
- }
- } else
-#endif
- pI830->disableTiling = TRUE; /* no DRI - so disableTiling */
-
- 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);
@@ -2372,15 +2156,228 @@ 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;
+ 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 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 (I830IsPrimary(pScrn) && !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;
+ }
+ }
+ }
+
+ allocation_done = FALSE;
+ /*
+ * If the displayWidth is a tilable pitch, test if there's enough
+ * memory available to enable tiling.
+ */
+ savedMMSize = pI830->mmSize;
+ if (tiled) {
+retry_dryrun:
+ i830_reset_allocations(pScrn);
+ if (!i830_allocate_2d_memory(pScrn) ||
+ !i830_allocate_3d_memory(pScrn))
+ {
+ /* Failure to set up allocations, so try reducing the DRI memory
+ * manager's size if we haven't yet.
+ */
+ if (KB(pI830->mmSize) > I830_MM_MINPAGES * GTT_PAGE_SIZE) {
+ I830ReduceMMSize(pScrn, I830_MM_MINPAGES * GTT_PAGE_SIZE,
+ "to make room for tiling.");
+ goto retry_dryrun;
+ }
+ /* Otherwise, disable tiling. */
+ pScrn->displayWidth = savedDisplayWidth;
+ 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);
+ allocation_done = TRUE;
+ }
+ }
+ if (!allocation_done) {
+ /*
+ * Tiling can't be enabled. Check if there's enough memory for DRI
+ * without tiling.
+ */
+ pI830->mmSize = savedMMSize;
+ pI830->disableTiling = TRUE;
+retry_dryrun2:
+ i830_reset_allocations(pScrn);
+ if (!i830_allocate_2d_memory(pScrn) ||
+ !i830_allocate_3d_memory(pScrn))
+ {
+ /* Failure to set up allocations, so try reducing the DRI memory
+ * manager's size if we haven't yet.
+ */
+ 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,
+ "Not enough video memory. Disabling DRI.");
+ pI830->mmSize = 0;
+ pI830->directRenderingDisabled = TRUE;
+ } else {
+ allocation_done = TRUE;
+ }
+ }
+ } else
+#endif
+ pI830->disableTiling = TRUE; /* no DRI - so disableTiling */
+
+ 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
{
@@ -2479,13 +2476,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->XvEnabled = FALSE;
#endif
- if (I830IsPrimary(pScrn)) {
- i830_reset_allocations(pScrn);
-
- if (!i830_allocate_2d_memory(pScrn, ALLOC_INITIAL))
- return FALSE;
- }
-
if (!pI830->noAccel) {
if (pI830->LpRing->mem->size == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -2530,6 +2520,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);
}
}
@@ -2538,26 +2529,14 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (pI830->directRenderingEnabled)
pI830->directRenderingEnabled = I830DRIScreenInit(pScreen);
- if (pI830->directRenderingEnabled) {
- pI830->directRenderingEnabled =
- i830_allocate_3d_memory(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
- /* XXX:
- * 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)) {
- i830_allocate_2d_memory(pScrn, 0);
- }
-
i830_describe_allocations(pScrn, 1, "");
#ifdef XF86DRI
if (pI830->directRenderingEnabled)
diff --git a/src/i830_memory.c b/src/i830_memory.c
index c88261ec..5603c487 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -247,6 +247,23 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
memset(pI830->fence, 0, sizeof(pI830->fence));
}
+void
+i830_free_3d_memory(ScrnInfoPtr pScrn)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+
+ i830_free_memory(pScrn, pI830->logical_context);
+ pI830->logical_context = NULL;
+ i830_free_memory(pScrn, pI830->back_buffer);
+ pI830->back_buffer = NULL;
+ i830_free_memory(pScrn, pI830->depth_buffer);
+ pI830->depth_buffer = NULL;
+ i830_free_memory(pScrn, pI830->textures);
+ pI830->textures = NULL;
+ i830_free_memory(pScrn, pI830->memory_manager);
+ pI830->memory_manager = NULL;
+}
+
/**
* Initialize's the driver's video memory allocator to allocate in the
* given range.
@@ -585,10 +602,9 @@ i830_describe_allocations(ScrnInfoPtr pScrn, int verbosity, const char *prefix)
}
static Bool
-i830_allocate_ringbuffer(ScrnInfoPtr pScrn, int flags)
+i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
if (pI830->noAccel || pI830->LpRing->mem != NULL)
return TRUE;
@@ -597,10 +613,8 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn, int flags)
PRIMARY_RINGBUFFER_SIZE,
GTT_PAGE_SIZE, 0);
if (pI830->LpRing->mem == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate Ring Buffer space\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate Ring Buffer space\n");
return FALSE;
}
@@ -614,10 +628,9 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn, int flags)
* requested)
*/
static Bool
-i830_allocate_overlay(ScrnInfoPtr pScrn, int flags)
+i830_allocate_overlay(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
/* Only allocate if overlay is going to be enabled. */
if (!pI830->XvEnabled || IS_I965G(pI830))
@@ -628,11 +641,9 @@ i830_allocate_overlay(ScrnInfoPtr pScrn, int flags)
OVERLAY_SIZE, GTT_PAGE_SIZE,
NEED_PHYSICAL_ADDR);
if (pI830->overlay_regs == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate Overlay register space.\n");
- /* This failure isn't fatal. */
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate Overlay register space.\n");
+ /* This failure isn't fatal. */
}
}
@@ -641,10 +652,8 @@ i830_allocate_overlay(ScrnInfoPtr pScrn, int flags)
KB(pI830->LinearAlloc),
GTT_PAGE_SIZE, 0);
if (pI830->xaa_linear == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate linear buffer space\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate linear buffer space\n");
}
}
@@ -707,12 +716,9 @@ static i830_memory *
i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
Bool secondary, int flags)
{
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
unsigned int pitch = pScrn->displayWidth * pI830->cpp;
unsigned long minspace, avail;
int cacheLines, maxCacheLines;
- int verbosity = dryrun ? 4 : 1;
- const char *s = dryrun ? "[dryrun] " : "";
int align;
long size, fb_height;
char *name;
@@ -770,9 +776,9 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
FbMemBox->y2 += cacheLines;
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
- "%sAllocating at least %d scanlines for pixmap cache\n",
- s, cacheLines);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Allocating %d scanlines for pixmap cache\n",
+ cacheLines);
} else {
/* For EXA, we have a separate allocation for the linear allocator
* which also does the pixmap cache.
@@ -786,7 +792,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
name = secondary ? "secondary front buffer" : "front buffer";
/* Attempt to allocate it tiled first if we have page flipping on. */
- if (!flags & ALLOC_NO_TILING && pI830->allowPageFlip &&
+ if (!pI830->disableTiling && pI830->allowPageFlip &&
IsTileable(pScrn, pitch))
{
/* XXX: probably not the case on 965 */
@@ -796,7 +802,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
align = KB(512);
front_buffer = i830_allocate_memory_tiled(pScrn, name, size,
pitch, align,
- flags, TILING_XMAJOR);
+ 0, TILING_XMAJOR);
pI830->front_tiled = FENCE_XMAJOR;
}
@@ -807,11 +813,9 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
}
if (front_buffer == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate "
- "%sframebuffer. Is your VideoRAM set too low?\n",
- secondary ? "secondary " : "");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate "
+ "%sframebuffer. Is your VideoRAM set too low?\n",
+ secondary ? "secondary " : "");
return NULL;
}
@@ -819,13 +823,13 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
}
static Bool
-i830_allocate_cursor_buffers(xf86CrtcPtr crtc, int flags)
+i830_allocate_cursor_buffers(xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn = crtc->scrn;
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
I830Ptr pI830 = I830PTR(pScrn);
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
long size;
+ int flags = pI830->CursorNeedsPhysical ? NEED_PHYSICAL_ADDR : 0;
if (pI830->SWCursor)
return FALSE;
@@ -836,18 +840,14 @@ i830_allocate_cursor_buffers(xf86CrtcPtr crtc, int flags)
*/
size = HWCURSOR_SIZE;
- if (pI830->CursorNeedsPhysical)
- flags |= NEED_PHYSICAL_ADDR;
if (intel_crtc->cursor_mem == NULL) {
intel_crtc->cursor_mem = i830_allocate_memory(pScrn, "HW cursor",
size, GTT_PAGE_SIZE,
flags);
if (intel_crtc->cursor_mem == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate HW cursor space.\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate HW cursor space.\n");
return FALSE;
}
}
@@ -862,10 +862,8 @@ i830_allocate_cursor_buffers(xf86CrtcPtr crtc, int flags)
GTT_PAGE_SIZE,
flags);
if (intel_crtc->cursor_mem_argb == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate HW (ARGB) cursor space.\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate HW (ARGB) cursor space.\n");
}
}
@@ -877,38 +875,32 @@ i830_allocate_cursor_buffers(xf86CrtcPtr crtc, int flags)
* ring buffer, scratch memory, HW cursor.
*/
Bool
-i830_allocate_2d_memory(ScrnInfoPtr pScrn, const int flags)
+i830_allocate_2d_memory(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
unsigned int pitch = pScrn->displayWidth * pI830->cpp;
long size;
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
int i;
- DPRINTF(PFX, "i830_allocate_2d_memory: inital is %s\n",
- BOOLTOSTRING(flags & ALLOC_INITIAL));
-
if (!pI830->StolenOnly &&
(!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex))) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "AGP GART support is either not available or cannot "
- "be used.\n"
- "\tMake sure your kernel has agpgart support or has\n"
- "\tthe agpgart module loaded.\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "AGP GART support is either not available or cannot "
+ "be used.\n"
+ "\tMake sure your kernel has agpgart support or has\n"
+ "\tthe agpgart module loaded.\n");
return FALSE;
}
/* Allocate the ring buffer first, so it ends up in stolen mem. */
- i830_allocate_ringbuffer(pScrn, flags);
+ i830_allocate_ringbuffer(pScrn);
/* Next, allocate other fixed-size allocations we have. */
if (!pI830->SWCursor) {
/* Allocate cursor memory */
for (i = 0; i < xf86_config->num_crtc; i++) {
- if (!i830_allocate_cursor_buffers(xf86_config->crtc[i], flags) &&
+ if (!i830_allocate_cursor_buffers(xf86_config->crtc[i]) &&
!pI830->SWCursor)
{
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -925,7 +917,7 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn, const int flags)
* space. The second head in zaphod mode will share the space.
*/
if (I830IsPrimary(pScrn))
- i830_allocate_overlay(pScrn, flags);
+ i830_allocate_overlay(pScrn);
#endif
#ifdef I830_USE_EXA
@@ -943,12 +935,10 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn, const int flags)
size = ROUND_TO_PAGE(size);
pI830->exa_offscreen = i830_allocate_memory(pScrn, "exa offscreen",
- size, 1, flags);
+ size, 1, 0);
if (pI830->exa_offscreen == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate "
- "offscreen memory. Not enough VRAM?\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate "
+ "offscreen memory. Not enough VRAM?\n");
return FALSE;
}
}
@@ -956,86 +946,66 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn, const int flags)
if (IS_I965G(pI830) && pI830->exa_965_state == NULL) {
pI830->exa_965_state =
i830_allocate_memory(pScrn, "exa G965 state buffer",
- EXA_LINEAR_EXTRA, GTT_PAGE_SIZE,
- flags);
+ EXA_LINEAR_EXTRA, GTT_PAGE_SIZE, 0);
if (pI830->exa_965_state == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "G965: Failed to allocate exa state buffer "
- "space.\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "G965: Failed to allocate exa state buffer "
+ "space.\n");
return FALSE;
}
}
}
#endif /* I830_USE_EXA */
- if (flags & ALLOC_INITIAL) {
-
- /* Unfortunately this doesn't run on the DRY_RUN pass because our
- * second head hasn't been created yet..... */
- if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) {
- I830EntPtr pI830Ent = pI830->entityPrivate;
- I830Ptr pI8302 = I830PTR(pI830Ent->pScrn_2);
+ if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) {
+ I830EntPtr pI830Ent = pI830->entityPrivate;
+ I830Ptr pI8302 = I830PTR(pI830Ent->pScrn_2);
- pI830->front_buffer_2 =
- i830_allocate_framebuffer(pI830Ent->pScrn_2, pI8302,
- &pI830->FbMemBox2,
- TRUE, flags);
- if (pI830->front_buffer_2 == NULL)
- return FALSE;
- }
- pI830->front_buffer =
- i830_allocate_framebuffer(pScrn, pI830, &pI830->FbMemBox,
- FALSE, flags);
- if (pI830->front_buffer == NULL)
+ pI830->front_buffer_2 =
+ i830_allocate_framebuffer(pI830Ent->pScrn_2, pI8302,
+ &pI830->FbMemBox2, TRUE, 0);
+ if (pI830->front_buffer_2 == NULL)
return FALSE;
}
+ pI830->front_buffer =
+ i830_allocate_framebuffer(pScrn, pI830, &pI830->FbMemBox, FALSE, 0);
+ if (pI830->front_buffer == NULL)
+ return FALSE;
if (!pI830->noAccel && !pI830->useEXA) {
+ pI830->xaa_scratch =
+ i830_allocate_memory(pScrn, "xaa scratch", MAX_SCRATCH_BUFFER_SIZE,
+ GTT_PAGE_SIZE, 0);
if (pI830->xaa_scratch == NULL) {
pI830->xaa_scratch =
i830_allocate_memory(pScrn, "xaa scratch",
- MAX_SCRATCH_BUFFER_SIZE, GTT_PAGE_SIZE,
- flags);
+ MIN_SCRATCH_BUFFER_SIZE, GTT_PAGE_SIZE,
+ 0);
if (pI830->xaa_scratch == NULL) {
- pI830->xaa_scratch =
- i830_allocate_memory(pScrn, "xaa scratch",
- MIN_SCRATCH_BUFFER_SIZE,
- GTT_PAGE_SIZE,
- flags);
- if (pI830->xaa_scratch == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate scratch buffer "
- "space\n");
- }
- return FALSE;
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate scratch buffer "
+ "space\n");
+ return FALSE;
}
}
/* Let's allocate another scratch buffer for the second head */
/* Again, this code won't execute on the dry run pass */
- if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2 &&
- pI830->xaa_scratch_2 == NULL)
+ if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2)
{
pI830->xaa_scratch_2 =
i830_allocate_memory(pScrn, "xaa scratch 2",
MAX_SCRATCH_BUFFER_SIZE, GTT_PAGE_SIZE,
- flags);
+ 0);
if (pI830->xaa_scratch_2 == NULL) {
pI830->xaa_scratch_2 =
i830_allocate_memory(pScrn, "xaa scratch 2",
MIN_SCRATCH_BUFFER_SIZE,
- GTT_PAGE_SIZE,
- flags);
+ GTT_PAGE_SIZE, 0);
if (pI830->xaa_scratch_2 == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate secondary scratch "
- "buffer space\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate secondary scratch "
+ "buffer space\n");
return FALSE;
}
}
@@ -1059,12 +1029,11 @@ myLog2(unsigned int n)
}
static Bool
-i830_allocate_backbuffer(ScrnInfoPtr pScrn, const int flags)
+i830_allocate_backbuffer(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
unsigned int pitch = pScrn->displayWidth * pI830->cpp;
unsigned long size;
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
int height;
if (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180))
@@ -1073,13 +1042,13 @@ i830_allocate_backbuffer(ScrnInfoPtr pScrn, const int flags)
height = pScrn->virtualX;
/* Try to allocate on the best tile-friendly boundaries. */
- if (!(flags & ALLOC_NO_TILING) && IsTileable(pScrn, pitch))
+ if (!pI830->disableTiling && IsTileable(pScrn, pitch))
{
size = ROUND_TO_PAGE(pitch * ALIGN(height, 16));
pI830->back_buffer =
i830_allocate_memory_tiled(pScrn, "back buffer",
size, pitch, GTT_PAGE_SIZE,
- flags | ALIGN_BOTH_ENDS,
+ ALIGN_BOTH_ENDS,
TILING_XMAJOR);
pI830->back_tiled = FENCE_XMAJOR;
}
@@ -1089,15 +1058,13 @@ i830_allocate_backbuffer(ScrnInfoPtr pScrn, const int flags)
size = ROUND_TO_PAGE(pitch * height);
pI830->back_buffer = i830_allocate_memory(pScrn, "back buffer",
size, GTT_PAGE_SIZE,
- flags | ALIGN_BOTH_ENDS);
+ ALIGN_BOTH_ENDS);
pI830->back_tiled = FENCE_LINEAR;
}
if (pI830->back_buffer == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate back buffer space.\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate back buffer space.\n");
return FALSE;
}
@@ -1105,11 +1072,10 @@ i830_allocate_backbuffer(ScrnInfoPtr pScrn, const int flags)
}
static Bool
-i830_allocate_depthbuffer(ScrnInfoPtr pScrn, const int flags)
+i830_allocate_depthbuffer(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
unsigned long size;
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
unsigned int pitch = pScrn->displayWidth * pI830->cpp;
int height;
@@ -1120,13 +1086,13 @@ i830_allocate_depthbuffer(ScrnInfoPtr pScrn, const int flags)
height = pScrn->virtualX;
/* First try allocating it tiled */
- if (!(flags & ALLOC_NO_TILING) && IsTileable(pScrn, pitch))
+ if (!pI830->disableTiling && IsTileable(pScrn, pitch))
{
size = ROUND_TO_PAGE(pitch * ALIGN(height, 16));
pI830->depth_buffer =
i830_allocate_memory_tiled(pScrn, "depth buffer", size, pitch,
- GTT_PAGE_SIZE, flags | ALIGN_BOTH_ENDS,
+ GTT_PAGE_SIZE, ALIGN_BOTH_ENDS,
TILING_YMAJOR);
pI830->depth_tiled = FENCE_YMAJOR;
}
@@ -1136,15 +1102,13 @@ i830_allocate_depthbuffer(ScrnInfoPtr pScrn, const int flags)
size = ROUND_TO_PAGE(pitch * height);
pI830->depth_buffer =
i830_allocate_memory(pScrn, "depth buffer", size, GTT_PAGE_SIZE,
- flags);
+ 0);
pI830->depth_tiled = FENCE_LINEAR;
}
if (pI830->depth_buffer == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate depth buffer space.\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate depth buffer space.\n");
return FALSE;
}
@@ -1152,18 +1116,17 @@ i830_allocate_depthbuffer(ScrnInfoPtr pScrn, const int flags)
}
static Bool
-i830_allocate_texture_memory(ScrnInfoPtr pScrn, const int flags)
+i830_allocate_texture_memory(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
unsigned long size;
int i;
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
if (pI830->mmModeFlags & I830_KERNEL_MM) {
pI830->memory_manager =
i830_allocate_aperture(pScrn, "DRI memory manager",
pI830->mmSize, GTT_PAGE_SIZE,
- flags | ALIGN_BOTH_ENDS);
+ ALIGN_BOTH_ENDS);
/* XXX: try memory manager size backoff here? */
if (pI830->memory_manager == NULL)
return FALSE;
@@ -1172,8 +1135,6 @@ i830_allocate_texture_memory(ScrnInfoPtr pScrn, const int flags)
if (pI830->mmModeFlags & I830_KERNEL_TEX) {
/* XXX: auto-sizing */
size = MB(32);
- if (dryrun && (size < MB(1)))
- size = MB(1);
i = myLog2(size / I830_NR_TEX_REGIONS);
if (i < I830_LOG_MIN_TEX_REGION_SIZE)
i = I830_LOG_MIN_TEX_REGION_SIZE;
@@ -1182,21 +1143,17 @@ i830_allocate_texture_memory(ScrnInfoPtr pScrn, const int flags)
size >>= i;
size <<= i;
if (size < KB(512)) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Less than 512 kBytes for texture space (real %ld"
- "kBytes).\n",
- size / 1024);
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Less than 512 kBytes for texture space (real %ld"
+ "kBytes).\n",
+ size / 1024);
return FALSE;
}
pI830->textures = i830_allocate_memory(pScrn, "textures", size,
- GTT_PAGE_SIZE, flags);
+ GTT_PAGE_SIZE, 0);
if (pI830->textures == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate texture space.\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate texture space.\n");
return FALSE;
}
}
@@ -1205,32 +1162,28 @@ i830_allocate_texture_memory(ScrnInfoPtr pScrn, const int flags)
}
Bool
-i830_allocate_3d_memory(ScrnInfoPtr pScrn, const int flags)
+i830_allocate_3d_memory(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
- Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
DPRINTF(PFX, "I830Allocate3DMemory\n");
/* Space for logical context. 32k is fine for right now. */
pI830->logical_context = i830_allocate_memory(pScrn, "logical 3D context",
- KB(32), GTT_PAGE_SIZE,
- flags);
+ KB(32), GTT_PAGE_SIZE, 0);
if (pI830->logical_context == NULL) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate logical context space.\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate logical context space.\n");
return FALSE;
}
- if (!i830_allocate_backbuffer(pScrn, flags))
+ if (!i830_allocate_backbuffer(pScrn))
return FALSE;
- if (!i830_allocate_depthbuffer(pScrn, flags))
+ if (!i830_allocate_depthbuffer(pScrn))
return FALSE;
- if (!i830_allocate_texture_memory(pScrn, flags))
+ if (!i830_allocate_texture_memory(pScrn))
return FALSE;
return TRUE;