xf86-video-intel: 8 commits - src/i830_accel.c src/i830_driver.c src/i830.h src/i830_ring.h
Eric Anholt
anholt at kemper.freedesktop.org
Thu Jun 5 14:42:57 PDT 2008
src/i830.h | 17 +++++--
src/i830_accel.c | 2
src/i830_driver.c | 120 +++++++++++++++++++++++++-----------------------------
src/i830_ring.h | 17 -------
4 files changed, 72 insertions(+), 84 deletions(-)
New commits:
commit ad459b21b7de4a79552ac155803d5930432fb84b
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jun 5 14:37:59 2008 -0700
Remove SVG_WORK_CONTROL init.
The bit set is now reserved -- used to be a workaround for early revisions.
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 48a64f3..03bfe7e 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3176,13 +3176,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (serverGeneration == 1)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
- if (IS_I965G(pI830)) {
- /* Enable DAP stateless accesses.
- * Required for all i965 steppings.
- */
- OUTREG(SVG_WORK_CTL, 0x00000010);
- }
-
pI830->starting = FALSE;
pI830->closing = FALSE;
pI830->suspended = FALSE;
commit e41dc98a0aeec389b221038753056c725ecee1c5
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jun 5 14:37:26 2008 -0700
Initialize clock gating from EnterVT and save/restore it appropriately.
diff --git a/src/i830.h b/src/i830.h
index 3e124d0..62e645a 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -649,6 +649,10 @@ typedef struct _I830Rec {
uint32_t saveFBC_CONTROL2;
uint32_t saveFBC_CONTROL;
uint32_t saveFBC_FENCE_OFF;
+ uint32_t saveRENCLK_GATE_D1;
+ uint32_t saveRENCLK_GATE_D2;
+ uint32_t saveDSPCLK_GATE_D;
+ uint32_t saveRAMCLK_GATE_D;
enum last_3d *last_3d;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 0474e57..48a64f3 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1499,8 +1499,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
i830TakeRegSnapshot(pScrn);
- i830_init_clock_gating(pScrn);
-
if (DEVICE_ID(pI830->PciInfo) == PCI_CHIP_E7221_G)
num_pipe = 1;
else
@@ -2093,6 +2091,14 @@ SaveHWState(ScrnInfoPtr pScrn)
pI830->saveSWF[15] = INREG(SWF31);
pI830->saveSWF[16] = INREG(SWF32);
+ pI830->saveDSPCLK_GATE_D = INREG(DSPCLK_GATE_D);
+ pI830->saveRENCLK_GATE_D1 = INREG(RENCLK_GATE_D1);
+
+ if (IS_I965G(pI830)) {
+ pI830->saveRENCLK_GATE_D2 = INREG(RENCLK_GATE_D2);
+ pI830->saveRAMCLK_GATE_D = INREG(RAMCLK_GATE_D);
+ }
+
if (IS_MOBILE(pI830) && !IS_I830(pI830))
pI830->saveLVDS = INREG(LVDS);
pI830->savePFIT_CONTROL = INREG(PFIT_CONTROL);
@@ -2152,6 +2158,13 @@ RestoreHWState(ScrnInfoPtr pScrn)
OUTREG(DSPARB, pI830->saveDSPARB);
+ OUTREG(DSPCLK_GATE_D, pI830->saveDSPCLK_GATE_D);
+ OUTREG(RENCLK_GATE_D1, pI830->saveRENCLK_GATE_D1);
+
+ if (IS_I965G(pI830)) {
+ OUTREG(RENCLK_GATE_D2, pI830->saveRENCLK_GATE_D2);
+ OUTREG(RAMCLK_GATE_D, pI830->saveRAMCLK_GATE_D);
+ }
/*
* Pipe regs
* To restore the saved state, we first need to program the PLL regs,
@@ -3164,13 +3177,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
if (IS_I965G(pI830)) {
- /* turn off clock gating */
-#if 0
- OUTREG(0x6204, 0x70804000);
- OUTREG(0x6208, 0x00000001);
-#else
- OUTREG(0x6204, 0x70000000);
-#endif
/* Enable DAP stateless accesses.
* Required for all i965 steppings.
*/
@@ -3365,6 +3371,8 @@ I830EnterVT(int scrnIndex, int flags)
/* Tell the BIOS that we're in control of mode setting now. */
i830_init_bios_control(pScrn);
+ i830_init_clock_gating(pScrn);
+
/* Clear the framebuffer */
memset(pI830->FbBase + pScrn->fbOffset, 0,
pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
commit 8061e5ac27a5f61f940bccc940be922999cc1d3f
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jun 5 14:09:45 2008 -0700
Move BIOS scratch register setup to EnterVT instead of PreInit.
We want these to always be set when our driver's in control. They are
already appropriately save/restored at leave/entervt.
diff --git a/src/i830.h b/src/i830.h
index 2152153..3e124d0 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -557,10 +557,6 @@ typedef struct _I830Rec {
Bool StolenOnly;
- Bool swfSaved;
- uint32_t saveSWF0;
- uint32_t saveSWF4;
-
Bool checkDevices;
/* Driver phase/state information */
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 3b8f408..0474e57 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -963,6 +963,19 @@ i830_init_clock_gating(ScrnInfoPtr pScrn)
}
}
+static void
+i830_init_bios_control(ScrnInfoPtr pScrn)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+
+ /* Set "extended desktop" */
+ OUTREG(SWF0, INREG(SWF0) | (1 << 21));
+
+ /* Set "driver loaded", "OS unknown", "APM 1.2" */
+ OUTREG(SWF4, (INREG(SWF4) & ~((3 << 19) | (7 << 16))) |
+ (1 << 23) | (2 << 16));
+}
+
static int
I830LVDSPresent(ScrnInfoPtr pScrn)
{
@@ -1021,10 +1034,6 @@ PreInitCleanup(ScrnInfoPtr pScrn)
if (pI830->entityPrivate)
pI830->entityPrivate->pScrn_2 = NULL;
}
- if (pI830->swfSaved) {
- OUTREG(SWF0, pI830->saveSWF0);
- OUTREG(SWF4, pI830->saveSWF4);
- }
if (pI830->MMIOBase)
I830UnmapMMIO(pScrn);
I830FreeRec(pScrn);
@@ -1492,19 +1501,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
i830_init_clock_gating(pScrn);
-#if 1
- pI830->saveSWF0 = INREG(SWF0);
- pI830->saveSWF4 = INREG(SWF4);
- pI830->swfSaved = TRUE;
-
- /* Set "extended desktop" */
- OUTREG(SWF0, pI830->saveSWF0 | (1 << 21));
-
- /* Set "driver loaded", "OS unknown", "APM 1.2" */
- OUTREG(SWF4, (pI830->saveSWF4 & ~((3 << 19) | (7 << 16))) |
- (1 << 23) | (2 << 16));
-#endif
-
if (DEVICE_ID(pI830->PciInfo) == PCI_CHIP_E7221_G)
num_pipe = 1;
else
@@ -1739,12 +1735,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->noAccel = TRUE;
}
- /* Don't need MMIO access anymore. */
- if (pI830->swfSaved) {
- OUTREG(SWF0, pI830->saveSWF0);
- OUTREG(SWF4, pI830->saveSWF4);
- }
-
/* Set display resolution */
xf86SetDpi(pScrn, 0, 0);
@@ -3372,6 +3362,9 @@ I830EnterVT(int scrnIndex, int flags)
*/
i830_set_dsparb(pScrn);
+ /* Tell the BIOS that we're in control of mode setting now. */
+ i830_init_bios_control(pScrn);
+
/* Clear the framebuffer */
memset(pI830->FbBase + pScrn->fbOffset, 0,
pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
commit b61cb9283185eb5211e84eb7d8e68beea607c2eb
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jun 5 13:57:54 2008 -0700
Remove gratuitous wait_ring_idle after I830Sync. Syncing implies that.
diff --git a/src/i830_driver.c b/src/i830_driver.c
index efc3630..3b8f408 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1851,7 +1851,6 @@ i830_stop_ring(ScrnInfoPtr pScrn, Bool flush)
if (temp & RING_VALID) {
i830_refresh_ring(pScrn);
I830Sync(pScrn);
- i830_wait_ring_idle(pScrn);
}
OUTREG(LP_RING + RING_LEN, 0);
@@ -3421,7 +3420,6 @@ I830EnterVT(int scrnIndex, int flags)
i830_refresh_ring(pScrn);
I830Sync(pScrn);
- i830_wait_ring_idle(pScrn);
sarea->texAge++;
for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++)
commit b65f67b74ff99aea1490d52f170ef4fe80cef6c7
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jun 5 13:40:55 2008 -0700
Move the remaining two lines of SetHWOperatingState to the caller.
diff --git a/src/i830_driver.c b/src/i830_driver.c
index ba0b8a7..efc3630 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1965,22 +1965,6 @@ i830_set_dsparb(ScrnInfoPtr pScrn)
}
}
-/*
- * This should be called everytime the X server gains control of the screen,
- * before any video modes are programmed (ScreenInit, EnterVT).
- */
-static void
-SetHWOperatingState(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- DPRINTF(PFX, "SetHWOperatingState\n");
-
- i830_start_ring(pScrn);
- if (!pI830->SWCursor)
- I830InitHWCursor(pScrn);
-}
-
enum pipe {
PIPE_A = 0,
PIPE_B,
@@ -3380,7 +3364,9 @@ I830EnterVT(int scrnIndex, int flags)
}
i830_stop_ring(pScrn, FALSE);
- SetHWOperatingState(pScrn);
+ i830_start_ring(pScrn);
+ if (!pI830->SWCursor)
+ I830InitHWCursor(pScrn);
/* Set the DSPARB register. This disables the outputs, which is about to
* happen (likely) in xf86SetDesiredModes anyway.
commit adb4f5a5e826e584ab212d23fc8d474c3e7bb8e8
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jun 5 13:39:08 2008 -0700
Remove duplicated i830_stop_ring()/SetHWOperatingState() in EnterVT().
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 34c83c1..ba0b8a7 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3400,9 +3400,6 @@ I830EnterVT(int scrnIndex, int flags)
}
i830DescribeOutputConfiguration(pScrn);
- i830_stop_ring(pScrn, TRUE);
- SetHWOperatingState(pScrn);
-
#ifdef XF86DRI
if (pI830->directRenderingEnabled) {
/* HW status is fixed, we need to set it up before any drm
commit c2e2fe48113667c683c6e1e9b1237635c41c61c3
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jun 5 13:21:55 2008 -0700
Move DSPARB setup into a separate function, and save/restore it at VT switch.
diff --git a/src/i830.h b/src/i830.h
index cac3ef6..2152153 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -582,6 +582,7 @@ typedef struct _I830Rec {
enum backlight_control backlight_control_method;
+ uint32_t saveDSPARB;
uint32_t saveDSPACNTR;
uint32_t saveDSPBCNTR;
uint32_t savePIPEACONF;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 5af3153..34c83c1 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1921,22 +1921,22 @@ i830_refresh_ring(ScrnInfoPtr pScrn)
i830MarkSync(pScrn);
}
-/*
- * This should be called everytime the X server gains control of the screen,
- * before any video modes are programmed (ScreenInit, EnterVT).
+/**
+ * Sets up the DSPARB register to split the display fifo appropriately between
+ * the display planes.
+ *
+ * Adjusting this register requires that the planes be off, thus as a side
+ * effect they are disabled by this function.
*/
static void
-SetHWOperatingState(ScrnInfoPtr pScrn)
+i830_set_dsparb(ScrnInfoPtr pScrn)
{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
- DPRINTF(PFX, "SetHWOperatingState\n");
-
- /*
- * Disable outputs & pipes since some of these regs can only be updated
- * when they're off.
+ /* Disable outputs & pipes since DSPARB can only be updated when they're
+ * off.
*/
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
@@ -1949,12 +1949,7 @@ SetHWOperatingState(ScrnInfoPtr pScrn)
}
i830WaitForVblank(pScrn);
- i830_start_ring(pScrn);
- if (!pI830->SWCursor)
- I830InitHWCursor(pScrn);
-
- /*
- * Fixup FIFO defaults:
+ /* Fixup FIFO defaults:
* we don't use plane C at all so we can allocate all but one of the 96
* FIFO RAM entries equally between planes A and B.
*/
@@ -1970,6 +1965,22 @@ SetHWOperatingState(ScrnInfoPtr pScrn)
}
}
+/*
+ * This should be called everytime the X server gains control of the screen,
+ * before any video modes are programmed (ScreenInit, EnterVT).
+ */
+static void
+SetHWOperatingState(ScrnInfoPtr pScrn)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+
+ DPRINTF(PFX, "SetHWOperatingState\n");
+
+ i830_start_ring(pScrn);
+ if (!pI830->SWCursor)
+ I830InitHWCursor(pScrn);
+}
+
enum pipe {
PIPE_A = 0,
PIPE_B,
@@ -2034,6 +2045,8 @@ SaveHWState(ScrnInfoPtr pScrn)
}
/* Save video mode information for native mode-setting. */
+ pI830->saveDSPARB = INREG(DSPARB);
+
pI830->saveDSPACNTR = INREG(DSPACNTR);
pI830->savePIPEACONF = INREG(PIPEACONF);
pI830->savePIPEASRC = INREG(PIPEASRC);
@@ -2164,6 +2177,8 @@ RestoreHWState(ScrnInfoPtr pScrn)
if (!IS_I830(pI830) && !IS_845G(pI830))
OUTREG(PFIT_CONTROL, pI830->savePFIT_CONTROL);
+ OUTREG(DSPARB, pI830->saveDSPARB);
+
/*
* Pipe regs
* To restore the saved state, we first need to program the PLL regs,
@@ -3237,7 +3252,6 @@ I830LeaveVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
I830Ptr pI830 = I830PTR(pScrn);
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#ifndef HAVE_FREE_SHADOW
int o;
#endif
@@ -3368,6 +3382,11 @@ I830EnterVT(int scrnIndex, int flags)
i830_stop_ring(pScrn, FALSE);
SetHWOperatingState(pScrn);
+ /* Set the DSPARB register. This disables the outputs, which is about to
+ * happen (likely) in xf86SetDesiredModes anyway.
+ */
+ i830_set_dsparb(pScrn);
+
/* Clear the framebuffer */
memset(pI830->FbBase + pScrn->fbOffset, 0,
pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
commit 7e51384c973a96366b02ea646392c43574674111
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jun 5 11:56:42 2008 -0700
Replace a couple of wait-for-ring-idles with a single function to do so.
diff --git a/src/i830.h b/src/i830.h
index 8290197..cac3ef6 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -859,6 +859,14 @@ i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
void i830_enter_render(ScrnInfoPtr);
+static inline void
+i830_wait_ring_idle(ScrnInfoPtr pScrn)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+
+ I830WaitLpRing(pScrn, pI830->LpRing->mem->size - 8, 0);
+}
+
static inline int i830_fb_compression_supported(I830Ptr pI830)
{
if (!IS_MOBILE(pI830))
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 953a73b..7784c62 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -201,7 +201,7 @@ I830Sync(ScrnInfoPtr pScrn)
ADVANCE_BATCH();
}
- I830WaitLpRing(pScrn, pI830->LpRing->mem->size - 8, 0);
+ i830_wait_ring_idle(pScrn);
pI830->LpRing->space = pI830->LpRing->mem->size - 8;
pI830->nextColorExpandBuf = 0;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 49f8db9..5af3153 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1851,7 +1851,7 @@ i830_stop_ring(ScrnInfoPtr pScrn, Bool flush)
if (temp & RING_VALID) {
i830_refresh_ring(pScrn);
I830Sync(pScrn);
- DO_RING_IDLE();
+ i830_wait_ring_idle(pScrn);
}
OUTREG(LP_RING + RING_LEN, 0);
@@ -3416,10 +3416,10 @@ I830EnterVT(int scrnIndex, int flags)
int i;
I830DRIResume(screenInfo.screens[scrnIndex]);
-
+
i830_refresh_ring(pScrn);
I830Sync(pScrn);
- DO_RING_IDLE();
+ i830_wait_ring_idle(pScrn);
sarea->texAge++;
for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++)
diff --git a/src/i830_ring.h b/src/i830_ring.h
index cf789eb..c2078fb 100644
--- a/src/i830_ring.h
+++ b/src/i830_ring.h
@@ -75,28 +75,13 @@ union intfloat {
pI830->ring_emitting = 0; \
} while (0)
-/*
- * XXX Note: the head/tail masks are different for 810 and i830.
- * If the i810 always sets the higher bits to 0, then this shouldn't be
- * a problem. Check this!
- */
-#define DO_RING_IDLE() do { \
- int _head; \
- int _tail; \
- do { \
- _head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; \
- _tail = INREG(LP_RING + RING_TAIL) & I830_TAIL_MASK; \
- DELAY(10); \
- } while (_head != _tail); \
-} while (0)
-
#define BEGIN_LP_RING(n) \
do { \
if (pI830->ring_emitting != 0) \
FatalError("%s: BEGIN_LP_RING called without closing " \
"ADVANCE_LP_RING\n", __FUNCTION__); \
if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \
- DO_RING_IDLE(); \
+ i830_wait_ring_idle(pScrn); \
pI830->ring_emitting = (n) * 4; \
if ((n) & 1) \
pI830->ring_emitting += 4; \
More information about the xorg-commit
mailing list