Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / mesa / drivers / dri / mach64 / mach64_context.c
index 5a6c301da2d9359b168c892f1a623492a15c2fa2..99abd209b69e00236331d60be448907c4114f991 100644 (file)
@@ -1,4 +1,4 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
+/* -*- mode: c; c-basic-offset: 3 -*- */
 /*
  * Copyright 2000 Gareth Hughes
  * All Rights Reserved.
  *     Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
  */
 
-#include "glheader.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/simple_list.h"
+#include "main/imports.h"
+#include "main/matrix.h"
+#include "main/extensions.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -58,6 +58,7 @@
 #include "vblank.h"
 
 #define need_GL_ARB_multisample
+#define need_GL_ARB_vertex_buffer_object
 #include "extension_helper.h"
 
 #ifndef MACH64_DEBUG
@@ -83,6 +84,7 @@ const struct dri_extension card_extensions[] =
 {
     { "GL_ARB_multisample",                GL_ARB_multisample_functions },
     { "GL_ARB_multitexture",               NULL },
+    { "GL_ARB_vertex_buffer_object",       GL_ARB_vertex_buffer_object_functions },
     { "GL_EXT_texture_edge_clamp",         NULL },
     { "GL_MESA_ycbcr_texture",             NULL },
     { "GL_SGIS_generate_mipmap",           NULL },
@@ -251,9 +253,6 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
 
    mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS"));
 
-   mmesa->vblank_flags = (mmesa->do_irqs)
-      ? driGetDefaultVBlankFlags(&mmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
    driContextPriv->driverPrivate = (void *)mmesa;
 
    if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
@@ -328,10 +327,15 @@ mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
       }
 
       
-      driDrawableInitVBlank( driDrawPriv, newMach64Ctx->vblank_flags,
-                            &newMach64Ctx->vbl_seq );
-
       if ( newMach64Ctx->driDrawable != driDrawPriv ) {
+        if (driDrawPriv->swap_interval == (unsigned)-1) {
+           driDrawPriv->vblFlags = (newMach64Ctx->do_irqs)
+              ? driGetDefaultVBlankFlags(&newMach64Ctx->optionCache)
+              : VBLANK_FLAG_NO_IRQ;
+
+           driDrawableInitVBlank( driDrawPriv );
+        }
+
         newMach64Ctx->driDrawable = driDrawPriv;
         mach64CalcViewport( newMach64Ctx->glCtx );
       }