summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>2014-01-12 06:42:36 +0400
committerSiarhei Siamashka <siarhei.siamashka@gmail.com>2014-04-01 00:29:49 +0400
commit4c7313c6db9ee770f39740c735268c88fcd136cf (patch)
tree2913bb00897f1026f7af66c0ad535640bc566b4c
parent154ebf4b69ee7f103539b7e6f60c3f89a6273698 (diff)
downloadxf86-video-fbturbo-4c7313c6db9ee770f39740c735268c88fcd136cf.tar.xz
vdpau: Report DRI2 VDPAU driver name as 'sunxi' on Allwinner hardware
Try to load the 'sunxi_cedar_mod' kernel module. And if it loads successfully, then report the DRI2 VDPAU name as 'sunxi'. This allows to use libvdpau-sunxi without setting the VDPAU_DRIVER environment variable. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-rw-r--r--src/sunxi_mali_ump_dri2.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/sunxi_mali_ump_dri2.c b/src/sunxi_mali_ump_dri2.c
index fa621dd..6aacffd 100644
--- a/src/sunxi_mali_ump_dri2.c
+++ b/src/sunxi_mali_ump_dri2.c
@@ -1074,21 +1074,36 @@ static unsigned long ump_get_size_from_secure_id(ump_secure_id secure_id)
return size;
}
+static const char *driverNames[1] = {
+ "lima" /* DRI2DriverDRI */
+};
+
+static const char *driverNamesWithVDPAU[2] = {
+ "lima", /* DRI2DriverDRI */
+ "sunxi" /* DRI2DriverVDPAU */
+};
+
SunxiMaliDRI2 *SunxiMaliDRI2_Init(ScreenPtr pScreen,
Bool bUseOverlay,
Bool bSwapbuffersWait)
{
int drm_fd;
- DRI2InfoRec info;
+ DRI2InfoRec info = { 0 };
SunxiMaliDRI2 *mali;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
sunxi_disp_t *disp = SUNXI_DISP(pScrn);
+ Bool have_sunxi_cedar = TRUE;
if (!xf86LoadKernelModule("mali"))
xf86DrvMsg(pScreen->myNum, X_INFO, "can't load 'mali' kernel module\n");
if (!xf86LoadKernelModule("mali_drm"))
xf86DrvMsg(pScreen->myNum, X_INFO, "can't load 'mali_drm' kernel module\n");
+ if (!xf86LoadKernelModule("sunxi_cedar_mod")) {
+ xf86DrvMsg(pScreen->myNum, X_INFO, "can't load 'sunxi_cedar_mod' kernel module\n");
+ have_sunxi_cedar = FALSE;
+ }
+
if (!xf86LoadSubModule(xf86Screens[pScreen->myNum], "dri2"))
return NULL;
@@ -1174,9 +1189,18 @@ SunxiMaliDRI2 *SunxiMaliDRI2_Init(ScreenPtr pScreen,
xf86DrvMsg(pScreen->myNum, X_INFO, "Wait on SwapBuffers? %s\n",
bSwapbuffersWait ? "enabled" : "disabled");
- info.version = 3;
+ info.version = 4;
- info.driverName = "lima";
+ if (have_sunxi_cedar) {
+ info.numDrivers = ARRAY_SIZE(driverNamesWithVDPAU);
+ info.driverName = driverNamesWithVDPAU[0];
+ info.driverNames = driverNamesWithVDPAU;
+ }
+ else {
+ info.numDrivers = ARRAY_SIZE(driverNames);
+ info.driverName = driverNames[0];
+ info.driverNames = driverNames;
+ }
info.deviceName = drmGetDeviceNameFromFd(drm_fd);
info.fd = drm_fd;