Allow batch buffer debugging without calling i915_winsys->batch_start so often.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Sat, 3 Nov 2007 02:00:28 +0000 (02:00 +0000)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Sat, 3 Nov 2007 02:01:32 +0000 (02:01 +0000)
src/mesa/pipe/i915simple/i915_batch.h
src/mesa/pipe/i915simple/i915_context.c
src/mesa/pipe/i915simple/i915_debug.c
src/mesa/pipe/i915simple/i915_debug.h

index d0b0946cdf898bc1180dbbf6095cf56530da3ec4..fb88cd6db0de937cb45200109b69d9a1fd28ea12 100644 (file)
@@ -34,7 +34,7 @@
 #define BATCH_LOCALS
 
 #define BEGIN_BATCH( dwords, relocs ) \
-   i915->winsys->batch_start( i915->winsys, dwords, relocs )
+   (i915->batch_start = i915->winsys->batch_start( i915->winsys, dwords, relocs ))
 
 #define OUT_BATCH( dword ) \
    i915->winsys->batch_dword( i915->winsys, dword )
 
 #define ADVANCE_BATCH()
 
-#define FLUSH_BATCH() do {                                     \
-   if (0) i915_dump_batchbuffer( i915, i915->batch_start, BEGIN_BATCH(0, 0) ); \
-   i915->winsys->batch_flush( i915->winsys );                          \
-   i915->batch_start = BEGIN_BATCH(0, 0);                              \
+#define FLUSH_BATCH() do {                             \
+   if (0) i915_dump_batchbuffer( i915 );               \
+   i915->winsys->batch_flush( i915->winsys );          \
+   i915->batch_start = NULL;                           \
    i915->hardware_dirty = ~0;                          \
 } while (0)
 
index fc878c175c3ba39294e62c1ce485aac4001e73b3..2c36a194c71842e743358e230bd5749a72e42bed 100644 (file)
@@ -347,7 +347,7 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys,
 
    /* Batch stream debugging is a bit hacked up at the moment:
     */
-   i915->batch_start = BEGIN_BATCH(0, 0);
+   i915->batch_start = NULL;
 
    /*
     * XXX we could plug GL selection/feedback into the drawing pipeline
index d142194d84ca7f9bb3e798995473cabf0b4b2088..d07d2f1fa9578c73f2d0f223885a211edc5804bc 100644 (file)
@@ -822,20 +822,24 @@ static boolean i915_debug_packet( struct debug_stream *stream )
 
 
 void
-i915_dump_batchbuffer( struct i915_context *i915,
-                      unsigned *start,
-                      unsigned *end )
+i915_dump_batchbuffer( struct i915_context *i915 )
 {
    struct debug_stream stream;
+   unsigned *start = i915->batch_start;
+   unsigned *end = i915->winsys->batch_start( i915->winsys, 0, 0 );
    unsigned bytes = (end - start) * 4;
    boolean done = FALSE;
 
-
    stream.offset = 0;
    stream.ptr = (char *)start;
    stream.print_addresses = 0;
    stream.winsys = i915->pipe.winsys;
 
+   if (!start || !end) {
+      stream.winsys->printf( stream.winsys, "\n\nBATCH: ???\n");
+      return;
+   }
+   
    stream.winsys->printf( stream.winsys, "\n\nBATCH: (%d)\n", bytes / 4);
 
    while (!done &&
index 0ea131171ef72cd9d93715bedcafa3dde0dc9abb..4c3aa64b4217ad67cf4d8f8dc285089302118dd9 100644 (file)
@@ -79,9 +79,7 @@ void i915_print_ureg(const char *msg, unsigned ureg);
 #endif
 
 
-void i915_dump_batchbuffer( struct i915_context *i915,
-                           unsigned *start,
-                           unsigned *end );
+void i915_dump_batchbuffer( struct i915_context *i915 );