From: José Fonseca Date: Sun, 31 Jan 2010 05:36:33 +0000 (+0000) Subject: Merge remote branch 'origin/master' into lp-binning X-Git-Tag: 062012170305~12852^2~1154^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bee9964b29b2428ee75e2d1efc0e1d2c2518a417;p=profile%2Fivi%2Fmesa.git Merge remote branch 'origin/master' into lp-binning Conflicts: Makefile src/gallium/auxiliary/util/u_surface.c src/gallium/drivers/llvmpipe/lp_flush.c src/gallium/drivers/llvmpipe/lp_setup.c src/gallium/drivers/llvmpipe/lp_state_derived.c src/gallium/drivers/llvmpipe/lp_state_fs.c src/gallium/drivers/llvmpipe/lp_state_surface.c src/gallium/drivers/llvmpipe/lp_tex_cache.c src/gallium/drivers/llvmpipe/lp_texture.c src/gallium/drivers/llvmpipe/lp_tile_cache.c src/mesa/state_tracker/st_cb_condrender.c --- bee9964b29b2428ee75e2d1efc0e1d2c2518a417 diff --cc Makefile index 340747d,16395bc..bf8debf --- a/Makefile +++ b/Makefile @@@ -127,7 -127,7 +127,8 @@@ linux-ia64-icc-static linux-icc \ linux-icc-static \ linux-llvm \ +linux-llvm-debug \ + linux-opengl-es \ linux-osmesa \ linux-osmesa-static \ linux-osmesa16 \ diff --cc src/gallium/auxiliary/util/u_surface.c index f66376a,f828908..70de140 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@@ -36,8 -36,6 +36,7 @@@ #include "pipe/p_state.h" #include "pipe/p_defines.h" +#include "util/u_memory.h" - #include "util/u_format.h" #include "util/u_surface.h" diff --cc src/gallium/drivers/llvmpipe/lp_flush.c index 07f3284,6c81012..edd480d --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@@ -35,8 -35,8 +35,7 @@@ #include "lp_flush.h" #include "lp_context.h" #include "lp_surface.h" - #include "lp_winsys.h" -#include "lp_state.h" -#include "lp_tile_cache.h" +#include "lp_setup.h" void diff --cc src/gallium/drivers/llvmpipe/lp_jit.c index 9fad703,9e0118c..310fc2b --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@@ -37,10 -37,8 +37,9 @@@ #include "util/u_memory.h" #include "util/u_cpu_detect.h" +#include "lp_debug.h" #include "lp_screen.h" #include "lp_bld_intr.h" - #include "lp_bld_misc.h" #include "lp_jit.h" diff --cc src/gallium/drivers/llvmpipe/lp_state_fs.c index a7514ee,ddd0740..0602e94 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@@ -65,8 -62,6 +65,7 @@@ #include "util/u_memory.h" #include "util/u_format.h" #include "util/u_debug_dump.h" +#include "util/u_time.h" - #include "pipe/internal/p_winsys_screen.h" #include "pipe/p_shader_tokens.h" #include "draw/draw_context.h" #include "tgsi/tgsi_dump.h" @@@ -838,88 -629,11 +837,88 @@@ generate_fragment(struct llvmpipe_conte debug_printf("\n"); } - variant->jit_function = (lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, variant->function); + /* + * Translate the LLVM IR into machine code. + */ + variant->jit_function[do_tri_test] = (lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, function); if (LP_DEBUG & DEBUG_ASM) - lp_disassemble(variant->jit_function); + lp_disassemble(variant->jit_function[do_tri_test]); +} + + +static struct lp_fragment_shader_variant * +generate_variant(struct llvmpipe_context *lp, + struct lp_fragment_shader *shader, + const struct lp_fragment_shader_variant_key *key) +{ + struct lp_fragment_shader_variant *variant; + + if (LP_DEBUG & DEBUG_JIT) { + unsigned i; + + tgsi_dump(shader->base.tokens, 0); + if(key->depth.enabled) { + debug_printf("depth.format = %s\n", pf_name(key->zsbuf_format)); + debug_printf("depth.func = %s\n", debug_dump_func(key->depth.func, TRUE)); + debug_printf("depth.writemask = %u\n", key->depth.writemask); + } + if(key->alpha.enabled) { + debug_printf("alpha.func = %s\n", debug_dump_func(key->alpha.func, TRUE)); + debug_printf("alpha.ref_value = %f\n", key->alpha.ref_value); + } + if(key->blend.logicop_enable) { + debug_printf("blend.logicop_func = %u\n", key->blend.logicop_func); + } - else if(key->blend.blend_enable) { - debug_printf("blend.rgb_func = %s\n", debug_dump_blend_func (key->blend.rgb_func, TRUE)); - debug_printf("rgb_src_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_src_factor, TRUE)); - debug_printf("rgb_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_dst_factor, TRUE)); - debug_printf("alpha_func = %s\n", debug_dump_blend_func (key->blend.alpha_func, TRUE)); - debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_src_factor, TRUE)); - debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_dst_factor, TRUE)); ++ else if(key->blend.rt[0].blend_enable) { ++ debug_printf("blend.rgb_func = %s\n", debug_dump_blend_func (key->blend.rt[0].rgb_func, TRUE)); ++ debug_printf("rgb_src_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].rgb_src_factor, TRUE)); ++ debug_printf("rgb_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].rgb_dst_factor, TRUE)); ++ debug_printf("alpha_func = %s\n", debug_dump_blend_func (key->blend.rt[0].alpha_func, TRUE)); ++ debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].alpha_src_factor, TRUE)); ++ debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].alpha_dst_factor, TRUE)); + } - debug_printf("blend.colormask = 0x%x\n", key->blend.colormask); ++ debug_printf("blend.colormask = 0x%x\n", key->blend.rt[0].colormask); + for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) { + if(key->sampler[i].format) { + debug_printf("sampler[%u] = \n", i); + debug_printf(" .format = %s\n", + pf_name(key->sampler[i].format)); + debug_printf(" .target = %s\n", + debug_dump_tex_target(key->sampler[i].target, TRUE)); + debug_printf(" .pot = %u %u %u\n", + key->sampler[i].pot_width, + key->sampler[i].pot_height, + key->sampler[i].pot_depth); + debug_printf(" .wrap = %s %s %s\n", + debug_dump_tex_wrap(key->sampler[i].wrap_s, TRUE), + debug_dump_tex_wrap(key->sampler[i].wrap_t, TRUE), + debug_dump_tex_wrap(key->sampler[i].wrap_r, TRUE)); + debug_printf(" .min_img_filter = %s\n", + debug_dump_tex_filter(key->sampler[i].min_img_filter, TRUE)); + debug_printf(" .min_mip_filter = %s\n", + debug_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE)); + debug_printf(" .mag_img_filter = %s\n", + debug_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE)); + if(key->sampler[i].compare_mode != PIPE_TEX_COMPARE_NONE) + debug_printf(" .compare_func = %s\n", debug_dump_func(key->sampler[i].compare_func, TRUE)); + debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords); + debug_printf(" .prefilter = %u\n", key->sampler[i].prefilter); + } + } + } + + variant = CALLOC_STRUCT(lp_fragment_shader_variant); + if(!variant) + return NULL; + + variant->shader = shader; + memcpy(&variant->key, key, sizeof *key); + generate_fragment(lp, shader, variant, 0); + generate_fragment(lp, shader, variant, 1); + + /* insert new variant into linked list */ variant->next = shader->variants; shader->variants = variant; @@@ -1019,8 -726,12 +1018,8 @@@ llvmpipe_set_constant_buffer(struct pip /* note: reference counting */ pipe_buffer_reference(&llvmpipe->constants[shader], constants); - if(shader == PIPE_SHADER_FRAGMENT) { - llvmpipe->jit_context.constants = data; - } - if(shader == PIPE_SHADER_VERTEX) { - draw_set_mapped_constant_buffer(llvmpipe->draw, PIPE_SHADER_VERTEX, + draw_set_mapped_constant_buffer(llvmpipe->draw, PIPE_SHADER_VERTEX, 0, data, size); } @@@ -1071,14 -776,11 +1070,14 @@@ make_variant_key(struct llvmpipe_contex assert(format_desc->layout == UTIL_FORMAT_COLORSPACE_RGB || format_desc->layout == UTIL_FORMAT_COLORSPACE_SRGB); - /* mask out color channels not present in the color buffer */ + /* mask out color channels not present in the color buffer. + * Should be simple to incorporate per-cbuf writemasks: + */ for(chan = 0; chan < 4; ++chan) { enum util_format_swizzle swizzle = format_desc->swizzle[chan]; - if(swizzle > 4) - key->blend.rt[0].colormask &= ~(1 << chan); + + if(swizzle <= UTIL_FORMAT_SWIZZLE_W) - key->cbuf_blend[i].colormask |= (1 << chan); ++ key->blend.rt[0].colormask |= (1 << chan); } } @@@ -1110,34 -807,8 +1109,34 @@@ llvmpipe_update_fs(struct llvmpipe_cont variant = variant->next; } - if(!variant) - variant = generate_fragment(lp, shader, &key); + if (!variant) { + struct util_time t0, t1; + int64_t dt; + util_time_get(&t0); + + variant = generate_variant(lp, shader, &key); + + util_time_get(&t1); + dt = util_time_diff(&t0, &t1); + LP_COUNT_ADD(llvm_compile_time, dt); + LP_COUNT_ADD(nr_llvm_compiles, 2); /* emit vs. omit in/out test */ + } shader->current = variant; + + /* TODO: put this in the variant */ + /* TODO: most of these can be relaxed, in particular the colormask */ + opaque = !key.blend.logicop_enable && - !key.blend.blend_enable && - key.blend.colormask == 0xf && ++ !key.blend.rt[0].blend_enable && ++ key.blend.rt[0].colormask == 0xf && + !key.alpha.enabled && + !key.depth.enabled && + !key.scissor && + !shader->info.uses_kill + ? TRUE : FALSE; + + lp_setup_set_fs_functions(lp->setup, + shader->current->jit_function[0], + shader->current->jit_function[1], + opaque); } diff --cc src/gallium/drivers/llvmpipe/lp_state_surface.c index 0e9f03b,3b08b0d..aa4241a --- a/src/gallium/drivers/llvmpipe/lp_state_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c @@@ -28,12 -28,9 +28,11 @@@ /* Authors: Keith Whitwell */ +#include "pipe/p_state.h" +#include "util/u_surface.h" #include "lp_context.h" #include "lp_state.h" - #include "lp_surface.h" -#include "lp_tile_cache.h" +#include "lp_setup.h" #include "draw/draw_context.h" diff --cc src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c index d59d768,5138ccf..7f55f1a --- a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c @@@ -44,10 -44,9 +44,9 @@@ #include "pipe/p_shader_tokens.h" #include "lp_bld_debug.h" #include "lp_bld_type.h" - #include "lp_bld_intr.h" #include "lp_bld_sample.h" #include "lp_bld_tgsi.h" -#include "lp_state.h" +#include "lp_jit.h" #include "lp_tex_sample.h"