summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/egl/drivers/glx/egl_glx.c29
-rw-r--r--src/egl/drivers/xdri/egl_xdri.c42
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.h39
3 files changed, 13 insertions, 97 deletions
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 8e6b5b07a2f..3cbfebe4881 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -116,35 +116,14 @@ struct GLX_egl_config
int index;
};
-/** cast wrapper */
-static struct GLX_egl_driver *
-GLX_egl_driver(_EGLDriver *drv)
-{
- return (struct GLX_egl_driver *) drv;
-}
-
-static struct GLX_egl_display *
-GLX_egl_display(_EGLDisplay *dpy)
-{
- return (struct GLX_egl_display *) dpy->DriverData;
-}
-
-static struct GLX_egl_context *
-GLX_egl_context(_EGLContext *ctx)
-{
- return (struct GLX_egl_context *) ctx;
-}
-
-static struct GLX_egl_surface *
-GLX_egl_surface(_EGLSurface *surf)
-{
- return (struct GLX_egl_surface *) surf;
-}
+/* standard typecasts */
+_EGL_DRIVER_STANDARD_TYPECASTS(GLX_egl)
static int
GLX_egl_config_index(_EGLConfig *conf)
{
- return ((struct GLX_egl_config *) conf)->index;
+ struct GLX_egl_config *GLX_conf = GLX_egl_config(conf);
+ return GLX_conf->index;
}
diff --git a/src/egl/drivers/xdri/egl_xdri.c b/src/egl/drivers/xdri/egl_xdri.c
index 68e659eb276..555473c00a5 100644
--- a/src/egl/drivers/xdri/egl_xdri.c
+++ b/src/egl/drivers/xdri/egl_xdri.c
@@ -112,43 +112,13 @@ struct xdri_egl_config
-/** cast wrapper */
-static INLINE struct xdri_egl_driver *
-xdri_egl_driver(_EGLDriver *drv)
-{
- return (struct xdri_egl_driver *) drv;
-}
-
+/* standard typecasts */
+_EGL_DRIVER_STANDARD_TYPECASTS(xdri_egl)
-static INLINE struct xdri_egl_display *
-lookup_display(_EGLDisplay *dpy)
-{
- return (struct xdri_egl_display *) dpy->DriverData;
-}
-
-
-/** Map EGLSurface handle to xdri_egl_surface object */
-static INLINE struct xdri_egl_surface *
-lookup_surface(_EGLSurface *surface)
-{
- return (struct xdri_egl_surface *) surface;
-}
-
-
-/** Map EGLContext handle to xdri_egl_context object */
-static INLINE struct xdri_egl_context *
-lookup_context(_EGLContext *context)
-{
- return (struct xdri_egl_context *) context;
-}
-
-
-/** Map EGLConfig handle to xdri_egl_config object */
-static INLINE struct xdri_egl_config *
-lookup_config(_EGLConfig *conf)
-{
- return (struct xdri_egl_config *) conf;
-}
+#define lookup_display(dpy) xdri_egl_display(dpy)
+#define lookup_context(ctx) xdri_egl_context(ctx)
+#define lookup_surface(surf) xdri_egl_surface(surf)
+#define lookup_config(conf) xdri_egl_config(conf)
/** Get size of given window */
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
index 3dae8c40529..5d2d9c481ab 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
@@ -87,41 +87,8 @@ struct egl_g3d_screen {
const struct native_mode **native_modes;
};
-static INLINE struct egl_g3d_driver *
-egl_g3d_driver(_EGLDriver *drv)
-{
- return (struct egl_g3d_driver *) drv;
-}
-
-static INLINE struct egl_g3d_display *
-egl_g3d_display(_EGLDisplay *dpy)
-{
- /* note that it is not direct casting */
- return (struct egl_g3d_display *) dpy->DriverData;
-}
-
-static INLINE struct egl_g3d_context *
-egl_g3d_context(_EGLContext *ctx)
-{
- return (struct egl_g3d_context *) ctx;
-}
-
-static INLINE struct egl_g3d_surface *
-egl_g3d_surface(_EGLSurface *surf)
-{
- return (struct egl_g3d_surface *) surf;
-}
-
-static INLINE struct egl_g3d_config *
-egl_g3d_config(_EGLConfig *conf)
-{
- return (struct egl_g3d_config *) conf;
-}
-
-static INLINE struct egl_g3d_screen *
-egl_g3d_screen(_EGLScreen *scr)
-{
- return (struct egl_g3d_screen *) scr;
-}
+/* standard typecasts */
+_EGL_DRIVER_STANDARD_TYPECASTS(egl_g3d)
+_EGL_DRIVER_TYPECAST(egl_g3d_screen, _EGLScreen, obj)
#endif /* _EGL_G3D_H_ */