[Mesa-dev] [PATCH 04/15] egl: import headers from Khronos EGL registry

Emil Velikov emil.l.velikov at gmail.com
Thu May 14 15:33:35 PDT 2015


Hi Marek,
On 12/05/15 22:54, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> with the extension of keeping:
>     #define KHRONOS_APICALL __attribute__((visibility("default")))
> 
> And don't include mesa headers in egl.h.
Can we do this more gradually (like below). It will ease the conflicts
that this patch might cause.

 - egl.h - should have no side effects
 - eglext.h and eglmesaext.h - will clearly illustrate the parts that
have been moved from the latter to the former.
 - eglplatform.h and khrplatform.h - there are a few controversial
changes which might cause breakage.


> ---
>  include/EGL/egl.h          | 562 +++++++++++++++++++++------------------------
>  include/EGL/eglext.h       | 259 +++++++++++++++++++--
>  include/EGL/eglplatform.h  |  45 +---
>  include/KHR/khrplatform.h  |  25 +-
>  src/egl/main/egltypedefs.h |   2 +
>  5 files changed, 540 insertions(+), 353 deletions(-)
> 

> diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
> index 2eb6865..1284089 100644
> --- a/include/EGL/eglplatform.h
> +++ b/include/EGL/eglplatform.h

> -#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
> +#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
>  
>  typedef int   EGLNativeDisplayType;
>  typedef void *EGLNativeWindowType;
>  typedef void *EGLNativePixmapType;
>  
> -#elif defined(WL_EGL_PLATFORM)
> +#elif defined(__ANDROID__) || defined(ANDROID)
>  
> -typedef struct wl_display     *EGLNativeDisplayType;
> -typedef struct wl_egl_pixmap  *EGLNativePixmapType;
> -typedef struct wl_egl_window  *EGLNativeWindowType;
> +#include <android/native_window.h>
>  
> -#elif defined(__GBM__)
> -
> -typedef struct gbm_device  *EGLNativeDisplayType;
> -typedef struct gbm_bo      *EGLNativePixmapType;
> -typedef void               *EGLNativeWindowType;
> -
> -#elif defined(ANDROID) /* Android */
> -
> -struct ANativeWindow;
>  struct egl_native_pixmap_t;
>  
> -typedef struct ANativeWindow        *EGLNativeWindowType;
> -typedef struct egl_native_pixmap_t  *EGLNativePixmapType;
> -typedef void                        *EGLNativeDisplayType;
> +typedef struct ANativeWindow*           EGLNativeWindowType;
> +typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
> +typedef void*                           EGLNativeDisplayType;
>  
>  #elif defined(__unix__)
>  
> -#if defined(MESA_EGL_NO_X11_HEADERS)
> -
> -typedef void            *EGLNativeDisplayType;
> -typedef khronos_uintptr_t EGLNativePixmapType;
> -typedef khronos_uintptr_t EGLNativeWindowType;
> -
> -#else
> -
>  /* X11 (tentative)  */
>  #include <X11/Xlib.h>
>  #include <X11/Xutil.h>
> @@ -122,18 +103,8 @@ typedef Display *EGLNativeDisplayType;
>  typedef Pixmap   EGLNativePixmapType;
>  typedef Window   EGLNativeWindowType;
>  
> -#endif /* MESA_EGL_NO_X11_HEADERS */
> -
> -#elif __HAIKU__
> -#include <kernel/image.h>
> -typedef void				*EGLNativeDisplayType;
> -typedef khronos_uintptr_t	 EGLNativePixmapType;
> -typedef khronos_uintptr_t	 EGLNativeWindowType;
> -
Upon closer look, one could get away with the above changes, although
there may be something more subtle to it.

Kristian, Chad,

Would you have any suggestions for/against nuking the Wayland/GBM/other
typedefs ? With an extra eye on the Haiku changes, what would it take to
get the current eglplatform.h (or equivalent) accepted with Khronos ?


> diff --git a/include/KHR/khrplatform.h b/include/KHR/khrplatform.h
> index 4479539..faa0ed7 100644
> --- a/include/KHR/khrplatform.h
> +++ b/include/KHR/khrplatform.h

>  #if defined(_WIN32) && !defined(__SCITECH_SNAP__)
> -#   if defined(KHRONOS_DLL_EXPORTS)
> -#      define KHRONOS_APICALL __declspec(dllexport)
> -#   else
> -#      define KHRONOS_APICALL __declspec(dllimport)
> -#   endif
> +#   define KHRONOS_APICALL __declspec(dllimport)
This might cause a problem with our Windows/SCons build. On the surface
it seems to rely on KHRONOS_DLL_EXPORTS. Although we do have module
definition files, which set the correct symbols as external.

Perhaps Jose/Brian might be able to confirm if things are good or go
pear-shaped ?


> diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h
> index e90959a..2430033 100644
> --- a/src/egl/main/egltypedefs.h
> +++ b/src/egl/main/egltypedefs.h
> @@ -35,6 +35,8 @@
>  
>  #include <EGL/egl.h>
>  #include <EGL/eglext.h>
> +#include <EGL/eglextchromium.h>
> +#include <EGL/eglmesaext.h>
>  
If my memory recalls correctly there was a discussion that
additional/third party extension headers should be included from within
eglext.h. Although I'm struggling to find the quote plus was never a fan
of it.

This will require that we check all possible users of the remaining
mesa/chromium extensions and update them :\


-Emil


More information about the mesa-dev mailing list