diff options
Diffstat (limited to 'src/armsoc_driver.c')
-rw-r--r-- | src/armsoc_driver.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/armsoc_driver.c b/src/armsoc_driver.c index 972922c..f21d8ef 100644 --- a/src/armsoc_driver.c +++ b/src/armsoc_driver.c @@ -725,6 +725,37 @@ out: } /** + * Find a drmmode driver with the same name as the underlying + * drm kernel driver +*/ +static struct drmmode_interface *get_drmmode_implementation(int drm_fd) +{ + drmVersionPtr version; + struct drmmode_interface *ret = NULL; + struct drmmode_interface *ifaces[] = { + &exynos_interface, + &pl111_interface, + }; + int i; + + version = drmGetVersion(drm_fd); + if (!version) + return NULL; + + for (i = 0; i < ARRAY_SIZE(ifaces); i++) { + struct drmmode_interface *iface = ifaces[i]; + if (strcmp(version->name, iface->driver_name) == 0) { + ret = iface; + break; + } + } + + drmFreeVersion(version); + return ret; +} + + +/** * The driver's PreInit() function. Additional hardware probing is allowed * now, including display configuration. */ @@ -807,7 +838,7 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags) goto fail; pARMSOC->drmmode_interface = - drmmode_interface_get_implementation(pARMSOC->drmFD); + get_drmmode_implementation(pARMSOC->drmFD); if (!pARMSOC->drmmode_interface) goto fail2; |