[Mesa-dev] [PATCH] gallivm: More fallout from disabling with LLVM 3.6
Tom Stellard
tom at stellard.net
Thu Sep 25 13:58:50 PDT 2014
On Thu, Sep 25, 2014 at 12:24:14PM +0900, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> The draw module would still try to use gallivm, causing many piglit tests
> to fail with an assertion failure. llvmpipe might have been similarly
> affected.
>
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
> src/gallium/auxiliary/draw/draw_context.c | 2 --
> src/gallium/auxiliary/draw/draw_llvm.c | 5 +++--
> src/gallium/auxiliary/gallivm/lp_bld_init.c | 16 +++++++++++++---
> src/gallium/auxiliary/gallivm/lp_bld_init.h | 2 +-
> src/gallium/drivers/llvmpipe/lp_jit.c | 4 ++--
> src/gallium/drivers/llvmpipe/lp_jit.h | 2 +-
> src/gallium/drivers/llvmpipe/lp_screen.c | 5 +++--
> src/gallium/drivers/llvmpipe/lp_test_main.c | 5 +++--
> 8 files changed, 26 insertions(+), 15 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
> index 001446f..85f8e26 100644
> --- a/src/gallium/auxiliary/draw/draw_context.c
> +++ b/src/gallium/auxiliary/draw/draw_context.c
> @@ -93,8 +93,6 @@ draw_create_context(struct pipe_context *pipe, boolean try_llvm)
> #if HAVE_LLVM
> if (try_llvm && draw_get_option_use_llvm()) {
> draw->llvm = draw_llvm_create(draw);
> - if (!draw->llvm)
> - goto err_destroy;
> }
> #endif
>
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
> index e8e837a..504f3ef 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -484,12 +484,13 @@ draw_llvm_create(struct draw_context *draw)
> {
> struct draw_llvm *llvm;
>
> + if (!lp_build_init())
> + return NULL;
> +
> llvm = CALLOC_STRUCT( draw_llvm );
> if (!llvm)
> return NULL;
>
> - lp_build_init();
> -
> llvm->draw = draw;
>
> llvm->nr_variants = 0;
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
> index 243d248..75ef935 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
> @@ -306,7 +306,8 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name)
> assert(!gallivm->context);
> assert(!gallivm->module);
>
> - lp_build_init();
> + if (!lp_build_init())
> + return FALSE;
>
> if (USE_GLOBAL_CONTEXT) {
> gallivm->context = LLVMGetGlobalContext();
> @@ -382,11 +383,18 @@ fail:
> }
>
>
> -void
> +boolean
> lp_build_init(void)
> {
> if (gallivm_initialized)
> - return;
> + return TRUE;
> +
> + /* XXX: Remove this once lp_bld_misc.cpp has been adapted to the removal
> + * of JITMemoryManager
> + */
> +#if HAVE_LLVM >= 0x0306
> + return FALSE;
> +#endif
>
> #ifdef DEBUG
> gallivm_debug = debug_get_option_gallivm_debug();
> @@ -477,6 +485,8 @@ lp_build_init(void)
> util_cpu_caps.has_avx = 0;
> util_cpu_caps.has_f16c = 0;
> #endif
> +
> + return TRUE;
> }
>
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.h b/src/gallium/auxiliary/gallivm/lp_bld_init.h
> index 2e32cf8..64c5278 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_init.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.h
> @@ -49,7 +49,7 @@ struct gallivm_state
> };
>
>
> -void
> +boolean
> lp_build_init(void);
>
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
> index 261702f..9acde4f 100644
> --- a/src/gallium/drivers/llvmpipe/lp_jit.c
> +++ b/src/gallium/drivers/llvmpipe/lp_jit.c
> @@ -231,10 +231,10 @@ lp_jit_screen_cleanup(struct llvmpipe_screen *screen)
> }
>
>
> -void
> +boolean
> lp_jit_screen_init(struct llvmpipe_screen *screen)
> {
> - lp_build_init();
> + return lp_build_init();
> }
>
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
> index 1325a8c..097fa7d 100644
> --- a/src/gallium/drivers/llvmpipe/lp_jit.h
> +++ b/src/gallium/drivers/llvmpipe/lp_jit.h
> @@ -252,7 +252,7 @@ void
> lp_jit_screen_cleanup(struct llvmpipe_screen *screen);
>
>
> -void
> +boolean
> lp_jit_screen_init(struct llvmpipe_screen *screen);
>
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index e6597e9..3025322 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -557,6 +557,9 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
> return NULL;
> #endif
>
> + if (!lp_jit_screen_init(screen))
> + return NULL;
> +
> #ifdef DEBUG
> LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 );
> #endif
> @@ -588,8 +591,6 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
>
> llvmpipe_init_screen_resource_funcs(&screen->base);
>
> - lp_jit_screen_init(screen);
> -
> screen->num_threads = util_cpu_caps.nr_cpus > 1 ? util_cpu_caps.nr_cpus : 0;
> #ifdef PIPE_SUBSYSTEM_EMBEDDED
> screen->num_threads = 0;
> diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c
> index 8a896be..c7b6d65 100644
> --- a/src/gallium/drivers/llvmpipe/lp_test_main.c
> +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c
> @@ -376,6 +376,9 @@ int main(int argc, char **argv)
> fpstate = util_fpstate_get();
> util_fpstate_set_denorms_to_zero(fpstate);
>
> + if (!lp_build_init())
> + return 1;
> +
> for(i = 1; i < argc; ++i) {
> if(strcmp(argv[i], "-v") == 0)
> ++verbose;
> @@ -387,8 +390,6 @@ int main(int argc, char **argv)
> n = atoi(argv[i]);
> }
>
> - lp_build_init();
> -
> #ifdef DEBUG
> if (verbose >= 2) {
> gallivm_debug |= GALLIVM_DEBUG_IR;
> --
> 2.1.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list