Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / gallium / winsys / xlib / brw_aub.c
index 541d50c6e40c3c6baa874360795020cd5fe8a287..6e814ce5d1199519114add1b7b8a5ea14abf1043 100644 (file)
   *   Keith Whitwell <keith@tungstengraphics.com>
   */
 
+#include <stdio.h>
+#include <stdlib.h>
 #include "brw_aub.h"
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
-#include "imports.h"
-//#include "intel_winsys.h"
+#include "pipe/p_util.h"
+#include "pipe/p_debug.h"
 
 
 struct brw_aubfile {
@@ -320,7 +322,10 @@ void brw_aub_dump_bmp( struct brw_aubfile *aubfile,
    struct aub_dump_bmp db;
    unsigned format;
 
-   if (surface->cpp == 4)
+   assert(surface->block.width == 1);
+   assert(surface->block.height == 1);
+   
+   if (surface->block.size == 4)
       format = 0x7;
    else
       format = 0x3;
@@ -329,8 +334,8 @@ void brw_aub_dump_bmp( struct brw_aubfile *aubfile,
    db.xmin = 0;
    db.ymin = 0;
    db.format = format;
-   db.bpp = surface->cpp * 8;
-   db.pitch = surface->pitch;
+   db.bpp = surface->block.size * 8;
+   db.pitch = surface->stride/surface->block.size;
    db.xsize = surface->width;
    db.ysize = surface->height;
    db.addr = gtt_offset;
@@ -350,9 +355,9 @@ struct brw_aubfile *brw_aubfile_create( void )
 
    i++;
 
-   if (_mesa_getenv("INTEL_AUBFILE")) {
-      val = snprintf(filename, sizeof(filename), "%s%d.aub", _mesa_getenv("INTEL_AUBFILE"), i%4);
-      _mesa_printf("--> Aub file: %s\n", filename);
+   if (getenv("INTEL_AUBFILE")) {
+      val = snprintf(filename, sizeof(filename), "%s%d.aub", getenv("INTEL_AUBFILE"), i%4);
+      debug_printf("--> Aub file: %s\n", filename);
       aubfile->file = fopen(filename, "w");
    }
    else {
@@ -360,12 +365,12 @@ struct brw_aubfile *brw_aubfile_create( void )
       if (val < 0 || val > sizeof(filename)) 
         strcpy(filename, "default.aub");   
    
-      _mesa_printf("--> Aub file: %s\n", filename);
+      debug_printf("--> Aub file: %s\n", filename);
       aubfile->file = fopen(filename, "w");
    }
 
    if (!aubfile->file) {
-      _mesa_printf("couldn't open aubfile\n");
+      debug_printf("couldn't open aubfile\n");
       exit(1);
    }