OSDN Git Service

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 d0b0946..fb88cd6 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 fc878c1..2c36a19 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 d142194..d07d2f1 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 0ea1311..4c3aa64 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 );