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

Sinclair Yeh syeh at vmware.com
Wed Apr 20 16:59:01 UTC 2016


Minor comment below.  Either way:

Reviewed-by: Sinclair Yeh <syeh at vmware.com>

On Wed, Apr 20, 2016 at 05:52:17PM +0200, Mircea Gherzan wrote:
> 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

Assuming rearranging the code won't cause too many issues, instead of
the double negative, "#ifdef MESA_EGL_NO_X11_HEADER" is easier to
read.

>  /**
>   * 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
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list