Re: [Mesa-dev] [PATCH] mesa_glinterop: allow building without X and related headers
On 12 October 2016 at 22:19, Vinson Lee wrote: > Builds okay with this patch for me. > Smashing. Thanks for the testing gents ! Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa_glinterop: allow building without X and related headers
Thanks Emil! Reviewed-by: Tapani Pälli On 10/12/2016 08:49 PM, Emil Velikov wrote: This commit effectively reverts c10dcb2ce837922c6ee4e191e6d6202098a5ee10 and fixes the typedef redefinition which inspired it. In order to prevent requiring X packages at build time earlier commit forward declared the required X/GLX typedefs. Since that approach introduced typedef redefinition (a C11 feature) it was reverted. To avoid the redefinition while _not_ mandating X and related headers forward declare the structs and use those through the header. As anyone uses the mesa interop header they ensure that the X (or others in terms of EGL) headers are included, which ensures that everything is resolved within the compilation unit. Cc: Vinson Lee Cc: "12.0" Cc: Tapani Pälli Cc: Chih-Wei Huang Fixes: c10dcb2ce837 ("Revert "mesa_glinterop: remove inclusion of GLX header"") Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770 Signed-off-by: Emil Velikov --- TL;DR; Yay typedefs, because they make things so much better ;-) Tapani/Chih-Wei, this should fix the breakage that you are seing. Please let me know if it sorts things on your end. Vison, this should resolve things on your end as well. A confirmation would be great. --- include/GL/mesa_glinterop.h | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h index c6a967e..173476a 100644 --- a/include/GL/mesa_glinterop.h +++ b/include/GL/mesa_glinterop.h @@ -52,12 +52,15 @@ #include #include -#include #ifdef __cplusplus extern "C" { #endif +/* Forward declarations to avoid inclusion of GL/glx.h */ +struct _XDisplay; +struct __GLXcontextRec; + /* Forward declarations to avoid inclusion of EGL/egl.h */ typedef void *EGLDisplay; typedef void *EGLContext; @@ -243,7 +246,7 @@ struct mesa_glinterop_export_out { * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error */ int -MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context, +MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct __GLXcontextRec *context, struct mesa_glinterop_device_info *out); @@ -268,7 +271,7 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context, * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error */ int -MesaGLInteropGLXExportObject(Display *dpy, GLXContext context, +MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec *context, struct mesa_glinterop_export_in *in, struct mesa_glinterop_export_out *out); @@ -283,11 +286,11 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context, struct mesa_glinterop_export_out *out); -typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, GLXContext context, +typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context, struct mesa_glinterop_device_info *out); typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context, struct mesa_glinterop_device_info *out); -typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext context, +typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context, struct mesa_glinterop_export_in *in, struct mesa_glinterop_export_out *out); typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext context, ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa_glinterop: allow building without X and related headers
On Wed, Oct 12, 2016 at 10:49 AM, Emil Velikov wrote: > This commit effectively reverts c10dcb2ce837922c6ee4e191e6d6202098a5ee10 > and fixes the typedef redefinition which inspired it. > > In order to prevent requiring X packages at build time earlier commit > forward declared the required X/GLX typedefs. Since that approach > introduced typedef redefinition (a C11 feature) it was reverted. > > To avoid the redefinition while _not_ mandating X and related headers > forward declare the structs and use those through the header. > > As anyone uses the mesa interop header they ensure that the X (or others > in terms of EGL) headers are included, which ensures that everything is > resolved within the compilation unit. > > Cc: Vinson Lee > Cc: "12.0" > Cc: Tapani Pälli > Cc: Chih-Wei Huang > Fixes: c10dcb2ce837 ("Revert "mesa_glinterop: remove inclusion of GLX > header"") > Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header") > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770 > Signed-off-by: Emil Velikov > --- > TL;DR; Yay typedefs, because they make things so much better ;-) > > Tapani/Chih-Wei, this should fix the breakage that you are seing. Please > let me know if it sorts things on your end. > > Vison, this should resolve things on your end as well. A confirmation > would be great. > --- > include/GL/mesa_glinterop.h | 13 - > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h > index c6a967e..173476a 100644 > --- a/include/GL/mesa_glinterop.h > +++ b/include/GL/mesa_glinterop.h > @@ -52,12 +52,15 @@ > > #include > #include > -#include > > #ifdef __cplusplus > extern "C" { > #endif > > +/* Forward declarations to avoid inclusion of GL/glx.h */ > +struct _XDisplay; > +struct __GLXcontextRec; > + > /* Forward declarations to avoid inclusion of EGL/egl.h */ > typedef void *EGLDisplay; > typedef void *EGLContext; > @@ -243,7 +246,7 @@ struct mesa_glinterop_export_out { > * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error > */ > int > -MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context, > +MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct > __GLXcontextRec *context, > struct mesa_glinterop_device_info *out); > > > @@ -268,7 +271,7 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, > EGLContext context, > * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error > */ > int > -MesaGLInteropGLXExportObject(Display *dpy, GLXContext context, > +MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec > *context, > struct mesa_glinterop_export_in *in, > struct mesa_glinterop_export_out *out); > > @@ -283,11 +286,11 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext > context, > struct mesa_glinterop_export_out *out); > > > -typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, > GLXContext context, > +typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, > struct __GLXcontextRec *context, > struct > mesa_glinterop_device_info *out); > typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, > EGLContext context, > struct > mesa_glinterop_device_info *out); > -typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext > context, > +typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(struct _XDisplay *dpy, > struct __GLXcontextRec *context, >struct > mesa_glinterop_export_in *in, >struct > mesa_glinterop_export_out *out); > typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext > context, > -- > 2.10.0 > Builds okay with this patch for me. Tested-by: Vinson Lee ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa_glinterop: allow building without X and related headers
On 12 October 2016 at 19:15, Chih-Wei Huang wrote: > 2016-10-13 1:49 GMT+08:00 Emil Velikov : >> This commit effectively reverts c10dcb2ce837922c6ee4e191e6d6202098a5ee10 >> and fixes the typedef redefinition which inspired it. >> >> In order to prevent requiring X packages at build time earlier commit >> forward declared the required X/GLX typedefs. Since that approach >> introduced typedef redefinition (a C11 feature) it was reverted. >> >> To avoid the redefinition while _not_ mandating X and related headers >> forward declare the structs and use those through the header. >> >> As anyone uses the mesa interop header they ensure that the X (or others >> in terms of EGL) headers are included, which ensures that everything is >> resolved within the compilation unit. >> >> Cc: Vinson Lee >> Cc: "12.0" >> Cc: Tapani Pälli >> Cc: Chih-Wei Huang >> Fixes: c10dcb2ce837 ("Revert "mesa_glinterop: remove inclusion of GLX >> header"") >> Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header") >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770 >> Signed-off-by: Emil Velikov >> --- >> TL;DR; Yay typedefs, because they make things so much better ;-) >> >> Tapani/Chih-Wei, this should fix the breakage that you are seing. Please >> let me know if it sorts things on your end. >> >> Vison, this should resolve things on your end as well. A confirmation >> would be great. >> --- >> include/GL/mesa_glinterop.h | 13 - >> 1 file changed, 8 insertions(+), 5 deletions(-) >> >> diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h >> index c6a967e..173476a 100644 >> --- a/include/GL/mesa_glinterop.h >> +++ b/include/GL/mesa_glinterop.h >> @@ -52,12 +52,15 @@ >> >> #include >> #include >> -#include >> >> #ifdef __cplusplus >> extern "C" { >> #endif >> >> +/* Forward declarations to avoid inclusion of GL/glx.h */ >> +struct _XDisplay; >> +struct __GLXcontextRec; >> + >> /* Forward declarations to avoid inclusion of EGL/egl.h */ >> typedef void *EGLDisplay; >> typedef void *EGLContext; >> @@ -243,7 +246,7 @@ struct mesa_glinterop_export_out { >> * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error >> */ >> int >> -MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context, >> +MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct >> __GLXcontextRec *context, >> struct mesa_glinterop_device_info *out); >> >> >> @@ -268,7 +271,7 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, >> EGLContext context, >> * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error >> */ >> int >> -MesaGLInteropGLXExportObject(Display *dpy, GLXContext context, >> +MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec >> *context, >> struct mesa_glinterop_export_in *in, >> struct mesa_glinterop_export_out *out); >> >> @@ -283,11 +286,11 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, >> EGLContext context, >> struct mesa_glinterop_export_out *out); >> >> >> -typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, >> GLXContext context, >> +typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, >> struct __GLXcontextRec *context, >> struct >> mesa_glinterop_device_info *out); >> typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, >> EGLContext context, >> struct >> mesa_glinterop_device_info *out); >> -typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext >> context, >> +typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(struct _XDisplay *dpy, >> struct __GLXcontextRec *context, >>struct >> mesa_glinterop_export_in *in, >>struct >> mesa_glinterop_export_out *out); >> typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, >> EGLContext context, >> -- >> 2.10.0 >> > > Build OK on Android 7.0. Thanks! > > BTW, the typedef EGLDisplay and EGLContext > has similar redefinition issues. > Should we fix them in the same way? > Yes and no... for EGL the actual typedefs vary based on some very "interesting" and fragile heuristics. So one would either need to a) import the here (very bad idea), b) see how my earlier series to untangle it goes [1] and use the 'generic' typedef or c) see if is an actual issue somewhere and worry about it then. I'm leaning towards the last one ;-) Emil [1] https://patchwork.freedesktop.org/series/12778/ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa_glinterop: allow building without X and related headers
2016-10-13 1:49 GMT+08:00 Emil Velikov : > This commit effectively reverts c10dcb2ce837922c6ee4e191e6d6202098a5ee10 > and fixes the typedef redefinition which inspired it. > > In order to prevent requiring X packages at build time earlier commit > forward declared the required X/GLX typedefs. Since that approach > introduced typedef redefinition (a C11 feature) it was reverted. > > To avoid the redefinition while _not_ mandating X and related headers > forward declare the structs and use those through the header. > > As anyone uses the mesa interop header they ensure that the X (or others > in terms of EGL) headers are included, which ensures that everything is > resolved within the compilation unit. > > Cc: Vinson Lee > Cc: "12.0" > Cc: Tapani Pälli > Cc: Chih-Wei Huang > Fixes: c10dcb2ce837 ("Revert "mesa_glinterop: remove inclusion of GLX > header"") > Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header") > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770 > Signed-off-by: Emil Velikov > --- > TL;DR; Yay typedefs, because they make things so much better ;-) > > Tapani/Chih-Wei, this should fix the breakage that you are seing. Please > let me know if it sorts things on your end. > > Vison, this should resolve things on your end as well. A confirmation > would be great. > --- > include/GL/mesa_glinterop.h | 13 - > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h > index c6a967e..173476a 100644 > --- a/include/GL/mesa_glinterop.h > +++ b/include/GL/mesa_glinterop.h > @@ -52,12 +52,15 @@ > > #include > #include > -#include > > #ifdef __cplusplus > extern "C" { > #endif > > +/* Forward declarations to avoid inclusion of GL/glx.h */ > +struct _XDisplay; > +struct __GLXcontextRec; > + > /* Forward declarations to avoid inclusion of EGL/egl.h */ > typedef void *EGLDisplay; > typedef void *EGLContext; > @@ -243,7 +246,7 @@ struct mesa_glinterop_export_out { > * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error > */ > int > -MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context, > +MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct > __GLXcontextRec *context, > struct mesa_glinterop_device_info *out); > > > @@ -268,7 +271,7 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, > EGLContext context, > * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error > */ > int > -MesaGLInteropGLXExportObject(Display *dpy, GLXContext context, > +MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec > *context, > struct mesa_glinterop_export_in *in, > struct mesa_glinterop_export_out *out); > > @@ -283,11 +286,11 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext > context, > struct mesa_glinterop_export_out *out); > > > -typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, > GLXContext context, > +typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, > struct __GLXcontextRec *context, > struct > mesa_glinterop_device_info *out); > typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, > EGLContext context, > struct > mesa_glinterop_device_info *out); > -typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext > context, > +typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(struct _XDisplay *dpy, > struct __GLXcontextRec *context, >struct > mesa_glinterop_export_in *in, >struct > mesa_glinterop_export_out *out); > typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext > context, > -- > 2.10.0 > Build OK on Android 7.0. Thanks! BTW, the typedef EGLDisplay and EGLContext has similar redefinition issues. Should we fix them in the same way? [ 95% 667/699] target C: libGLES_mesa <= external/mesa/src/egl/drivers/dri2/egl_dri2.c In file included from external/mesa/src/egl/drivers/dri2/egl_dri2.c:58: In file included from external/mesa/src/egl/drivers/dri2/egl_dri2.h:73: In file included from external/mesa/src/egl/main/eglconfig.h:39: In file included from external/mesa/src/egl/main/egltypedefs.h:34: external/mesa/include/EGL/egl.h:55:15: warning: redefinition of typedef 'EGLDisplay' is a C11 feature [-Wtypedef-redefinition] typedef void *EGLDisplay; ^ external/mesa/include/GL/mesa_glinterop.h:65:15: note: previous definition is here typedef void *EGLDisplay; ^ In file included from external/mesa/src/egl/drivers/dri2/egl_dri2.c:58: In file included from external/mesa/src/egl/drivers/dri2/egl_dri2.h:73: In file included from external/mesa/src/egl/main/eglconfi
[Mesa-dev] [PATCH] mesa_glinterop: allow building without X and related headers
This commit effectively reverts c10dcb2ce837922c6ee4e191e6d6202098a5ee10 and fixes the typedef redefinition which inspired it. In order to prevent requiring X packages at build time earlier commit forward declared the required X/GLX typedefs. Since that approach introduced typedef redefinition (a C11 feature) it was reverted. To avoid the redefinition while _not_ mandating X and related headers forward declare the structs and use those through the header. As anyone uses the mesa interop header they ensure that the X (or others in terms of EGL) headers are included, which ensures that everything is resolved within the compilation unit. Cc: Vinson Lee Cc: "12.0" Cc: Tapani Pälli Cc: Chih-Wei Huang Fixes: c10dcb2ce837 ("Revert "mesa_glinterop: remove inclusion of GLX header"") Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770 Signed-off-by: Emil Velikov --- TL;DR; Yay typedefs, because they make things so much better ;-) Tapani/Chih-Wei, this should fix the breakage that you are seing. Please let me know if it sorts things on your end. Vison, this should resolve things on your end as well. A confirmation would be great. --- include/GL/mesa_glinterop.h | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h index c6a967e..173476a 100644 --- a/include/GL/mesa_glinterop.h +++ b/include/GL/mesa_glinterop.h @@ -52,12 +52,15 @@ #include #include -#include #ifdef __cplusplus extern "C" { #endif +/* Forward declarations to avoid inclusion of GL/glx.h */ +struct _XDisplay; +struct __GLXcontextRec; + /* Forward declarations to avoid inclusion of EGL/egl.h */ typedef void *EGLDisplay; typedef void *EGLContext; @@ -243,7 +246,7 @@ struct mesa_glinterop_export_out { * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error */ int -MesaGLInteropGLXQueryDeviceInfo(Display *dpy, GLXContext context, +MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct __GLXcontextRec *context, struct mesa_glinterop_device_info *out); @@ -268,7 +271,7 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context, * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error */ int -MesaGLInteropGLXExportObject(Display *dpy, GLXContext context, +MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec *context, struct mesa_glinterop_export_in *in, struct mesa_glinterop_export_out *out); @@ -283,11 +286,11 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context, struct mesa_glinterop_export_out *out); -typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display *dpy, GLXContext context, +typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context, struct mesa_glinterop_device_info *out); typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context, struct mesa_glinterop_device_info *out); -typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display *dpy, GLXContext context, +typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context, struct mesa_glinterop_export_in *in, struct mesa_glinterop_export_out *out); typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext context, -- 2.10.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev