[Mesa-dev] [PATCH] include/GL: fix the interop header for a --disable-glx build

Mircea Gherzan mircea.gherzan at intel.com
Wed Apr 20 15:52:17 UTC 2016


This header should not blindly include the GLX and should also
conditionally define functions that use GLX parameters. The
MESA_EGL_NO_X11_HEADERS macro is used to check if we're building without
GLX support.

Signed-off-by: Mircea Gherzan <mircea.gherzan at intel.com>
---
 include/GL/mesa_glinterop.h | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h
index 814064d..cd3151f 100644
--- a/include/GL/mesa_glinterop.h
+++ b/include/GL/mesa_glinterop.h
@@ -50,7 +50,12 @@
 #ifndef MESA_GLINTEROP_H
 #define MESA_GLINTEROP_H
 
+#ifdef MESA_EGL_NO_X11_HEADERS
+#include <GL/gl.h>
+#else
 #include <GL/glx.h>
+#endif
+
 #include <EGL/egl.h>
 
 #ifdef __cplusplus
@@ -219,6 +224,7 @@ typedef struct _mesa_glinterop_export_out {
 } mesa_glinterop_export_out;
 
 
+#ifndef MESA_EGL_NO_X11_HEADERS
 /**
  * Query device information.
  *
@@ -232,16 +238,6 @@ GLAPI int GLAPIENTRY
 MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context,
                                 mesa_glinterop_device_info *out);
 
-
-/**
- * Same as MesaGLInteropGLXQueryDeviceInfo except that it accepts EGLDisplay
- * and EGLContext.
- */
-GLAPI int GLAPIENTRY
-MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context,
-                                mesa_glinterop_device_info *out);
-
-
 /**
  * Create and return a DMABUF handle corresponding to the given OpenGL
  * object, and return other parameters about the OpenGL object.
@@ -258,6 +254,20 @@ MesaGLInteropGLXExportObject(Display *dpy, GLXContext context,
                              const mesa_glinterop_export_in *in,
                              mesa_glinterop_export_out *out);
 
+typedef int (APIENTRYP PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, GLXContext context,
+                                                               mesa_glinterop_device_info *out);
+typedef int (APIENTRYP PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext context,
+                                                            const mesa_glinterop_export_in *in,
+                                                            mesa_glinterop_export_out *out);
+#endif /* MESA_EGL_NO_X11_HEADERS */
+
+/**
+ * Same as MesaGLInteropGLXQueryDeviceInfo except that it accepts EGLDisplay
+ * and EGLContext.
+ */
+GLAPI int GLAPIENTRY
+MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context,
+                                mesa_glinterop_device_info *out);
 
 /**
  * Same as MesaGLInteropGLXExportObject except that it accepts
@@ -268,18 +278,11 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context,
                              const mesa_glinterop_export_in *in,
                              mesa_glinterop_export_out *out);
 
-
-typedef int (APIENTRYP PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, GLXContext context,
-                                                               mesa_glinterop_device_info *out);
 typedef int (APIENTRYP PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context,
                                                                mesa_glinterop_device_info *out);
-typedef int (APIENTRYP PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext context,
-                                                            const mesa_glinterop_export_in *in,
-                                                            mesa_glinterop_export_out *out);
 typedef int (APIENTRYP PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext context,
                                                             const mesa_glinterop_export_in *in,
                                                             mesa_glinterop_export_out *out);
-
 #ifdef __cplusplus
 }
 #endif
-- 
2.5.0



More information about the mesa-dev mailing list