st/egl_g3d: Hook to update_buffer of the pipe screen.
authorChia-I Wu <olvaffe@gmail.com>
Fri, 15 Jan 2010 09:45:52 +0000 (17:45 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 15 Jan 2010 10:12:20 +0000 (18:12 +0800)
It is a notification from the client APIs that the surface size might
have changed.

src/gallium/state_trackers/egl_g3d/common/egl_g3d.c
src/gallium/state_trackers/egl_g3d/common/native.h

index 7da9300c20024909174e840d8f69c9973425abd6..d0c9755d5ed2b88cd1081807ece5720d926ec774 100644 (file)
@@ -469,6 +469,22 @@ egl_g3d_flush_frontbuffer(struct pipe_screen *screen,
    }
 }
 
+/**
+ * Re-validate the context.
+ */
+static void
+egl_g3d_update_buffer(struct pipe_screen *screen, void *context_private)
+{
+   struct egl_g3d_context *gctx = egl_g3d_context(context_private);
+
+   /**
+    * It is likely that the surface has changed when this function is called.
+    * Set force_validate to skip an unnecessary check.
+    */
+   gctx->force_validate = EGL_TRUE;
+   egl_g3d_validate_context(gctx->base.Display, &gctx->base);
+}
+
 static EGLBoolean
 egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
 {
@@ -517,6 +533,7 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
    }
 
    gdpy->native->screen->flush_frontbuffer = egl_g3d_flush_frontbuffer;
+   gdpy->native->screen->update_buffer = egl_g3d_update_buffer;
 
    dpy->ClientAPIsMask = gdrv->api_mask;
 
index 1c3b016b98a021d1c8f32872661ec0b9298ff83d..76f0e0c78acdb69b8d7ef2b5b3df0ac60d0d6604 100644 (file)
@@ -117,7 +117,8 @@ struct native_display {
    /**
     * The pipe screen of the native display.
     *
-    * Note that the "flush_frontbuffer" callback will be overridden.
+    * Note that the "flush_frontbuffer" and "update_buffer" callbacks will be
+    * overridden.
     */
    struct pipe_screen *screen;