summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2007-03-05 22:32:52 -0800
committerKeith Packard <keithp@guitar.keithp.com>2007-03-05 22:34:13 -0800
commit4042b27f01fdb94e7fc0d4e991e054fff88479ea (patch)
tree1a9160de3d92ce7d9700ae58654574b7108eba5b
parent55ee46aebbf1ec1a8ce914fbd0c8894fc857db8f (diff)
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.
-rw-r--r--src/i830.h2
-rw-r--r--src/i830_display.h3
-rw-r--r--src/i830_driver.c45
-rw-r--r--src/i830_memory.c2
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;
}