summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2014-01-07 14:54:51 -0800
committerChad Versace <chad.versace@linux.intel.com>2014-03-17 15:39:23 -0700
commit6d1f83ec09164bd805c90785635bbcf861b403e5 (patch)
tree8b4ec7c4d8322e62ec78df551d91cb14d79149be
parentcefa06cd6967f2c2db2acfb54a4bf3be398a3ce8 (diff)
egl/main: Stop using EGLNative types internally
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>
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c12
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h6
-rw-r--r--src/egl/drivers/dri2/egl_dri2_fallbacks.h4
-rw-r--r--src/egl/drivers/dri2/platform_android.c10
-rw-r--r--src/egl/drivers/dri2/platform_drm.c9
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c9
-rw-r--r--src/egl/drivers/dri2/platform_x11.c24
-rw-r--r--src/egl/main/eglapi.c31
-rw-r--r--src/egl/main/eglapi.h6
-rw-r--r--src/egl/main/egldisplay.c4
-rw-r--r--src/egl/main/egldisplay.h2
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c18
12 files changed, 89 insertions, 46 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 76dc7734d9e..8abe8acdd34 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -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
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index ad74015f733..e62e265b25e 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -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);
diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
index 80ed26d2fe5..a5cf344f5e8 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -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;
}
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index db9edfaee57..7b1db7677ce 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -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 *
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 8f9149d98aa..785139e0eb3 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -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
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 02d70390fd2..85564661e92 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -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);
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 82f3ce9fdc0..7b585a21971 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -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;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 950c447de9d..836714ce244 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -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);
}
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index 091c09cbfa8..f20ce5b701b 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -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);
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index bed7663efc5..b43e3ea5d9b 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -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;
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 0952bc960cf..911a2e9bd67 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -162,7 +162,7 @@ struct _egl_display
extern _EGLPlatformType
-_eglGetNativePlatform(EGLNativeDisplayType nativeDisplay);
+_eglGetNativePlatform(void *nativeDisplay);
extern void
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index 46a3245246f..b19d8998dbd 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -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;