egl/main: Stop using EGLNative types internally
authorChad Versace <chad.versace@linux.intel.com>
Tue, 7 Jan 2014 22:54:51 +0000 (14:54 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Mon, 17 Mar 2014 22:39:23 +0000 (15:39 -0700)
Internally, much of the EGL code uses EGLNativeDisplayType,
EGLNativeWindowType, and EGLPixmapType. However, the EGLNative type
often does not match the variable's actual type.

The concept of EGLNative types are a bad match for Linux, as explained
below. And the EGL platform extensions don't use EGLNative types at all.
Those extensions attempt to solve cross-platform issues by moving the
EGL API away from the EGLNative types.

The core of the problem is that eglplatform.h can define each EGLNative
type once only, but Linux supports multiple EGL platforms.

To work around the problem, Mesa's eglplatform.h contains multiple
definitions of each EGLNative type, selected by feature macros. Mesa
expects EGL clients to set the feature macro approrpiately. But the
feature macros don't work when a single codebase must be built with
support for multiple EGL platforms, *such as Mesa itself*.

When building libEGL, autotools chooses the EGLNative typedefs based on
the first element of '--with-egl-platforms'. For example,
'--with-egl-platforms=x11,drm,wayland' defines the following:

    typedef Display* EGLNativeDisplayType;
    typedef Window   EGLNativeWindowType;
    typedef Pixmap   EGLNativePixmapType;

Clearly, this doesn't work well for Wayland and GBM.  Mesa works around
the problem by casting the EGLNative types to different things in
different files.

For sanity's sake, and to prepare for the EGL platform extensions, this
patch removes from egl/main and egl/dri2 all internal use of the
EGLNative types. It replaces them with 'void*' and checks each explicit
cast with a static assertion. Also, the patch touches egl_gallium the
minimal amount to keep it compatible with eglapi.h.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 files changed:
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/egl_dri2_fallbacks.h
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c
src/egl/main/eglapi.c
src/egl/main/eglapi.h
src/egl/main/egldisplay.c
src/egl/main/egldisplay.h
src/gallium/state_trackers/egl/common/egl_g3d_api.c

index 76dc7734d9e65ba3fe4c01922a2c4c5b3fbe662a..8abe8acdd34e32d9e47a4cdafa7271e9b25de4db 100644 (file)
@@ -1026,21 +1026,21 @@ dri2_get_proc_address(_EGLDriver *drv, const char *procname)
 
 static _EGLSurface*
 dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy,
-                           _EGLConfig *conf, EGLNativeWindowType window,
+                           _EGLConfig *conf, void *native_window,
                            const EGLint *attrib_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
-   return dri2_dpy->vtbl->create_window_surface(drv, dpy, conf, window,
+   return dri2_dpy->vtbl->create_window_surface(drv, dpy, conf, native_window,
                                                 attrib_list);
 }
 
 static _EGLSurface*
 dri2_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy,
-                           _EGLConfig *conf, EGLNativePixmapType pixmap,
+                           _EGLConfig *conf, void *native_pixmap,
                            const EGLint *attrib_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
-   return dri2_dpy->vtbl->create_pixmap_surface(drv, dpy, conf, pixmap,
+   return dri2_dpy->vtbl->create_pixmap_surface(drv, dpy, conf, native_pixmap,
                                                 attrib_list);
 }
 
@@ -1102,10 +1102,10 @@ dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
 
 static EGLBoolean
 dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
-                  EGLNativePixmapType target)
+                  void *native_pixmap_target)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
-   return dri2_dpy->vtbl->copy_buffers(drv, dpy, surf, target);
+   return dri2_dpy->vtbl->copy_buffers(drv, dpy, surf, native_pixmap_target);
 }
 
 static EGLint
index ad74015f73359e0e2bead525ae088763fa2492c2..e62e265b25e14fcd4bdaab86199a046c3b57e602 100644 (file)
@@ -91,12 +91,12 @@ struct dri2_egl_display_vtbl {
 
    _EGLSurface* (*create_window_surface)(_EGLDriver *drv, _EGLDisplay *dpy,
                                          _EGLConfig *config,
-                                         EGLNativeWindowType window,
+                                         void *native_window,
                                          const EGLint *attrib_list);
 
    _EGLSurface* (*create_pixmap_surface)(_EGLDriver *drv, _EGLDisplay *dpy,
                                          _EGLConfig *config,
-                                         EGLNativePixmapType pixmap,
+                                         void *native_pixmap,
                                          const EGLint *attrib_list);
 
    _EGLSurface* (*create_pbuffer_surface)(_EGLDriver *drv, _EGLDisplay *dpy,
@@ -131,7 +131,7 @@ struct dri2_egl_display_vtbl {
                                  EGLint width, EGLint height);
 
    EGLBoolean (*copy_buffers)(_EGLDriver *drv, _EGLDisplay *dpy,
-                              _EGLSurface *surf, EGLNativePixmapType target);
+                              _EGLSurface *surf, void *native_pixmap_target);
 
    EGLint (*query_buffer_age)(_EGLDriver *drv, _EGLDisplay *dpy,
                               _EGLSurface *surf);
index 80ed26d2fe5ff82a57db17be20fd4d98f74514ae..a5cf344f5e8fd7b2de68ed0728c6ca5641dbd809 100644 (file)
@@ -31,7 +31,7 @@ struct wl_buffer;
 static inline _EGLSurface *
 dri2_fallback_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
                                     _EGLConfig *conf,
-                                    EGLNativePixmapType pixmap,
+                                    void *native_pixmap,
                                     const EGLint *attrib_list)
 {
    return NULL;
@@ -79,7 +79,7 @@ dri2_fallback_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy,
 static inline EGLBoolean
 dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy,
                            _EGLSurface *surf,
-                           EGLNativePixmapType target)
+                           void *native_pixmap_target)
 {
    return EGL_FALSE;
 }
index db9edfaee5748013a64c4035f6c276d2da0f2dbf..7b1db7677ce9735ba5f6ad3972a055afab4f8f04 100644 (file)
@@ -194,12 +194,14 @@ droid_free_local_buffers(struct dri2_egl_surface *dri2_surf)
 
 static _EGLSurface *
 droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
-                   _EGLConfig *conf, EGLNativeWindowType window,
+                   _EGLConfig *conf, void *native_window,
                    const EGLint *attrib_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
    struct dri2_egl_surface *dri2_surf;
+   struct ANativeWindow *window = native_window;
+
    dri2_surf = calloc(1, sizeof *dri2_surf);
    if (!dri2_surf) {
       _eglError(EGL_BAD_ALLOC, "droid_create_surface");
@@ -254,11 +256,11 @@ cleanup_surface:
 
 static _EGLSurface *
 droid_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
-                          _EGLConfig *conf, EGLNativeWindowType window,
-                          const EGLint *attrib_list)
+                            _EGLConfig *conf, void *native_window,
+                            const EGLint *attrib_list)
 {
    return droid_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
-                             window, attrib_list);
+                               native_window, attrib_list);
 }
 
 static _EGLSurface *
index 8f9149d98aa352cc6c1a09bd9e0ce506489c30e9..785139e0eb36174703d510b1b43550fa4393c02d 100644 (file)
@@ -88,12 +88,13 @@ has_free_buffers(struct gbm_surface *_surf)
 
 static _EGLSurface *
 dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
-                        _EGLConfig *conf, EGLNativeWindowType window,
+                        _EGLConfig *conf, void *native_window,
                         const EGLint *attrib_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
    struct dri2_egl_surface *dri2_surf;
+   struct gbm_surface *window = native_window;
    struct gbm_dri_surface *surf;
 
    (void) drv;
@@ -111,7 +112,7 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
    case EGL_WINDOW_BIT:
       if (!window)
          return NULL;
-      surf = gbm_dri_surface((struct gbm_surface *) window);
+      surf = gbm_dri_surface(window);
       dri2_surf->gbm_surf = surf;
       dri2_surf->base.Width =  surf->base.width;
       dri2_surf->base.Height = surf->base.height;
@@ -141,11 +142,11 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
 
 static _EGLSurface *
 dri2_drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
-                               _EGLConfig *conf, EGLNativeWindowType window,
+                               _EGLConfig *conf, void *native_window,
                                const EGLint *attrib_list)
 {
    return dri2_drm_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
-                                  window, attrib_list);
+                                  native_window, attrib_list);
 }
 
 static EGLBoolean
index 02d70390fd25b3ba824b987db427dc847efb5e65..85564661e92ffdbbab6af53f4bb6bf692cf34323 100644 (file)
@@ -120,11 +120,12 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
  */
 static _EGLSurface *
 dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
-                       _EGLConfig *conf, EGLNativeWindowType window,
+                       _EGLConfig *conf, void *native_window,
                        const EGLint *attrib_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
+   struct wl_egl_window *window = native_window;
    struct dri2_egl_surface *dri2_surf;
 
    (void) drv;
@@ -148,7 +149,7 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
 
    switch (type) {
    case EGL_WINDOW_BIT:
-      dri2_surf->wl_win = (struct wl_egl_window *) window;
+      dri2_surf->wl_win = window;
 
       dri2_surf->wl_win->private = dri2_surf;
       dri2_surf->wl_win->resize_callback = resize_callback;
@@ -186,14 +187,14 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
  */
 static _EGLSurface *
 dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
-                              _EGLConfig *conf, EGLNativeWindowType window,
+                              _EGLConfig *conf, void *native_window,
                               const EGLint *attrib_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    _EGLSurface *surf;
 
    surf = dri2_wl_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
-                                 window, attrib_list);
+                                 native_window, attrib_list);
 
    if (surf != NULL)
       dri2_wl_swap_interval(drv, disp, surf, dri2_dpy->default_swap_interval);
index 82f3ce9fdc0e24233e1b3d9a71756ef8c32a2320..7b585a21971d8f6c6564e027a83b600d6339a2b6 100644 (file)
@@ -183,7 +183,7 @@ swrastGetImage(__DRIdrawable * read,
  */
 static _EGLSurface *
 dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
-                        _EGLConfig *conf, EGLNativeWindowType native_window,
+                        _EGLConfig *conf, void *native_surface,
                         const EGLint *attrib_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
@@ -193,7 +193,10 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
    xcb_get_geometry_reply_t *reply;
    xcb_screen_iterator_t s;
    xcb_generic_error_t *error;
-   xcb_drawable_t window = (uintptr_t )native_window;
+   xcb_drawable_t drawable;
+
+   STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_surface));
+   drawable = (uintptr_t) native_surface;
 
    (void) drv;
 
@@ -214,7 +217,7 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
                        dri2_surf->drawable, s.data->root,
                        dri2_surf->base.Width, dri2_surf->base.Height);
    } else {
-      dri2_surf->drawable = window;
+      dri2_surf->drawable = drawable;
    }
 
    if (dri2_dpy->dri2) {
@@ -278,14 +281,14 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
  */
 static _EGLSurface *
 dri2_x11_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
-                               _EGLConfig *conf, EGLNativeWindowType window,
+                               _EGLConfig *conf, void *native_window,
                                const EGLint *attrib_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    _EGLSurface *surf;
 
    surf = dri2_x11_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
-                                  window, attrib_list);
+                                  native_window, attrib_list);
    if (surf != NULL) {
       /* When we first create the DRI2 drawable, its swap interval on the
        * server side is 1.
@@ -301,11 +304,11 @@ dri2_x11_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
 
 static _EGLSurface *
 dri2_x11_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
-                               _EGLConfig *conf, EGLNativePixmapType pixmap,
+                               _EGLConfig *conf, void *native_pixmap,
                                const EGLint *attrib_list)
 {
    return dri2_x11_create_surface(drv, disp, EGL_PIXMAP_BIT, conf,
-                                  pixmap, attrib_list);
+                                  native_pixmap, attrib_list);
 }
 
 static _EGLSurface *
@@ -862,12 +865,15 @@ dri2_x11_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
 
 static EGLBoolean
 dri2_x11_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
-                      EGLNativePixmapType native_target)
+                      void *native_pixmap_target)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
    xcb_gcontext_t gc;
-   xcb_pixmap_t target = (uintptr_t )native_target;
+   xcb_pixmap_t target;
+
+   STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_pixmap_target));
+   target = (uintptr_t) native_pixmap_target;
 
    (void) drv;
 
index 950c447de9dd6ad609c0e4cb3cc09d6c874607c6..836714ce244342e8932c1700b033cba107706906 100644 (file)
@@ -296,8 +296,15 @@ _eglUnlockDisplay(_EGLDisplay *dpy)
 EGLDisplay EGLAPIENTRY
 eglGetDisplay(EGLNativeDisplayType nativeDisplay)
 {
-   _EGLPlatformType plat = _eglGetNativePlatform(nativeDisplay);
-   _EGLDisplay *dpy = _eglFindDisplay(plat, (void *) nativeDisplay);
+   _EGLPlatformType plat;
+   _EGLDisplay *dpy;
+   void *native_display_ptr;
+
+   STATIC_ASSERT(sizeof(void*) == sizeof(nativeDisplay));
+   native_display_ptr = (void*) nativeDisplay;
+
+   plat = _eglGetNativePlatform(native_display_ptr);
+   dpy = _eglFindDisplay(plat, native_display_ptr);
    return _eglGetDisplayHandle(dpy);
 }
 
@@ -529,12 +536,17 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
    _EGLDriver *drv;
    _EGLSurface *surf;
    EGLSurface ret;
+   void *native_window_ptr;
+
+   STATIC_ASSERT(sizeof(void*) == sizeof(window));
+   native_window_ptr = (void*) window;
 
    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
    if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
 
-   surf = drv->API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
+   surf = drv->API.CreateWindowSurface(drv, disp, conf, native_window_ptr,
+                                       attrib_list);
    ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
 
    RETURN_EGL_EVAL(disp, ret);
@@ -550,12 +562,17 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
    _EGLDriver *drv;
    _EGLSurface *surf;
    EGLSurface ret;
+   void *native_pixmap_ptr;
+
+   STATIC_ASSERT(sizeof(void*) == sizeof(pixmap));
+   native_pixmap_ptr = (void*) pixmap;
 
    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
    if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
 
-   surf = drv->API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
+   surf = drv->API.CreatePixmapSurface(drv, disp, conf, native_pixmap_ptr,
+                                       attrib_list);
    ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
 
    RETURN_EGL_EVAL(disp, ret);
@@ -740,11 +757,15 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
    _EGLSurface *surf = _eglLookupSurface(surface, disp);
    _EGLDriver *drv;
    EGLBoolean ret;
+   void *native_pixmap_ptr;
+
+   STATIC_ASSERT(sizeof(void*) == sizeof(target));
+   native_pixmap_ptr = (void*) target;
 
    _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
    if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE);
-   ret = drv->API.CopyBuffers(drv, disp, surf, target);
+   ret = drv->API.CopyBuffers(drv, disp, surf, native_pixmap_ptr);
 
    RETURN_EGL_EVAL(disp, ret);
 }
index 091c09cbfa88245e10c95a1f68fff84faa8e521a..f20ce5b701b383cd6c41f5f7db236d1edceb538d 100644 (file)
@@ -58,8 +58,8 @@ typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurfa
 typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value);
 
 /* surface funcs */
-typedef _EGLSurface *(*CreateWindowSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativeWindowType window, const EGLint *attrib_list);
-typedef _EGLSurface *(*CreatePixmapSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+typedef _EGLSurface *(*CreateWindowSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, void *native_window, const EGLint *attrib_list);
+typedef _EGLSurface *(*CreatePixmapSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, void *native_pixmap, const EGLint *attrib_list);
 typedef _EGLSurface *(*CreatePbufferSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list);
 typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface);
 typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint *value);
@@ -68,7 +68,7 @@ typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurf
 typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer);
 typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
 typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
-typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLNativePixmapType target);
+typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, void *native_pixmap_target);
 
 /* misc funcs */
 typedef const char *(*QueryString_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);
index bed7663efc5a5ff43b3acfbeeb9153028da16c72..b43e3ea5d9b2d5dd46bff4bb439c701dc2cf3a80 100644 (file)
@@ -139,7 +139,7 @@ _eglPointerIsDereferencable(void *p)
  * Try detecting native platform with the help of native display characteristcs.
  */
 static _EGLPlatformType
-_eglNativePlatformDetectNativeDisplay(EGLNativeDisplayType nativeDisplay)
+_eglNativePlatformDetectNativeDisplay(void *nativeDisplay)
 {
 #ifdef HAVE_FBDEV_PLATFORM
    struct stat buf;
@@ -186,7 +186,7 @@ _eglNativePlatformDetectNativeDisplay(EGLNativeDisplayType nativeDisplay)
  * Return the native platform.  It is the platform of the EGL native types.
  */
 _EGLPlatformType
-_eglGetNativePlatform(EGLNativeDisplayType nativeDisplay)
+_eglGetNativePlatform(void *nativeDisplay)
 {
    static _EGLPlatformType native_platform = _EGL_INVALID_PLATFORM;
    char *detection_method = NULL;
index 0952bc960cf867a8f62fb04b4ad597a1f03aabd4..911a2e9bd67a47a1a9936a51c94286c5606d2ef0 100644 (file)
@@ -162,7 +162,7 @@ struct _egl_display
 
 
 extern _EGLPlatformType
-_eglGetNativePlatform(EGLNativeDisplayType nativeDisplay);
+_eglGetNativePlatform(void *nativeDisplay);
 
 
 extern void
index 46a3245246fb373c3ef67825865f59e4a6b0e5af..b19d8998dbdaa92c5567cf85eda082278b654340 100644 (file)
@@ -315,11 +315,15 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
 
 static _EGLSurface *
 egl_g3d_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy,
-                              _EGLConfig *conf, EGLNativeWindowType win,
+                              _EGLConfig *conf, void *native_window,
                               const EGLint *attribs)
 {
+   EGLNativeWindowType win;
    struct egl_g3d_create_surface_arg arg;
 
+   STATIC_ASSERT(sizeof(EGLNativeWindowType) == sizeof(native_window));
+   win = (EGLNativeWindowType) native_window;
+
    memset(&arg, 0, sizeof(arg));
    arg.type = EGL_WINDOW_BIT;
    arg.u.win = win;
@@ -329,11 +333,15 @@ egl_g3d_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy,
 
 static _EGLSurface *
 egl_g3d_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy,
-                              _EGLConfig *conf, EGLNativePixmapType pix,
+                              _EGLConfig *conf, void *native_pixmap,
                               const EGLint *attribs)
 {
+   EGLNativePixmapType pix;
    struct egl_g3d_create_surface_arg arg;
 
+   STATIC_ASSERT(sizeof(EGLNativePixmapType) == sizeof(native_pixmap));
+   pix = (EGLNativePixmapType) native_pixmap;
+
    memset(&arg, 0, sizeof(arg));
    arg.type = EGL_PIXMAP_BIT;
    arg.u.pix = pix;
@@ -634,11 +642,15 @@ egl_g3d_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
 
 static EGLBoolean
 egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
-                     EGLNativePixmapType target)
+                     void *native_pixmap_target)
 {
    struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
    struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
    _EGLContext *ctx = _eglGetCurrentContext();
+   EGLNativePixmapType target;
+
+   STATIC_ASSERT(sizeof(EGLNativePixmapType) == sizeof(native_pixmap_target));
+   target = (EGLNativePixmapType) native_pixmap_target;
 
    if (!gsurf->render_texture)
       return EGL_TRUE;