llvmpipe: add DEBUG_MEM option
authorKeith Whitwell <keithw@vmware.com>
Wed, 8 Sep 2010 17:37:45 +0000 (18:37 +0100)
committerKeith Whitwell <keithw@vmware.com>
Sat, 11 Sep 2010 09:04:53 +0000 (10:04 +0100)
src/gallium/drivers/llvmpipe/lp_debug.h
src/gallium/drivers/llvmpipe/lp_scene.h
src/gallium/drivers/llvmpipe/lp_screen.c

index a928ee3..add43e4 100644 (file)
@@ -48,6 +48,7 @@ st_print_current(void);
 #define DEBUG_COUNTERS      0x800
 #define DEBUG_SCENE         0x1000
 #define DEBUG_FENCE         0x2000
+#define DEBUG_MEM           0x4000
 
 
 #ifdef DEBUG
index 49c5d4d..eb433f2 100644 (file)
@@ -38,6 +38,7 @@
 #include "os/os_thread.h"
 #include "lp_tile_soa.h"
 #include "lp_rast.h"
+#include "lp_debug.h"
 
 struct lp_scene_queue;
 
@@ -205,6 +206,11 @@ lp_scene_alloc( struct lp_scene *scene, unsigned size)
    assert(size <= DATA_BLOCK_SIZE);
    assert(block != NULL);
 
+   if (LP_DEBUG & DEBUG_MEM)
+      debug_printf("alloc %d block %d/%d tot %d/%d\n",
+                  size, block->used, DATA_BLOCK_SIZE,
+                  scene->scene_size, LP_SCENE_MAX_SIZE);
+
    if (block->used + size > DATA_BLOCK_SIZE) {
       block = lp_scene_new_data_block( scene );
       if (!block) {
@@ -232,6 +238,12 @@ lp_scene_alloc_aligned( struct lp_scene *scene, unsigned size,
    struct data_block *block = list->head;
 
    assert(block != NULL);
+
+   if (LP_DEBUG & DEBUG_MEM)
+      debug_printf("alloc %d block %d/%d tot %d/%d\n",
+                  size + alignment - 1,
+                  block->used, DATA_BLOCK_SIZE,
+                  scene->scene_size, LP_SCENE_MAX_SIZE);
        
    if (block->used + size + alignment - 1 > DATA_BLOCK_SIZE) {
       block = lp_scene_new_data_block( scene );
index 1e65a91..363940d 100644 (file)
@@ -63,6 +63,7 @@ static const struct debug_named_value lp_debug_flags[] = {
    { "counters", DEBUG_COUNTERS, NULL },
    { "scene", DEBUG_SCENE, NULL },
    { "fence", DEBUG_FENCE, NULL },
+   { "mem", DEBUG_MEM, NULL },
    DEBUG_NAMED_VALUE_END
 };
 #endif