xfree86: Set pScrn->pScreen before driver ScreenInit is called
Any code called from the driver ScreenInit may want to refer to pScrn->pScreen. As the function passed to AddScreen is the first place the DDX sees a new screen, the generic code needs to make sure that value is set before passing control to the video driver's initialization code. This was found by running a driver which didn't bother to set this value when the initial colormap was installed; xf86RandR12LoadPalette tried to use pScrn->pScreen and crashed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97124 Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
parent
387d6b5df3
commit
69b782aa75
|
@ -360,6 +360,15 @@ AddVTAtoms(CallbackListPtr *pcbl, void *data, void *screen)
|
||||||
"Failed to register VT properties\n");
|
"Failed to register VT properties\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
xf86ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
||||||
|
{
|
||||||
|
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||||
|
|
||||||
|
pScrn->pScreen = pScreen;
|
||||||
|
return pScrn->ScreenInit (pScreen, argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* InitOutput --
|
* InitOutput --
|
||||||
* Initialize screenInfo for all actually accessible framebuffers.
|
* Initialize screenInfo for all actually accessible framebuffers.
|
||||||
|
@ -791,7 +800,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
|
||||||
pScrn->SetOverscan = NULL;
|
pScrn->SetOverscan = NULL;
|
||||||
pScrn->DriverFunc = NULL;
|
pScrn->DriverFunc = NULL;
|
||||||
pScrn->pScreen = NULL;
|
pScrn->pScreen = NULL;
|
||||||
scr_index = AddGPUScreen(pScrn->ScreenInit, argc, argv);
|
scr_index = AddGPUScreen(xf86ScreenInit, argc, argv);
|
||||||
xf86VGAarbiterUnlock(pScrn);
|
xf86VGAarbiterUnlock(pScrn);
|
||||||
if (scr_index == i) {
|
if (scr_index == i) {
|
||||||
dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates,
|
dixSetPrivate(&screenInfo.gpuscreens[scr_index]->devPrivates,
|
||||||
|
@ -819,7 +828,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
|
||||||
xf86Screens[i]->SetOverscan = NULL;
|
xf86Screens[i]->SetOverscan = NULL;
|
||||||
xf86Screens[i]->DriverFunc = NULL;
|
xf86Screens[i]->DriverFunc = NULL;
|
||||||
xf86Screens[i]->pScreen = NULL;
|
xf86Screens[i]->pScreen = NULL;
|
||||||
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
|
scr_index = AddScreen(xf86ScreenInit, argc, argv);
|
||||||
xf86VGAarbiterUnlock(xf86Screens[i]);
|
xf86VGAarbiterUnlock(xf86Screens[i]);
|
||||||
if (scr_index == i) {
|
if (scr_index == i) {
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue