intel: Don't do the extra MI_FLUSH in flushing except when doing glFlush().
authorEric Anholt <eric@anholt.net>
Mon, 9 Feb 2009 23:55:15 +0000 (15:55 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 11 Feb 2009 02:45:18 +0000 (18:45 -0800)
Everything other than "make sure the last rendering ends up visible on the
screen" doesn't need that behavior.

src/mesa/drivers/dri/intel/intel_context.c

index 7a93801ee084fb8a1df780b7654ec792439fee52..d7ccfa0605890e43c179510e719a4862bc3dcf29 100644 (file)
@@ -365,9 +365,8 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state)
       intel->vtbl.invalidate_state( intel, new_state );
 }
 
-
-void
-intelFlush(GLcontext * ctx)
+static void
+intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
 {
    struct intel_context *intel = intel_context(ctx);
 
@@ -381,12 +380,25 @@ intelFlush(GLcontext * ctx)
     * lands onscreen in a timely manner, even if the X Server doesn't trigger
     * a flush for us.
     */
-   intel_batchbuffer_emit_mi_flush(intel->batch);
+   if (needs_mi_flush)
+      intel_batchbuffer_emit_mi_flush(intel->batch);
 
    if (intel->batch->map != intel->batch->ptr)
       intel_batchbuffer_flush(intel->batch);
 }
 
+void
+intelFlush(GLcontext * ctx)
+{
+   intel_flush(ctx, GL_FALSE);
+}
+
+static void
+intel_glFlush(GLcontext *ctx)
+{
+   intel_flush(ctx, GL_TRUE);
+}
+
 void
 intelFinish(GLcontext * ctx)
 {
@@ -413,7 +425,7 @@ intelInitDriverFunctions(struct dd_function_table *functions)
 {
    _mesa_init_driver_functions(functions);
 
-   functions->Flush = intelFlush;
+   functions->Flush = intel_glFlush;
    functions->Finish = intelFinish;
    functions->GetString = intelGetString;
    functions->UpdateState = intelInvalidateState;