Call _mesa_resize_framebuffer() within intelWindowMoved(). Fixes
[mesa.git] / src / mesa / drivers / dri / i915 / intel_context.c
index c79ce9661c1bcad66dee9a22a541ae38342f228f..54b0960c565d3354fa27bea083bf434ea2b7ca71 100644 (file)
@@ -453,6 +453,7 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
    if (intel) {
       GLboolean   release_texture_heaps;
 
+      INTEL_FIREVERTICES( intel );
 
       intel->vtbl.destroy( intel );
 
@@ -551,10 +552,14 @@ void intelSetBackClipRects( intelContextPtr intel )
 
 void intelWindowMoved( intelContextPtr intel )
 {
+   __DRIdrawablePrivate *dPriv = intel->driDrawable;
+
    if (!intel->ctx.DrawBuffer) {
       intelSetFrontClipRects( intel );
    }
    else {
+      driUpdateFramebufferSize(&intel->ctx, intel->driDrawable);
+    
       switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
       case BUFFER_BIT_FRONT_LEFT:
         intelSetFrontClipRects( intel );
@@ -568,6 +573,10 @@ void intelWindowMoved( intelContextPtr intel )
       }
    }
 
+   _mesa_resize_framebuffer(&intel->ctx,
+                           (GLframebuffer*)dPriv->driverPrivate,
+                           dPriv->w, dPriv->h);
+   
    /* Set state we know depends on drawable parameters:
     */
    {
@@ -722,7 +731,7 @@ void intelSwapBuffers( __DRIdrawablePrivate *dPriv )
         if ( 0 /*intel->doPageFlip*/ ) { /* doPageFlip is never set !!! */
            intelPageFlip( dPriv );
         } else {
-           intelCopyBuffer( dPriv );
+            intelCopyBuffer( dPriv, NULL );
         }
          if (screen->current_rotation != 0) {
             intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
@@ -734,6 +743,29 @@ void intelSwapBuffers( __DRIdrawablePrivate *dPriv )
    }
 }
 
+void intelCopySubBuffer( __DRIdrawablePrivate *dPriv,
+                        int x, int y, int w, int h )
+{
+   if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
+      intelContextPtr intel;
+      GLcontext *ctx;
+      intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;
+      ctx = &intel->ctx;
+      if (ctx->Visual.doubleBufferMode) {
+         intelScreenPrivate *screen = intel->intelScreen;
+        drm_clip_rect_t rect;
+        rect.x1 = x + dPriv->x;
+        rect.y1 = (dPriv->h - y - h) + dPriv->y;
+        rect.x2 = rect.x1 + w;
+        rect.y2 = rect.y1 + h;
+        _mesa_notifySwapBuffers( ctx );  /* flush pending rendering comands */
+        intelCopyBuffer( dPriv, &rect );
+      }
+   } 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__);
+   }
+}
 
 void intelInitState( GLcontext *ctx )
 {