54
54
#include "rdpPri.h"
55
55
#include "rdpDraw.h"
56
56
57
+ #if defined(XORGXRDP_GLAMOR )
58
+ #include <glamor.h>
59
+ #endif
60
+
57
61
#define LLOG_LEVEL 1
58
62
#define LLOGLN (_level , _args ) \
59
63
do \
@@ -150,6 +154,9 @@ rdpDri2Init(ScreenPtr pScreen)
150
154
{
151
155
rdpPtr dev ;
152
156
DRI2InfoRec info ;
157
+ #if defined(XORGXRDP_GLAMOR )
158
+ const char * driver_names [2 ] = { NULL , NULL };
159
+ #endif
153
160
154
161
LLOGLN (0 , ("rdpDri2Init:" ));
155
162
dev = rdpGetDevFromScreen (pScreen );
@@ -171,6 +178,42 @@ rdpDri2Init(ScreenPtr pScreen)
171
178
info .CreateBuffer2 = rdpDri2CreateBuffer2 ;
172
179
info .DestroyBuffer2 = rdpDri2DestroyBuffer2 ;
173
180
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
174
217
if (!DRI2ScreenInit (pScreen , & info ))
175
218
{
176
219
return 1 ;
0 commit comments