Skip to content

Commit ad5f3c8

Browse files
authored
Merge pull request #216 from akarl10/devel
populate DRI2InfoRec driverNames
2 parents 2856e3c + 0c9207c commit ad5f3c8

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

xrdpdev/xrdpdri2.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ dri2
5454
#include "rdpPri.h"
5555
#include "rdpDraw.h"
5656

57+
#if defined(XORGXRDP_GLAMOR)
58+
#include <glamor.h>
59+
#endif
60+
5761
#define LLOG_LEVEL 1
5862
#define LLOGLN(_level, _args) \
5963
do \
@@ -150,6 +154,9 @@ rdpDri2Init(ScreenPtr pScreen)
150154
{
151155
rdpPtr dev;
152156
DRI2InfoRec info;
157+
#if defined(XORGXRDP_GLAMOR)
158+
const char *driver_names[2] = { NULL, NULL };
159+
#endif
153160

154161
LLOGLN(0, ("rdpDri2Init:"));
155162
dev = rdpGetDevFromScreen(pScreen);
@@ -171,6 +178,42 @@ rdpDri2Init(ScreenPtr pScreen)
171178
info.CreateBuffer2 = rdpDri2CreateBuffer2;
172179
info.DestroyBuffer2 = rdpDri2DestroyBuffer2;
173180
info.CopyRegion2 = rdpDri2CopyRegion2;
181+
#if defined(XORGXRDP_GLAMOR)
182+
/* This is from xorg's hw/xfree86/drivers/modesetting/dri2.c. */
183+
/* This ensures that dri/va (=driver[0]) and vdpau (=driver[1]) */
184+
/* get the correct values. Currently only needed for intel drivers. */
185+
/* Ask Glamor to obtain the DRI driver name via EGL_MESA_query_driver. */
186+
driver_names[0] = glamor_egl_get_driver_name(pScreen);
187+
188+
if (driver_names[0])
189+
{
190+
/* There is no VDPAU driver for Intel, fallback to the generic
191+
* OpenGL/VAAPI va_gl backend to emulate VDPAU. Otherwise,
192+
* guess that the DRI and VDPAU drivers have the same name.
193+
*/
194+
if (strcmp(driver_names[0], "i965") == 0 ||
195+
strcmp(driver_names[0], "iris") == 0) ||
196+
strcmp(driver_names[0], "crocus") == 0)
197+
{
198+
driver_names[1] = "va_gl";
199+
}
200+
else
201+
{
202+
driver_names[1] = driver_names[0];
203+
}
204+
205+
info.numDrivers = 2;
206+
info.driverNames = driver_names;
207+
}
208+
else
209+
{
210+
/* EGL_MESA_query_driver was unavailable; let dri2.c select the
211+
* driver and fill in these fields for us.
212+
*/
213+
info.numDrivers = 0;
214+
info.driverNames = NULL;
215+
}
216+
#endif
174217
if (!DRI2ScreenInit(pScreen, &info))
175218
{
176219
return 1;

0 commit comments

Comments
 (0)