modesetting: add platform bus support
This commit is contained in:
parent
709dbc68cd
commit
fa171c5a81
|
@ -52,6 +52,9 @@
|
||||||
#include "xf86xv.h"
|
#include "xf86xv.h"
|
||||||
#include <X11/extensions/Xv.h>
|
#include <X11/extensions/Xv.h>
|
||||||
#include <xorg-server.h>
|
#include <xorg-server.h>
|
||||||
|
#ifdef XSERVER_PLATFORM_BUS
|
||||||
|
#include "xf86platformBus.h"
|
||||||
|
#endif
|
||||||
#if XSERVER_LIBPCIACCESS
|
#if XSERVER_LIBPCIACCESS
|
||||||
#include <pciaccess.h>
|
#include <pciaccess.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,6 +91,12 @@ static const struct pci_id_match ms_device_match[] = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSERVER_PLATFORM_BUS
|
||||||
|
static Bool ms_platform_probe(DriverPtr driver,
|
||||||
|
int entity_num, int flags, struct xf86_platform_device *device,
|
||||||
|
intptr_t match_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
_X_EXPORT DriverRec modesetting = {
|
_X_EXPORT DriverRec modesetting = {
|
||||||
1,
|
1,
|
||||||
"modesetting",
|
"modesetting",
|
||||||
|
@ -99,6 +108,9 @@ _X_EXPORT DriverRec modesetting = {
|
||||||
NULL,
|
NULL,
|
||||||
ms_device_match,
|
ms_device_match,
|
||||||
ms_pci_probe,
|
ms_pci_probe,
|
||||||
|
#ifdef XSERVER_PLATFORM_BUS
|
||||||
|
ms_platform_probe,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static SymTabRec Chipsets[] = {
|
static SymTabRec Chipsets[] = {
|
||||||
|
@ -288,6 +300,40 @@ ms_pci_probe(DriverPtr driver,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSERVER_PLATFORM_BUS
|
||||||
|
static Bool
|
||||||
|
ms_platform_probe(DriverPtr driver,
|
||||||
|
int entity_num, int flags, struct xf86_platform_device *dev, intptr_t match_data)
|
||||||
|
{
|
||||||
|
ScrnInfoPtr scrn = NULL;
|
||||||
|
char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
|
||||||
|
int scr_flags = 0;
|
||||||
|
|
||||||
|
if (flags & PLATFORM_PROBE_GPU_SCREEN)
|
||||||
|
scr_flags = XF86_ALLOCATE_GPU_SCREEN;
|
||||||
|
|
||||||
|
if (probe_hw(path)) {
|
||||||
|
scrn = xf86AllocateScreen(driver, scr_flags);
|
||||||
|
xf86AddEntityToScreen(scrn, entity_num);
|
||||||
|
|
||||||
|
scrn->driverName = "modesetting";
|
||||||
|
scrn->name = "modesetting";
|
||||||
|
scrn->PreInit = PreInit;
|
||||||
|
scrn->ScreenInit = ScreenInit;
|
||||||
|
scrn->SwitchMode = SwitchMode;
|
||||||
|
scrn->AdjustFrame = AdjustFrame;
|
||||||
|
scrn->EnterVT = EnterVT;
|
||||||
|
scrn->LeaveVT = LeaveVT;
|
||||||
|
scrn->FreeScreen = FreeScreen;
|
||||||
|
scrn->ValidMode = ValidMode;
|
||||||
|
xf86DrvMsg(scrn->scrnIndex, X_INFO,
|
||||||
|
"using drv %s\n", path ? path : "default device");
|
||||||
|
}
|
||||||
|
|
||||||
|
return scrn != NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
Probe(DriverPtr drv, int flags)
|
Probe(DriverPtr drv, int flags)
|
||||||
{
|
{
|
||||||
|
@ -431,7 +477,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
|
||||||
rgb defaultWeight = { 0, 0, 0 };
|
rgb defaultWeight = { 0, 0, 0 };
|
||||||
EntityInfoPtr pEnt;
|
EntityInfoPtr pEnt;
|
||||||
EntPtr msEnt = NULL;
|
EntPtr msEnt = NULL;
|
||||||
char *BusID, *devicename;
|
char *BusID = NULL, *devicename;
|
||||||
Bool prefer_shadow = TRUE;
|
Bool prefer_shadow = TRUE;
|
||||||
uint64_t value = 0;
|
uint64_t value = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -477,24 +523,32 @@ PreInit(ScrnInfoPtr pScrn, int flags)
|
||||||
pScrn->progClock = TRUE;
|
pScrn->progClock = TRUE;
|
||||||
pScrn->rgbBits = 8;
|
pScrn->rgbBits = 8;
|
||||||
|
|
||||||
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
|
#if XSERVER_PLATFORM_BUS
|
||||||
if (ms->PciInfo) {
|
if (pEnt->location.type == BUS_PLATFORM) {
|
||||||
BusID = malloc(64);
|
char *path = xf86_get_platform_device_attrib(pEnt->location.id.plat, ODEV_ATTRIB_PATH);
|
||||||
sprintf(BusID, "PCI:%d:%d:%d",
|
ms->fd = open_hw(path);
|
||||||
#if XSERVER_LIBPCIACCESS
|
}
|
||||||
((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
|
else
|
||||||
ms->PciInfo->dev, ms->PciInfo->func
|
|
||||||
#else
|
|
||||||
((pciConfigPtr) ms->PciInfo->thisCard)->busnum,
|
|
||||||
((pciConfigPtr) ms->PciInfo->thisCard)->devnum,
|
|
||||||
((pciConfigPtr) ms->PciInfo->thisCard)->funcnum
|
|
||||||
#endif
|
#endif
|
||||||
);
|
if (pEnt->location.type == BUS_PCI) {
|
||||||
|
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
|
||||||
ms->fd = drmOpen(NULL, BusID);
|
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 {
|
} else {
|
||||||
devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev");
|
devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev");
|
||||||
ms->fd = open_hw(devicename);
|
ms->fd = open_hw(devicename);
|
||||||
}
|
}
|
||||||
if (ms->fd < 0)
|
if (ms->fd < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in New Issue