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.
This commit is contained in:
Keith Packard 2007-03-05 22:32:52 -08:00
parent 55ee46aebb
commit 4042b27f01
4 changed files with 9 additions and 43 deletions

View File

@ -255,8 +255,6 @@ typedef struct _I830Rec {
unsigned char *FbBase;
int cpp;
DisplayModePtr currentMode;
I830EntPtr entityPrivate;
int init;

View File

@ -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);

View File

@ -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

View File

@ -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;
}