Squashed commit of the following:
[mesa.git] / src / gallium / drivers / i965 / brw_pipe_flush.c
index 1b43428760d14f8551d409f1232323be3438192e..fa2b64fd261b5360cbc50eb3fe1eb95940457b4a 100644 (file)
@@ -1,51 +1,58 @@
 
+#include "brw_context.h"
+#include "brw_screen.h"
+#include "brw_batchbuffer.h"
+
 #include "util/u_upload_mgr.h"
 
-#include "brw_context.h"
 
 
-/**
- * called from brw_batchbuffer_flush and children before sending a
- * batchbuffer off.
+
+/* All batchbuffer flushes must go through this function.
  */
-static void brw_finish_batch(struct brw_context *brw)
+void brw_context_flush( struct brw_context *brw )
 {
+   /*
+    * 
+    */
    brw_emit_query_end(brw);
-}
 
+   /* Move to the end of the current upload buffer so that we'll force choosing
+    * a new buffer next time.
+    */
+   u_upload_flush( brw->vb.upload_vertex );
+   u_upload_flush( brw->vb.upload_index );
 
-/**
- * called from intelFlushBatchLocked
- */
-static void brw_new_batch( struct brw_context *brw )
-{
-   brw->curbe.need_new_bo = GL_TRUE;
+   _brw_batchbuffer_flush( brw->batch, __FILE__, __LINE__ );
 
    /* Mark all context state as needing to be re-emitted.
     * This is probably not as severe as on 915, since almost all of our state
     * is just in referenced buffers.
     */
    brw->state.dirty.brw |= BRW_NEW_CONTEXT;
-
    brw->state.dirty.mesa |= ~0;
    brw->state.dirty.brw |= ~0;
    brw->state.dirty.cache |= ~0;
 
-   /* Move to the end of the current upload buffer so that we'll force choosing
-    * a new buffer next time.
-    */
-   u_upload_flush( brw->vb.upload_vertex );
-   u_upload_flush( brw->vb.upload_index );
+   brw->curbe.need_new_bo = GL_TRUE;
+}
 
+static void
+brw_flush( struct pipe_context *pipe,
+           unsigned flags, 
+           struct pipe_fence_handle **fence )
+{
+   brw_context_flush( brw_context( pipe ) );
+   if (fence)
+      *fence = NULL;
 }
 
-/* called from intelWaitForIdle() and intelFlush()
- *
- * For now, just flush everything.  Could be smarter later.
- */
-static GLuint brw_flush_cmd( void )
+void brw_pipe_flush_init( struct brw_context *brw )
 {
-   return ((MI_FLUSH << 16) | BRW_FLUSH_STATE_CACHE);
+   brw->base.flush = brw_flush;
 }
 
 
+void brw_pipe_flush_cleanup( struct brw_context *brw )
+{
+}