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

Mircea Gherzan mircea.gherzan at intel.com
Wed Apr 20 21:50:43 UTC 2016


On 20-Apr-16 6:59 PM, Sinclair Yeh wrote:
> 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.

This particular #ifdef has no #else and, AFAIK, there's not 
MESA_EGL_HAS_X11_HEADERS macro (or any macro as a negation of 
MESA_EGL_NO_X11_HEADERS) so I do not see a way to rewrite this.

>
>>  /**
>>   * 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


-- 
- Mircea


More information about the mesa-dev mailing list