summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-03-06 09:28:52 +0100
committerMichel Dänzer <michel@tungstengraphics.com>2007-03-06 09:28:52 +0100
commit6c299aea8e87e72c68c96c03594706c976601ede (patch)
tree9fc7d6b2a1acc764ad35e2d24e91434aeeba9300
parent330815251dee808754b328cd2fd60db39f2460eb (diff)
parent4042b27f01fdb94e7fc0d4e991e054fff88479ea (diff)
Merge remote branch 'origin/master' into i830-pageflip
Conflicts: src/i830_display.c src/i830_driver.c
-rw-r--r--configure.ac2
-rw-r--r--src/i830.h2
-rw-r--r--src/i830_display.c138
-rw-r--r--src/i830_display.h3
-rw-r--r--src/i830_driver.c97
-rw-r--r--src/i830_memory.c27
6 files changed, 67 insertions, 202 deletions
diff --git a/configure.ac b/configure.ac
index 255ccf83..fbb9c647 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-video-intel],
- 1.9.90,
+ 1.9.91,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-video-intel)
diff --git a/src/i830.h b/src/i830.h
index c7043721..82a41664 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -258,8 +258,6 @@ typedef struct _I830Rec {
unsigned char *FbBase;
int cpp;
- DisplayModePtr currentMode;
-
I830EntPtr entityPrivate;
int init;
diff --git a/src/i830_display.c b/src/i830_display.c
index f5a2faa0..8a2494fe 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -418,107 +418,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
}
/**
- * In the current world order, there are lists of modes per output, which may
- * or may not include the mode that was asked to be set by XFree86's mode
- * selection. Find the closest one, in the following preference order:
- *
- * - Equality
- * - Closer in size to the requested mode, but no larger
- * - Closer in refresh rate to the requested mode.
- */
-DisplayModePtr
-i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- DisplayModePtr pBest = NULL, pScan = NULL;
- int i;
-
- /* Assume that there's only one output connected to the given CRTC. */
- for (i = 0; i < xf86_config->num_output; i++)
- {
- xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc && output->probed_modes != NULL)
- {
- pScan = output->probed_modes;
- break;
- }
- }
-
- /* If the pipe doesn't have any detected modes, just let the system try to
- * spam the desired mode in.
- */
- if (pScan == NULL) {
- I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "No pipe mode list for pipe %d,"
- "continuing with desired mode\n", intel_crtc->pipe);
- return pMode;
- }
-
- for (; pScan != NULL; pScan = pScan->next) {
- assert(pScan->VRefresh != 0.0);
-
- /* If there's an exact match, we're done. */
- if (xf86ModesEqual(pScan, pMode)) {
- pBest = pMode;
- break;
- }
-
- /* Reject if it's larger than the desired mode. */
- if (pScan->HDisplay > pMode->HDisplay ||
- pScan->VDisplay > pMode->VDisplay)
- {
- continue;
- }
-
- if (pBest == NULL) {
- pBest = pScan;
- continue;
- }
-
- /* Find if it's closer to the right size than the current best
- * option.
- */
- if ((pScan->HDisplay > pBest->HDisplay &&
- pScan->VDisplay >= pBest->VDisplay) ||
- (pScan->HDisplay >= pBest->HDisplay &&
- pScan->VDisplay > pBest->VDisplay))
- {
- pBest = pScan;
- continue;
- }
-
- /* Find if it's still closer to the right refresh than the current
- * best resolution.
- */
- if (pScan->HDisplay == pBest->HDisplay &&
- pScan->VDisplay == pBest->VDisplay &&
- (fabs(pScan->VRefresh - pMode->VRefresh) <
- fabs(pBest->VRefresh - pMode->VRefresh))) {
- pBest = pScan;
- }
- }
-
- if (pBest == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "No suitable mode found to program for the pipe.\n"
- " continuing with desired mode %dx%d@%.1f\n",
- pMode->HDisplay, pMode->VDisplay, pMode->VRefresh);
- } else if (!xf86ModesEqual(pBest, pMode)) {
- I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
- int pipe = intel_crtc->pipe;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Choosing pipe %d's mode %dx%d@%.1f instead of xf86 "
- "mode %dx%d@%.1f\n", pipe,
- pBest->HDisplay, pBest->VDisplay, pBest->VRefresh,
- pMode->HDisplay, pMode->VDisplay, pMode->VRefresh);
- pMode = pBest;
- }
- return pMode;
-}
-
-/**
* Sets the power management mode of the pipe and plane.
*
* This code should probably grow support for turning the cursor off and back
@@ -1168,43 +1067,6 @@ i830_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
}
-/**
- * This function configures the screens in clone mode on
- * all active outputs using a mode similar to the specified mode.
- */
-Bool
-i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, Rotation rotation)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- Bool ok = TRUE;
- xf86CrtcPtr crtc = config->output[config->compat_output]->crtc;
-
- DPRINTF(PFX, "i830SetMode\n");
-
- if (crtc && crtc->enabled)
- {
- ok = xf86CrtcSetMode(crtc,
- i830PipeFindClosestMode(crtc, pMode),
- rotation, 0, 0);
- if (!ok)
- goto done;
- crtc->desiredMode = *pMode;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Mode bandwidth is %d Mpixel/s\n",
- (int)(pMode->HDisplay * pMode->VDisplay *
- pMode->VRefresh / 1000000));
-
- xf86DisableUnusedFunctions(pScrn);
-
- i830DescribeOutputConfiguration(pScrn);
-
-done:
- i830DumpRegs (pScrn);
- i830_sdvo_dump(pScrn);
- return ok;
-}
-
void
i830DescribeOutputConfiguration(ScrnInfoPtr pScrn)
{
diff --git a/src/i830_display.h b/src/i830_display.h
index 31ab6155..07dfe93a 100644
--- a/src/i830_display.h
+++ b/src/i830_display.h
@@ -28,9 +28,6 @@
#include "xorgVersion.h"
/* i830_display.c */
-DisplayModePtr
-i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode);
-Bool i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, Rotation rotation);
void i830PipeSetBase(xf86CrtcPtr crtc, int x, int y);
void i830WaitForVblank(ScrnInfoPtr pScrn);
void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 8379b6b4..0de4d0df 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -272,8 +272,10 @@ typedef enum {
OPTION_COLOR_KEY,
OPTION_CHECKDEVICES,
OPTION_LINEARALLOC,
+#ifdef XF86DRI_MM
OPTION_INTELTEXPOOL,
OPTION_INTELMMSIZE,
+#endif
OPTION_TRIPLEBUFFER,
} I830Opts;
@@ -291,8 +293,10 @@ static OptionInfoRec I830Options[] = {
{OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
{OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN, {0}, FALSE},
{OPTION_LINEARALLOC, "LinearAlloc", OPTV_INTEGER, {0}, FALSE},
+#ifdef XF86DRI_MM
{OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_INTELMMSIZE, "AperTexSize", OPTV_INTEGER, {0}, FALSE},
+#endif
{OPTION_TRIPLEBUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@@ -1231,30 +1235,38 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->mmModeFlags = 0;
if (!pI830->directRenderingDisabled) {
+#ifdef XF86DRI_MM
Bool tmp = FALSE;
- pI830->mmModeFlags |= I830_KERNEL_TEX;
-#ifdef XF86DRI_MM
if (!IS_I965G(pI830))
pI830->mmModeFlags |= I830_KERNEL_MM;
+ else
#endif
+ pI830->mmModeFlags |= I830_KERNEL_TEX;
from = X_PROBED;
+
+#ifdef XF86DRI_MM
if (xf86GetOptValBool(pI830->Options,
OPTION_INTELTEXPOOL, &tmp)) {
from = X_CONFIG;
if (tmp) {
pI830->mmModeFlags |= I830_KERNEL_TEX;
+ pI830->mmModeFlags &= ~I830_KERNEL_MM;
} else {
pI830->mmModeFlags &= ~I830_KERNEL_TEX;
+ pI830->mmModeFlags |= I830_KERNEL_MM;
}
}
+#endif
+
xf86DrvMsg(pScrn->scrnIndex, from,
"Will %stry to allocate texture pool "
"for old Mesa 3D driver.\n",
(pI830->mmModeFlags & I830_KERNEL_TEX) ?
"" : "not ");
+#ifdef XF86DRI_MM
pI830->mmSize = I830_MM_MAXSIZE;
from = X_INFO;
if (xf86GetOptValInteger(pI830->Options, OPTION_INTELMMSIZE,
@@ -1267,6 +1279,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->mmSize);
}
}
+#endif
#endif
@@ -2140,8 +2153,10 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
MessageType from;
#ifdef XF86DRI
Bool driDisabled;
+#ifdef XF86DRI_MM
unsigned long savedMMSize;
#endif
+#endif
pScrn = xf86Screens[pScreen->myNum];
pI830 = I830PTR(pScrn);
@@ -2268,7 +2283,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!I830CheckDRIAvailable(pScrn)) {
pI830->directRenderingDisabled = TRUE;
+#ifdef XF86DRI_MM
pI830->mmSize = 0;
+#endif
}
if (!pI830->directRenderingDisabled) {
@@ -2318,12 +2335,17 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
*/
pI830->disableTiling = FALSE;
+#ifdef XF86DRI_MM
savedMMSize = pI830->mmSize;
- for (i = 0; i < 4; i++) {
+#define MM_TURNS 4
+#else
+#define MM_TURNS 2
+#endif
+ for (i = 0; i < MM_TURNS; i++) {
if (!tiled && i < 2)
continue;
- if (i >= 2) {
+ if (i >= MM_TURNS/2) {
/* For further allocations, disable tiling */
pI830->disableTiling = TRUE;
pScrn->displayWidth = savedDisplayWidth;
@@ -2334,6 +2356,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->allowPageFlip = FALSE;
}
+#ifdef XF86DRI_MM
if (i & 1) {
/* For this allocation, switch to a smaller DRI memory manager
* size.
@@ -2348,6 +2371,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
"\t %s DRI memory manager reservation:\n",
(i & 2) ? "untiled" : "tiled",
(i & 1) ? "small" : "large");
+#else
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Attempting memory allocation with %s buffers:\n",
+ (i & 1) ? "untiled" : "tiled");
+#endif
if (i830_allocate_2d_memory(pScrn) &&
i830_allocate_3d_memory(pScrn))
@@ -2366,10 +2394,12 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
i830_reset_allocations(pScrn);
}
- if (i == 4) {
+ if (i == MM_TURNS) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Not enough video memory. Disabling DRI.\n");
+#ifdef XF86DRI_MM
pI830->mmSize = 0;
+#endif
pI830->directRenderingDisabled = TRUE;
}
} else
@@ -2752,13 +2782,17 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
I830DRICloseScreen(pScreen);
pI830->directRenderingEnabled = FALSE;
} else {
+ unsigned long aperEnd = ROUND_DOWN_TO(pI830->memory_manager->offset +
+ pI830->memory_manager->size,
+ GTT_PAGE_SIZE) / GTT_PAGE_SIZE;
+ unsigned long aperStart = ROUND_TO(pI830->memory_manager->offset,
+ GTT_PAGE_SIZE) / GTT_PAGE_SIZE;
+
#ifndef XSERVER_LIBDRM_MM
- if (I830DrmMMInit(pI830->drmSubFD, pI830->memory_manager->offset,
- pI830->memory_manager->size,
+ if (I830DrmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart,
DRM_BO_MEM_TT)) {
#else
- if (drmMMInit(pI830->drmSubFD, pI830->memory_manager->offset,
- pI830->memory_manager->size,
+ if (drmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart,
DRM_BO_MEM_TT)) {
#endif
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -2869,9 +2903,7 @@ static Bool
I830EnterVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
- int i;
DPRINTF(PFX, "Enter VT\n");
@@ -2886,12 +2918,6 @@ I830EnterVT(int scrnIndex, int flags)
pI830->leaving = FALSE;
-#if 1
- /* Clear the framebuffer */
- memset(pI830->FbBase + pScrn->fbOffset, 0,
- pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
-#endif
-
if (I830IsPrimary(pScrn))
if (!i830_bind_all_memory(pScrn))
return FALSE;
@@ -2904,27 +2930,13 @@ I830EnterVT(int scrnIndex, int flags)
ResetState(pScrn, FALSE);
SetHWOperatingState(pScrn);
- for (i = 0; i < xf86_config->num_crtc; i++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[i];
-
- /* Mark that we'll need to re-set the mode for sure */
- memset(&crtc->mode, 0, sizeof(crtc->mode));
- if (!crtc->desiredMode.CrtcHDisplay)
- {
- crtc->desiredMode = *i830PipeFindClosestMode (crtc, pScrn->currentMode);
- crtc->desiredRotation = RR_Rotate_0;
- crtc->desiredX = 0;
- crtc->desiredY = 0;
- }
-
- if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation,
- crtc->desiredX, crtc->desiredY))
- return FALSE;
- }
-
- xf86DisableUnusedFunctions(pScrn);
+ /* Clear the framebuffer */
+ memset(pI830->FbBase + pScrn->fbOffset, 0,
+ pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
+ if (!xf86SetDesiredModes (pScrn))
+ return FALSE;
+
i830DumpRegs (pScrn);
i830DescribeOutputConfiguration(pScrn);
@@ -2983,8 +2995,6 @@ I830EnterVT(int scrnIndex, int flags)
if (pI830->checkDevices)
pI830->devicesTimer = TimerSet(NULL, 0, 1000, I830CheckDevicesTimer, pScrn);
- pI830->currentMode = pScrn->currentMode;
-
/* Force invarient 3D state to be emitted */
*pI830->used3D = 1<<31;
@@ -2994,17 +3004,10 @@ I830EnterVT(int scrnIndex, int flags)
static Bool
I830SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
-
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
I830Ptr pI830 = I830PTR(pScrn);
- Bool ret = TRUE;
- DPRINTF(PFX, "I830SwitchMode: mode == %p\n", mode);
-
- if (!i830SetMode(pScrn, mode, pI830->rotation))
- pI830->currentMode = mode;
-
- return ret;
+ return xf86SetSingleMode (pScrn, mode, pI830->rotation);
}
static Bool
diff --git a/src/i830_memory.c b/src/i830_memory.c
index f5cffbaf..17cad73b 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -842,6 +842,8 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
return NULL;
}
+ if (pI830->FbBase)
+ memset (pI830->FbBase + front_buffer->offset, 0, size);
return front_buffer;
}
@@ -943,6 +945,20 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
"Failed to allocate logical context space.\n");
return FALSE;
}
+#ifdef I830_USE_EXA
+ if (pI830->useEXA) {
+ 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, 0);
+ if (pI830->exa_965_state == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Failed to allocate exa state buffer for 965.\n");
+ return FALSE;
+ }
+ }
+ }
+#endif
#ifdef I830_XV
/* Allocate overlay register space and optional XAA linear allocator
@@ -989,17 +1005,6 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
return FALSE;
}
}
-
- 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, 0);
- if (pI830->exa_965_state == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Failed to allocate exa state buffer for 965.\n");
- return FALSE;
- }
- }
}
#endif /* I830_USE_EXA */