Clean up reworked data structure code so the server actually starts.

Use i830GeLoadDetectPipe again (instead of missing xf86AllocCrtc).  Actually
create new Crtc structures. Fix a few other NULL pointer dereferences.
This commit is contained in:
Keith Packard 2006-11-26 18:26:26 -08:00
parent 2529863a1a
commit a47c549df0
5 changed files with 43 additions and 14 deletions

View File

@ -292,13 +292,13 @@ i830_crt_detect(I830_xf86OutputPtr output)
return OUTPUT_STATUS_CONNECTED;
/* Use the load-detect method if we have no other way of telling. */
crtc = i830xf86AllocCrtc (output);
crtc = i830GetLoadDetectPipe (output);
if (crtc)
{
Bool connected = i830_crt_detect_load(crtc, output);
i830xf86FreeCrtc (crtc);
i830ReleaseLoadDetectPipe (output);
if (connected)
return OUTPUT_STATUS_CONNECTED;
else

View File

@ -667,6 +667,34 @@ I830SetupOutputs(ScrnInfoPtr pScrn)
i830_tv_init(pScrn);
}
/**
* Setup the CRTCs
*/
static const I830_xf86CrtcFuncsRec i830_crtc_funcs = {
};
static void
I830SetupCrtcs(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
int p;
for (p = 0; p < pI830->num_pipes; p++)
{
I830_xf86CrtcPtr crtc = i830xf86CrtcCreate (pScrn, &i830_crtc_funcs);
I830CrtcPrivatePtr intel_crtc;
if (!crtc)
break;
intel_crtc = xnfcalloc (sizeof (I830CrtcPrivateRec), 1);
intel_crtc->pipe = p;
crtc->driver_private = intel_crtc;
pI830->xf86_crtc[p] = crtc;
}
}
static void
I830PreInitDDC(ScrnInfoPtr pScrn)
{
@ -685,8 +713,6 @@ I830PreInitDDC(ScrnInfoPtr pScrn)
if (xf86LoadSubModule(pScrn, "i2c")) {
xf86LoaderReqSymLists(I810i2cSymbols, NULL);
I830SetupOutputs(pScrn);
pI830->ddc2 = TRUE;
} else {
pI830->ddc2 = FALSE;
@ -1241,6 +1267,8 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
}
I830PreInitDDC(pScrn);
I830SetupOutputs(pScrn);
I830SetupCrtcs(pScrn);
if (xf86ReturnOptValBool(pI830->Options, OPTION_CLONE, FALSE)) {
if (pI830->num_pipes == 1) {

View File

@ -1215,17 +1215,17 @@ I830RandRPreInit (ScrnInfoPtr pScrn)
{
I830_xf86OutputPtr output = pI830->xf86_output[o];
RRModePtr randr_mode = output_modes[o];
RRCrtcPtr randr_crtc = output_crtcs[o];
DisplayModePtr mode;
RRCrtcPtr randr_crtc = output_crtcs[o];
I830_xf86CrtcPtr crtc = randr_crtc->devPrivate;
if (randr_mode)
if (randr_mode && randr_crtc)
{
I830_xf86CrtcPtr crtc = randr_crtc->devPrivate;
mode = (DisplayModePtr) randr_mode->devPrivate;
else
mode = NULL;
if (mode)
crtc->desiredMode = *mode;
output->crtc = crtc;
output->crtc = crtc;
}
}
#endif
i830_set_xf86_modes_from_outputs (pScrn);

View File

@ -39,8 +39,8 @@
* Crtc functions
*/
I830_xf86CrtcPtr
i830xf86CrtcCreate (ScrnInfoPtr scrn,
I830_xf86CrtcFuncsPtr funcs)
i830xf86CrtcCreate (ScrnInfoPtr scrn,
const I830_xf86CrtcFuncsRec *funcs)
{
I830_xf86CrtcPtr xf86_crtc;
@ -119,6 +119,7 @@ i830xf86OutputDestroy (I830_xf86OutputPtr output)
memmove (&pI830->xf86_output[o],
&pI830->xf86_output[o+1],
pI830->num_outputs - (o + 1));
pI830->num_outputs--;
break;
}
xfree (output);

View File

@ -257,7 +257,7 @@ struct _I830_xf86Output {
*/
I830_xf86CrtcPtr
i830xf86CrtcCreate (ScrnInfoPtr scrn,
const I830_xf86CrtcFuncsPtr funcs);
const I830_xf86CrtcFuncsRec *funcs);
void
i830xf86CrtcDestroy (I830_xf86CrtcPtr xf86_crtc);