diff options
author | Brian Paul <brianp@vmware.com> | 2010-11-03 10:50:51 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-11-03 10:50:57 -0600 |
commit | 05a54356513d6cb40e5da1e45cd6aca42e05490e (patch) | |
tree | 2a61640b9247d5a10b2295b2e7460646f690f033 | |
parent | bb216a67c775435490c572bbcd7795c5e4070e1b (diff) |
llvmpipe: make variant_count global
It's shared by all contexts. When we GC, we destroy all contexts' shader
variants.
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_context.h | 9 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_flush.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_fs.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_setup.c | 2 |
5 files changed, 15 insertions, 4 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index a2a999168e..2036a717a0 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -50,6 +50,8 @@ DEBUG_GET_ONCE_BOOL_OPTION(lp_no_rast, "LP_NO_RAST", FALSE) +/** shared by all contexts */ +unsigned llvmpipe_variant_count; /** diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 83e3973a0b..5719071e01 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -124,13 +124,20 @@ struct llvmpipe_context { /** JIT code generation */ struct gallivm_state *gallivm; LLVMTypeRef jit_context_ptr_type; - unsigned variant_count; struct lp_setup_variant_list_item setup_variants_list; unsigned nr_setup_variants; }; +/** + * Fragment and setup variant count, used to trigger garbage collection. + * This is global since all variants in all contexts will be free when + * we do garbage collection. + */ +extern unsigned llvmpipe_variant_count; + + struct pipe_context * llvmpipe_create_context( struct pipe_screen *screen, void *priv ); diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 72eb4e484c..e8d00cf516 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -57,10 +57,10 @@ llvmpipe_flush( struct pipe_context *pipe, lp_setup_flush(llvmpipe->setup, flags, fence, reason); - if (llvmpipe->variant_count > 1000) { + if (llvmpipe_variant_count > 1000) { /* time to do a garbage collection */ gallivm_garbage_collect(llvmpipe->gallivm); - llvmpipe->variant_count = 0; + llvmpipe_variant_count = 0; } /* Enable to dump BMPs of the color/depth buffers each frame */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 5965381273..9c39845980 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -1372,7 +1372,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp) LP_COUNT_ADD(llvm_compile_time, dt); LP_COUNT_ADD(nr_llvm_compiles, 2); /* emit vs. omit in/out test */ - lp->variant_count++; + llvmpipe_variant_count++; /* Put the new variant into the list */ if (variant) { diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c index 8376ecd545..f7a9b55e74 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c @@ -720,6 +720,8 @@ llvmpipe_update_setup(struct llvmpipe_context *lp) variant = generate_setup_variant(lp->gallivm, key); insert_at_head(&lp->setup_variants_list, &variant->list_item_global); lp->nr_setup_variants++; + + llvmpipe_variant_count++; } lp_setup_set_setup_variant(lp->setup, |