diff options
author | matt335672 <30179339+matt335672@users.noreply.github.com> | 2022-03-28 20:46:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-28 20:46:51 +0300 |
commit | ad5f3c8db5089e3e48397094ee97b07882a91101 (patch) | |
tree | c82b83d611fabcac674d109afb4da475e2e02562 | |
parent | 2856e3cdb9db88622148910211ddcadddfe532be (diff) | |
parent | 0c9207c7337d5bc75bbf6d42d25e28f3eeb39d5f (diff) |
Merge pull request #216 from akarl10/devel
populate DRI2InfoRec driverNames
-rw-r--r-- | xrdpdev/xrdpdri2.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/xrdpdev/xrdpdri2.c b/xrdpdev/xrdpdri2.c index 140e633..7494554 100644 --- a/xrdpdev/xrdpdri2.c +++ b/xrdpdev/xrdpdri2.c @@ -54,6 +54,10 @@ dri2 #include "rdpPri.h" #include "rdpDraw.h" +#if defined(XORGXRDP_GLAMOR) +#include <glamor.h> +#endif + #define LLOG_LEVEL 1 #define LLOGLN(_level, _args) \ do \ @@ -150,6 +154,9 @@ rdpDri2Init(ScreenPtr pScreen) { rdpPtr dev; DRI2InfoRec info; +#if defined(XORGXRDP_GLAMOR) + const char *driver_names[2] = { NULL, NULL }; +#endif LLOGLN(0, ("rdpDri2Init:")); dev = rdpGetDevFromScreen(pScreen); @@ -171,6 +178,42 @@ rdpDri2Init(ScreenPtr pScreen) info.CreateBuffer2 = rdpDri2CreateBuffer2; info.DestroyBuffer2 = rdpDri2DestroyBuffer2; info.CopyRegion2 = rdpDri2CopyRegion2; +#if defined(XORGXRDP_GLAMOR) + /* This is from xorg's hw/xfree86/drivers/modesetting/dri2.c. */ + /* This ensures that dri/va (=driver[0]) and vdpau (=driver[1]) */ + /* get the correct values. Currently only needed for intel drivers. */ + /* Ask Glamor to obtain the DRI driver name via EGL_MESA_query_driver. */ + driver_names[0] = glamor_egl_get_driver_name(pScreen); + + if (driver_names[0]) + { + /* There is no VDPAU driver for Intel, fallback to the generic + * OpenGL/VAAPI va_gl backend to emulate VDPAU. Otherwise, + * guess that the DRI and VDPAU drivers have the same name. + */ + if (strcmp(driver_names[0], "i965") == 0 || + strcmp(driver_names[0], "iris") == 0) || + strcmp(driver_names[0], "crocus") == 0) + { + driver_names[1] = "va_gl"; + } + else + { + driver_names[1] = driver_names[0]; + } + + info.numDrivers = 2; + info.driverNames = driver_names; + } + else + { + /* EGL_MESA_query_driver was unavailable; let dri2.c select the + * driver and fill in these fields for us. + */ + info.numDrivers = 0; + info.driverNames = NULL; + } +#endif if (!DRI2ScreenInit(pScreen, &info)) { return 1; |