965: respect pipe flush flags
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 20 Dec 2007 13:47:11 +0000 (13:47 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 20 Dec 2007 13:47:11 +0000 (13:47 +0000)
Now we emit way too many flushes instead of none at all.

src/mesa/pipe/i965simple/brw_batch.h
src/mesa/pipe/i965simple/brw_curbe.c
src/mesa/pipe/i965simple/brw_flush.c
src/mesa/pipe/i965simple/brw_state.h
src/mesa/pipe/i965simple/brw_urb.c

index bef69ac..8605d7c 100644 (file)
@@ -53,4 +53,6 @@
    brw->hardware_dirty = ~0;                           \
 } while (0)
 
+#define BRW_BATCH_STRUCT(brw, s) brw_batchbuffer_data( brw->winsys, (s), sizeof(*(s)))
+
 #endif
index ee20e00..785affa 100644 (file)
@@ -34,6 +34,7 @@
 #include "brw_context.h"
 #include "brw_defines.h"
 #include "brw_state.h"
+#include "brw_batch.h"
 #include "brw_util.h"
 #include "brw_wm.h"
 #include "pipe/p_state.h"
index 1f11c5f..5216c68 100644 (file)
@@ -49,22 +49,18 @@ static void brw_flush( struct pipe_context *pipe,
     * caches?
     */
    if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) {
-      unsigned flush = CMD_MI_FLUSH;
-      
-#if 0
+      struct brw_mi_flush flush;
+
+      memset(&flush, 0, sizeof(flush));      
+      flush.opcode = CMD_MI_FLUSH;
+
       if (!(flags & PIPE_FLUSH_RENDER_CACHE))
-        flush |= INHIBIT_FLUSH_RENDER_CACHE;
+        flush.flags |= BRW_INHIBIT_FLUSH_RENDER_CACHE;
 
       if (flags & PIPE_FLUSH_TEXTURE_CACHE)
-        flush |= FLUSH_MAP_CACHE;
-#endif
+        flush.flags |= BRW_FLUSH_READ_CACHE;
 
-      if (!BEGIN_BATCH(1, 0)) {
-        FLUSH_BATCH( &fence );
-        assert(BEGIN_BATCH(1, 0));
-      }
-      OUT_BATCH( flush );
-      ADVANCE_BATCH();
+      BRW_BATCH_STRUCT(brw, &flush);
    }
 
    /* If there are no flags, just flush pending commands to hardware:
index 62055e5..8b4d7aa 100644 (file)
@@ -115,7 +115,6 @@ static inline struct pipe_buffer_handle *brw_cache_buffer(struct brw_context *br
 /***********************************************************************
  * brw_state_batch.c
  */
-#define BRW_BATCH_STRUCT(brw, s) brw_batchbuffer_data( brw->winsys, (s), sizeof(*(s)))
 #define BRW_CACHED_BATCH_STRUCT(brw, s) brw_cached_batch_struct( brw, (s), sizeof(*(s)) )
 
 boolean brw_cached_batch_struct( struct brw_context *brw,
index 8cc86e2..b284526 100644 (file)
@@ -31,7 +31,8 @@
 
 
 #include "brw_context.h"
-#include "brw_state.h"
+//#include "brw_state.h"
+#include "brw_batch.h"
 #include "brw_defines.h"
 
 #define VS 0