diff options
author | Chad Versace <[email protected]> | 2014-01-28 11:41:46 -0800 |
---|---|---|
committer | Chad Versace <[email protected]> | 2014-03-17 15:36:03 -0700 |
commit | 90502b18b2b868250ab7e9189810ca42b3c812a1 (patch) | |
tree | d8c18fecf90bdf2665c1cb6e1d14e3e2a81aea0a /src/egl/drivers/dri2/platform_x11.c | |
parent | 38848b6217377064665e28441648352c2688edf3 (diff) |
egl/dri2: Move dri2_egl_display virtual funcs to vtbl
dri2_egl_display has only one virtual function, 'authenticate'. Define
dri2_egl_display::vtbl and move 'authenticate' there.
This prepares for the EGL platform extensions, which will add many
more virtual functions to dri2_egl_display.
Reviewed-by: Ian Romanick <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2/platform_x11.c')
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index d878b772d82..b5df0f990c8 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -985,6 +985,14 @@ dri2_x11_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, } } +static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = { + .authenticate = NULL, +}; + +static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = { + .authenticate = dri2_x11_authenticate, +}; + static EGLBoolean dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp) { @@ -1044,6 +1052,11 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp) disp->VersionMajor = 1; disp->VersionMinor = 4; + /* Fill vtbl last to prevent accidentally calling virtual function during + * initialization. + */ + dri2_dpy->vtbl = &dri2_x11_swrast_display_vtbl; + return EGL_TRUE; cleanup_configs: @@ -1209,12 +1222,15 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp) goto cleanup_configs; } - dri2_dpy->authenticate = dri2_x11_authenticate; - /* we're supporting EGL 1.4 */ disp->VersionMajor = 1; disp->VersionMinor = 4; + /* Fill vtbl last to prevent accidentally calling virtual function during + * initialization. + */ + dri2_dpy->vtbl = &dri2_x11_display_vtbl; + return EGL_TRUE; cleanup_configs: |