modesetting: move opening kernel device to before setting depth

due to interaction between option handling and set depth, we need
to what fbdev does to get the device path early.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2012-05-01 16:52:18 +01:00
parent 00c663a3bc
commit 610f532e6a

View File

@ -437,6 +437,28 @@ PreInit(ScrnInfoPtr pScrn, int flags)
pScrn->progClock = TRUE;
pScrn->rgbBits = 8;
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
if (ms->PciInfo) {
BusID = malloc(64);
sprintf(BusID, "PCI:%d:%d:%d",
#if XSERVER_LIBPCIACCESS
((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
ms->PciInfo->dev, ms->PciInfo->func
#else
((pciConfigPtr) ms->PciInfo->thisCard)->busnum,
((pciConfigPtr) ms->PciInfo->thisCard)->devnum,
((pciConfigPtr) ms->PciInfo->thisCard)->funcnum
#endif
);
ms->fd = drmOpen(NULL, BusID);
} else {
devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev");
ms->fd = open_hw(devicename);
}
if (ms->fd < 0)
return FALSE;
if (!xf86SetDepthBpp
(pScrn, 0, 0, 0,
PreferConvert24to32 | SupportConvert24to32 | Support32bppFb))
@ -462,28 +484,6 @@ PreInit(ScrnInfoPtr pScrn, int flags)
memcpy(ms->Options, Options, sizeof(Options));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
if (ms->PciInfo) {
BusID = malloc(64);
sprintf(BusID, "PCI:%d:%d:%d",
#if XSERVER_LIBPCIACCESS
((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
ms->PciInfo->dev, ms->PciInfo->func
#else
((pciConfigPtr) ms->PciInfo->thisCard)->busnum,
((pciConfigPtr) ms->PciInfo->thisCard)->devnum,
((pciConfigPtr) ms->PciInfo->thisCard)->funcnum
#endif
);
ms->fd = drmOpen(NULL, BusID);
} else {
devicename = xf86GetOptValString(ms->Options, OPTION_DEVICE_PATH);
ms->fd = open_hw(devicename);
}
if (ms->fd < 0)
return FALSE;
if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight))
return FALSE;
if (!xf86SetDefaultVisual(pScrn, -1))