glamor: use drmGetDeviceNameFromFD2 when available

This is for glamor can support fd from DRM render node which is useful
for a render only DDX.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
This commit is contained in:
Qiang Yu 2017-03-07 11:53:23 +08:00 committed by Adam Jackson
parent d4b7e0eaa4
commit 9232835bd1
3 changed files with 10 additions and 0 deletions

View File

@ -2166,6 +2166,9 @@ if test "x$GLAMOR" = xyes; then
AC_MSG_ERROR([Glamor for Xorg requires $LIBGBM])
fi
fi
PKG_CHECK_MODULES(LIBDRM, "libdrm >= 2.4.74",
[AC_DEFINE(GLAMOR_HAS_DRM_NAME_FROM_FD_2, 1, [Have GLAMOR_HAS_DRM_NAME_FROM_FD_2])], [])
fi
AM_CONDITIONAL([GLAMOR_EGL], [test "x$GBM" = xyes])

View File

@ -685,7 +685,11 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
/* To do DRI3 device FD generation, we need to open a new fd
* to the same device we were handed in originally.
*/
#ifdef GLAMOR_HAS_DRM_NAME_FROM_FD_2
glamor_egl->device_path = drmGetDeviceNameFromFd2(glamor_egl->fd);
#else
glamor_egl->device_path = drmGetDeviceNameFromFd(glamor_egl->fd);
#endif
if (!dri3_screen_init(screen, &glamor_dri3_info)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,

View File

@ -518,6 +518,9 @@
/* Build glamor/gbm has linear support */
#undef GLAMOR_HAS_GBM_LINEAR
/* Build glamor use new drmGetDeviceNameFromFD2 */
#undef GLAMOR_HAS_DRM_NAME_FROM_FD_2
/* byte order */
#undef X_BYTE_ORDER