diff options
author | akark10 <mike@mwsys.mine.bz> | 2022-03-25 17:23:34 +0300 |
---|---|---|
committer | akark10 <mike@mwsys.mine.bz> | 2022-03-25 17:23:34 +0300 |
commit | 3a2d86f6147d55bfbfaa7076a590390c8e412b88 (patch) | |
tree | db19851e1992c945e54aae6e8a57af521cb5d460 | |
parent | 2856e3cdb9db88622148910211ddcadddfe532be (diff) |
populate DRI2InfoRec driverNames
Currently needed for VDPAU with intel GPU
Borrowed from xorg modesetting display driver
-rw-r--r-- | xrdpdev/xrdpdri2.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/xrdpdev/xrdpdri2.c b/xrdpdev/xrdpdri2.c index 140e633..3fced4c 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,35 @@ 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) { + 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; |