[PATCH xserver] glamor: use drmGetDeviceNameFromFD2 when available

Qiang Yu Qiang.Yu at amd.com
Tue Mar 7 03:53:23 UTC 2017


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

Signed-off-by: Qiang Yu <Qiang.Yu at amd.com>
---
 configure.ac            | 3 +++
 glamor/glamor_egl.c     | 4 ++++
 include/dix-config.h.in | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/configure.ac b/configure.ac
index 110027d..ac11e65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
 
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 4bde637..ca94227 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -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,
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index d357910..c3f956d 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -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
 
-- 
2.7.4



More information about the xorg-devel mailing list