intel: Move swap-related functions from intel_buffers.c to new intel_swapbuffers.c
authorBrian Paul <brianp@vmware.com>
Mon, 26 Jan 2009 18:53:06 +0000 (11:53 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 26 Jan 2009 19:39:28 +0000 (12:39 -0700)
src/mesa/drivers/dri/i915/Makefile
src/mesa/drivers/dri/i915/intel_swapbuffers.c [new symlink]
src/mesa/drivers/dri/i965/Makefile
src/mesa/drivers/dri/i965/intel_swapbuffers.c [new symlink]
src/mesa/drivers/dri/intel/intel_buffers.c
src/mesa/drivers/dri/intel/intel_buffers.h
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/intel/intel_screen.h
src/mesa/drivers/dri/intel/intel_swapbuffers.c [new file with mode: 0644]
src/mesa/drivers/dri/intel/intel_swapbuffers.h [new file with mode: 0644]

index 5652f9e4bd0cdc6be159d7591ae415ee66d01eb9..0abf47b830219412dcbcd3365395234b307c104a 100644 (file)
@@ -34,6 +34,7 @@ DRIVER_SOURCES = \
        intel_pixel_read.c \
        intel_buffers.c \
        intel_blit.c \
+       intel_swapbuffers.c \
        i915_tex.c \
        i915_texstate.c \
        i915_context.c \
diff --git a/src/mesa/drivers/dri/i915/intel_swapbuffers.c b/src/mesa/drivers/dri/i915/intel_swapbuffers.c
new file mode 120000 (symlink)
index 0000000..148d521
--- /dev/null
@@ -0,0 +1 @@
+../intel/intel_swapbuffers.c
\ No newline at end of file
index f134d6809ae621790d2af6b478d1aa2c516eb832..692a285cbe319a83f15a6fb42123d8059c36ac3d 100644 (file)
@@ -21,6 +21,7 @@ DRIVER_SOURCES = \
        intel_pixel_copy.c \
        intel_pixel_draw.c \
        intel_state.c \
+       intel_swapbuffers.c \
        intel_tex.c \
        intel_tex_copy.c \
        intel_tex_format.c \
diff --git a/src/mesa/drivers/dri/i965/intel_swapbuffers.c b/src/mesa/drivers/dri/i965/intel_swapbuffers.c
new file mode 120000 (symlink)
index 0000000..148d521
--- /dev/null
@@ -0,0 +1 @@
+../intel/intel_swapbuffers.c
\ No newline at end of file
index f1a08c5c10c580aeda94e0ba80cfca55e36a18bf..827cb8a2a7273ae7080be1ee2b31a8221b1e3eb3 100644 (file)
 #include "intel_blit.h"
 #include "intel_buffers.h"
 #include "intel_chipset.h"
-#include "intel_depthstencil.h"
 #include "intel_fbo.h"
 #include "intel_regions.h"
 #include "intel_batchbuffer.h"
-#include "intel_reg.h"
-#include "main/context.h"
 #include "main/framebuffer.h"
 #include "swrast/swrast.h"
-#include "utils.h"
 #include "drirenderbuffer.h"
-#include "vblank.h"
-#include "i915_drm.h"
 
 #define FILE_DEBUG_FLAG DEBUG_BLIT
 
@@ -114,7 +108,6 @@ intel_get_cliprects(struct intel_context *intel,
                    int *x_off, int *y_off)
 {
    __DRIdrawablePrivate *dPriv = intel->driDrawable;
-   struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
 
    if (intel->constant_cliprect) {
       /* FBO or DRI2 rendering, which can just use the fb's size. */
@@ -143,130 +136,6 @@ intel_get_cliprects(struct intel_context *intel,
    }
 }
 
-/*
- * Correct a drawablePrivate's set of vblank flags WRT the current context.
- * When considering multiple crtcs.
- */
-GLuint
-intelFixupVblank(struct intel_context *intel, __DRIdrawablePrivate *dPriv)
-{
-
-   if (!intel->intelScreen->driScrnPriv->dri2.enabled &&
-       intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) {
-      volatile drm_i915_sarea_t *sarea = intel->sarea;
-      drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
-                                  .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };
-      drm_clip_rect_t planeA_rect = { .x1 = sarea->planeA_x, .y1 = sarea->planeA_y,
-                                    .x2 = sarea->planeA_x + sarea->planeA_w,
-                                    .y2 = sarea->planeA_y + sarea->planeA_h };
-      drm_clip_rect_t planeB_rect = { .x1 = sarea->planeB_x, .y1 = sarea->planeB_y,
-                                    .x2 = sarea->planeB_x + sarea->planeB_w,
-                                    .y2 = sarea->planeB_y + sarea->planeB_h };
-      GLint areaA = driIntersectArea( drw_rect, planeA_rect );
-      GLint areaB = driIntersectArea( drw_rect, planeB_rect );
-      GLuint flags = dPriv->vblFlags;
-
-      /* Update vblank info
-       */
-      if (areaB > areaA || (areaA == areaB && areaB > 0)) {
-        flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY;
-      } else {
-        flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
-      }
-
-      /* Do the stupid test: Is one of them actually disabled?
-       */
-      if (sarea->planeA_w == 0 || sarea->planeA_h == 0) {
-        flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY;
-      } else if (sarea->planeB_w == 0 || sarea->planeB_h == 0) {
-        flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
-      }
-
-      return flags;
-   } else {
-       return dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
-   }
-}
-
-/**
- * This will be called whenever the currently bound window is moved/resized.
- * XXX: actually, it seems to NOT be called when the window is only moved (BP).
- */
-void
-intelWindowMoved(struct intel_context *intel)
-{
-   GLcontext *ctx = &intel->ctx;
-   __DRIdrawablePrivate *dPriv = intel->driDrawable;
-   struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
-
-   if (!intel->intelScreen->driScrnPriv->dri2.enabled &&
-       intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) {
-      GLuint flags = intelFixupVblank(intel, dPriv);
-
-      /* Check to see if we changed pipes */
-      if (flags != dPriv->vblFlags && dPriv->vblFlags &&
-         !(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ)) {
-        int64_t count;
-        drmVBlank vbl;
-        int i;
-
-        /*
-         * Deal with page flipping
-         */
-        vbl.request.type = DRM_VBLANK_ABSOLUTE;
-
-        if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) {
-           vbl.request.type |= DRM_VBLANK_SECONDARY;
-        }
-
-        for (i = 0; i < 2; i++) {
-           if (!intel_fb->color_rb[i] ||
-               (intel_fb->vbl_waited - intel_fb->color_rb[i]->vbl_pending) <=
-               (1<<23))
-              continue;
-
-           vbl.request.sequence = intel_fb->color_rb[i]->vbl_pending;
-           drmWaitVBlank(intel->driFd, &vbl);
-        }
-
-        /*
-         * Update msc_base from old pipe
-         */
-        driDrawableGetMSC32(dPriv->driScreenPriv, dPriv, &count);
-        dPriv->msc_base = count;
-        /*
-         * Then get new vblank_base and vblSeq values
-         */
-        dPriv->vblFlags = flags;
-        driGetCurrentVBlank(dPriv);
-        dPriv->vblank_base = dPriv->vblSeq;
-
-        intel_fb->vbl_waited = dPriv->vblSeq;
-
-        for (i = 0; i < 2; i++) {
-           if (intel_fb->color_rb[i])
-              intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_waited;
-        }
-      }
-   } else {
-      dPriv->vblFlags &= ~VBLANK_FLAG_SECONDARY;
-   }
-
-   /* Update Mesa's notion of window size */
-   driUpdateFramebufferSize(ctx, dPriv);
-   intel_fb->Base.Initialized = GL_TRUE; /* XXX remove someday */
-
-   /* Update hardware scissor */
-   if (ctx->Driver.Scissor != NULL) {
-      ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
-                         ctx->Scissor.Width, ctx->Scissor.Height);
-   }
-
-   /* Re-calculate viewport related state */
-   if (ctx->Driver.DepthRange != NULL)
-      ctx->Driver.DepthRange( ctx, ctx->Viewport.Near, ctx->Viewport.Far );
-}
-
 
 
 /* A true meta version of this would be very simple and additionally
@@ -482,85 +351,6 @@ intelClear(GLcontext *ctx, GLbitfield mask)
    }
 }
 
-void
-intelSwapBuffers(__DRIdrawablePrivate * dPriv)
-{
-   __DRIscreenPrivate *psp = dPriv->driScreenPriv;
-
-   if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
-      GET_CURRENT_CONTEXT(ctx);
-      struct intel_context *intel;
-
-      if (ctx == NULL)
-        return;
-
-      intel = intel_context(ctx);
-
-      if (ctx->Visual.doubleBufferMode) {
-        GLboolean missed_target;
-        struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
-        int64_t ust;
-         
-        _mesa_notifySwapBuffers(ctx);  /* flush pending rendering comands */
-
-       /*
-        * The old swapping ioctl was incredibly racy, just wait for vblank
-        * and do the swap ourselves.
-        */
-        driWaitForVBlank(dPriv, &missed_target);
-
-        /*
-         * Update each buffer's vbl_pending so we don't get too out of
-         * sync
-         */
-        intel_get_renderbuffer(&intel_fb->Base,
-                               BUFFER_BACK_LEFT)->vbl_pending = dPriv->vblSeq;
-         intel_get_renderbuffer(&intel_fb->Base,
-                               BUFFER_FRONT_LEFT)->vbl_pending = dPriv->vblSeq;
-
-        intelCopyBuffer(dPriv, NULL);
-
-        intel_fb->swap_count++;
-        (*psp->systemTime->getUST) (&ust);
-        if (missed_target) {
-           intel_fb->swap_missed_count++;
-           intel_fb->swap_missed_ust = ust - intel_fb->swap_ust;
-        }
-
-        intel_fb->swap_ust = ust;
-      }
-      drmCommandNone(intel->driFd, DRM_I915_GEM_THROTTLE);
-
-   }
-   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
-intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
-{
-   if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
-      struct intel_context *intel =
-         (struct intel_context *) dPriv->driContextPriv->driverPrivate;
-      GLcontext *ctx = &intel->ctx;
-
-      if (ctx->Visual.doubleBufferMode) {
-         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__);
-   }
-}
 
 
 /**
index 529e823b4f51ff6e604a1e39c6c09bdf6b67fdb6..97ae8bf738f7f0c5674aa2302e4fb8cf599cf266 100644 (file)
@@ -45,13 +45,6 @@ extern struct intel_region *intel_readbuf_region(struct intel_context *intel);
 
 extern struct intel_region *intel_drawbuf_region(struct intel_context *intel);
 
-extern void intelSwapBuffers(__DRIdrawablePrivate * dPriv);
-
-extern GLuint intelFixupVblank(struct intel_context *intel,
-                              __DRIdrawablePrivate *dPriv);
-
-extern void intelWindowMoved(struct intel_context *intel);
-
 extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb);
 
 extern void intelInitBufferFuncs(struct dd_function_table *functions);
index 87b0417baa200645d2ae209b86fa1e031304a35a..72610b2454f51059744e0dddb7aefe0a241f8164 100644 (file)
@@ -59,6 +59,7 @@
 #include "intel_fbo.h"
 #include "intel_decode.h"
 #include "intel_bufmgr.h"
+#include "intel_swapbuffers.h"
 
 #include "drirenderbuffer.h"
 #include "vblank.h"
index 7042c2556447afab73504627a47bbd581839de66..26ab35306d847baebe29089304e387384a5d48e0 100644 (file)
@@ -43,6 +43,7 @@
 #include "intel_span.h"
 #include "intel_fbo.h"
 #include "intel_chipset.h"
+#include "intel_swapbuffers.h"
 
 #include "i915_drm.h"
 #include "i830_dri.h"
index fcd0d9c28c77171466a3ca73df8d830826d802a7..230b2c34612d3f78d3f537f86b904fb255baaeeb 100644 (file)
@@ -105,11 +105,6 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
                  __DRIdrawablePrivate * driDrawPriv,
                  __DRIdrawablePrivate * driReadPriv);
 
-extern void intelSwapBuffers(__DRIdrawablePrivate * dPriv);
-
-extern void
-intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h);
-
 extern struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen);
 
 #endif
diff --git a/src/mesa/drivers/dri/intel/intel_swapbuffers.c b/src/mesa/drivers/dri/intel/intel_swapbuffers.c
new file mode 100644 (file)
index 0000000..c135166
--- /dev/null
@@ -0,0 +1,243 @@
+/**************************************************************************
+ * 
+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#include "intel_blit.h"
+#include "intel_buffers.h"
+#include "intel_swapbuffers.h"
+#include "intel_fbo.h"
+#include "intel_batchbuffer.h"
+#include "drirenderbuffer.h"
+#include "vblank.h"
+#include "i915_drm.h"
+
+
+
+/*
+ * Correct a drawablePrivate's set of vblank flags WRT the current context.
+ * When considering multiple crtcs.
+ */
+GLuint
+intelFixupVblank(struct intel_context *intel, __DRIdrawablePrivate *dPriv)
+{
+
+   if (!intel->intelScreen->driScrnPriv->dri2.enabled &&
+       intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) {
+      volatile drm_i915_sarea_t *sarea = intel->sarea;
+      drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
+                                  .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };
+      drm_clip_rect_t planeA_rect = { .x1 = sarea->planeA_x, .y1 = sarea->planeA_y,
+                                    .x2 = sarea->planeA_x + sarea->planeA_w,
+                                    .y2 = sarea->planeA_y + sarea->planeA_h };
+      drm_clip_rect_t planeB_rect = { .x1 = sarea->planeB_x, .y1 = sarea->planeB_y,
+                                    .x2 = sarea->planeB_x + sarea->planeB_w,
+                                    .y2 = sarea->planeB_y + sarea->planeB_h };
+      GLint areaA = driIntersectArea( drw_rect, planeA_rect );
+      GLint areaB = driIntersectArea( drw_rect, planeB_rect );
+      GLuint flags = dPriv->vblFlags;
+
+      /* Update vblank info
+       */
+      if (areaB > areaA || (areaA == areaB && areaB > 0)) {
+        flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY;
+      } else {
+        flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
+      }
+
+      /* Do the stupid test: Is one of them actually disabled?
+       */
+      if (sarea->planeA_w == 0 || sarea->planeA_h == 0) {
+        flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY;
+      } else if (sarea->planeB_w == 0 || sarea->planeB_h == 0) {
+        flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
+      }
+
+      return flags;
+   } else {
+       return dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY;
+   }
+}
+
+
+void
+intelSwapBuffers(__DRIdrawablePrivate * dPriv)
+{
+   __DRIscreenPrivate *psp = dPriv->driScreenPriv;
+
+   if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
+      GET_CURRENT_CONTEXT(ctx);
+      struct intel_context *intel;
+
+      if (ctx == NULL)
+        return;
+
+      intel = intel_context(ctx);
+
+      if (ctx->Visual.doubleBufferMode) {
+        GLboolean missed_target;
+        struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
+        int64_t ust;
+         
+        _mesa_notifySwapBuffers(ctx);  /* flush pending rendering comands */
+
+       /*
+        * The old swapping ioctl was incredibly racy, just wait for vblank
+        * and do the swap ourselves.
+        */
+        driWaitForVBlank(dPriv, &missed_target);
+
+        /*
+         * Update each buffer's vbl_pending so we don't get too out of
+         * sync
+         */
+        intel_get_renderbuffer(&intel_fb->Base,
+                               BUFFER_BACK_LEFT)->vbl_pending = dPriv->vblSeq;
+         intel_get_renderbuffer(&intel_fb->Base,
+                               BUFFER_FRONT_LEFT)->vbl_pending = dPriv->vblSeq;
+
+        intelCopyBuffer(dPriv, NULL);
+
+        intel_fb->swap_count++;
+        (*psp->systemTime->getUST) (&ust);
+        if (missed_target) {
+           intel_fb->swap_missed_count++;
+           intel_fb->swap_missed_ust = ust - intel_fb->swap_ust;
+        }
+
+        intel_fb->swap_ust = ust;
+      }
+      drmCommandNone(intel->driFd, DRM_I915_GEM_THROTTLE);
+
+   }
+   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
+intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
+{
+   if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
+      struct intel_context *intel =
+         (struct intel_context *) dPriv->driContextPriv->driverPrivate;
+      GLcontext *ctx = &intel->ctx;
+
+      if (ctx->Visual.doubleBufferMode) {
+         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__);
+   }
+}
+
+
+/**
+ * This will be called whenever the currently bound window is moved/resized.
+ * XXX: actually, it seems to NOT be called when the window is only moved (BP).
+ */
+void
+intelWindowMoved(struct intel_context *intel)
+{
+   GLcontext *ctx = &intel->ctx;
+   __DRIdrawablePrivate *dPriv = intel->driDrawable;
+   struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
+
+   if (!intel->intelScreen->driScrnPriv->dri2.enabled &&
+       intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) {
+      GLuint flags = intelFixupVblank(intel, dPriv);
+
+      /* Check to see if we changed pipes */
+      if (flags != dPriv->vblFlags && dPriv->vblFlags &&
+         !(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ)) {
+        int64_t count;
+        drmVBlank vbl;
+        int i;
+
+        /*
+         * Deal with page flipping
+         */
+        vbl.request.type = DRM_VBLANK_ABSOLUTE;
+
+        if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) {
+           vbl.request.type |= DRM_VBLANK_SECONDARY;
+        }
+
+        for (i = 0; i < 2; i++) {
+           if (!intel_fb->color_rb[i] ||
+               (intel_fb->vbl_waited - intel_fb->color_rb[i]->vbl_pending) <=
+               (1<<23))
+              continue;
+
+           vbl.request.sequence = intel_fb->color_rb[i]->vbl_pending;
+           drmWaitVBlank(intel->driFd, &vbl);
+        }
+
+        /*
+         * Update msc_base from old pipe
+         */
+        driDrawableGetMSC32(dPriv->driScreenPriv, dPriv, &count);
+        dPriv->msc_base = count;
+        /*
+         * Then get new vblank_base and vblSeq values
+         */
+        dPriv->vblFlags = flags;
+        driGetCurrentVBlank(dPriv);
+        dPriv->vblank_base = dPriv->vblSeq;
+
+        intel_fb->vbl_waited = dPriv->vblSeq;
+
+        for (i = 0; i < 2; i++) {
+           if (intel_fb->color_rb[i])
+              intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_waited;
+        }
+      }
+   } else {
+      dPriv->vblFlags &= ~VBLANK_FLAG_SECONDARY;
+   }
+
+   /* Update Mesa's notion of window size */
+   driUpdateFramebufferSize(ctx, dPriv);
+   intel_fb->Base.Initialized = GL_TRUE; /* XXX remove someday */
+
+   /* Update hardware scissor */
+   if (ctx->Driver.Scissor != NULL) {
+      ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
+                         ctx->Scissor.Width, ctx->Scissor.Height);
+   }
+
+   /* Re-calculate viewport related state */
+   if (ctx->Driver.DepthRange != NULL)
+      ctx->Driver.DepthRange( ctx, ctx->Viewport.Near, ctx->Viewport.Far );
+}
diff --git a/src/mesa/drivers/dri/intel/intel_swapbuffers.h b/src/mesa/drivers/dri/intel/intel_swapbuffers.h
new file mode 100644 (file)
index 0000000..75bb624
--- /dev/null
@@ -0,0 +1,52 @@
+
+/**************************************************************************
+ * 
+ * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#ifndef INTEL_SWAPBUFFERS_H
+#define INTEL_SWAPBUFFERS_H
+
+#include "dri_util.h"
+#include "drm.h"
+
+struct intel_context;
+struct intel_framebuffer;
+
+
+extern void
+intelSwapBuffers(__DRIdrawablePrivate * dPriv);
+
+extern void
+intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h);
+
+extern GLuint
+intelFixupVblank(struct intel_context *intel, __DRIdrawablePrivate *dPriv);
+
+extern void
+intelWindowMoved(struct intel_context *intel);
+
+
+#endif /* INTEL_SWAPBUFFERS_H */