Mesa (master): radeonsi: switch to v*i8 for resources and samplers v2
Module: Mesa Branch: master Commit: de80e560bcdf365845cfdfbfd919e2f91cea2b26 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=de80e560bcdf365845cfdfbfd919e2f91cea2b26 Author: Christian König christian.koe...@amd.com Date: Fri Mar 1 11:34:16 2013 +0100 radeonsi: switch to v*i8 for resources and samplers v2 v2: remove unrelated changes Signed-off-by: Christian König christian.koe...@amd.com Reviewed-by: Tom Stellard thomas.stell...@amd.com --- src/gallium/drivers/radeonsi/radeonsi_shader.c | 30 +-- 1 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index 37ade9b..958d3a3 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -84,10 +84,9 @@ static struct si_shader_context * si_shader_context( enum sgpr_type { SGPR_CONST_PTR_F32, - SGPR_CONST_PTR_V4I32, - SGPR_CONST_PTR_V8I32, - SGPR_I32, - SGPR_I64 + SGPR_CONST_PTR_V16I8, + SGPR_CONST_PTR_V32I8, + SGPR_I32 }; /** @@ -149,22 +148,17 @@ static LLVMValueRef use_sgpr( ret_type = LLVMInt32TypeInContext(gallivm-context); break; - case SGPR_I64: + case SGPR_CONST_PTR_V16I8: assert(sgpr % 2 == 0); - ret_type= LLVMInt64TypeInContext(gallivm-context); - break; - - case SGPR_CONST_PTR_V4I32: - assert(sgpr % 2 == 0); - ret_type = LLVMInt32TypeInContext(gallivm-context); - ret_type = LLVMVectorType(ret_type, 4); + ret_type = LLVMInt8TypeInContext(gallivm-context); + ret_type = LLVMVectorType(ret_type, 16); ret_type = LLVMPointerType(ret_type, CONST_ADDR_SPACE); break; - case SGPR_CONST_PTR_V8I32: + case SGPR_CONST_PTR_V32I8: assert(sgpr % 2 == 0); - ret_type = LLVMInt32TypeInContext(gallivm-context); - ret_type = LLVMVectorType(ret_type, 8); + ret_type = LLVMInt8TypeInContext(gallivm-context); + ret_type = LLVMVectorType(ret_type, 32); ret_type = LLVMPointerType(ret_type, CONST_ADDR_SPACE); break; @@ -197,7 +191,7 @@ static void declare_input_vs( unsigned chan; /* Load the T list */ - t_list_ptr = use_sgpr(base-gallivm, SGPR_CONST_PTR_V4I32, SI_SGPR_VERTEX_BUFFER); + t_list_ptr = use_sgpr(base-gallivm, SGPR_CONST_PTR_V16I8, SI_SGPR_VERTEX_BUFFER); t_offset = lp_build_const_int32(base-gallivm, input_index); @@ -944,14 +938,14 @@ static void tex_fetch_args( emit_data-args[1] = lp_build_gather_values(gallivm, address, count); /* Resource */ - ptr = use_sgpr(bld_base-base.gallivm, SGPR_CONST_PTR_V8I32, SI_SGPR_RESOURCE); + ptr = use_sgpr(bld_base-base.gallivm, SGPR_CONST_PTR_V32I8, SI_SGPR_RESOURCE); offset = lp_build_const_int32(bld_base-base.gallivm, emit_data-inst-Src[1].Register.Index); emit_data-args[2] = build_indexed_load(bld_base-base.gallivm, ptr, offset); /* Sampler */ - ptr = use_sgpr(bld_base-base.gallivm, SGPR_CONST_PTR_V4I32, SI_SGPR_SAMPLER); + ptr = use_sgpr(bld_base-base.gallivm, SGPR_CONST_PTR_V16I8, SI_SGPR_SAMPLER); offset = lp_build_const_int32(bld_base-base.gallivm, emit_data-inst-Src[1].Register.Index); emit_data-args[3] = build_indexed_load(bld_base-base.gallivm, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g/llvm: Update CONSTANT_BUFFER address space definition
Module: Mesa Branch: master Commit: 2cb54833d097738b56c726a572a951302ac465a6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2cb54833d097738b56c726a572a951302ac465a6 Author: Christian König christian.koe...@amd.com Date: Thu Mar 7 10:02:24 2013 +0100 r600g/llvm: Update CONSTANT_BUFFER address space definition To match recent LLVM changes. Signed-off-by: Christian König christian.koe...@amd.com --- src/gallium/drivers/r600/r600_llvm.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index aee7cea..3385c44 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -20,7 +20,7 @@ #if defined R600_USE_LLVM || defined HAVE_OPENCL -#define CONSTANT_BUFFER_0_ADDR_SPACE 9 +#define CONSTANT_BUFFER_0_ADDR_SPACE 8 #define CONSTANT_BUFFER_1_ADDR_SPACE (CONSTANT_BUFFER_0_ADDR_SPACE + R600_UCP_CONST_BUFFER) static LLVMValueRef llvm_fetch_const( ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeon/llvm: replace shader type intrinsic with function attribute
Module: Mesa Branch: master Commit: b8f4ca3d85b8a192b5c1940f9a4b558f1ce78d8f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8f4ca3d85b8a192b5c1940f9a4b558f1ce78d8f Author: Christian König christian.koe...@amd.com Date: Mon Mar 4 15:35:30 2013 +0100 radeon/llvm: replace shader type intrinsic with function attribute Signed-off-by: Christian König christian.koe...@amd.com Reviewed-by: Tom Stellard thomas.stell...@amd.com --- src/gallium/drivers/radeon/radeon_llvm_emit.cpp | 22 ++ src/gallium/drivers/radeon/radeon_llvm_emit.h |2 ++ src/gallium/drivers/radeonsi/radeonsi_shader.c | 14 ++ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp index 0491e64..ee82a90 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp @@ -28,10 +28,12 @@ #if HAVE_LLVM 0x0303 #include llvm/LLVMContext.h #include llvm/Module.h +#include llvm/Function.h #include llvm/DataLayout.h #else #include llvm/IR/LLVMContext.h #include llvm/IR/Module.h +#include llvm/IR/Function.h #include llvm/IR/DataLayout.h #endif @@ -69,6 +71,26 @@ static LLVMEnsureMultithreaded lLVMEnsureMultithreaded; } /** + * Set the shader type we want to compile + * + * @param type shader type to set + */ +extern C void +radeon_llvm_shader_type(LLVMValueRef F, unsigned type) +{ + Function *Func = unwrapFunction(F); + int Idx = AttributeSet::FunctionIndex; + AttrBuilder B; + char Str[2]; + + sprintf(Str, %1d, type); + B.addAttribute(ShaderType, Str); + + AttributeSet Set = AttributeSet::get(Func-getContext(), Idx, B); + Func-addAttributes(Idx, Set); +} + +/** * Compile an LLVM module to machine code. * * @param bytes This function allocates memory for the byte stream, it is the diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.h b/src/gallium/drivers/radeon/radeon_llvm_emit.h index bdb242b..b68100f 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.h +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h @@ -33,6 +33,8 @@ extern C { #endif +void radeon_llvm_shader_type(LLVMValueRef F, unsigned type); + unsigned radeon_llvm_bitcode_compile( unsigned char * bitcode, unsigned bitcode_len, unsigned char ** bytes, unsigned * byte_count, diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index 958d3a3..af05078 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -542,17 +542,6 @@ static void si_llvm_init_export_args(struct lp_build_tgsi_context *bld_base, * stage. */ } -static void si_llvm_emit_prologue(struct lp_build_tgsi_context *bld_base) -{ - struct si_shader_context *si_shader_ctx = si_shader_context(bld_base); - struct gallivm_state *gallivm = bld_base-base.gallivm; - lp_build_intrinsic_unary(gallivm-builder, - llvm.AMDGPU.shader.type, - LLVMVoidTypeInContext(gallivm-context), - lp_build_const_int32(gallivm, si_shader_ctx-type)); -} - - static void si_alpha_test(struct lp_build_tgsi_context *bld_base, unsigned index) { @@ -1032,7 +1021,6 @@ int si_pipe_shader_create( shader-shader.uses_kill = shader_info.uses_kill; bld_base-info = shader_info; bld_base-emit_fetch_funcs[TGSI_FILE_CONSTANT] = fetch_constant; - bld_base-emit_prologue = si_llvm_emit_prologue; bld_base-emit_epilogue = si_llvm_emit_epilogue; bld_base-op_actions[TGSI_OPCODE_TEX] = tex_action; @@ -1048,6 +1036,8 @@ int si_pipe_shader_create( si_shader_ctx.type = si_shader_ctx.parse.FullHeader.Processor.Processor; si_shader_ctx.rctx = rctx; + radeon_llvm_shader_type(si_shader_ctx.radeon_bld.main_fn, si_shader_ctx.type); + shader-shader.nr_cbufs = rctx-framebuffer.nr_cbufs; /* Dump TGSI code before doing TGSI-LLVM conversion in case the ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeon/llvm: make SGPRs proper function arguments v2
Module: Mesa Branch: master Commit: 55fe5ccb39d220eb7a506729a60412746c74406c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=55fe5ccb39d220eb7a506729a60412746c74406c Author: Christian König christian.koe...@amd.com Date: Mon Mar 4 16:30:06 2013 +0100 radeon/llvm: make SGPRs proper function arguments v2 v2: remove unrelated changes Signed-off-by: Christian König christian.koe...@amd.com Reviewed-by: Tom Stellard thomas.stell...@amd.com --- src/gallium/drivers/r600/r600_llvm.c |1 + src/gallium/drivers/radeon/radeon_llvm.h |3 + .../drivers/radeon/radeon_setup_tgsi_llvm.c| 25 +++-- src/gallium/drivers/radeonsi/radeonsi_shader.c | 106 ++-- src/gallium/drivers/radeonsi/radeonsi_shader.h | 11 ++ 5 files changed, 63 insertions(+), 83 deletions(-) diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index 3385c44..c7aa45f 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -524,6 +524,7 @@ LLVMModuleRef r600_tgsi_llvm( struct tgsi_shader_info shader_info; struct lp_build_tgsi_context * bld_base = ctx-soa.bld_base; radeon_llvm_context_init(ctx); + radeon_llvm_create_func(ctx, NULL, 0); tgsi_scan_shader(tokens, shader_info); bld_base-info = shader_info; diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h index b1e025b..4c01d68 100644 --- a/src/gallium/drivers/radeon/radeon_llvm.h +++ b/src/gallium/drivers/radeon/radeon_llvm.h @@ -160,6 +160,9 @@ void radeon_llvm_emit_prepare_cube_coords(struct lp_build_tgsi_context * bld_bas void radeon_llvm_context_init(struct radeon_llvm_context * ctx); +void radeon_llvm_create_func(struct radeon_llvm_context * ctx, + LLVMTypeRef *ParamTypes, unsigned ParamCount); + void radeon_llvm_dispose(struct radeon_llvm_context * ctx); inline static struct radeon_llvm_context * radeon_llvm_context( diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c index f9c8752..f7b7586 100644 --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c @@ -1094,8 +1094,6 @@ static void build_tgsi_intrinsic_readonly( void radeon_llvm_context_init(struct radeon_llvm_context * ctx) { struct lp_type type; - LLVMTypeRef main_fn_type; - LLVMBasicBlockRef main_fn_body; /* Initialize the gallivm object: * We are only using the module, context, and builder fields of this struct. @@ -1109,14 +1107,6 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx) ctx-gallivm.context); ctx-gallivm.builder = LLVMCreateBuilderInContext(ctx-gallivm.context); - /* Setup the module */ - main_fn_type = LLVMFunctionType(LLVMVoidTypeInContext(ctx-gallivm.context), -NULL, 0, 0); - ctx-main_fn = LLVMAddFunction(ctx-gallivm.module, main, main_fn_type); - main_fn_body = LLVMAppendBasicBlockInContext(ctx-gallivm.context, - ctx-main_fn, main_body); -LLVMPositionBuilderAtEnd(ctx-gallivm.builder, main_fn_body); - ctx-store_output_intr = llvm.AMDGPU.store.output.; ctx-swizzle_intr = llvm.AMDGPU.swizzle; struct lp_build_tgsi_context * bld_base = ctx-soa.bld_base; @@ -1261,6 +1251,21 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx) bld_base-rsq_action.intr_name = llvm.AMDGPU.rsq; } +void radeon_llvm_create_func(struct radeon_llvm_context * ctx, +LLVMTypeRef *ParamTypes, unsigned ParamCount) +{ + LLVMTypeRef main_fn_type; + LLVMBasicBlockRef main_fn_body; + + /* Setup the function */ + main_fn_type = LLVMFunctionType(LLVMVoidTypeInContext(ctx-gallivm.context), + ParamTypes, ParamCount, 0); + ctx-main_fn = LLVMAddFunction(ctx-gallivm.module, main, main_fn_type); + main_fn_body = LLVMAppendBasicBlockInContext(ctx-gallivm.context, + ctx-main_fn, main_body); + LLVMPositionBuilderAtEnd(ctx-gallivm.builder, main_fn_body); +} + void radeon_llvm_finalize_module(struct radeon_llvm_context * ctx) { struct gallivm_state * gallivm = ctx-soa.bld_base.base.gallivm; diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index af05078..9e1e25e 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -82,13 +82,6 @@ static struct si_shader_context * si_shader_context( #define CONST_ADDR_SPACE 2 #define USER_SGPR_ADDR_SPACE 8 -enum sgpr_type { - SGPR_CONST_PTR_F32, - SGPR_CONST_PTR_V16I8, -
Mesa (master): radeonsi: remove SI.vs.load.buffer.index
Module: Mesa Branch: master Commit: c497321d31290eaa92febf80eedb7e6ae71bb4e5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c497321d31290eaa92febf80eedb7e6ae71bb4e5 Author: Christian König christian.koe...@amd.com Date: Tue Mar 5 12:14:02 2013 +0100 radeonsi: remove SI.vs.load.buffer.index Signed-off-by: Christian König christian.koe...@amd.com Reviewed-by: Tom Stellard thomas.stell...@amd.com --- src/gallium/drivers/radeonsi/radeonsi_shader.c | 21 +++-- src/gallium/drivers/radeonsi/radeonsi_shader.h |1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index 9e1e25e..6873f12 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -118,7 +118,6 @@ static void declare_input_vs( LLVMValueRef args[3]; LLVMTypeRef vec4_type; LLVMValueRef input; - struct lp_build_context * uint = si_shader_ctx-radeon_bld.soa.bld_base.uint_bld; struct lp_build_context * base = si_shader_ctx-radeon_bld.soa.bld_base.base; //struct pipe_vertex_element *velem = rctx-vertex_elements-elements[input_index]; unsigned chan; @@ -133,11 +132,9 @@ static void declare_input_vs( /* Build the attribute offset */ attribute_offset = lp_build_const_int32(base-gallivm, 0); - /* Load the buffer index is always, which is always stored in VGPR0 + /* Load the buffer index, which is always stored in VGPR0 * for Vertex Shaders */ - buffer_index_reg = build_intrinsic(base-gallivm-builder, - llvm.SI.vs.load.buffer.index, uint-elem_type, NULL, 0, - LLVMReadNoneAttribute); + buffer_index_reg = LLVMGetParam(si_shader_ctx-radeon_bld.main_fn, SI_PARAM_VERTEX_INDEX); vec4_type = LLVMVectorType(base-elem_type, 4); args[0] = t_list; @@ -922,21 +919,25 @@ static const struct lp_build_tgsi_action txl_action = { static void create_function(struct si_shader_context *si_shader_ctx) { struct gallivm_state *gallivm = si_shader_ctx-radeon_bld.soa.bld_base.base.gallivm; - LLVMTypeRef params[4], f, i8; + LLVMTypeRef params[5], f, i8, i32; unsigned i; f = LLVMFloatTypeInContext(gallivm-context); i8 = LLVMInt8TypeInContext(gallivm-context); + i32 = LLVMInt32TypeInContext(gallivm-context); + params[SI_PARAM_CONST] = LLVMPointerType(f, CONST_ADDR_SPACE); params[SI_PARAM_SAMPLER] = LLVMPointerType(LLVMVectorType(i8, 16), CONST_ADDR_SPACE); params[SI_PARAM_RESOURCE] = LLVMPointerType(LLVMVectorType(i8, 32), CONST_ADDR_SPACE); - if (si_shader_ctx-type == TGSI_PROCESSOR_VERTEX) + if (si_shader_ctx-type == TGSI_PROCESSOR_VERTEX) { params[SI_PARAM_VERTEX_BUFFER] = params[SI_PARAM_SAMPLER]; - else + params[SI_PARAM_VERTEX_INDEX] = i32; + radeon_llvm_create_func(si_shader_ctx-radeon_bld, params, 5); + } else { params[SI_PARAM_PRIM_MASK] = LLVMInt32TypeInContext(gallivm-context); - - radeon_llvm_create_func(si_shader_ctx-radeon_bld, params, 4); + radeon_llvm_create_func(si_shader_ctx-radeon_bld, params, 4); + } radeon_llvm_shader_type(si_shader_ctx-radeon_bld.main_fn, si_shader_ctx-type); for (i = SI_PARAM_CONST; i = SI_PARAM_VERTEX_BUFFER; ++i) { diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.h b/src/gallium/drivers/radeonsi/radeonsi_shader.h index 3712347..4c2be80 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.h +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.h @@ -44,6 +44,7 @@ /* VS only parameters */ #define SI_PARAM_VERTEX_BUFFER 3 +#define SI_PARAM_VERTEX_INDEX 4 /* PS only parameters */ #define SI_PARAM_PRIM_MASK 3 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeon/llvm: enable LICM and DCE pass v2
Module: Mesa Branch: master Commit: a7a899584cf855725d3ca37f128bcd41b719e248 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7a899584cf855725d3ca37f128bcd41b719e248 Author: Christian König christian.koe...@amd.com Date: Wed Feb 27 22:40:24 2013 +0100 radeon/llvm: enable LICM and DCE pass v2 LICM stands for Loop Invariant Code Motion. Instructions that does not depend of loop index are moved outside of loop body. DCE is DeadCodeElimination. v2: updated commit msg, thx to Vincent. Signed-off-by: Christian König christian.koe...@amd.com Reviewed-by: Vincent Lejeune vljn at ovi.com Reviewed-by: Tom Stellard thomas.stell...@amd.com --- .../drivers/radeon/radeon_setup_tgsi_llvm.c|2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c index f7b7586..f017b87 100644 --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c @@ -1281,6 +1281,8 @@ void radeon_llvm_finalize_module(struct radeon_llvm_context * ctx) /* Add some optimization passes */ LLVMAddScalarReplAggregatesPass(gallivm-passmgr); + LLVMAddLICMPass(gallivm-passmgr); + LLVMAddAggressiveDCEPass(gallivm-passmgr); LLVMAddCFGSimplificationPass(gallivm-passmgr); /* Run the passs */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeon/llvm: document LLVM commit
Module: Mesa Branch: master Commit: eddf33f7112f569d119b677b0a41129350572198 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eddf33f7112f569d119b677b0a41129350572198 Author: Christian König christian.koe...@amd.com Date: Thu Mar 7 10:06:24 2013 +0100 radeon/llvm: document LLVM commit We need at least that revision to work correctly now. Signed-off-by: Christian König christian.koe...@amd.com --- src/gallium/drivers/radeon/LLVM_REVISION.txt |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/radeon/LLVM_REVISION.txt b/src/gallium/drivers/radeon/LLVM_REVISION.txt new file mode 100644 index 000..f5ee6d9 --- /dev/null +++ b/src/gallium/drivers/radeon/LLVM_REVISION.txt @@ -0,0 +1 @@ +r176626 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: fix glGetInteger*(GL_SAMPLER_BINDING).
Module: Mesa Branch: master Commit: 5984a911f9dda3f7421bdec604d30d0dfe2cea5e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5984a911f9dda3f7421bdec604d30d0dfe2cea5e Author: Alan Hourihane al...@vmware.com Date: Wed Mar 6 18:14:01 2013 + mesa: fix glGetInteger*(GL_SAMPLER_BINDING). If the sampler object has been deleted on another context, an alternative context may reference the old sampler. So ensure the sampler object still exists. Note: this is a candidate for the stable branch. Signed-off-by: Alan Hourihane al...@vmware.com Reviewed-by: Brian Paul bri...@vmware.com --- src/mesa/main/get.c| 12 +++- src/mesa/main/samplerobj.c |2 +- src/mesa/main/samplerobj.h |2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 2399f9c..582ef31 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -34,6 +34,7 @@ #include state.h #include texcompress.h #include framebuffer.h +#include samplerobj.h /* This is a table driven implemetation of the glGet*v() functions. * The basic idea is that most getters just look up an int somewhere @@ -827,7 +828,16 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu { struct gl_sampler_object *samp = ctx-Texture.Unit[ctx-Texture.CurrentUnit].Sampler; - v-value_int = samp ? samp-Name : 0; + + /* + * The sampler object may have been deleted on another context, + * so we try to lookup the sampler object before returning its Name. + */ + if (samp _mesa_lookup_samplerobj(ctx, samp-Name)) { +v-value_int = samp-Name; + } else { +v-value_int = 0; + } } break; /* GL_ARB_uniform_buffer_object */ diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 4664cc3..5cff329 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -40,7 +40,7 @@ #include main/samplerobj.h -static struct gl_sampler_object * +struct gl_sampler_object * _mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name) { if (name == 0) diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h index 3114257..69e3899 100644 --- a/src/mesa/main/samplerobj.h +++ b/src/mesa/main/samplerobj.h @@ -62,6 +62,8 @@ _mesa_reference_sampler_object(struct gl_context *ctx, _mesa_reference_sampler_object_(ctx, ptr, samp); } +extern struct gl_sampler_object * +_mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name); extern struct gl_sampler_object * _mesa_new_sampler_object(struct gl_context *ctx, GLuint name); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): vbo: fix crash found with shared display lists
Module: Mesa Branch: master Commit: c2665aacdd14beec9580246736c602e3ff04d7ae URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c2665aacdd14beec9580246736c602e3ff04d7ae Author: Brian Paul bri...@vmware.com Date: Wed Mar 6 12:08:17 2013 -0700 vbo: fix crash found with shared display lists This fixes a crash when a display list is created in one context but executed from a second one. The vbo_save_context::vertex_store memeber will be NULL if we never created a display list with the context. Just check for that before dereferencing the pointer. Fixes http://bugzilla.redhat.com/show_bug.cgi?id=918661 Note: This is a candidate for the stable branches. --- src/mesa/vbo/vbo_save_draw.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index efb386e..f5b5c41 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -253,7 +253,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) struct vbo_save_context *save = vbo_context(ctx)-save; GLboolean remap_vertex_store = GL_FALSE; - if (save-vertex_store-buffer) { + if (save-vertex_store save-vertex_store-buffer) { /* The vertex store is currently mapped but we're about to replay * a display list. This can happen when a nested display list is * being build with GL_COMPILE_AND_EXECUTE. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): llvmpipe: remove the power of two sizeof(struct cmd_block) assertion
Module: Mesa Branch: master Commit: 9915636fb8afe75ee2e8e013e4f495a4cb937afb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9915636fb8afe75ee2e8e013e4f495a4cb937afb Author: Brian Paul bri...@vmware.com Date: Wed Mar 6 16:57:20 2013 -0700 llvmpipe: remove the power of two sizeof(struct cmd_block) assertion It fails on 32-bit systems (I only tested on 64-bit). Power of two size isn't required, so just remove the assertion. Reviewed-by: José Fonseca jfons...@vmware.com --- src/gallium/drivers/llvmpipe/lp_scene.c |7 --- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index dd0943e..a0912eb 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -76,13 +76,6 @@ lp_scene_create( struct pipe_context *pipe ) assert(maxCommandBytes LP_SCENE_MAX_SIZE); /* We'll also need space for at least one other data block */ assert(maxCommandPlusData = LP_SCENE_MAX_SIZE); - - /* Ideally, the size of a cmd_block object will be a power of two - * in order to avoid wasting space when we allocation them from - * data blocks (which are power of two also). - */ - assert(sizeof(struct cmd_block) == - util_next_power_of_two(sizeof(struct cmd_block))); } #endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw: add const qualifier to silence compiler warning
Module: Mesa Branch: master Commit: 057c46d791112a04f02f5fe8fb2956b021c583f3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=057c46d791112a04f02f5fe8fb2956b021c583f3 Author: Brian Paul bri...@vmware.com Date: Thu Mar 7 08:10:56 2013 -0700 draw: add const qualifier to silence compiler warning --- src/gallium/auxiliary/draw/draw_pipe_clip.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index eeaaf41..8da0c41 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -600,7 +600,7 @@ clip_init_state( struct draw_stage *stage ) const struct draw_geometry_shader *gs = stage-draw-gs.geometry_shader; const struct draw_fragment_shader *fs = stage-draw-fs.fragment_shader; uint i; - struct tgsi_shader_info *vs_info = gs ? gs-info : vs-info; + const struct tgsi_shader_info *vs_info = gs ? gs-info : vs-info; /* We need to know for each attribute what kind of interpolation is * done on it (flat, smooth or noperspective). But the information ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): dri/nouveau: fix crash in nouveau_flush
Module: Mesa Branch: master Commit: 17f1cb1d99e66227d1e05925ef937643f5c1089a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=17f1cb1d99e66227d1e05925ef937643f5c1089a Author: Jan de Groot j...@jgc.homeip.net Date: Thu Mar 7 19:48:13 2013 +0100 dri/nouveau: fix crash in nouveau_flush https://bugs.freedesktop.org/show_bug.cgi?id=61947 Note: this is a candidate for the stable branches --- src/mesa/drivers/dri/nouveau/nouveau_driver.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index f56b3b2..6c119d5 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -69,7 +69,8 @@ nouveau_flush(struct gl_context *ctx) __DRIdri2LoaderExtension *dri2 = screen-dri2.loader; __DRIdrawable *drawable = nctx-dri_context-driDrawablePriv; - dri2-flushFrontBuffer(drawable, drawable-loaderPrivate); + if (drawable drawable-loaderPrivate) + dri2-flushFrontBuffer(drawable, drawable-loaderPrivate); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit