rewrite/simplify intelSwapBuffers()
authorBrian <brian.paul@tungstengraphics.com>
Mon, 5 Nov 2007 17:01:51 +0000 (10:01 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Mon, 5 Nov 2007 17:01:51 +0000 (10:01 -0700)
src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c

index 0d5ceec1e5c0ef79c40a4e595936f127ea9fce4c..bc1ad04395fd6bf5785970ab35b7d877fda82285 100644 (file)
@@ -231,25 +231,18 @@ intelUpdateWindowSize(__DRIdrawablePrivate *dPriv)
 void
 intelSwapBuffers(__DRIdrawablePrivate * dPriv)
 {
-   if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
-      GET_CURRENT_CONTEXT(ctx);
-
-      if (ctx == NULL)
-        return;
+   struct intel_framebuffer *intel_fb = intel_framebuffer(dPriv);
+   struct pipe_surface *back_surf;
 
-      if (ctx->Visual.doubleBufferMode) {
-        struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
-         struct pipe_surface *back_surf
-            = st_get_framebuffer_surface(intel_fb->stfb, ST_SURFACE_BACK_LEFT);
+   assert(intel_fb);
+   assert(intel_fb->stfb);
 
-        _mesa_notifySwapBuffers(ctx);  /* flush pending rendering comands */
+   st_notify_swapbuffers(intel_fb->stfb);
 
-         intelDisplaySurface(dPriv, back_surf, NULL);
-      }
-   }
-   else {
-      /* XXX this shouldn't be an error but we can't handle it for now */
-      fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
+   back_surf = st_get_framebuffer_surface(intel_fb->stfb,
+                                          ST_SURFACE_BACK_LEFT);
+   if (back_surf) {
+      intelDisplaySurface(dPriv, back_surf, NULL);
    }
 }