diff options
author | Rob Clark <robdclark@gmail.com> | 2014-06-14 09:46:28 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2014-07-04 13:00:37 -0400 |
commit | 9d814c9cd5ddf08d0afd8f19df1d5efb27a60cfc (patch) | |
tree | 107eea4cb1d27ddc981fba01d2a853047868e394 | |
parent | 228671402989ef47ca28df6621e94695e559fa24 (diff) |
add platform-probe support
Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r-- | src/msm-driver.c | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/src/msm-driver.c b/src/msm-driver.c index 4461d27..8bc65f8 100644 --- a/src/msm-driver.c +++ b/src/msm-driver.c @@ -679,6 +679,82 @@ MSMProbe(DriverPtr drv, int flags) return foundScreen; } +static Bool +MSMDriverFunc(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data) +{ + xorgHWFlags *flag; + + switch (op) { + case GET_REQUIRED_HW_INTERFACES: + flag = (CARD32 *)data; + (*flag) = 0; + return TRUE; + default: + return FALSE; + } +} + +#ifdef XSERVER_PLATFORM_BUS +static Bool probe_hw(struct xf86_platform_device *dev) +{ + int fd; + + /* NOTE: for kgsl we still need config file to find fbdev device, + * so it will always be probed through the old MSMProbe path. So + * only look for drm/msm here: + */ + + fd = drmOpen("msm", NULL); + if (fd != -1) { + close(fd); + return TRUE; + } + + return FALSE; +} + +static Bool +MSMPlatformProbe(DriverPtr driver, + int entity_num, int flags, struct xf86_platform_device *dev, + intptr_t match_data) +{ + ScrnInfoPtr pScrn = NULL; + int scr_flags = 0; + + /* Note: at least for now there is no point in gpu screens.. and + * allowing them exposes a bug in older xservers that would result + * in the device probed as a gpu screen rather than regular screen + * resulting in "No screens found". + * + * If later there is actually reason to support GPU screens, track + * down the first xorg ABI # that contains the fix, and make this + * conditional on that or later ABI versions. Otherwise you will + * break things for people with older xservers. + * + if (flags & PLATFORM_PROBE_GPU_SCREEN) + scr_flags = XF86_ALLOCATE_GPU_SCREEN; + */ + + if (probe_hw(dev)) { + pScrn = xf86AllocateScreen(driver, scr_flags); + xf86AddEntityToScreen(pScrn, entity_num); + + pScrn->driverVersion = MSM_VERSION_CURRENT; + pScrn->driverName = MSM_NAME; + pScrn->name = MSM_NAME; + pScrn->Probe = MSMProbe; + pScrn->PreInit = MSMPreInit; + pScrn->ScreenInit = MSMScreenInit; + pScrn->SwitchMode = MSMSwitchMode; + pScrn->EnterVT = MSMEnterVT; + pScrn->LeaveVT = MSMLeaveVT; + pScrn->FreeScreen = MSMFreeScreen; + } + + return pScrn != NULL; +} +#endif + _X_EXPORT DriverRec freedrenoDriver = { MSM_VERSION_CURRENT, MSM_DRIVER_NAME, @@ -687,7 +763,12 @@ _X_EXPORT DriverRec freedrenoDriver = { MSMAvailableOptions, NULL, 0, - NULL + MSMDriverFunc, + NULL, + NULL, /* pci_probe */ +#ifdef XSERVER_PLATFORM_BUS + MSMPlatformProbe, +#endif }; MODULESETUPPROTO(freedrenoSetup); |