From af565872a49a1a464ee4154c27136660b184c4c1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 4 Mar 2007 21:20:33 -0800 Subject: [PATCH 1/4] Set version number to 2.0 RC1 (1.9.91). --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 772b40bd..c8b99c74 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) From c2c62559e702e7de1fa2ef309fa647ab13564dc3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 3 Mar 2007 23:12:54 -0800 Subject: [PATCH 2/4] Move single mode setting code to X server. Code to drive the global configuration from a single mode setting operation (from RandR 1.1, XFree86-VidModeExtension or XFree86-DGA) has been included in the X server now, so remove it from this driver. --- src/i830_display.c | 141 --------------------------------------------- 1 file changed, 141 deletions(-) diff --git a/src/i830_display.c b/src/i830_display.c index d0b21a92..e9c997ab 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -392,107 +392,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. * @@ -1140,46 +1039,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); - -#ifdef XF86DRI - I830DRISetVBlankInterrupt (pScrn, TRUE); -#endif -done: - i830DumpRegs (pScrn); - i830_sdvo_dump(pScrn); - return ok; -} - void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn) { From 5c720147e2b86ca4046b7c3812c1ca6b0fb78c9d Mon Sep 17 00:00:00 2001 From: Wang Zhenyu Date: Tue, 6 Mar 2007 12:44:04 +0800 Subject: [PATCH 3/4] EXA: try to always alloc exa i965 state buffer in stolen mem I think this is a safe way to work around any possible chip error. --- src/i830_memory.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/i830_memory.c b/src/i830_memory.c index 5cddf173..7bcf48e0 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -936,6 +936,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 @@ -982,17 +996,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 */ From 4042b27f01fdb94e7fc0d4e991e054fff88479ea Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 5 Mar 2007 22:32:52 -0800 Subject: [PATCH 4/4] Move EnterVT mode setting code to xf86SetDesiredModes. Make the application of crtc desiredModes generic code instead of per-driver by creating xf86SetDesiredModes from the code that was in EnterVT and calling it. Also, move the frame buffer clear until just before mode setting to make sure things are mapped correctly. --- src/i830.h | 2 -- src/i830_display.h | 3 --- src/i830_driver.c | 45 +++++++-------------------------------------- src/i830_memory.c | 2 ++ 4 files changed, 9 insertions(+), 43 deletions(-) diff --git a/src/i830.h b/src/i830.h index 08d9e3ed..dfa94d8e 100644 --- a/src/i830.h +++ b/src/i830.h @@ -255,8 +255,6 @@ typedef struct _I830Rec { unsigned char *FbBase; int cpp; - DisplayModePtr currentMode; - I830EntPtr entityPrivate; int init; 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 7ab2cdc8..0977511f 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -2885,9 +2885,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"); @@ -2902,12 +2900,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; @@ -2920,27 +2912,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); @@ -3003,8 +2981,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; @@ -3014,17 +2990,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 7bcf48e0..ea6b90d7 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -835,6 +835,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; }