From 51b00574a2ef81629548b079ef70c016bdd4251d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 15 Jan 2010 17:39:49 +0800 Subject: st/egl_g3d: Always override flush_frontbuffer. Instead of letting the native displays install their own version of flush_frontbuffer, always override the callback with a version that calls the flush_frontbuffer of the native surface. --- src/gallium/state_trackers/egl_g3d/common/egl_g3d.c | 10 ++++++---- src/gallium/state_trackers/egl_g3d/common/native.h | 17 +++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src/gallium/state_trackers/egl_g3d/common') diff --git a/src/gallium/state_trackers/egl_g3d/common/egl_g3d.c b/src/gallium/state_trackers/egl_g3d/common/egl_g3d.c index 8b69a8cfcb..7da9300c20 100644 --- a/src/gallium/state_trackers/egl_g3d/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl_g3d/common/egl_g3d.c @@ -24,6 +24,7 @@ #include #include +#include "pipe/p_screen.h" #include "util/u_memory.h" #include "egldriver.h" #include "eglcurrent.h" @@ -456,8 +457,8 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id) * Flush the front buffer of the context's draw surface. */ static void -egl_g3d_flush_frontbuffer(void *dummy, struct pipe_surface *surf, - void *context_private) +egl_g3d_flush_frontbuffer(struct pipe_screen *screen, + struct pipe_surface *surf, void *context_private) { struct egl_g3d_context *gctx = egl_g3d_context(context_private); struct egl_g3d_surface *gsurf = egl_g3d_surface(gctx->base.DrawSurface); @@ -509,13 +510,14 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy, } dpy->DriverData = gdpy; - gdpy->native = - native_create_display(dpy->NativeDisplay, egl_g3d_flush_frontbuffer); + gdpy->native = native_create_display(dpy->NativeDisplay); if (!gdpy->native) { _eglError(EGL_NOT_INITIALIZED, "eglInitialize(no usable display)"); goto fail; } + gdpy->native->screen->flush_frontbuffer = egl_g3d_flush_frontbuffer; + dpy->ClientAPIsMask = gdrv->api_mask; if (egl_g3d_add_configs(drv, dpy, 1) == 1) { diff --git a/src/gallium/state_trackers/egl_g3d/common/native.h b/src/gallium/state_trackers/egl_g3d/common/native.h index 4714e24b5c..1c3b016b98 100644 --- a/src/gallium/state_trackers/egl_g3d/common/native.h +++ b/src/gallium/state_trackers/egl_g3d/common/native.h @@ -114,7 +114,13 @@ struct native_display_modeset; * the native display server. */ struct native_display { + /** + * The pipe screen of the native display. + * + * Note that the "flush_frontbuffer" callback will be overridden. + */ struct pipe_screen *screen; + void (*destroy)(struct native_display *ndpy); /** @@ -204,19 +210,10 @@ struct native_display_modeset { const struct native_mode *nmode); }; -/** - * This function is called when the native display wants to display the front - * buffer of the draw surface of the given context. - */ -typedef void (*native_flush_frontbuffer)(void *dummy, - struct pipe_surface *surf, - void *context_private); - const char * native_get_name(void); struct native_display * -native_create_display(EGLNativeDisplayType dpy, - native_flush_frontbuffer flush_frontbuffer); +native_create_display(EGLNativeDisplayType dpy); #endif /* _NATIVE_H_ */ -- cgit v1.2.3