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 bef69ac871bde696ef398f04ed57d0b31e5ca262..8605d7c10834c447a078e8128579ea64c7d0f1fa 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 ee20e003624780a080712f18200579f07bf34486..785affa2d86bd85009144f9975d576d29b9bddf0 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 1f11c5f164c2b6b795a6a93020b5961bc86ac9f2..5216c680cf654e28727917e6f38a512984dee56f 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 62055e55061b24ee79d9d1930f6c762ed3068e60..8b4d7aabf0ab805a0f3985a06cf88fb68c57b170 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 8cc86e26a346abe6792603107f18923b1659026d..b284526aa6e9ee31e70f973122348c8636002e96 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