Mesa (master): r600: remove mask from output intructions
Module: Mesa Branch: master Commit: 5697bf166082119593bf1297028d03a7938eacfb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5697bf166082119593bf1297028d03a7938eacfb Author: Andre Maasikas amaasi...@gmail.com Date: Thu Sep 2 11:03:38 2010 +0300 r600: remove mask from output intructions in case of relative addressing we never get to know which comps were really written. --- src/mesa/drivers/dri/r600/evergreen_fragprog.c |7 --- src/mesa/drivers/dri/r600/evergreen_vertprog.c |8 src/mesa/drivers/dri/r600/r700_assembler.c | 14 +- src/mesa/drivers/dri/r600/r700_assembler.h |2 -- src/mesa/drivers/dri/r600/r700_fragprog.c |7 --- src/mesa/drivers/dri/r600/r700_vertprog.c |8 6 files changed, 1 insertions(+), 45 deletions(-) diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c index 0d31b1d..fb1f53a 100644 --- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c @@ -99,7 +99,6 @@ void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, { unsigned int unBit; unsigned int i; -GLuint ui; /* match fp inputs with vp exports. */ struct evergreen_vertex_program_cont *vpc = @@ -246,12 +245,6 @@ void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm, pAsm-pR700Shader-depthIsExported = 1; } -pAsm-pucOutMask = (unsigned char*) MALLOC(pAsm-number_of_exports); -for(ui=0; uipAsm-number_of_exports; ui++) -{ -pAsm-pucOutMask[ui] = 0x0; -} - pAsm-flag_reg_index = pAsm-number_used_registers++; pAsm-uFirstHelpReg = pAsm-number_used_registers; diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c index bdd9a9e..2911580 100644 --- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c +++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c @@ -200,7 +200,6 @@ void evergreen_Map_Vertex_Program(GLcontext *ctx, struct evergreen_vertex_program *vp, struct gl_vertex_program *mesa_vp) { -GLuint ui; r700_AssemblerBase *pAsm = (vp-r700AsmCode); unsigned int num_inputs; @@ -226,13 +225,6 @@ void evergreen_Map_Vertex_Program(GLcontext *ctx, pAsm-number_used_registers += pAsm-number_of_exports; -pAsm-pucOutMask = (unsigned char*) MALLOC(pAsm-number_of_exports); - -for(ui=0; uipAsm-number_of_exports; ui++) -{ -pAsm-pucOutMask[ui] = 0x0; -} - /* Map temporary registers (GPRs) */ pAsm-starting_temp_register_number = pAsm-number_used_registers; diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index d639fe0..9c5a505 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1413,17 +1413,6 @@ static GLboolean next_ins(r700_AssemblerBase *pAsm) if (pAsm-D.dst.rtype == DST_REG_OUT) { assert(pAsm-D.dst.reg = pAsm-starting_export_register_number); - -if (pAsm-D.dst.op3) -{ -// There is no mask for OP3 instructions, so all channels are written -pAsm-pucOutMask[pAsm-D.dst.reg - pAsm-starting_export_register_number] = 0xF; -} -else -{ -pAsm-pucOutMask[pAsm-D.dst.reg - pAsm-starting_export_register_number] - |= (unsigned char)pAsm-pILInst[pAsm-uiCurInst].DstReg.WriteMask; -} } //reset for next inst. @@ -7751,7 +7740,7 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm, { assert(starting_register_number = pAsm-starting_export_register_number); -ucWriteMask = pAsm-pucOutMask[starting_register_number - pAsm-starting_export_register_number]; +ucWriteMask = 0x0F; /* exports Z as a float into Red channel */ if (GL_TRUE == is_depth_export) ucWriteMask = 0x1; @@ -8087,7 +8076,6 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode) { -FREE(pR700AsmCode-pucOutMask); FREE(pR700AsmCode-pInstDeps); if(NULL != pR700AsmCode-subs) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index d357b0e..c7c7ab2 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -414,8 +414,6 @@ typedef struct r700_AssemblerBase unsigned char ucVP_AttributeMap[VERT_ATTRIB_MAX]; unsigned char ucVP_OutputMap[VERT_RESULT_MAX]; -unsigned char * pucOutMask; - //--- // flow control members
Mesa (master): r600: handle LIT writemask
Module: Mesa Branch: master Commit: 515d6eed0ba39f0279f35fa12b97803e33d9a4f7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=515d6eed0ba39f0279f35fa12b97803e33d9a4f7 Author: Andre Maasikas amaasi...@gmail.com Date: Wed Sep 1 10:57:35 2010 +0300 r600: handle LIT writemask --- src/mesa/drivers/dri/r600/r700_assembler.c | 288 ++-- 1 files changed, 141 insertions(+), 147 deletions(-) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 6a9bd85..083fa17 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4296,8 +4296,6 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) { unsigned int dstReg; unsigned int dstType; -unsigned int srcReg; -unsigned int srcType; checkop1(pAsm); int tmp = gethelpr(pAsm); @@ -4305,182 +4303,178 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) { return GL_FALSE; } -if( GL_FALSE == assemble_src(pAsm, 0, -1) ) -{ -return GL_FALSE; -} dstReg = pAsm-D.dst.reg; dstType = pAsm-D.dst.rtype; -srcReg = pAsm-S[0].src.reg; -srcType = pAsm-S[0].src.rtype; /* dst.xw, - 1.0 */ -pAsm-D.dst.opcode = SQ_OP2_INST_MOV; -pAsm-D.dst.rtype= dstType; -pAsm-D.dst.reg = dstReg; -pAsm-D.dst.writex = 1; -pAsm-D.dst.writey = 0; -pAsm-D.dst.writez = 0; -pAsm-D.dst.writew = 1; -pAsm-S[0].src.rtype = SRC_REG_TEMPORARY; -pAsm-S[0].src.reg = tmp; -setaddrmode_PVSSRC((pAsm-S[0].src), ADDR_ABSOLUTE); -noneg_PVSSRC((pAsm-S[0].src)); -pAsm-S[0].src.swizzlex = SQ_SEL_1; -pAsm-S[0].src.swizzley = SQ_SEL_1; -pAsm-S[0].src.swizzlez = SQ_SEL_1; -pAsm-S[0].src.swizzlew = SQ_SEL_1; -if( GL_FALSE == next_ins(pAsm) ) +if( pAsm-D.dst.writex || pAsm-D.dst.writew ) { -return GL_FALSE; -} +if( GL_FALSE == assemble_src(pAsm, 0, -1) ) +{ +return GL_FALSE; +} -if( GL_FALSE == assemble_src(pAsm, 0, -1) ) -{ -return GL_FALSE; +pAsm-D.dst.opcode = SQ_OP2_INST_MOV; +pAsm-D.dst.writey = 0; +pAsm-D.dst.writez = 0; +pAsm-S[0].src.rtype = SRC_REG_TEMPORARY; +pAsm-S[0].src.reg = tmp; +setaddrmode_PVSSRC((pAsm-S[0].src), ADDR_ABSOLUTE); +noneg_PVSSRC((pAsm-S[0].src)); +pAsm-S[0].src.swizzlex = SQ_SEL_1; +pAsm-S[0].src.swizzley = SQ_SEL_1; +pAsm-S[0].src.swizzlez = SQ_SEL_1; +pAsm-S[0].src.swizzlew = SQ_SEL_1; +if( GL_FALSE == next_ins(pAsm) ) +{ +return GL_FALSE; +} } -/* dst.y = max(src.x, 0.0) */ -pAsm-D.dst.opcode = SQ_OP2_INST_MAX; -pAsm-D.dst.rtype= dstType; -pAsm-D.dst.reg = dstReg; -pAsm-D.dst.writex = 0; -pAsm-D.dst.writey = 1; -pAsm-D.dst.writez = 0; -pAsm-D.dst.writew = 0; -pAsm-S[0].src.rtype = srcType; -pAsm-S[0].src.reg = srcReg; -setaddrmode_PVSSRC((pAsm-S[0].src), ADDR_ABSOLUTE); -swizzleagain_PVSSRC((pAsm-S[0].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); -pAsm-S[1].src.rtype = SRC_REG_TEMPORARY; -pAsm-S[1].src.reg = tmp; -setaddrmode_PVSSRC((pAsm-S[1].src), ADDR_ABSOLUTE); -noneg_PVSSRC((pAsm-S[1].src)); -pAsm-S[1].src.swizzlex = SQ_SEL_0; -pAsm-S[1].src.swizzley = SQ_SEL_0; -pAsm-S[1].src.swizzlez = SQ_SEL_0; -pAsm-S[1].src.swizzlew = SQ_SEL_0; -if( GL_FALSE == next_ins(pAsm) ) +if( GL_FALSE == assemble_dst(pAsm) ) { return GL_FALSE; } -if( GL_FALSE == assemble_src(pAsm, 0, -1) ) -{ -return GL_FALSE; -} +if( pAsm-D.dst.writey ) { -swizzleagain_PVSSRC((pAsm-S[0].src), SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y); +if( GL_FALSE == assemble_src(pAsm, 0, -1) ) +{ +return GL_FALSE; +} -/* dst.z = log(src.y) */ -if(8 == pAsm-unAsic) -{ -pAsm-D.dst.opcode = EG_OP2_INST_LOG_CLAMPED; -} -else -{ -pAsm-D.dst.opcode = SQ_OP2_INST_LOG_CLAMPED; -} -pAsm-D.dst.math = 1; -pAsm-D.dst.rtype= dstType; -pAsm-D.dst.reg = dstReg; -pAsm-D.dst.writex = 0; -pAsm-D.dst.writey = 0; -pAsm-D.dst.writez = 1; -pAsm-D.dst.writew = 0; -pAsm-S[0].src.rtype = srcType; -pAsm-S[0].src.reg = srcReg; -setaddrmode_PVSSRC((pAsm-S[0].src), ADDR_ABSOLUTE); -if( GL_FALSE == next_ins(pAsm) ) -{ -return GL_FALSE; +/* dst.y = max(src.x, 0.0) */ +pAsm-D.dst.opcode = SQ_OP2_INST_MAX; +pAsm-D.dst.writex = 0; +pAsm-D.dst.writey = 1; +pAsm-D.dst.writez = 0; +pAsm-D.dst.writew = 0; +swizzleagain_PVSSRC((pAsm-S[0].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); +pAsm-S[1].src.rtype = SRC_REG_TEMPORARY; +pAsm-S[1].src.reg = tmp; +
Mesa (master): r600: protect cleanup instructions from double free
Module: Mesa Branch: master Commit: 7753416c5b6bdcc757983400c50c5cf878bc9caf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7753416c5b6bdcc757983400c50c5cf878bc9caf Author: Andre Maasikas amaasi...@gmail.com Date: Thu Sep 2 11:09:52 2010 +0300 r600: protect cleanup instructions from double free We might get the cleanup when we have not translated the shader yet e.g 2 programstringnotifys in a row --- src/mesa/drivers/dri/r600/r700_assembler.c |9 - src/mesa/drivers/dri/r600/r700_shader.c| 13 - 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 9c5a505..5d557f7 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -8076,20 +8076,27 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode) { -FREE(pR700AsmCode-pInstDeps); +if(NULL != pR700AsmCode-pInstDeps) +{ +FREE(pR700AsmCode-pInstDeps); +pR700AsmCode-pInstDeps = NULL; +} if(NULL != pR700AsmCode-subs) { FREE(pR700AsmCode-subs); +pR700AsmCode-subs = NULL; } if(NULL != pR700AsmCode-callers) { FREE(pR700AsmCode-callers); +pR700AsmCode-callers = NULL; } if(NULL != pR700AsmCode-presubs) { FREE(pR700AsmCode-presubs); + pR700AsmCode-presubs = NULL; } return GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c index 67b0d40..8b3ed5c 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ b/src/mesa/drivers/dri/r600/r700_shader.c @@ -584,7 +584,11 @@ void cleanup_vfetch_shaderinst(R700_Shader *pShader) void Clean_Up_Shader(R700_Shader *pShader) { -FREE(pShader-pProgram); +if(NULL != pShader-pProgram) +{ +FREE(pShader-pProgram); +pShader-pProgram = NULL; +} R700ShaderInstruction *pInst; R700ShaderInstruction *pInstToFree; @@ -596,6 +600,8 @@ void Clean_Up_Shader(R700_Shader *pShader) pInst = pInst-pNextInst; FREE(pInstToFree); }; +pShader-lstCFInstructions.pHead = NULL; + pInst = pShader-lstALUInstructions.pHead; while(NULL != pInst) { @@ -603,6 +609,8 @@ void Clean_Up_Shader(R700_Shader *pShader) pInst = pInst-pNextInst; FREE(pInstToFree); }; +pShader-lstALUInstructions.pHead = NULL; + pInst = pShader-lstTEXInstructions.pHead; while(NULL != pInst) { @@ -610,6 +618,8 @@ void Clean_Up_Shader(R700_Shader *pShader) pInst = pInst-pNextInst; FREE(pInstToFree); }; +pShader-lstTEXInstructions.pHead = NULL; + pInst = pShader-lstVTXInstructions.pHead; while(NULL != pInst) { @@ -617,5 +627,6 @@ void Clean_Up_Shader(R700_Shader *pShader) pInst = pInst-pNextInst; FREE(pInstToFree); }; +pShader-lstVTXInstructions.pHead = NULL; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600: add TXL instruction and note about TXB
Module: Mesa Branch: master Commit: 777f352e6087e3ef05f7a88232f23e4f971bc5a0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=777f352e6087e3ef05f7a88232f23e4f971bc5a0 Author: Andre Maasikas amaasi...@gmail.com Date: Thu Sep 2 18:16:42 2010 +0300 r600: add TXL instruction and note about TXB --- src/mesa/drivers/dri/r600/r700_assembler.c | 17 - 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 798d6a7..0f8fb7a 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -619,7 +619,7 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 GLboolean IsTex(gl_inst_opcode Opcode) { if( (OPCODE_TEX==Opcode) || (OPCODE_TXP==Opcode) || (OPCODE_TXB==Opcode) || -(OPCODE_DDX==Opcode) || (OPCODE_DDY==Opcode) ) +(OPCODE_DDX==Opcode) || (OPCODE_DDY==Opcode) || (OPCODE_TXL==Opcode) ) { return GL_TRUE; } @@ -923,9 +923,10 @@ GLboolean add_tex_instruction(r700_AssemblerBase* pAsm, } } -// If this clause constains any TEX instruction that is dependent on a previous instruction, -// set the barrier bit -if( pAsm-pInstDeps[pAsm-uiCurInst].nDstDep (-1) || pAsm-need_tex_barrier == GL_TRUE ) +// If this clause constains any TEX instruction that is dependent on a +// previous instruction, set the barrier bit, also always set for vert +// programs as tex deps are not(yet) computed for them +if( pAsm-currentShaderType == SPT_VP || pAsm-pInstDeps[pAsm-uiCurInst].nDstDep (-1) || pAsm-need_tex_barrier == GL_TRUE ) { pAsm-cf_current_tex_clause_ptr-m_Word1.f.barrier = 0x1; } @@ -5277,6 +5278,11 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) pAsm-D.dst.opcode = SQ_TEX_INST_GET_GRADIENTS_V; break; case OPCODE_TXB: + /* this should actually be SAMPLE_LB but that needs bias to be + * embedded in the instruction - cant do here */ +pAsm-D.dst.opcode = SQ_TEX_INST_SAMPLE_L; +break; +case OPCODE_TXL: pAsm-D.dst.opcode = SQ_TEX_INST_SAMPLE_L; break; default: @@ -7104,7 +7110,8 @@ GLboolean AssembleInstr(GLuint uiFirstInst, case OPCODE_DDX: case OPCODE_DDY: case OPCODE_TEX: -case OPCODE_TXB: +case OPCODE_TXB: +case OPCODE_TXL: case OPCODE_TXP: if ( GL_FALSE == assemble_TEX(pR700AsmCode) ) return GL_FALSE; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600: remove depth exports move, just set to output x - z in the export intruction
Module: Mesa Branch: master Commit: 1f12945d2fba751e09c2f2dd01899107590b30ec URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f12945d2fba751e09c2f2dd01899107590b30ec Author: Andre Maasikas amaasi...@gmail.com Date: Thu Sep 2 11:37:23 2010 +0300 r600: remove depth exports move, just set to output x - z in the export intruction --- src/mesa/drivers/dri/r600/r700_assembler.c | 75 ++-- 1 files changed, 5 insertions(+), 70 deletions(-) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 5d557f7..798d6a7 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -7659,8 +7659,6 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm, GLuint starting_register_number, GLboolean is_depth_export) { -unsigned char ucWriteMask; - check_current_clause(pAsm, CF_EMPTY_CLAUSE); check_current_clause(pAsm, CF_EXPORT_CLAUSE); //alloc the cf_current_export_clause_ptr @@ -7740,43 +7738,21 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm, { assert(starting_register_number = pAsm-starting_export_register_number); -ucWriteMask = 0x0F; /* exports Z as a float into Red channel */ if (GL_TRUE == is_depth_export) - ucWriteMask = 0x1; - -if( (ucWriteMask 0x1) != 0) { -pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_x = SQ_SEL_X; +pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_x = SQ_SEL_Z; +pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_y = SQ_SEL_MASK; +pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_z = SQ_SEL_MASK; +pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_w = SQ_SEL_MASK; } else { -pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_x = SQ_SEL_MASK; -} -if( ((ucWriteMask1) 0x1) != 0) -{ +pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_x = SQ_SEL_X; pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_y = SQ_SEL_Y; -} -else -{ -pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_y = SQ_SEL_MASK; -} -if( ((ucWriteMask2) 0x1) != 0) -{ pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_z = SQ_SEL_Z; -} -else -{ -pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_z = SQ_SEL_MASK; -} -if( ((ucWriteMask3) 0x1) != 0) -{ pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_w = SQ_SEL_W; } -else -{ -pAsm-cf_current_export_clause_ptr-m_Word1_SWIZ.f.sel_w = SQ_SEL_MASK; -} } else { @@ -7792,39 +7768,6 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm, return GL_TRUE; } -GLboolean Move_Depth_Exports_To_Correct_Channels(r700_AssemblerBase *pAsm, BITS depth_channel_select) -{ - gl_inst_opcode Opcode_save = pAsm-pILInst[pAsm-uiCurInst].Opcode; //Should be OPCODE_END -pAsm-pILInst[pAsm-uiCurInst].Opcode = OPCODE_MOV; - -// MOV depth_export_register.hw_depth_channel, depth_export_register.depth_channel_select - -pAsm-D.dst.opcode = SQ_OP2_INST_MOV; - -setaddrmode_PVSDST((pAsm-D.dst), ADDR_ABSOLUTE); -pAsm-D.dst.rtype = DST_REG_TEMPORARY; -pAsm-D.dst.reg = pAsm-depth_export_register_number; - -pAsm-D.dst.writex = 1; // depth goes in R channel for HW - -setaddrmode_PVSSRC((pAsm-S[0].src), ADDR_ABSOLUTE); -pAsm-S[0].src.rtype = DST_REG_TEMPORARY; -pAsm-S[0].src.reg = pAsm-depth_export_register_number; - -setswizzle_PVSSRC((pAsm-S[0].src), depth_channel_select); - -noneg_PVSSRC((pAsm-S[0].src)); - -if( GL_FALSE == next_ins(pAsm) ) -{ -return GL_FALSE; -} - -pAsm-pILInst[pAsm-uiCurInst].Opcode = Opcode_save; - -return GL_TRUE; -} - GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten) { @@ -7832,14 +7775,6 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, GLuint export_count = 0; unsigned int i; -if(pR700AsmCode-depth_export_register_number = 0) -{ -if( GL_FALSE == Move_Depth_Exports_To_Correct_Channels(pR700AsmCode, SQ_SEL_Z) ) // depth - { - return GL_FALSE; - } -} - for (i = 0; i FRAG_RESULT_MAX; ++i) { unBit = 1 i; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600: fix rsq from negative input
Module: Mesa Branch: master Commit: 9d0d78ad3f1f906c99dae593e9ebc0c52496ffe1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d0d78ad3f1f906c99dae593e9ebc0c52496ffe1 Author: Andre Maasikas amaasi...@gmail.com Date: Wed Sep 1 10:38:07 2010 +0300 r600: fix rsq from negative input arbfp specifies rsq of abs value --- src/mesa/drivers/dri/r600/r700_assembler.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 45ff9c0..6a9bd85 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3189,6 +3189,9 @@ GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode) return GL_FALSE; } +if( pAsm-pILInst[pAsm-uiCurInst].Opcode == OPCODE_RSQ ) +pAsm-S[0].src.abs = 1; + if ( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600: allow relative addressing of temps, inputs, outputs
Module: Mesa Branch: master Commit: ae21956be29c027659568e17f1cf72d1931c4d61 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae21956be29c027659568e17f1cf72d1931c4d61 Author: Andre Maasikas amaasi...@gmail.com Date: Thu Sep 2 10:49:30 2010 +0300 r600: allow relative addressing of temps, inputs, outputs --- src/mesa/drivers/dri/r600/r700_assembler.c | 43 +++ 1 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 083fa17..d639fe0 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1645,10 +1645,17 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, } else { +if (1 == pILInst-SrcReg[src].RelAddr) +{ +setaddrmode_PVSSRC((pAsm-S[fld].src), ADDR_RELATIVE_A0); +} +else +{ +setaddrmode_PVSSRC((pAsm-S[fld].src), ADDR_ABSOLUTE); +} switch (pILInst-SrcReg[src].File) { case PROGRAM_TEMPORARY: -setaddrmode_PVSSRC((pAsm-S[fld].src), ADDR_ABSOLUTE); pAsm-S[fld].src.rtype = SRC_REG_TEMPORARY; pAsm-S[fld].src.reg = pILInst-SrcReg[src].Index + pAsm-starting_temp_register_number; break; @@ -1657,15 +1664,6 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, case PROGRAM_ENV_PARAM: case PROGRAM_STATE_VAR: case PROGRAM_UNIFORM: -if (1 == pILInst-SrcReg[src].RelAddr) -{ -setaddrmode_PVSSRC((pAsm-S[fld].src), ADDR_RELATIVE_A0); -} -else -{ -setaddrmode_PVSSRC((pAsm-S[fld].src), ADDR_ABSOLUTE); -} - pAsm-S[fld].src.rtype = SRC_REG_CONSTANT; if(pILInst-SrcReg[src].Index 0) { @@ -1678,7 +1676,6 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, } break; case PROGRAM_INPUT: -setaddrmode_PVSSRC((pAsm-S[fld].src), ADDR_ABSOLUTE); pAsm-S[fld].src.rtype = SRC_REG_GPR; switch (pAsm-currentShaderType) { @@ -1691,7 +1688,6 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, } break; case PROGRAM_OUTPUT: -setaddrmode_PVSSRC((pAsm-S[fld].src), ADDR_ABSOLUTE); pAsm-S[fld].src.rtype = SRC_REG_GPR; switch (pAsm-currentShaderType) { @@ -1728,7 +1724,14 @@ GLboolean assemble_dst(r700_AssemblerBase *pAsm) switch (pILInst-DstReg.File) { case PROGRAM_TEMPORARY: +if (1 == pILInst-DstReg.RelAddr) +{ +setaddrmode_PVSDST((pAsm-D.dst), ADDR_RELATIVE_A0); +} +else +{ setaddrmode_PVSDST((pAsm-D.dst), ADDR_ABSOLUTE); +} pAsm-D.dst.rtype = DST_REG_TEMPORARY; pAsm-D.dst.reg = pILInst-DstReg.Index + pAsm-starting_temp_register_number; break; @@ -1738,7 +1741,14 @@ GLboolean assemble_dst(r700_AssemblerBase *pAsm) pAsm-D.dst.reg = 0; break; case PROGRAM_OUTPUT: +if (1 == pILInst-DstReg.RelAddr) +{ +setaddrmode_PVSDST((pAsm-D.dst), ADDR_RELATIVE_A0); +} +else +{ setaddrmode_PVSDST((pAsm-D.dst), ADDR_ABSOLUTE); +} pAsm-D.dst.rtype = DST_REG_OUT; switch (pAsm-currentShaderType) { @@ -3026,7 +3036,14 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) return GL_FALSE; } -alu_instruction_ptr-m_Word1.f.dst_rel = SQ_ABSOLUTE; //D.rtype +if ( ADDR_RELATIVE_A0 == addrmode_PVSDST((pAsm-D.dst)) ) +{ +alu_instruction_ptr-m_Word1.f.dst_rel = SQ_RELATIVE; +} +else +{ +alu_instruction_ptr-m_Word1.f.dst_rel = SQ_ABSOLUTE; +} if ( is_single_scalar_operation == GL_TRUE ) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glx: Fix another use-after-free problem
Module: Mesa Branch: master Commit: 80e48ddcf6d5bdc1fc063f28b7af478dae330233 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=80e48ddcf6d5bdc1fc063f28b7af478dae330233 Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Sep 9 08:06:40 2010 -0400 glx: Fix another use-after-free problem --- src/glx/glx_pbuffer.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index d1cb66b..34892e8 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -220,12 +220,14 @@ DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable) { struct glx_display *const priv = __glXInitialize(dpy); __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); + XID xid; if (pdraw != NULL) { + xid = pdraw-xDrawable; (*pdraw-destroyDrawable) (pdraw); __glxHashDelete(priv-drawHash, drawable); if (destroy_xdrawable) - XFreePixmap(pdraw-psc-dpy, pdraw-xDrawable); + XFreePixmap(priv-dpy, xid); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): dri/nv04: Add support for NV_texture_env_combine4.
Module: Mesa Branch: master Commit: 699749cfeeea7d0a17ed5f94fd5fdbbe52f4ab2b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=699749cfeeea7d0a17ed5f94fd5fdbbe52f4ab2b Author: Francisco Jerez curroje...@riseup.net Date: Thu Sep 9 14:14:14 2010 +0200 dri/nv04: Add support for NV_texture_env_combine4. --- src/mesa/drivers/dri/nouveau/nv04_context.c|1 + src/mesa/drivers/dri/nouveau/nv04_state_frag.c | 36 +++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index 6834f7c..1d34c86 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.c +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c @@ -39,6 +39,7 @@ nv04_context_engine(GLcontext *ctx) struct nouveau_grobj *fahrenheit; if (ctx-Texture.Unit[0].EnvMode == GL_COMBINE || + ctx-Texture.Unit[0].EnvMode == GL_COMBINE4_NV || ctx-Texture.Unit[0].EnvMode == GL_BLEND || ctx-Texture.Unit[0].EnvMode == GL_ADD || ctx-Texture.Unit[1]._ReallyEnabled || diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c index d7c86d4..bb5d7dc 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c @@ -44,6 +44,7 @@ struct combiner_state { GLcontext *ctx; int unit; GLboolean alpha; + GLboolean premodulate; /* GL state */ GLenum mode; @@ -66,6 +67,7 @@ struct combiner_state { (rc)-ctx = ctx;\ (rc)-unit = i; \ (rc)-alpha = __INIT_COMBINER_ALPHA_##chan; \ + (rc)-premodulate = c-_NumArgs##chan == 4; \ (rc)-mode = c-Mode##chan; \ (rc)-source = c-Source##chan; \ (rc)-operand = c-Operand##chan; \ @@ -79,6 +81,9 @@ static uint32_t get_input_source(struct combiner_state *rc, int source) { switch (source) { + case GL_ZERO: + return COMBINER_SOURCE(ZERO); + case GL_TEXTURE: return rc-unit ? COMBINER_SOURCE(TEXTURE1) : COMBINER_SOURCE(TEXTURE0); @@ -195,11 +200,24 @@ setup_combiner(struct combiner_state *rc) break; case GL_ADD: - INPUT_ARG(rc, 0, 0, 0); - INPUT_SRC(rc, 1, ZERO, INVERT); - INPUT_ARG(rc, 2, 1, 0); - INPUT_SRC(rc, 3, ZERO, INVERT); - UNSIGNED_OP(rc); + case GL_ADD_SIGNED: + if (rc-premodulate) { + INPUT_ARG(rc, 0, 0, 0); + INPUT_ARG(rc, 1, 1, 0); + INPUT_ARG(rc, 2, 2, 0); + INPUT_ARG(rc, 3, 3, 0); + } else { + INPUT_ARG(rc, 0, 0, 0); + INPUT_SRC(rc, 1, ZERO, INVERT); + INPUT_ARG(rc, 2, 1, 0); + INPUT_SRC(rc, 3, ZERO, INVERT); + } + + if (rc-mode == GL_ADD_SIGNED) + SIGNED_OP(rc); + else + UNSIGNED_OP(rc); + break; case GL_INTERPOLATE: @@ -210,14 +228,6 @@ setup_combiner(struct combiner_state *rc) UNSIGNED_OP(rc); break; - case GL_ADD_SIGNED: - INPUT_ARG(rc, 0, 0, 0); - INPUT_SRC(rc, 1, ZERO, INVERT); - INPUT_ARG(rc, 2, 1, 0); - INPUT_SRC(rc, 3, ZERO, INVERT); - SIGNED_OP(rc); - break; - default: assert(0); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): dri/nouveau: Minor cleanup.
Module: Mesa Branch: master Commit: a76f6dc84952348261c32bcace56790e939a2902 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a76f6dc84952348261c32bcace56790e939a2902 Author: Francisco Jerez curroje...@riseup.net Date: Thu Sep 2 02:18:02 2010 +0200 dri/nouveau: Minor cleanup. --- src/mesa/drivers/dri/nouveau/nv20_state_tnl.c | 50 ++-- 1 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c index 62efe80..2daaae2 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c @@ -32,6 +32,28 @@ #include nv10_driver.h #include nv20_driver.h +#define LIGHT_MODEL_AMBIENT_R(side)\ + ((side) ? NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R : \ +NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R) +#define LIGHT_AMBIENT_R(side, i) \ + ((side) ? NV20TCL_LIGHT_BACK_AMBIENT_R(i) : \ +NV20TCL_LIGHT_FRONT_AMBIENT_R(i)) +#define LIGHT_DIFFUSE_R(side, i) \ + ((side) ? NV20TCL_LIGHT_BACK_DIFFUSE_R(i) : \ +NV20TCL_LIGHT_FRONT_DIFFUSE_R(i)) +#define LIGHT_SPECULAR_R(side, i) \ + ((side) ? NV20TCL_LIGHT_BACK_SPECULAR_R(i) :\ +NV20TCL_LIGHT_FRONT_SPECULAR_R(i)) +#define MATERIAL_FACTOR_R(side)\ + ((side) ? NV20TCL_MATERIAL_FACTOR_BACK_R : \ +NV20TCL_MATERIAL_FACTOR_FRONT_R) +#define MATERIAL_FACTOR_A(side)\ + ((side) ? NV20TCL_MATERIAL_FACTOR_BACK_A : \ +NV20TCL_MATERIAL_FACTOR_FRONT_A) +#define MATERIAL_SHININESS(side) \ + ((side) ? NV20TCL_BACK_MATERIAL_SHININESS(0) : \ +NV20TCL_FRONT_MATERIAL_SHININESS(0)) + void nv20_emit_clip_plane(GLcontext *ctx, int emit) { @@ -210,10 +232,6 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit) struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); float (*mat)[4] = ctx-Light.Material.Attrib; - uint32_t m_scene[] = { NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R, - NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R }; - uint32_t m_factor[] = { NV20TCL_MATERIAL_FACTOR_FRONT_R, - NV20TCL_MATERIAL_FACTOR_BACK_R }; float c_scene[3], c_factor[3]; struct gl_light *l; @@ -231,23 +249,21 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit) ZERO_3V(c_factor); } - BEGIN_RING(chan, kelvin, m_scene[side], 3); + BEGIN_RING(chan, kelvin, LIGHT_MODEL_AMBIENT_R(side), 3); OUT_RINGp(chan, c_scene, 3); if (ctx-Light.ColorMaterialEnabled) { - BEGIN_RING(chan, kelvin, m_factor[side], 3); + BEGIN_RING(chan, kelvin, MATERIAL_FACTOR_R(side), 3); OUT_RINGp(chan, c_factor, 3); } foreach(l, ctx-Light.EnabledList) { const int i = l - ctx-Light.Light; - uint32_t m_light[] = { NV20TCL_LIGHT_FRONT_AMBIENT_R(i), - NV20TCL_LIGHT_BACK_AMBIENT_R(i) }; float *c_light = (USE_COLOR_MATERIAL(AMBIENT, side) ? l-Ambient : l-_MatAmbient[side]); - BEGIN_RING(chan, kelvin, m_light[side], 3); + BEGIN_RING(chan, kelvin, LIGHT_AMBIENT_R(side, i), 3); OUT_RINGp(chan, c_light, 3); } } @@ -259,22 +275,18 @@ nv20_emit_material_diffuse(GLcontext *ctx, int emit) struct nouveau_channel *chan = context_chan(ctx); struct nouveau_grobj *kelvin = context_eng3d(ctx); GLfloat (*mat)[4] = ctx-Light.Material.Attrib; - uint32_t m_factor[] = { NV20TCL_MATERIAL_FACTOR_FRONT_A, - NV20TCL_MATERIAL_FACTOR_BACK_A }; struct gl_light *l; - BEGIN_RING(chan, kelvin, m_factor[side], 1); + BEGIN_RING(chan, kelvin, MATERIAL_FACTOR_A(side), 1); OUT_RINGf(chan, mat[MAT_ATTRIB_DIFFUSE(side)][3]); foreach(l, ctx-Light.EnabledList) { const int i = l - ctx-Light.Light; - uint32_t m_light[] = { NV20TCL_LIGHT_FRONT_DIFFUSE_R(i), - NV20TCL_LIGHT_BACK_DIFFUSE_R(i) }; float *c_light = (USE_COLOR_MATERIAL(DIFFUSE, side) ? l-Diffuse : l-_MatDiffuse[side]); - BEGIN_RING(chan, kelvin, m_light[side], 3); + BEGIN_RING(chan, kelvin, LIGHT_DIFFUSE_R(side, i), 3); OUT_RINGp(chan, c_light, 3); } } @@ -289,13 +301,11 @@ nv20_emit_material_specular(GLcontext *ctx, int emit) foreach(l, ctx-Light.EnabledList) { const int i = l - ctx-Light.Light; -
Mesa (master): dri/nouveau: Expose EXT_texture_env_combine.
Module: Mesa Branch: master Commit: cdd5f21eacc93dfb242e59a6158d0e450a39a9b6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cdd5f21eacc93dfb242e59a6158d0e450a39a9b6 Author: Francisco Jerez curroje...@riseup.net Date: Thu Sep 9 14:07:38 2010 +0200 dri/nouveau: Expose EXT_texture_env_combine. --- src/mesa/drivers/dri/nouveau/nouveau_context.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 287f77d..4a1534b 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -58,6 +58,7 @@ static const struct dri_extension nouveau_extensions[] = { { GL_EXT_framebuffer_object, GL_EXT_framebuffer_object_functions }, { GL_EXT_secondary_color, GL_EXT_secondary_color_functions }, { GL_EXT_stencil_wrap,NULL }, + { GL_EXT_texture_env_combine, NULL }, { GL_EXT_texture_lod_bias,NULL }, { GL_NV_blend_square, NULL }, { GL_NV_texture_env_combine4, NULL }, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): dri/nv10-nv20: Add support for NV_texture_env_combine4.
Module: Mesa Branch: master Commit: 3bbad7f1084c3d6259dfa23fd60f654c949f7408 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3bbad7f1084c3d6259dfa23fd60f654c949f7408 Author: Francisco Jerez curroje...@riseup.net Date: Thu Sep 9 14:14:48 2010 +0200 dri/nv10-nv20: Add support for NV_texture_env_combine4. --- src/mesa/drivers/dri/nouveau/nouveau_context.c |1 + src/mesa/drivers/dri/nouveau/nv10_state_frag.c | 31 ++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index b1d4152..287f77d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -60,6 +60,7 @@ static const struct dri_extension nouveau_extensions[] = { { GL_EXT_stencil_wrap,NULL }, { GL_EXT_texture_lod_bias,NULL }, { GL_NV_blend_square, NULL }, + { GL_NV_texture_env_combine4, NULL }, { GL_SGIS_generate_mipmap,NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c index 76b95fd..ab713f9 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c @@ -63,6 +63,7 @@ struct combiner_state { GLcontext *ctx; int unit; + GLboolean premodulate; /* GL state */ GLenum mode; @@ -82,6 +83,7 @@ struct combiner_state { ctx-Texture.Unit[i]._CurrentCombine; \ (rc)-ctx = ctx;\ (rc)-unit = i; \ + (rc)-premodulate = c-_NumArgs##chan == 4; \ (rc)-mode = c-Mode##chan; \ (rc)-source = c-Source##chan; \ (rc)-operand = c-Operand##chan; \ @@ -95,6 +97,9 @@ static uint32_t get_input_source(struct combiner_state *rc, int source) { switch (source) { + case GL_ZERO: + return RC_IN_SOURCE(ZERO); + case GL_TEXTURE: return RC_IN_SOURCE(TEXTURE0) + rc-unit; @@ -228,21 +233,21 @@ setup_combiner(struct combiner_state *rc) break; case GL_ADD: - INPUT_ARG(rc, A, 0, 0); - INPUT_ONE(rc, B, 0); - INPUT_ARG(rc, C, 1, 0); - INPUT_ONE(rc, D, 0); - - rc-out = RC_OUT_SUM; - break; - case GL_ADD_SIGNED: - INPUT_ARG(rc, A, 0, 0); - INPUT_ONE(rc, B, 0); - INPUT_ARG(rc, C, 1, 0); - INPUT_ONE(rc, D, 0); + if (rc-premodulate) { + INPUT_ARG(rc, A, 0, 0); + INPUT_ARG(rc, B, 1, 0); + INPUT_ARG(rc, C, 2, 0); + INPUT_ARG(rc, D, 3, 0); + } else { + INPUT_ARG(rc, A, 0, 0); + INPUT_ONE(rc, B, 0); + INPUT_ARG(rc, C, 1, 0); + INPUT_ONE(rc, D, 0); + } - rc-out = RC_OUT_SUM | RC_OUT_BIAS; + rc-out = RC_OUT_SUM | + (rc-mode == GL_ADD_SIGNED ? RC_OUT_BIAS : 0); break; case GL_INTERPOLATE: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): llvmpipe: remove redundant tgsi_dup_tokens() call
Module: Mesa Branch: master Commit: 3ec296390c250dbcdc2690e78da9a51ec57dabf5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ec296390c250dbcdc2690e78da9a51ec57dabf5 Author: Brian Paul bri...@vmware.com Date: Thu Sep 9 10:03:46 2010 -0600 llvmpipe: remove redundant tgsi_dup_tokens() call We were calling this twice so the first allocation was orphaned/leaked. --- src/gallium/drivers/llvmpipe/lp_state_fs.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 8f3976c..e17bfb4 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -901,9 +901,6 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, debug_printf(\n); } - /* Keep a copy of the tokens in shader-base.tokens */ - shader-base.tokens = tgsi_dup_tokens(templ-tokens); - return shader; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl: Use _EGL_CHECK_DISPLAY in eglCreateContext.
Module: Mesa Branch: master Commit: 916c8ed2c8f916604166b22e6fcb9433b960a924 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=916c8ed2c8f916604166b22e6fcb9433b960a924 Author: Chia-I Wu o...@lunarg.com Date: Fri Sep 10 00:06:32 2010 +0800 egl: Use _EGL_CHECK_DISPLAY in eglCreateContext. _EGL_CHECK_DISPLAY checks the display and returns from eglCreateContext on error. --- src/egl/main/eglapi.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 31c5419..829d700 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -405,7 +405,7 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, if (config) _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv); else - drv = _eglCheckDisplay(disp, __FUNCTION__); + _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv); if (!share share_list != EGL_NO_CONTEXT) RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl: Display may be NULL in _eglLookup*.
Module: Mesa Branch: master Commit: 08a482e7a9d13db5d4e6fd974942f6699d7d49dc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08a482e7a9d13db5d4e6fd974942f6699d7d49dc Author: Chia-I Wu o...@lunarg.com Date: Fri Sep 10 00:02:47 2010 +0800 egl: Display may be NULL in _eglLookup*. This fixes several NULL dereferences. --- src/egl/main/eglconfig.h |2 +- src/egl/main/eglmode.c |2 +- src/egl/main/eglscreen.c |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h index ca63c40..0ad58cf 100644 --- a/src/egl/main/eglconfig.h +++ b/src/egl/main/eglconfig.h @@ -117,7 +117,7 @@ static INLINE _EGLConfig * _eglLookupConfig(EGLConfig config, _EGLDisplay *dpy) { _EGLConfig *conf = (_EGLConfig *) config; - if (!_eglCheckConfigHandle(config, dpy)) + if (!dpy || !_eglCheckConfigHandle(config, dpy)) conf = NULL; return conf; } diff --git a/src/egl/main/eglmode.c b/src/egl/main/eglmode.c index 37594cd..ed107d5 100644 --- a/src/egl/main/eglmode.c +++ b/src/egl/main/eglmode.c @@ -25,7 +25,7 @@ _eglLookupMode(EGLModeMESA mode, _EGLDisplay *disp) { EGLint scrnum; - if (!disp-Screens) + if (!disp || !disp-Screens) return NULL; /* loop over all screens on the display */ diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c index 8b8966f..9e39335 100644 --- a/src/egl/main/eglscreen.c +++ b/src/egl/main/eglscreen.c @@ -69,7 +69,7 @@ _eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display) { EGLint i; - if (!display-Screens) + if (!display || !display-Screens) return NULL; for (i = 0; i display-Screens-Size; i++) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glx: Optimize out no-op make current calls
Module: Mesa Branch: master Commit: 94118fe2d4b1e5d0b9f39d9d2c44706db462e97e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=94118fe2d4b1e5d0b9f39d9d2c44706db462e97e Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Sep 9 13:18:40 2010 -0400 glx: Optimize out no-op make current calls This make a lot more sense now that we might have to recreate the glx drawables for legacy code paths. --- src/glx/glxcurrent.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index 0d359f7..3631738 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -242,6 +242,10 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, return False; } + if (oldGC == gc + gc-currentDrawable == draw gc-currentReadable == read) + return True; + if (oldGC != dummyContext) { oldGC-vtable-unbind(oldGC, gc); oldGC-currentDpy = 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (nv50-compiler): nv50: save tgsi instructions
Module: Mesa Branch: nv50-compiler Commit: 217542a061ef31150b1b04f1b45b6099bcc153fe URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=217542a061ef31150b1b04f1b45b6099bcc153fe Author: Christoph Bumiller e0425...@student.tuwien.ac.at Date: Sun Sep 5 19:06:17 2010 +0200 nv50: save tgsi instructions --- src/gallium/drivers/nv50/nv50_program.c |5 + src/gallium/drivers/nv50/nv50_program.h |1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 523603c..d7d3030 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -499,6 +499,8 @@ nv50_prog_scan(struct nv50_translation_info *ti) ti-immd32 = (uint32_t *)MALLOC(ti-scan.immediate_count * 16); ti-immd32_ty = (ubyte *)MALLOC(ti-scan.immediate_count * sizeof(ubyte)); + ti-insns = MALLOC(ti-scan.num_instructions * sizeof(ti-insns[0])); + tgsi_parse_init(parse, p-pipe.tokens); while (!tgsi_parse_end_of_tokens(parse)) { tgsi_parse_token(parse); @@ -511,6 +513,7 @@ nv50_prog_scan(struct nv50_translation_info *ti) prog_decl(ti, parse.FullToken.FullDeclaration); break; case TGSI_TOKEN_TYPE_INSTRUCTION: + ti-insns[ti-inst_nr] = parse.FullToken.FullInstruction; prog_inst(ti, parse.FullToken.FullInstruction, ++ti-inst_nr); break; } @@ -567,6 +570,8 @@ out: FREE(ti-immd32); if (ti-immd32_ty) FREE(ti-immd32_ty); + if (ti-insns) + FREE(ti-insns); FREE(ti); return ret ? FALSE : TRUE; } diff --git a/src/gallium/drivers/nv50/nv50_program.h b/src/gallium/drivers/nv50/nv50_program.h index 639f062..3c3f1f7 100644 --- a/src/gallium/drivers/nv50/nv50_program.h +++ b/src/gallium/drivers/nv50/nv50_program.h @@ -104,6 +104,7 @@ struct nv50_subroutine { struct nv50_translation_info { struct nv50_program *p; unsigned inst_nr; + struct tgsi_full_instruction *insns; ubyte input_file; ubyte output_file; ubyte input_map[PIPE_MAX_SHADER_INPUTS][4]; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (nv50-compiler): nv50: prepare for having multiple functions
Module: Mesa Branch: nv50-compiler Commit: d91b8865ec2bb41f9b58ad5ce2df7f6f48f98281 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d91b8865ec2bb41f9b58ad5ce2df7f6f48f98281 Author: Christoph Bumiller e0425...@student.tuwien.ac.at Date: Tue Sep 7 15:40:34 2010 +0200 nv50: prepare for having multiple functions At some point we'll want to support real subroutines instead of just inlining them into the main shader. Since recursive calls are forbidden, we can just save all used registers to a fixed local memory region and restore them on a return, no need for a stack pointer. --- src/gallium/drivers/nv50/nv50_pc.c | 48 +++-- src/gallium/drivers/nv50/nv50_pc.h | 12 +++-- src/gallium/drivers/nv50/nv50_pc_optimize.c | 56 +--- src/gallium/drivers/nv50/nv50_pc_regalloc.c | 23 +++--- src/gallium/drivers/nv50/nv50_program.c | 63 +- src/gallium/drivers/nv50/nv50_program.h | 16 --- src/gallium/drivers/nv50/nv50_screen.c |3 +- src/gallium/drivers/nv50/nv50_tgsi_to_nc.c |2 +- 8 files changed, 171 insertions(+), 52 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c index e34c055..c54f16e 100644 --- a/src/gallium/drivers/nv50/nv50_pc.c +++ b/src/gallium/drivers/nv50/nv50_pc.c @@ -304,7 +304,7 @@ nv_pc_pass_in_order(struct nv_basic_block *root, nv_pc_pass_func f, void *priv) } static void -nv_do_print_program(void *priv, struct nv_basic_block *b) +nv_do_print_function(void *priv, struct nv_basic_block *b) { struct nv_instruction *i = b-phi; @@ -323,11 +323,23 @@ nv_do_print_program(void *priv, struct nv_basic_block *b) } void -nv_print_program(struct nv_basic_block *root) +nv_print_function(struct nv_basic_block *root) { - nv_pc_pass_in_order(root, nv_do_print_program, root); + if (root-subroutine) + debug_printf(SUBROUTINE %i\n, root-subroutine); + else + debug_printf(MAIN\n); - debug_printf(END\n\n); + nv_pc_pass_in_order(root, nv_do_print_function, root); +} + +void +nv_print_program(struct nv_pc *pc) +{ + int i; + for (i = 0; i pc-num_subroutines + 1; ++i) + if (pc-root[i]) + nv_print_function(pc-root[i]); } static INLINE void @@ -388,11 +400,18 @@ nv50_generate_code(struct nv50_translation_info *ti) if (!pc) return 1; + pc-root = CALLOC(ti-subr_nr + 1, sizeof(pc-root[0])); + if (!pc-root) { + FREE(pc); + return 1; + } + pc-num_subroutines = ti-subr_nr; + ret = nv50_tgsi_to_nc(pc, ti); if (ret) goto out; #ifdef NV50PC_DEBUG - nv_print_program(pc-root); + nv_print_program(pc); #endif /* optimization */ @@ -400,7 +419,7 @@ nv50_generate_code(struct nv50_translation_info *ti) if (ret) goto out; #ifdef NV50PC_DEBUG - nv_print_program(pc-root); + nv_print_program(pc); #endif /* register allocation */ @@ -408,7 +427,7 @@ nv50_generate_code(struct nv50_translation_info *ti) if (ret) goto out; #ifdef NV50PC_DEBUG - nv_print_program(pc-root); + nv_print_program(pc); #endif /* prepare for emission */ @@ -441,16 +460,19 @@ nv50_generate_code(struct nv50_translation_info *ti) out: nv_pc_free_refs(pc); - if (ret) { + + if (pc-bb_list) + FREE(pc-bb_list); + + if (ret) { /* on success, these will be referenced by nv50_program */ if (pc-emit) - free(pc-emit); + FREE(pc-emit); if (pc-immd_buf) - free(pc-immd_buf); + FREE(pc-immd_buf); if (pc-fixups) - free(pc-fixups); + FREE(pc-fixups); } - free(pc); - + FREE(pc); return ret; } diff --git a/src/gallium/drivers/nv50/nv50_pc.h b/src/gallium/drivers/nv50/nv50_pc.h index 703d32d..d9cc775 100644 --- a/src/gallium/drivers/nv50/nv50_pc.h +++ b/src/gallium/drivers/nv50/nv50_pc.h @@ -282,7 +282,7 @@ struct nv_basic_block { ubyte in_kind[8]; int id; - struct nv_basic_block *last_visitor; + int subroutine; uint priv; uint pass_seq; @@ -314,10 +314,10 @@ nv_fixup_apply(uint32_t *bin, struct nv_fixup *fixup, uint32_t data) bin[fixup-offset / 4] = val; } -struct nv_pc { - struct nv50_translation_info *ti; +struct nv50_translation_info; - struct nv_basic_block *root; +struct nv_pc { + struct nv_basic_block **root; struct nv_basic_block *current_block; struct nv_basic_block *parent_block; @@ -332,6 +332,7 @@ struct nv_pc { int num_instructions; int num_refs; int num_blocks; + int num_subroutines; int max_reg[4]; @@ -463,7 +464,8 @@ void nv_print_instruction(struct nv_instruction *); /* nv50_pc.c */ -void nv_print_program(struct nv_basic_block *b); +void nv_print_function(struct nv_basic_block *root); +void nv_print_program(struct nv_pc *); boolean nv_op_commutative(uint opcode); int nv50_indirect_opnd(struct nv_instruction *); diff --git
Mesa (nv50-compiler): nv50: use actual loads/ stores if TEMPs are accessed indirectly
Module: Mesa Branch: nv50-compiler Commit: f30810cb68a53c4fef360778a230126ed0ee0ee3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f30810cb68a53c4fef360778a230126ed0ee0ee3 Author: Christoph Bumiller e0425...@student.tuwien.ac.at Date: Thu Sep 9 19:12:54 2010 +0200 nv50: use actual loads/stores if TEMPs are accessed indirectly --- src/gallium/drivers/nv50/nv50_pc.c |2 + src/gallium/drivers/nv50/nv50_pc.h |3 + src/gallium/drivers/nv50/nv50_pc_emit.c | 28 ++--- src/gallium/drivers/nv50/nv50_pc_optimize.c | 19 ++--- src/gallium/drivers/nv50/nv50_pc_print.c|3 + src/gallium/drivers/nv50/nv50_program.c |7 +++ src/gallium/drivers/nv50/nv50_program.h |1 + src/gallium/drivers/nv50/nv50_screen.c | 25 ++-- src/gallium/drivers/nv50/nv50_screen.h |3 +- src/gallium/drivers/nv50/nv50_tgsi_to_nc.c | 54 +-- 10 files changed, 122 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c index c54f16e..637b3cf 100644 --- a/src/gallium/drivers/nv50/nv50_pc.c +++ b/src/gallium/drivers/nv50/nv50_pc.c @@ -414,6 +414,8 @@ nv50_generate_code(struct nv50_translation_info *ti) nv_print_program(pc); #endif + pc-opt_reload_elim = ti-store_to_memory ? FALSE : TRUE; + /* optimization */ ret = nv_pc_exec_pass0(pc); if (ret) diff --git a/src/gallium/drivers/nv50/nv50_pc.h b/src/gallium/drivers/nv50/nv50_pc.h index d9cc775..ba32ab0 100644 --- a/src/gallium/drivers/nv50/nv50_pc.h +++ b/src/gallium/drivers/nv50/nv50_pc.h @@ -345,6 +345,9 @@ struct nv_pc { struct nv_fixup *fixups; int num_fixups; + + /* optimization enables */ + boolean opt_reload_elim; }; void nvbb_insert_tail(struct nv_basic_block *, struct nv_instruction *); diff --git a/src/gallium/drivers/nv50/nv50_pc_emit.c b/src/gallium/drivers/nv50/nv50_pc_emit.c index bb0a6f3..8c64b19 100644 --- a/src/gallium/drivers/nv50/nv50_pc_emit.c +++ b/src/gallium/drivers/nv50/nv50_pc_emit.c @@ -412,25 +412,25 @@ emit_form_IMM(struct nv_pc *pc, struct nv_instruction *i, ubyte mod_mask) } static void -set_ld_st_size(struct nv_pc *pc, ubyte type) +set_ld_st_size(struct nv_pc *pc, int s, ubyte type) { switch (type) { case NV_TYPE_F64: - pc-emit[1] |= 0x8000; + pc-emit[1] |= 0x8000 s; break; case NV_TYPE_F32: case NV_TYPE_S32: case NV_TYPE_U32: - pc-emit[1] |= 0xc000; + pc-emit[1] |= 0xc000 s; break; case NV_TYPE_S16: - pc-emit[1] |= 0x6000; + pc-emit[1] |= 0x6000 s; break; case NV_TYPE_U16: - pc-emit[1] |= 0x4000; + pc-emit[1] |= 0x4000 s; break; case NV_TYPE_S8: - pc-emit[1] |= 0x2000; + pc-emit[1] |= 0x2000 s; break; default: break; @@ -473,12 +473,14 @@ emit_ld(struct nv_pc *pc, struct nv_instruction *i) if (sf == NV_FILE_MEM_L) { pc-emit[0] = 0xd001; pc-emit[1] = 0x4000; + + set_addr(pc, i); } else { NOUVEAU_ERR(invalid ld source file\n); abort(); } - set_ld_st_size(pc, STYPE(i, 0)); + set_ld_st_size(pc, (sf == NV_FILE_MEM_L) ? 8 : 0, STYPE(i, 0)); set_dst(pc, i-def[0]); set_pred_wr(pc, i); @@ -495,7 +497,19 @@ emit_ld(struct nv_pc *pc, struct nv_instruction *i) static void emit_st(struct nv_pc *pc, struct nv_instruction *i) { + assert(SFILE(i, 1) == NV_FILE_GPR); + assert(SFILE(i, 0) == NV_FILE_MEM_L); + + pc-emit[0] = 0xd001; + pc-emit[1] = 0x6000; + SID(pc, i-src[1], 2); + SID(pc, i-src[0], 9); + + set_ld_st_size(pc, 8, STYPE(i, 1)); + + set_addr(pc, i); + set_pred(pc, i); } static int diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c b/src/gallium/drivers/nv50/nv50_pc_optimize.c index 4f5bdc1..09d232a 100644 --- a/src/gallium/drivers/nv50/nv50_pc_optimize.c +++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c @@ -82,6 +82,8 @@ inst_commutation_legal(struct nv_instruction *a, static INLINE boolean inst_cullable(struct nv_instruction *nvi) { + if (nvi-opcode == NV_OP_STA) + return FALSE; return (!(nvi-is_terminator || nvi-is_join || nvi-target || nvi-fixed || @@ -739,6 +741,7 @@ struct nv_pass_reld_elim { int alloc; }; +/* TODO: properly handle loads from l[] memory in the presence of stores */ static int nv_pass_reload_elim(struct nv_pass_reld_elim *ctx, struct nv_basic_block *b) { @@ -1074,13 +1077,15 @@ nv_pc_pass0(struct nv_pc *pc, struct nv_basic_block *root) if (ret) return ret; - reldelim = CALLOC_STRUCT(nv_pass_reld_elim); - reldelim-pc = pc; - pc-pass_seq++; - ret = nv_pass_reload_elim(reldelim, root); - FREE(reldelim); - if (ret) - return ret; + if (pc-opt_reload_elim) { + reldelim = CALLOC_STRUCT(nv_pass_reld_elim); + reldelim-pc = pc; + pc-pass_seq++; + ret =
Mesa (nv50-compiler): nv50: don't parse again in tgsi_2_nc
Module: Mesa Branch: nv50-compiler Commit: d8dcff79702860eae92d3d35b461c9b71114c1c5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8dcff79702860eae92d3d35b461c9b71114c1c5 Author: Christoph Bumiller e0425...@student.tuwien.ac.at Date: Tue Sep 7 19:02:10 2010 +0200 nv50: don't parse again in tgsi_2_nc --- src/gallium/drivers/nv50/nv50_tgsi_to_nc.c | 18 +++--- 1 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c index dea8fa0..983fcb2 100644 --- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c +++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c @@ -1849,6 +1849,7 @@ nv50_tgsi_to_nc(struct nv_pc *pc, struct nv50_translation_info *ti) { struct bld_context *bld = CALLOC_STRUCT(bld_context); int c; + unsigned ip; pc-root[0] = pc-current_block = new_basic_block(pc); @@ -1865,21 +1866,8 @@ nv50_tgsi_to_nc(struct nv_pc *pc, struct nv50_translation_info *ti) bld-frgcrd[3] = bld_insn_1(bld, NV_OP_RCP, bld-frgcrd[3]); } - tgsi_parse_init(bld-parse[0], ti-p-pipe.tokens); - - while (!tgsi_parse_end_of_tokens(bld-parse[bld-call_lvl])) { - const union tgsi_full_token *tok = bld-parse[bld-call_lvl].FullToken; - - tgsi_parse_token(bld-parse[bld-call_lvl]); - - switch (tok-Token.Type) { - case TGSI_TOKEN_TYPE_INSTRUCTION: - bld_instruction(bld, tok-FullInstruction); - break; - default: - break; - } - } + for (ip = 0; ip ti-inst_nr; ++ip) + bld_instruction(bld, ti-insns[ip]); bld_free_value_trackers(bld-tvs[0][0], BLD_MAX_TEMPS); bld_free_value_trackers(bld-avs[0][0], BLD_MAX_ADDRS); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (nv50-compiler): nv50: create value references with the right type
Module: Mesa Branch: nv50-compiler Commit: 9cc80e25db3d0bfd38015a197de3a1a80b6733ab URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cc80e25db3d0bfd38015a197de3a1a80b6733ab Author: Christoph Bumiller e0425...@student.tuwien.ac.at Date: Thu Sep 9 19:17:55 2010 +0200 nv50: create value references with the right type Since atm our OPs aren't typed but instead values are, we need to take care if they're used as different types (e.g. a load makes a value u32 by default). Maybe this should be changed (also to match TGSI), but it should work as well if done properly. --- src/gallium/drivers/nv50/nv50_pc.h |9 -- src/gallium/drivers/nv50/nv50_tgsi_to_nc.c | 46 ++-- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_pc.h b/src/gallium/drivers/nv50/nv50_pc.h index ba32ab0..ccddae0 100644 --- a/src/gallium/drivers/nv50/nv50_pc.h +++ b/src/gallium/drivers/nv50/nv50_pc.h @@ -189,6 +189,7 @@ struct nv_reg { int id; ubyte file; ubyte type; /* type of generating instruction's result */ + ubyte as_type; /* default type for new references to this value */ union { float f32; double f64; @@ -396,14 +397,16 @@ new_value(struct nv_pc *pc, ubyte file, ubyte type) value-join = value; value-reg.id = -1; value-reg.file = file; - value-reg.type = type; + value-reg.type = value-reg.as_type = type; return value; } static INLINE struct nv_value * new_value_like(struct nv_pc *pc, struct nv_value *like) { - return new_value(pc, like-reg.file, like-reg.type); + struct nv_value *val = new_value(pc, like-reg.file, like-reg.type); + val-reg.as_type = like-reg.as_type; + return val; } static INLINE struct nv_ref * @@ -425,7 +428,7 @@ new_ref(struct nv_pc *pc, struct nv_value *val) ref = pc-refs[pc-num_refs++]; ref-value = val; - ref-typecast = val-reg.type; + ref-typecast = val-reg.as_type; ++val-refc; return ref; diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c index f4fee4e..50f0151 100644 --- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c +++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c @@ -22,8 +22,6 @@ /* #define NV50_TGSI2NC_DEBUG */ -/* XXX: need to clean this up so we get the typecasting right more naturally */ - #include unistd.h #include nv50_context.h @@ -519,17 +517,16 @@ bld_imm_f32(struct bld_context *bld, float f) return bld_imm_u32(bld, fui(f)); } -#define SET_TYPE(v, t) ((v)-reg.type = NV_TYPE_##t) +#define SET_TYPE(v, t) ((v)-reg.type = (v)-reg.as_type = (t)) static struct nv_value * bld_insn_1(struct bld_context *bld, uint opcode, struct nv_value *src0) { struct nv_instruction *insn = new_instruction(bld-pc, opcode); - assert(insn); - nv_reference(bld-pc, insn-src[0], src0); /* NOTE: new_ref would suffice */ + nv_reference(bld-pc, insn-src[0], src0); - return bld_def(insn, 0, new_value(bld-pc, NV_FILE_GPR, src0-reg.type)); + return bld_def(insn, 0, new_value(bld-pc, NV_FILE_GPR, src0-reg.as_type)); } static struct nv_value * @@ -541,7 +538,7 @@ bld_insn_2(struct bld_context *bld, uint opcode, nv_reference(bld-pc, insn-src[0], src0); nv_reference(bld-pc, insn-src[1], src1); - return bld_def(insn, 0, new_value(bld-pc, NV_FILE_GPR, src0-reg.type)); + return bld_def(insn, 0, new_value(bld-pc, NV_FILE_GPR, src0-reg.as_type)); } static struct nv_value * @@ -555,7 +552,7 @@ bld_insn_3(struct bld_context *bld, uint opcode, nv_reference(bld-pc, insn-src[1], src1); nv_reference(bld-pc, insn-src[2], src2); - return bld_def(insn, 0, new_value(bld-pc, NV_FILE_GPR, src0-reg.type)); + return bld_def(insn, 0, new_value(bld-pc, NV_FILE_GPR, src0-reg.as_type)); } static void @@ -593,14 +590,14 @@ bld_lmem_load(struct bld_context *bld, struct nv_value *ptr, int ofst) #define BLD_INSN_1_EX(d, op, dt, s0, s0t) \ do { \ (d) = bld_insn_1(bld, (NV_OP_##op), (s0));\ - (d)-reg.type = NV_TYPE_##dt; \ + SET_TYPE(d, NV_TYPE_##dt);\ (d)-insn-src[0]-typecast = NV_TYPE_##s0t; \ } while(0) #define BLD_INSN_2_EX(d, op, dt, s0, s0t, s1, s1t) \ do { \ (d) = bld_insn_2(bld, (NV_OP_##op), (s0), (s1)); \ - (d)-reg.type = NV_TYPE_##dt; \ + SET_TYPE(d, NV_TYPE_##dt); \ (d)-insn-src[0]-typecast = NV_TYPE_##s0t; \ (d)-insn-src[1]-typecast = NV_TYPE_##s1t; \ } while(0) @@ -910,9 +907,9 @@ emit_store(struct bld_context *bld, const struct tgsi_full_instruction *inst, BLD_INSN_1_EX(value, SAT, F32, value, F32); break; case TGSI_SAT_MINUS_PLUS_ONE: + value-reg.as_type = NV_TYPE_F32; value = bld_insn_2(bld, NV_OP_MAX, value,
Mesa (nv50-compiler): nv50: duplicate interps in load_proj_tex_coords
Module: Mesa Branch: nv50-compiler Commit: 246ebd7df1854db22a7f46302ecb1b5d56b68855 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=246ebd7df1854db22a7f46302ecb1b5d56b68855 Author: Christoph Bumiller e0425...@student.tuwien.ac.at Date: Thu Sep 9 19:18:42 2010 +0200 nv50: duplicate interps in load_proj_tex_coords Otherwise we might clobber the origin interpolation result or use the result of the RCP before its definition. --- src/gallium/drivers/nv50/nv50_tgsi_to_nc.c | 39 +--- 1 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c index 50f0151..4168bbb 100644 --- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c +++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c @@ -555,6 +555,34 @@ bld_insn_3(struct bld_context *bld, uint opcode, return bld_def(insn, 0, new_value(bld-pc, NV_FILE_GPR, src0-reg.as_type)); } +static struct nv_value * +bld_duplicate_insn(struct bld_context *bld, struct nv_instruction *nvi) +{ + struct nv_instruction *dupi = new_instruction(bld-pc, nvi-opcode); + int c; + + if (nvi-def[0]) + bld_def(dupi, 0, new_value_like(bld-pc, nvi-def[0])); + + if (nvi-flags_def) { + dupi-flags_def = new_value_like(bld-pc, nvi-flags_def); + dupi-flags_def-insn = dupi; + } + + for (c = 0; c 5; ++c) + if (nvi-src[c]) + nv_reference(bld-pc, dupi-src[c], nvi-src[c]-value); + if (nvi-flags_src) + nv_reference(bld-pc, dupi-flags_src, nvi-flags_src-value); + + dupi-cc = nvi-cc; + dupi-saturate = nvi-saturate; + dupi-centroid = nvi-centroid; + dupi-flat = nvi-flat; + + return dupi-def[0]; +} + static void bld_lmem_store(struct bld_context *bld, struct nv_value *ptr, int ofst, struct nv_value *val) @@ -1232,6 +1260,7 @@ load_proj_tex_coords(struct bld_context *bld, t[3] = emit_fetch(bld, insn, 0, 3); if (t[3]-insn-opcode == NV_OP_PINTERP) { + t[3] = bld_duplicate_insn(bld, t[3]-insn); t[3]-insn-opcode = NV_OP_LINTERP; nv_reference(bld-pc, t[3]-insn-src[1], NULL); } @@ -1240,13 +1269,15 @@ load_proj_tex_coords(struct bld_context *bld, for (c = 0; c dim; ++c) { t[c] = emit_fetch(bld, insn, 0, c); - if (t[c]-insn-opcode == NV_OP_LINTERP) - t[c]-insn-opcode = NV_OP_PINTERP; - if (t[c]-insn-opcode == NV_OP_PINTERP) + if (t[c]-insn-opcode == NV_OP_LINTERP || + t[c]-insn-opcode == NV_OP_PINTERP) { + t[c] = bld_duplicate_insn(bld, t[c]-insn); + t[c]-insn-opcode = NV_OP_PINTERP; nv_reference(bld-pc, t[c]-insn-src[1], t[3]); - else + } else { mask |= 1 c; + } } for (c = 0; mask; ++c, mask = 1) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (nv50-compiler): nv50: address regs are 16 bit
Module: Mesa Branch: nv50-compiler Commit: 6b14a3eb191ab798e524f2413180256fbcc2b33e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b14a3eb191ab798e524f2413180256fbcc2b33e Author: Christoph Bumiller e0425...@student.tuwien.ac.at Date: Thu Sep 9 19:19:08 2010 +0200 nv50: address regs are 16 bit --- src/gallium/drivers/nv50/nv50_pc_print.c |4 +++- src/gallium/drivers/nv50/nv50_tgsi_to_nc.c |2 ++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_pc_print.c b/src/gallium/drivers/nv50/nv50_pc_print.c index 74c3970..a714019 100644 --- a/src/gallium/drivers/nv50/nv50_pc_print.c +++ b/src/gallium/drivers/nv50/nv50_pc_print.c @@ -171,12 +171,14 @@ nv_value_allocated(struct nv_value *value) static INLINE void nv_print_address(const char c, int buf, struct nv_value *a, int offset) { + const char ac = (a nv_value_allocated(a)) ? '$' : '%'; + if (buf = 0) PRINT( %s%c%i[, cyan, c, buf); else PRINT( %s%c[, cyan, c); if (a) - PRINT(%s$a%i%s+, mgta, nv_value_id(a), cyan); + PRINT(%s%ca%i%s+, mgta, ac, nv_value_id(a), cyan); PRINT(%s0x%x%s], orng, offset, cyan); } diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c index 4168bbb..6fd749b 100644 --- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c +++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c @@ -674,6 +674,7 @@ bld_get_address(struct bld_context *bld, int id, struct nv_value *indirect) bld-saved_addr[i][0] = bld_load_imm_u32(bld, id); bld-saved_addr[i][0]-reg.file = NV_FILE_ADDR; + bld-saved_addr[i][0]-reg.type = NV_TYPE_U16; bld-saved_addr[i][1] = indirect; return bld-saved_addr[i][0]; } @@ -967,6 +968,7 @@ emit_store(struct bld_context *bld, const struct tgsi_full_instruction *inst, case TGSI_FILE_ADDRESS: assert(reg-Register.Index BLD_MAX_ADDRS); value-reg.file = NV_FILE_ADDR; + value-reg.type = NV_TYPE_U16; STORE_ADDR(reg-Register.Index, chan, value); break; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (nv50-compiler): nv50: fix can_load check for 3rd source
Module: Mesa Branch: nv50-compiler Commit: 6997da9f3cf22b9d11ffdfa6ad25b68ef4913fc3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6997da9f3cf22b9d11ffdfa6ad25b68ef4913fc3 Author: Christoph Bumiller e0425...@student.tuwien.ac.at Date: Thu Sep 9 19:09:38 2010 +0200 nv50: fix can_load check for 3rd source --- src/gallium/drivers/nv50/nv50_pc.c | 12 +--- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c index 637b3cf..e4df742 100644 --- a/src/gallium/drivers/nv50/nv50_pc.c +++ b/src/gallium/drivers/nv50/nv50_pc.c @@ -112,13 +112,11 @@ nv50_nvi_can_load(struct nv_instruction *nvi, int s, struct nv_value *value) if (s == 0 (value-reg.file == NV_FILE_MEM_S || value-reg.file == NV_FILE_MEM_P)) return TRUE; - if (s == 1 - value-reg.file = NV_FILE_MEM_C(0) - value-reg.file = NV_FILE_MEM_C(15)) - return TRUE; - if (s == 2 nvi-src[1]-value-reg.file == NV_FILE_GPR) - return TRUE; - return FALSE; + if (value-reg.file NV_FILE_MEM_C(0) || + value-reg.file NV_FILE_MEM_C(15)) + return FALSE; + return (s == 1) || + ((s == 2) (nvi-src[1]-value-reg.file == NV_FILE_GPR)); case NV_OP_MOV: assert(s == 0); return /* TRUE */ FALSE; /* don't turn MOVs into loads */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (shader-work): glsl: add ir_control_flow_visitor
Module: Mesa Branch: shader-work Commit: 54846b7423155ab7dc8e69de399553a29e0319de URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=54846b7423155ab7dc8e69de399553a29e0319de Author: Luca Barbieri l...@luca-barbieri.com Date: Tue Sep 7 00:22:34 2010 +0200 glsl: add ir_control_flow_visitor This is just a subclass of ir_visitor with empty implementations of all the visit methods for non-control flow nodes. Used to avoid duplicating that in ir_visitor subclasses. ir_hierarchical_visitor is another way to solve this, but is less natural for some applications. --- src/glsl/ir_visitor.h | 17 + 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/src/glsl/ir_visitor.h b/src/glsl/ir_visitor.h index b87d737..7dd35fe 100644 --- a/src/glsl/ir_visitor.h +++ b/src/glsl/ir_visitor.h @@ -64,4 +64,21 @@ public: /*...@}*/ }; +/* NOTE: function calls may never return due to discards inside them + * This is usually not an issue, but if it is, keep it in mind + */ +class ir_control_flow_visitor : public ir_visitor { +public: + virtual void visit(class ir_variable *) {} + virtual void visit(class ir_expression *) {} + virtual void visit(class ir_texture *) {} + virtual void visit(class ir_swizzle *) {} + virtual void visit(class ir_dereference_variable *) {} + virtual void visit(class ir_dereference_array *) {} + virtual void visit(class ir_dereference_record *) {} + virtual void visit(class ir_assignment *) {} + virtual void visit(class ir_constant *) {} + virtual void visit(class ir_call *) {} +}; + #endif /* IR_VISITOR_H */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (shader-work): glsl: add continue/break/return unification/ elimination pass (v2)
Module: Mesa Branch: shader-work Commit: 76a5dafa583b71138e26c52d6ecf15b0381a25d3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=76a5dafa583b71138e26c52d6ecf15b0381a25d3 Author: Luca Barbieri l...@luca-barbieri.com Date: Tue Sep 7 00:24:08 2010 +0200 glsl: add continue/break/return unification/elimination pass (v2) Changes in v2: - Base class renamed to ir_control_flow_visitor - Tried to comply with coding style This is a new pass that supersedes ir_if_return and lowers jumps to if/else structures. Currently it causes no regressions on softpipe and nv40, but I'm not sure whether the piglit glsl tests are thorough enough, so consider this experimental. It can be asked to: 1. Pull jumps out of ifs where possible 2. Remove all continues, replacing them with an execute flag 3. Replace all break with a single conditional one at the end of the loop 4. Replace all returns with a single return at the end of the function, for the main function and/or other functions This gives several great benefits: 1. All functions can be inlined after this pass 2. nv40 and other pre-DX10 chips without continue can be supported 3. nv30 and other pre-DX10 chips with no control flow at all are better supported Note that for full effect we should also teach the unroller to unroll loops with a fixed maximum number of iterations but with the canonical conditional break that this pass will insert if asked to. Continues are lowered by adding a per-loop execute flag, initialized to TRUE, that when cleared inhibits all execution until the end of the loop. Breaks are lowered to continues, plus setting a break flag that is checked at the end of the loop, and trigger the unique break. Returns are lowered to breaks/continues, plus adding a return flag that causes loops to break again out of their enclosing loops until all the loops are exited: then the execute flag logic will ignore everything until the end of the function. Note that continue and return can also be implemented by adding a dummy loop and using break. However, this is bad for hardware with limited nesting depth, and prevents further optimization, and thus is not currently performed. --- src/glsl/Makefile |2 +- src/glsl/SConscript |2 +- src/glsl/glsl_parser_extras.cpp |2 +- src/glsl/ir_if_return.cpp | 246 -- src/glsl/ir_lower_jumps.cpp | 544 +++ src/glsl/ir_optimization.h |2 +- 6 files changed, 548 insertions(+), 250 deletions(-) diff --git a/src/glsl/Makefile b/src/glsl/Makefile index eb62112..efa274b 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -50,10 +50,10 @@ CXX_SOURCES = \ ir_function_inlining.cpp \ ir_hierarchical_visitor.cpp \ ir_hv_accept.cpp \ - ir_if_return.cpp \ ir_if_simplification.cpp \ ir_if_to_cond_assign.cpp \ ir_import_prototypes.cpp \ + ir_lower_jumps.cpp \ ir_mat_op_to_vec.cpp \ ir_mod_to_fract.cpp \ ir_noop_swizzle.cpp \ diff --git a/src/glsl/SConscript b/src/glsl/SConscript index 1ea876e..ac6324a 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -47,10 +47,10 @@ sources = [ 'ir_function_inlining.cpp', 'ir_hierarchical_visitor.cpp', 'ir_hv_accept.cpp', -'ir_if_return.cpp', 'ir_if_simplification.cpp', 'ir_if_to_cond_assign.cpp', 'ir_import_prototypes.cpp', +'ir_lower_jumps.cpp', 'ir_mat_op_to_vec.cpp', 'ir_mod_to_fract.cpp', 'ir_noop_swizzle.cpp', diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 400203d..28241f7 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -711,7 +711,7 @@ do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iteration progress = do_constant_variable_unlinked(ir) || progress; progress = do_constant_folding(ir) || progress; progress = do_algebraic(ir) || progress; - progress = do_if_return(ir) || progress; + progress = do_lower_jumps(ir) || progress; progress = do_vec_index_to_swizzle(ir) || progress; progress = do_swizzle_swizzle(ir) || progress; progress = do_noop_swizzle(ir) || progress; diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp deleted file mode 100644 index 5ab8759..000 --- a/src/glsl/ir_if_return.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the Software), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission
Mesa (shader-work): loop_controls: fix analysis of already analyzed loops
Module: Mesa Branch: shader-work Commit: a3d7aebd3dfccbc5e41997423e03fa74f5ff5116 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3d7aebd3dfccbc5e41997423e03fa74f5ff5116 Author: Luca Barbieri l...@luca-barbieri.com Date: Tue Sep 7 17:02:37 2010 +0200 loop_controls: fix analysis of already analyzed loops The loop_controls pass didn't look at the counter values it put in ir_loop on previous iterations, so while the first iteration worked, subsequent ones couldn't determine max_iterations. --- src/glsl/loop_controls.cpp |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp index 17a0d2d..9619d8a 100644 --- a/src/glsl/loop_controls.cpp +++ b/src/glsl/loop_controls.cpp @@ -182,7 +182,14 @@ loop_control_visitor::visit_leave(ir_loop *ir) * i is a loop induction variable, c is a constant, and is any relative * operator. */ - int max_iterations = (ls-max_iterations 0) ? INT_MAX : ls-max_iterations; + int max_iterations = ls-max_iterations; + + if(ir-from ir-to ir-increment) + max_iterations = calculate_iterations(ir-from, ir-to, ir-increment, (ir_expression_operation)ir-cmp); + + if(max_iterations 0) + max_iterations = INT_MAX; + foreach_list(node, ls-terminators) { loop_terminator *t = (loop_terminator *) node; ir_if *if_stmt = t-ir; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (shader-work): glsl: call ir_lower_jumps according to compiler options
Module: Mesa Branch: shader-work Commit: d8cc3047bf1cd5100ff6c1e47ae53edba6fa15e1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8cc3047bf1cd5100ff6c1e47ae53edba6fa15e1 Author: Luca Barbieri l...@luca-barbieri.com Date: Tue Sep 7 02:15:26 2010 +0200 glsl: call ir_lower_jumps according to compiler options --- src/mesa/program/ir_to_mesa.cpp |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index caa906a..5a3c17a 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2719,6 +2719,8 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) do_div_to_mul_rcp(ir); do_explog_to_explog2(ir); +progress = do_lower_jumps(ir, true, true, options-EmitNoMainReturn, options-EmitNoCont, options-EmitNoLoops) || progress; + progress = do_common_optimization(ir, true, options-MaxUnrollIterations) || progress; if (options-EmitNoIfs) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (shader-work): loop_unroll: unroll loops with (lowered) breaks
Module: Mesa Branch: shader-work Commit: a9cee0a35384b2f277d50a50575b9953b1de954c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9cee0a35384b2f277d50a50575b9953b1de954c Author: Luca Barbieri l...@luca-barbieri.com Date: Tue Sep 7 17:03:43 2010 +0200 loop_unroll: unroll loops with (lowered) breaks If the loop ends with an if with one/two breaks, or in a single break or continue, lower it. This will generate the obvious if structure. ir_lower_jumps can guarantee that all loops are put in this form and thus all loops are now potentially unrollable if an upper bound on the number of iterations can be found. --- src/glsl/loop_unroll.cpp | 93 -- 1 files changed, 89 insertions(+), 4 deletions(-) diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp index 80f9217..54fe388 100644 --- a/src/glsl/loop_unroll.cpp +++ b/src/glsl/loop_unroll.cpp @@ -47,6 +47,7 @@ ir_visitor_status loop_unroll_visitor::visit_leave(ir_loop *ir) { loop_variable_state *const ls = this-state-get(ir); + int iterations; /* If we've entered a loop that hasn't been analyzed, something really, * really bad has happened. @@ -56,23 +57,107 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) return visit_continue; } + iterations = ls-max_iterations; + /* Don't try to unroll loops where the number of iterations is not known * at compile-time. */ - if (ls-max_iterations 0) + if (iterations 0) return visit_continue; /* Don't try to unroll loops that have zillions of iterations either. */ - if (ls-max_iterations max_iterations) + if (iterations max_iterations) return visit_continue; - if (ls-num_loop_jumps 0) + if (ls-num_loop_jumps 2) return visit_continue; + else if (ls-num_loop_jumps) { + /* recognize loops in the form produced by ir_lower_jumps */ + ir_instruction* last_ir = ((ir_instruction*)ir-body_instructions.get_tail()); + ir_if* last_if = last_ir-as_if(); + if(last_if) { + ir_instruction* breaks[2] = {0, 0}; + + for(unsigned i = 0; i 2; ++i) + { +ir_instruction* last = ((ir_instruction*)(i ? last_if-else_instructions : last_if-then_instructions).get_tail()); +if(last last-ir_type == ir_type_loop_jump ((ir_loop_jump*)last)-is_break()) + breaks[i] = (ir_loop_jump*)last; + } + + if(ls-num_loop_jumps != (!!breaks[0] + !!breaks[1])) +return visit_continue; + + if(breaks[0] breaks[1]) { +breaks[0]-remove(); +breaks[1]-remove(); +last_if-insert_after(breaks[0]); +last_ir = breaks[0]; +goto one_break; + } + + unsigned break_branch = breaks[0] ? 0 : 1; + breaks[break_branch]-remove(); + + void *const mem_ctx = talloc_parent(ir); + + ir_instruction* ir_to_replace = ir; + + for (int i = 0; i iterations; i++) { +exec_list copy_list; + +copy_list.make_empty(); +clone_ir_list(mem_ctx, copy_list, ir-body_instructions); + +last_if = ((ir_instruction*)copy_list.get_tail())-as_if(); +assert(last_if); + +ir_to_replace-insert_before(copy_list); +ir_to_replace-remove(); + +/* placeholder that will be removed in the next iteration */ +ir_to_replace = new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_continue); +/* this is the branch where there is NOT a break */ +exec_list* list = break_branch ? last_if-then_instructions : last_if-else_instructions; +list-push_tail(ir_to_replace); + } + + ir_to_replace-remove(); + + this-progress = true; + return visit_continue; + } + else if(last_ir last_ir-ir_type == ir_type_loop_jump ((ir_loop_jump*)last_ir)-is_break()) + { + if(ls-num_loop_jumps != 1) +return visit_continue; + +one_break: + last_ir-remove(); + if(max_iterations) +max_iterations = 1; + /* fall through to normal unrolling */ + } + else if(last_ir last_ir-ir_type == ir_type_loop_jump ((ir_loop_jump*)last_ir)-is_continue()) + { + /* this case might be somewhat redundant, but it's probably best + * not to rely on the rest of the optimizer too much, especially + * because this particular case might not be optimized yet... + */ + if(ls-num_loop_jumps != 1) +return visit_continue; + + last_ir-remove(); + /* fall through to normal unrolling */ + } + else + return visit_continue; + } void *const mem_ctx = talloc_parent(ir); - for (int i = 0; i ls-max_iterations; i++) { + for (int i = 0; i iterations; i++) { exec_list copy_list; copy_list.make_empty();
Mesa (shader-work): mesa: add GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB and env var to set it
Module: Mesa Branch: shader-work Commit: 0d5a3e21a4c05a9af3957ce713da3bfced52481f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d5a3e21a4c05a9af3957ce713da3bfced52481f Author: Luca Barbieri l...@luca-barbieri.com Date: Wed Sep 8 06:24:10 2010 +0200 mesa: add GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB and env var to set it ARB_robustness specifies it, and we need the bit to choose whether to apply some loop optimizations in the GLSL compiler. Currenly, it is turned on by export MESA_ROBUST_ACCESS=1. In the future, GLX_ARB_create_context_robustness will allow to turn it on in the standard way. --- src/mesa/main/context.c |5 + src/mesa/main/mtypes.h |4 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8e34ec4..1966309 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -873,6 +873,11 @@ _mesa_initialize_context_for_api(GLcontext *ctx, ctx-WinSysDrawBuffer = NULL; ctx-WinSysReadBuffer = NULL; + /* eventually, GLX_ARB_create_context_robustness will be usable to enable this too */ + if (_mesa_getenv(MESA_ROBUST_ACCESS)) { + ctx-Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB; + } + /* misc one-time initializations */ one_time_init(ctx); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 3e54656..38a0728 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3089,6 +3089,10 @@ typedef enum { API_OPENGLES2 } gl_api; +#ifndef GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x0004 +#endif + /** * Mesa rendering context. * ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (shader-work): glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmps (v2 )
Module: Mesa Branch: shader-work Commit: 2fab36b79b02930cf0b7223162ed57c50e64fde9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2fab36b79b02930cf0b7223162ed57c50e64fde9 Author: Luca Barbieri l...@luca-barbieri.com Date: Wed Sep 8 01:31:39 2010 +0200 glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmps (v2) Changes in v2: - Fix buggy ir_validate logic Currently GLSL IR forbids any vector comparisons, and defines ir_binop_equal and ir_binop_nequal to compare all elements and give a single bool. This is highly unintuitive and prevents generation of optimal Mesa IR. Hence, first rename ir_binop_equal to ir_binop_all_equal and ir_binop_nequal to ir_binop_any_nequal. Second, readd ir_binop_equal and ir_binop_nequal with the same semantics as less, lequal, etc. Third, allow all comparisons to acts on vectors. --- src/glsl/ast_to_hir.cpp |4 +- src/glsl/ir.cpp |2 + src/glsl/ir.h |6 +++- src/glsl/ir_algebraic.cpp |2 + src/glsl/ir_constant_expression.cpp | 38 +++--- src/glsl/ir_mat_op_to_vec.cpp |6 ++-- src/glsl/ir_validate.cpp| 35 +--- src/mesa/program/ir_to_mesa.cpp |8 ++- 8 files changed, 77 insertions(+), 24 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 3de6caa..31bb40d 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -636,8 +636,8 @@ ast_expression::hir(exec_list *instructions, ir_binop_greater, ir_binop_lequal, ir_binop_gequal, - ir_binop_equal, - ir_binop_nequal, + ir_binop_all_equal, + ir_binop_any_nequal, ir_binop_bit_and, ir_binop_bit_xor, ir_binop_bit_or, diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 9ac2485..5d58e1b 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -208,6 +208,8 @@ ir_expression::get_num_operands(ir_expression_operation op) 2, /* ir_binop_gequal */ 2, /* ir_binop_equal */ 2, /* ir_binop_nequal */ + 2, /* ir_binop_all_equal */ + 2, /* ir_binop_any_nequal */ 2, /* ir_binop_lshift */ 2, /* ir_binop_rshift */ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 0d93302..caa5c10 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -673,16 +673,18 @@ enum ir_expression_operation { ir_binop_greater, ir_binop_lequal, ir_binop_gequal, + ir_binop_equal, + ir_binop_nequal, /** * Returns single boolean for whether all components of operands[0] * equal the components of operands[1]. */ - ir_binop_equal, + ir_binop_all_equal, /** * Returns single boolean for whether any component of operands[0] * is not equal to the corresponding component of operands[1]. */ - ir_binop_nequal, + ir_binop_any_nequal, /*...@}*/ /** diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index ff81563..2ed66db 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -270,6 +270,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) case ir_binop_gequal: new_op = ir_binop_less;break; case ir_binop_equal: new_op = ir_binop_nequal; break; case ir_binop_nequal: new_op = ir_binop_equal; break; + case ir_binop_all_equal: new_op = ir_binop_any_nequal; break; + case ir_binop_any_nequal: new_op = ir_binop_all_equal; break; default: /* The default case handler is here to silence a warning from GCC. diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index ca12392..ec0e26d 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -89,9 +89,9 @@ ir_expression::constant_expression_value() if (op[0]-type-is_array()) { assert(op[1] != NULL op[1]-type-is_array()); switch (this-operation) { - case ir_binop_equal: + case ir_binop_all_equal: return new(ctx) ir_constant(op[0]-has_value(op[1])); - case ir_binop_nequal: + case ir_binop_any_nequal: return new(ctx) ir_constant(!op[0]-has_value(op[1])); default: break; @@ -622,11 +622,41 @@ ir_expression::constant_expression_value() assert(0); } break; - case ir_binop_equal: - data.b[0] = op[0]-has_value(op[1]); + switch (op[0]-type-base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]-value.u[0] == op[1]-value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]-value.i[0] == op[1]-value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]-value.f[0] == op[1]-value.f[0]; + break; + default: + assert(0); + } break; case ir_binop_nequal: + switch (op[0]-type-base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]-value.u[0] !=
Mesa (shader-work): glsl: teach loop analysis that array dereferences are bounds on the index (v2)
Module: Mesa Branch: shader-work Commit: 6321214ec425523c862c46f196d8f744a45c7038 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6321214ec425523c862c46f196d8f744a45c7038 Author: Luca Barbieri l...@luca-barbieri.com Date: Tue Sep 7 19:29:00 2010 +0200 glsl: teach loop analysis that array dereferences are bounds on the index (v2) Changes in v2: - Incorporate Ian Romanick's feedback - Make GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB disable this Since out-of-bounds dereferences cause undefined behavior, we are allowed to assume that they terminate the loop, if my interpretation of the GLSL spec is correct. This allows to find the maximum number of iterations in cases like this: uniform int texcoords; float4 gl_TexCoord[8]; for(i = 0; i texcoords; ++i) do_something_with(gl_TexCoord[i]); This is apparently an interesting case since NV_fragment_program2 has a construct for this. --- src/glsl/glsl_parser_extras.cpp |4 +- src/glsl/ir_optimization.h |2 +- src/glsl/linker.cpp |2 +- src/glsl/loop_analysis.cpp | 51 ++- src/glsl/loop_analysis.h|2 +- src/glsl/loop_controls.cpp | 22 ++-- src/glsl/main.cpp |4 ++- src/mesa/program/ir_to_mesa.cpp |4 +- 8 files changed, 74 insertions(+), 17 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 28241f7..b30e7e4 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -685,7 +685,7 @@ ast_struct_specifier::ast_struct_specifier(char *identifier, } bool -do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations) +do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations, bool robust_access) { GLboolean progress = GL_FALSE; @@ -716,7 +716,7 @@ do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iteration progress = do_swizzle_swizzle(ir) || progress; progress = do_noop_swizzle(ir) || progress; - loop_state *ls = analyze_loop_variables(ir); + loop_state *ls = analyze_loop_variables(ir, !robust_access); progress = set_loop_controls(ir, ls) || progress; progress = unroll_loops(ir, ls, max_unroll_iterations) || progress; delete ls; diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index d4201b5..cba2976 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -28,7 +28,7 @@ * Prototypes for optimization passes to be called by the compiler and drivers. */ -bool do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations); +bool do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations, bool robust_access); bool do_algebraic(exec_list *instructions); bool do_constant_folding(exec_list *instructions); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index c2c6621..8567efe 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1471,7 +1471,7 @@ link_shaders(GLcontext *ctx, struct gl_shader_program *prog) * some of that unused. */ for (unsigned i = 0; i prog-_NumLinkedShaders; i++) { - while (do_common_optimization(prog-_LinkedShaders[i]-ir, true, 32)) + while (do_common_optimization(prog-_LinkedShaders[i]-ir, true, 32, true)) ; } diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp index 91e34da..9d6dce6 100644 --- a/src/glsl/loop_analysis.cpp +++ b/src/glsl/loop_analysis.cpp @@ -105,6 +105,7 @@ public: virtual ir_visitor_status visit(ir_loop_jump *); virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit_leave(ir_dereference_array *); virtual ir_visitor_status visit_enter(ir_loop *); virtual ir_visitor_status visit_leave(ir_loop *); @@ -113,6 +114,8 @@ public: virtual ir_visitor_status visit_enter(ir_if *); virtual ir_visitor_status visit_leave(ir_if *); + bool out_of_bounds_can_break; + loop_state *loops; int if_statement_depth; @@ -191,6 +194,51 @@ loop_analysis::visit(ir_dereference_variable *ir) } ir_visitor_status +loop_analysis::visit_leave(ir_dereference_array *ir) +{ + /* If we're not somewhere inside a loop, there's nothing to do. +*/ + if (this-state.is_empty()) + return visit_continue; + + /* ARB_robustness forbids this */ + if(!out_of_bounds_can_break) + return visit_continue; + + loop_variable_state *const ls = +(loop_variable_state *) this-state.get_head(); + + int max_index; + if(ir-array-type-is_array()) + max_index = ir-array-type-length - 1; + else if(ir-array-type-is_vector() || ir-array-type-is_matrix()) + max_index = ir-array-type-components() - 1; + else + assert(0); + + assert(ir-array_index-type-is_integer()); + ir_constant *const max_index_c = + (ir-array_index-type-base_type == GLSL_TYPE_UINT) +?
Mesa (shader-work): glsl: teach structure splitting to split arrays, and never split in/outs
Module: Mesa Branch: shader-work Commit: 8b2208820a194b14ad6cf8803e384fb55618bb9a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b2208820a194b14ad6cf8803e384fb55618bb9a Author: Luca Barbieri l...@luca-barbieri.com Date: Wed Sep 8 03:47:58 2010 +0200 glsl: teach structure splitting to split arrays, and never split in/outs Currently structure splitting cannot split arrays, which makes do_array_index_to_cond_assign useless. This commit adds that capability. Also, it prevents it from splitting in/out/inout variables, which were incorrectly split. It may be possible to split them if user-defined, but that will need further changes and some way to make sure we link stages correctly. --- src/glsl/ir_structure_splitting.cpp | 143 +++--- 1 files changed, 113 insertions(+), 30 deletions(-) diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index ff3ec93..807d447 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -86,6 +86,7 @@ public: virtual ir_visitor_status visit(ir_variable *); virtual ir_visitor_status visit(ir_dereference_variable *); virtual ir_visitor_status visit_enter(ir_dereference_record *); + virtual ir_visitor_status visit_enter(ir_dereference_array *); virtual ir_visitor_status visit_enter(ir_assignment *); virtual ir_visitor_status visit_enter(ir_function_signature *); @@ -102,7 +103,8 @@ ir_structure_reference_visitor::get_variable_entry2(ir_variable *var) { assert(var); - if (!var-type-is_record() || var-mode == ir_var_uniform) + if ((!var-type-is_record() !var-type-is_array()) + || (var-mode != ir_var_auto var-mode != ir_var_temporary)) return NULL; foreach_iter(exec_list_iterator, iter, this-variable_list) { @@ -149,6 +151,25 @@ ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir) } ir_visitor_status +ir_structure_reference_visitor::visit_enter(ir_dereference_array *ir) +{ + ir-array_index-accept(this); + if(!ir-array_index-as_constant()) + { + /* FINISHME: could produce and make use of information + * about possible values of the index + */ + ir_variable *const var = ir-array-variable_referenced(); + variable_entry2 *entry = this-get_variable_entry2(var); + + if (entry) + entry-whole_structure_access++; + } + + /* Don't descend into the ir_dereference_variable below. */ + return visit_continue_with_parent; +} +ir_visitor_status ir_structure_reference_visitor::visit_enter(ir_assignment *ir) { if (ir-lhs-as_dereference_variable() @@ -198,7 +219,7 @@ ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) { assert(var); - if (!var-type-is_record()) + if (!var-type-is_record() !var-type-is_array()) return NULL; foreach_iter(exec_list_iterator, iter, *this-variable_list) { @@ -214,27 +235,61 @@ ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) void ir_structure_splitting_visitor::split_deref(ir_dereference **deref) { - if ((*deref)-ir_type != ir_type_dereference_record) - return; - - ir_dereference_record *deref_record = (ir_dereference_record *)*deref; - ir_dereference_variable *deref_var = deref_record-record-as_dereference_variable(); - if (!deref_var) - return; - - variable_entry2 *entry = get_splitting_entry(deref_var-var); - if (!entry) - return; + if ((*deref)-ir_type == ir_type_dereference_record) + { + ir_dereference_record *deref_record = (ir_dereference_record *)*deref; + ir_dereference_variable *deref_var = deref_record-record-as_dereference_variable(); + if (!deref_var) + return; + + variable_entry2 *entry = get_splitting_entry(deref_var-var); + if (!entry) + return; + + unsigned int i; + for (i = 0; i entry-var-type-length; i++) { + if (strcmp(deref_record-field, +entry-var-type-fields.structure[i].name) == 0) +break; + } + assert(i != entry-var-type-length); - unsigned int i; - for (i = 0; i entry-var-type-length; i++) { - if (strcmp(deref_record-field, -entry-var-type-fields.structure[i].name) == 0) -break; + *deref = new(entry-mem_ctx) ir_dereference_variable(entry-components[i]); + } + else if ((*deref)-ir_type == ir_type_dereference_array) + { + ir_dereference_array *deref_array = (ir_dereference_array*)*deref; + ir_dereference_variable *deref_var = deref_array-array-as_dereference_variable(); + if (!deref_var) + return; + + variable_entry2 *entry = get_splitting_entry(deref_var-var); + if (!entry) + return; + + ir_constant* index = deref_array-array_index-as_constant(); + assert(index); + assert(index-type-is_scalar()); + assert(index-type-base_type == GLSL_TYPE_INT || index-type-base_type ==
Mesa (shader-work): glsl: add pass to lower variable array indexing to conditional assignments
Module: Mesa Branch: shader-work Commit: 831691d0bdcae4b1efbab3a62f7ead59e30ae5d7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=831691d0bdcae4b1efbab3a62f7ead59e30ae5d7 Author: Luca Barbieri l...@luca-barbieri.com Date: Wed Sep 8 01:35:44 2010 +0200 glsl: add pass to lower variable array indexing to conditional assignments Currenly GLSL happily generates indirect addressing of any kind of arrays. Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in general. This pass fixes that by lowering such constructs to a binary search on the values, followed at the end by vectorized generation of equality masks, and 4 conditional assignments for each mask generation. Note that this requires the ir_binop_equal change so that we can emit SEQ to generate the boolean masks. Unfortunately, ir_structure_splitting is too dumb to turn the resulting constant array references to individual variables, so this will need to be added too before this pass can actually be effective for temps. --- src/glsl/Makefile |1 + src/glsl/SConscript|1 + src/glsl/ir_optimization.h |1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/glsl/Makefile b/src/glsl/Makefile index efa274b..b12878c 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -31,6 +31,7 @@ CXX_SOURCES = \ glsl_symbol_table.cpp \ hir_field_selection.cpp \ ir_algebraic.cpp \ + ir_array_index_to_cond_assign.cpp \ ir_basic_block.cpp \ ir_clone.cpp \ ir_constant_expression.cpp \ diff --git a/src/glsl/SConscript b/src/glsl/SConscript index ac6324a..ed12e84 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -28,6 +28,7 @@ sources = [ 'glsl_symbol_table.cpp', 'hir_field_selection.cpp', 'ir_algebraic.cpp', +'ir_array_index_to_cond_assign.cpp', 'ir_basic_block.cpp', 'ir_clone.cpp', 'ir_constant_expression.cpp', diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index cba2976..8cb46b3 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -31,6 +31,7 @@ bool do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations, bool robust_access); bool do_algebraic(exec_list *instructions); +bool do_array_index_to_cond_assign(exec_list *instructions); bool do_constant_folding(exec_list *instructions); bool do_constant_variable(exec_list *instructions); bool do_constant_variable_unlinked(exec_list *instructions); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (shader-work): glsl: TEMP: do array indexing lowering and structure split in main.cpp
Module: Mesa Branch: shader-work Commit: c9a86ab2ca9c2be64790451a8e8ec37d2afbc6f9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9a86ab2ca9c2be64790451a8e8ec37d2afbc6f9 Author: Luca Barbieri l...@luca-barbieri.com Date: Thu Sep 9 20:15:09 2010 +0200 glsl: TEMP: do array indexing lowering and structure split in main.cpp The places that run optimization passes should be unified and refactored, so that things need not be added everywhere. Currently add this to main.cpp; OpenGL will need this too depending on options. --- src/glsl/main.cpp |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index bc82966..dddc181 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -219,6 +219,9 @@ compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = set_loop_controls(shader-ir, ls) || progress; progress = unroll_loops(shader-ir, ls, 32) || progress; delete ls; + +progress = do_array_index_to_cond_assign(shader-ir) || progress; +progress = do_structure_splitting(shader-ir) || progress; } while (progress); validate_ir_tree(shader-ir); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl: Remove old egldri driver
Module: Mesa Branch: master Commit: 01a7eebc4c3591eecb59e42409790bf1d6344847 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=01a7eebc4c3591eecb59e42409790bf1d6344847 Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Sep 9 14:05:30 2010 -0400 egl: Remove old egldri driver This driver doesn't work with any of the DRI drivers in the source tree. --- src/egl/drivers/dri/Makefile | 69 --- src/egl/drivers/dri/egldri.c | 1205 -- src/egl/drivers/dri/egldri.h | 116 3 files changed, 0 insertions(+), 1390 deletions(-) diff --git a/src/egl/drivers/dri/Makefile b/src/egl/drivers/dri/Makefile deleted file mode 100644 index c3aacff..000 --- a/src/egl/drivers/dri/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -# src/egl/drivers/dri/Makefile - -TOP = ../../../.. -include $(TOP)/configs/current - - -### Include directories -INCLUDE_DIRS = \ - -I. \ - -I/usr/include \ - $(shell pkg-config --cflags-only-I libdrm) \ - -I$(TOP)/include \ - -I$(TOP)/include/GL/internal \ - -I$(TOP)/src/mapi \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/math \ - -I$(TOP)/src/mesa/transform \ - -I$(TOP)/src/mesa/shader \ - -I$(TOP)/src/mesa/swrast \ - -I$(TOP)/src/mesa/swrast_setup \ - -I$(TOP)/src/egl/main \ - -I$(TOP)/src/mesa/drivers/dri/common - - -HEADERS = egldri.h - -SOURCES = egldri.c - -OBJECTS = $(SOURCES:.c=.o) - -DRM_LIB = `pkg-config --libs libdrm` - - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $ -o $@ - - - -default: depend library Makefile - - -# EGLdri Library -library: $(TOP)/$(LIB_DIR)/libEGLdri.so - -$(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS) - $(MKLIB) -o EGLdri -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS) - -install: - $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(MINSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR) - -clean: - -rm -f *.o - -rm -f *.so - -rm -f depend depend.bak - -depend: $(SOURCES) $(HEADERS) - @ echo running $(MKDEP) - @ rm -f depend - @ touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \ - $(SOURCES) $(HEADERS) /dev/null 2/dev/null - -include depend -# DO NOT DELETE - diff --git a/src/egl/drivers/dri/egldri.c b/src/egl/drivers/dri/egldri.c deleted file mode 100644 index 6a8bf89..000 --- a/src/egl/drivers/dri/egldri.c +++ /dev/null @@ -1,1205 +0,0 @@ -/** - * Generic EGL driver for DRI. This is basically an adaptor driver - * that allows libEGL to load/use regular DRI drivers. - * - * This file contains all the code needed to interface DRI-based drivers - * with libEGL. - * - * There's a lot of dependencies on fbdev and the /sys/ filesystem. - */ - - -#include dirent.h -#include stdio.h -#include string.h -#include linux/fb.h -#include assert.h -#include dlfcn.h -#include fcntl.h -#include unistd.h -#include errno.h -#include sys/time.h - -#include egldriver.h -#include egldisplay.h -#include eglcontext.h -#include eglconfig.h -#include eglconfigutil.h -#include eglsurface.h -#include eglscreen.h -#include eglglobals.h -#include egllog.h -#include eglmode.h - -#include egldri.h - -const char *sysfs = /sys/class; - -static const int empty_attribute_list[1] = { None }; - - - -/** - * Given a card number, return the name of the DRI driver to use. - * This generally means reading the contents of - * /sys/class/drm/cardX/dri_library_name, where X is the card number - */ -static EGLBoolean -driver_name_from_card_number(int card, char *driverName, int maxDriverName) -{ - char path[2000]; - FILE *f; - int length; - - snprintf(path, sizeof(path), %s/drm/card%d/dri_library_name, sysfs, card); - - f = fopen(path, r); - if (!f) - return EGL_FALSE; - - fgets(driverName, maxDriverName, f); - fclose(f); - - if ((length = strlen(driverName)) 1) { - /* remove the trailing newline from sysfs */ - driverName[length - 1] = '\0'; - strncat(driverName, _dri, maxDriverName); - return EGL_TRUE; - } - else { - return EGL_FALSE; - } -} - - - -/** - * The bootstrap function. - * Return a new driDriver object and plug in API functions. - * This function, in turn, loads a specific DRI driver (ex: r200_dri.so). - */ -_EGLDriver * -_eglMain(_EGLDisplay *dpy, const char *args) -{ -#if 1 - const int card = args ? atoi(args) : 0; - _EGLDriver *driver = NULL; - char driverName[1000]; - - if (!driver_name_from_card_number(card, driverName, sizeof(driverName))) { - _eglLog(_EGL_WARNING, - Unable to determine driver name for card %d\n, card); - return NULL; - } - - _eglLog(_EGL_DEBUG, Driver name: %s\n, driverName); - - driver = _eglOpenDriver(dpy, driverName, args); - - return driver; - -#else - - int length; - char path[NAME_MAX]; - struct
Mesa (master): glapi: Implement optional dispatch logging
Module: Mesa Branch: master Commit: b9abc6139a310677a37754ea7172d976dbf56979 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b9abc6139a310677a37754ea7172d976dbf56979 Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Sep 9 12:59:14 2010 -0400 glapi: Implement optional dispatch logging There's a useful feature buried in glapi to log all API calls to stderr. Unfortunately it requires editing the code and then it's enabled unconditionally for that build. This patch builds in API logging for debug builds and makes it run-time switchable by setting MESA_DEBUG=dispatch. --- src/mapi/glapi/glapi.h |8 +++- src/mapi/glapi/glapi_dispatch.c| 80 +-- src/mesa/drivers/dri/common/dri_test.c | 12 + src/mesa/main/context.c| 24 +- src/mesa/main/context.h|3 + src/mesa/main/debug.c |6 ++- src/mesa/main/dlist.c |8 ++-- src/mesa/main/mtypes.h |3 +- 8 files changed, 119 insertions(+), 25 deletions(-) diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index a0bb078..2fa5802 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -94,7 +94,7 @@ _GLAPI_EXPORT extern __thread void * _glapi_tls_Context _GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; _GLAPI_EXPORT extern const void *_glapi_Context; -# define GET_DISPATCH() _glapi_tls_Dispatch +# define GET_DISPATCH(t) _glapi_tls_Dispatch # define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context #else @@ -167,6 +167,12 @@ _glapi_get_proc_name(unsigned int offset); _GLAPI_EXPORT unsigned long _glthread_GetID(void); +_GLAPI_EXPORT int +_glapi_logging_available(void); + +_GLAPI_EXPORT void +_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), + void *data); /* * These stubs are kept so that the old DRI drivers still load. diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 7421a36..0d41c94 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -41,7 +41,6 @@ #include glapi/glapitable.h #include glapi/glapidispatch.h - #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) #if defined(WIN32) @@ -58,27 +57,12 @@ #define NAME(func) gl##func #endif -#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ - -#define F stdout -#define DISPATCH(FUNC, ARGS, MESSAGE) \ - fprintf MESSAGE;\ - CALL_ ## FUNC(GET_DISPATCH(), ARGS); - -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - fprintf MESSAGE;\ - return CALL_ ## FUNC(GET_DISPATCH(), ARGS); - -#else - #define DISPATCH(FUNC, ARGS, MESSAGE) \ CALL_ ## FUNC(GET_DISPATCH(), ARGS); #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ return CALL_ ## FUNC(GET_DISPATCH(), ARGS); -#endif /* logging */ - #ifndef GLAPIENTRY #define GLAPIENTRY @@ -91,3 +75,67 @@ #include glapi/glapitemp.h #endif /* USE_X86_ASM */ + + +#ifdef DEBUG + +static void *logger_data; +static void (*logger_func)(void *data, const char *fmt, ...); +static struct _glapi_table *real_dispatch; /* FIXME: This need to be TLS etc */ + +#define KEYWORD1 static +#define KEYWORD1_ALT static +#define KEYWORD2 +#define NAME(func) log_##func +#define F logger_data + +static void +log_Unused(void) +{ +} + +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + logger_func MESSAGE;\ + CALL_ ## FUNC(real_dispatch, ARGS); + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + logger_func MESSAGE;\ + return CALL_ ## FUNC(real_dispatch, ARGS); + +#define DISPATCH_TABLE_NAME __glapi_logging_table + +#define TABLE_ENTRY(func) (_glapi_proc) log_##func + +#include glapi/glapitemp.h + +int +_glapi_logging_available(void) +{ + return 1; +} + +void +_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), + void *data) +{ + real_dispatch = GET_DISPATCH(); + logger_func = func; + logger_data = data; + _glapi_set_dispatch(__glapi_logging_table); +} + +#else + +int +_glapi_logging_available(void) +{ + return 0 +} + +void +_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), + void *data) +{ +} + +#endif diff --git a/src/mesa/drivers/dri/common/dri_test.c b/src/mesa/drivers/dri/common/dri_test.c index 793f0c3..8a47316 100644 --- a/src/mesa/drivers/dri/common/dri_test.c +++ b/src/mesa/drivers/dri/common/dri_test.c @@ -82,6 +82,18 @@ _glthread_GetID(void) return 0; } +PUBLIC int +_glapi_logging_available(void) +{ + return 0; +} + +PUBLIC void +_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), + void *data) +{ +} + int main(int argc, char** argv) { void* p = __driDriverExtensions; diff --git
Mesa (master): eglglx: Convert glx visuals/ fbconfigs straight to EGL configs
Module: Mesa Branch: master Commit: 6eda3f311bc24999835003e404d5eda5599bc5de URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6eda3f311bc24999835003e404d5eda5599bc5de Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Sep 9 15:00:02 2010 -0400 eglglx: Convert glx visuals/fbconfigs straight to EGL configs In other words, skip the __GLcontextModes middle man. --- src/egl/drivers/glx/egl_glx.c | 245 + src/egl/main/Makefile |2 - src/egl/main/SConscript |1 - src/egl/main/eglconfigutil.c | 128 - src/egl/main/eglconfigutil.h | 19 --- 5 files changed, 102 insertions(+), 293 deletions(-) diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index b4a40d1..b2076e2 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -37,8 +37,8 @@ #include string.h #include X11/Xlib.h #include GL/glx.h +#include EGL/egl.h -#include eglconfigutil.h #include eglconfig.h #include eglcontext.h #include egldefines.h @@ -127,48 +127,34 @@ GLX_egl_config_index(_EGLConfig *conf) } -#define MAP_ATTRIB(attr, memb) \ - { attr, offsetof(__GLcontextModes, memb) } - - static const struct { int attr; - int offset; + int egl_attr; } fbconfig_attributes[] = { /* table 3.1 of GLX 1.4 */ - MAP_ATTRIB(GLX_FBCONFIG_ID, fbconfigID), - MAP_ATTRIB(GLX_BUFFER_SIZE, rgbBits), - MAP_ATTRIB(GLX_LEVEL,level), - MAP_ATTRIB(GLX_DOUBLEBUFFER, doubleBufferMode), - MAP_ATTRIB(GLX_STEREO, stereoMode), - MAP_ATTRIB(GLX_AUX_BUFFERS, numAuxBuffers), - MAP_ATTRIB(GLX_RED_SIZE, redBits), - MAP_ATTRIB(GLX_GREEN_SIZE, greenBits), - MAP_ATTRIB(GLX_BLUE_SIZE,blueBits), - MAP_ATTRIB(GLX_ALPHA_SIZE, alphaBits), - MAP_ATTRIB(GLX_DEPTH_SIZE, depthBits), - MAP_ATTRIB(GLX_STENCIL_SIZE, stencilBits), - MAP_ATTRIB(GLX_ACCUM_RED_SIZE, accumRedBits), - MAP_ATTRIB(GLX_ACCUM_GREEN_SIZE, accumGreenBits), - MAP_ATTRIB(GLX_ACCUM_BLUE_SIZE, accumBlueBits), - MAP_ATTRIB(GLX_ACCUM_ALPHA_SIZE, accumAlphaBits), - MAP_ATTRIB(GLX_SAMPLE_BUFFERS, sampleBuffers), - MAP_ATTRIB(GLX_SAMPLES, samples), - MAP_ATTRIB(GLX_RENDER_TYPE, renderType), - MAP_ATTRIB(GLX_DRAWABLE_TYPE,drawableType), - MAP_ATTRIB(GLX_X_RENDERABLE, xRenderable), - MAP_ATTRIB(GLX_X_VISUAL_TYPE,visualType), - MAP_ATTRIB(GLX_CONFIG_CAVEAT,visualRating), - MAP_ATTRIB(GLX_TRANSPARENT_TYPE, transparentPixel), - MAP_ATTRIB(GLX_TRANSPARENT_INDEX_VALUE, transparentIndex), - MAP_ATTRIB(GLX_TRANSPARENT_RED_VALUE,transparentRed), - MAP_ATTRIB(GLX_TRANSPARENT_GREEN_VALUE, transparentGreen), - MAP_ATTRIB(GLX_TRANSPARENT_BLUE_VALUE, transparentBlue), - MAP_ATTRIB(GLX_TRANSPARENT_ALPHA_VALUE, transparentAlpha), - MAP_ATTRIB(GLX_MAX_PBUFFER_WIDTH,maxPbufferWidth), - MAP_ATTRIB(GLX_MAX_PBUFFER_HEIGHT, maxPbufferHeight), - MAP_ATTRIB(GLX_MAX_PBUFFER_PIXELS, maxPbufferPixels), - MAP_ATTRIB(GLX_VISUAL_ID,visualID), + { GLX_BUFFER_SIZE, EGL_BUFFER_SIZE }, + { GLX_LEVEL,EGL_LEVEL }, + { GLX_RED_SIZE, EGL_RED_SIZE }, + { GLX_GREEN_SIZE, EGL_GREEN_SIZE }, + { GLX_BLUE_SIZE,EGL_BLUE_SIZE }, + { GLX_ALPHA_SIZE, EGL_ALPHA_SIZE }, + { GLX_DEPTH_SIZE, EGL_DEPTH_SIZE }, + { GLX_STENCIL_SIZE, EGL_STENCIL_SIZE }, + { GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS }, + { GLX_SAMPLES, EGL_SAMPLES }, + { GLX_RENDER_TYPE, EGL_RENDERABLE_TYPE }, + { GLX_X_RENDERABLE, EGL_NATIVE_RENDERABLE }, + { GLX_X_VISUAL_TYPE,EGL_NATIVE_VISUAL_TYPE }, + { GLX_CONFIG_CAVEAT,EGL_CONFIG_CAVEAT }, + { GLX_TRANSPARENT_TYPE, EGL_TRANSPARENT_TYPE }, + { GLX_TRANSPARENT_RED_VALUE,EGL_TRANSPARENT_RED_VALUE }, + { GLX_TRANSPARENT_GREEN_VALUE, EGL_TRANSPARENT_GREEN_VALUE }, + { GLX_TRANSPARENT_BLUE_VALUE, EGL_TRANSPARENT_BLUE_VALUE }, + { GLX_MAX_PBUFFER_WIDTH,EGL_MAX_PBUFFER_WIDTH }, + { GLX_MAX_PBUFFER_HEIGHT, EGL_MAX_PBUFFER_HEIGHT }, + { GLX_MAX_PBUFFER_PIXELS, EGL_MAX_PBUFFER_PIXELS }, + { GLX_VISUAL_ID,EGL_NATIVE_VISUAL_ID }, + { GLX_X_VISUAL_TYPE,EGL_NATIVE_VISUAL_TYPE }, }; @@ -176,14 +162,12 @@ static EGLBoolean
Mesa (master): st/dri: support EGL_MESA_image_drm: createImage
Module: Mesa Branch: master Commit: a572e3198d19b88a5418e12376e233a583b5977a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a572e3198d19b88a5418e12376e233a583b5977a Author: ben benjaminfran...@googlemail.com Date: Thu Aug 26 17:31:42 2010 +0200 st/dri: support EGL_MESA_image_drm: createImage Signed-off-by: Jakob Bornecrantz wallbra...@gmail.com --- src/gallium/state_trackers/dri/drm/dri2.c | 58 + 1 files changed, 58 insertions(+), 0 deletions(-) diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index f68b695..2fa71ba 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -380,6 +380,63 @@ dri2_create_image_from_renderbuffer(__DRIcontext *context, return NULL; } +static __DRIimage * +dri2_create_image(__DRIscreen *_screen, + int width, int height, int format, + unsigned int use, void *loaderPrivate) +{ + struct dri_screen *screen = dri_screen(_screen); + __DRIimage *img; + struct pipe_resource templ; + unsigned tex_usage; + enum pipe_format pf; + + tex_usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; + + switch (format) { + case __DRI_IMAGE_FORMAT_RGB565: + pf = PIPE_FORMAT_B5G6R5_UNORM; + break; + case __DRI_IMAGE_FORMAT_XRGB: + pf = PIPE_FORMAT_B8G8R8X8_UNORM; + break; + case __DRI_IMAGE_FORMAT_ARGB: + pf = PIPE_FORMAT_B8G8R8A8_UNORM; + break; + default: + pf = PIPE_FORMAT_NONE; + break; + } + if (pf == PIPE_FORMAT_NONE) + return NULL; + + img = CALLOC_STRUCT(__DRIimageRec); + if (!img) + return NULL; + + memset(templ, 0, sizeof(templ)); + templ.bind = tex_usage; + templ.format = pf; + templ.target = PIPE_TEXTURE_2D; + templ.last_level = 0; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; + + img-texture = screen-base.screen-resource_create(screen-base.screen, templ); + if (!img-texture) { + FREE(img); + return NULL; + } + + img-face = 0; + img-level = 0; + img-zslice = 0; + + img-loader_private = loaderPrivate; + return img; +} + static void dri2_destroy_image(__DRIimage *img) { @@ -392,6 +449,7 @@ static struct __DRIimageExtensionRec dri2ImageExtension = { dri2_create_image_from_name, dri2_create_image_from_renderbuffer, dri2_destroy_image, +dri2_create_image, }; /* ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/dri: support EGL_MESA_image_drm: queryImage
Module: Mesa Branch: master Commit: 1d61793824b77e45f2ecf9b7d38bfc36d2a5af52 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d61793824b77e45f2ecf9b7d38bfc36d2a5af52 Author: ben benjaminfran...@googlemail.com Date: Thu Aug 26 17:32:32 2010 +0200 st/dri: support EGL_MESA_image_drm: queryImage Signed-off-by: Jakob Bornecrantz wallbra...@gmail.com --- src/gallium/state_trackers/dri/drm/dri2.c | 30 + 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 2fa71ba..3ba7961 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -437,6 +437,35 @@ dri2_create_image(__DRIscreen *_screen, return img; } +static GLboolean +dri2_query_image(__DRIimage *image, int attrib, int *value) +{ + struct winsys_handle whandle; + memset(whandle, 0, sizeof(whandle)); + + switch (attrib) { + case __DRI_IMAGE_ATTRIB_STRIDE: + image-texture-screen-resource_get_handle(image-texture-screen, +image-texture, whandle); + *value = whandle.stride; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_HANDLE: + whandle.type = DRM_API_HANDLE_TYPE_KMS; + image-texture-screen-resource_get_handle(image-texture-screen, + image-texture, whandle); + *value = whandle.handle; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_NAME: + whandle.type = DRM_API_HANDLE_TYPE_SHARED; + image-texture-screen-resource_get_handle(image-texture-screen, + image-texture, whandle); + *value = whandle.handle; + return GL_TRUE; + default: + return GL_FALSE; + } +} + static void dri2_destroy_image(__DRIimage *img) { @@ -450,6 +479,7 @@ static struct __DRIimageExtensionRec dri2ImageExtension = { dri2_create_image_from_renderbuffer, dri2_destroy_image, dri2_create_image, +dri2_query_image, }; /* ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glapi: Fix non-debug builds
Module: Mesa Branch: master Commit: 7aae70406bb1c4c9d1e3d026847249684b5e5d0e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7aae70406bb1c4c9d1e3d026847249684b5e5d0e Author: Jakob Bornecrantz wallbra...@gmail.com Date: Thu Sep 9 22:46:49 2010 +0200 glapi: Fix non-debug builds --- src/mapi/glapi/glapi_dispatch.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 0d41c94..c060c55 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -129,7 +129,7 @@ _glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), int _glapi_logging_available(void) { - return 0 + return 0; } void ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Don' t reuse DummyFramebuffer as the incomplete framebuffer
Module: Mesa Branch: master Commit: 144356f9925fa9d892faa64fa7264ef9f1d7e2b4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=144356f9925fa9d892faa64fa7264ef9f1d7e2b4 Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Sep 9 17:08:12 2010 -0400 mesa: Don't reuse DummyFramebuffer as the incomplete framebuffer Binding framebuffer 0 on a context that doesn't have a winsys drawable will try to bind the incomplete framebuffer. That fails when that's also the dummy framebuffer. --- src/mesa/main/context.c |3 +++ src/mesa/main/fbobject.c |8 +++- 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 73d96e8..66e4183 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1300,6 +1300,9 @@ check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) if (ctxvis == bufvis) return GL_TRUE; + if (buffer == _mesa_get_incomplete_framebuffer()) + return GL_TRUE; + #if 0 /* disabling this fixes the fgl_glxgears pbuffer demo */ if (ctxvis-doubleBufferMode !bufvis-doubleBufferMode) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 72cbb09..5201f50 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -71,6 +71,10 @@ static struct gl_framebuffer DummyFramebuffer; static struct gl_renderbuffer DummyRenderbuffer; +/* We bind this framebuffer when applications pass a NULL + * drawable/surface in make current. */ +static struct gl_framebuffer IncompleteFramebuffer; + #define IS_CUBE_FACE(TARGET) \ ((TARGET) = GL_TEXTURE_CUBE_MAP_POSITIVE_X \ @@ -95,14 +99,16 @@ _mesa_init_fbobjects(GLcontext *ctx) { _glthread_INIT_MUTEX(DummyFramebuffer.Mutex); _glthread_INIT_MUTEX(DummyRenderbuffer.Mutex); + _glthread_INIT_MUTEX(IncompleteFramebuffer.Mutex); DummyFramebuffer.Delete = delete_dummy_framebuffer; DummyRenderbuffer.Delete = delete_dummy_renderbuffer; + IncompleteFramebuffer.Delete = delete_dummy_framebuffer; } struct gl_framebuffer * _mesa_get_incomplete_framebuffer(void) { - return DummyFramebuffer; + return IncompleteFramebuffer; } /** ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Only reference logging symbols in debug builds
Module: Mesa Branch: master Commit: 6fe1b479ca92b8abc7461d4be1c019bbefe0ef51 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fe1b479ca92b8abc7461d4be1c019bbefe0ef51 Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Sep 9 18:00:44 2010 -0400 mesa: Only reference logging symbols in debug builds --- src/mesa/main/context.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 66e4183..decc1dd 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1370,6 +1370,8 @@ _mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height) } } +#ifdef DEBUG + static void dispatch_logger(void *data, const char *fmt, ...) { @@ -1391,6 +1393,15 @@ _mesa_set_dispatch(void *table) } } +#else + +void +_mesa_set_dispatch(void *table) +{ + _glapi_set_dispatch(table); +} + +#endif /** * Bind the given context to the given drawBuffer and readBuffer and * make it the current context for the calling thread. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl2: Add lowering pass to remove noise opcodes
Module: Mesa Branch: master Commit: 547131ac8750acabd030972fc768705c13d19ef7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=547131ac8750acabd030972fc768705c13d19ef7 Author: Ian Romanick ian.d.roman...@intel.com Date: Thu Sep 9 15:20:09 2010 -0700 glsl2: Add lowering pass to remove noise opcodes --- src/glsl/Makefile |1 + src/glsl/Makefile.am |3 +- src/glsl/ir_optimization.h |1 + src/glsl/lower_noise.cpp | 71 4 files changed, 75 insertions(+), 1 deletions(-) diff --git a/src/glsl/Makefile b/src/glsl/Makefile index eb62112..e869b08 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -75,6 +75,7 @@ CXX_SOURCES = \ loop_analysis.cpp \ loop_controls.cpp \ loop_unroll.cpp \ + lower_noise.cpp \ s_expression.cpp LIBS = \ diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am index 7ff0cb0..3ce8e21 100644 --- a/src/glsl/Makefile.am +++ b/src/glsl/Makefile.am @@ -65,7 +65,8 @@ glsl_SOURCES = \ linker.cpp \ loop_analysis.cpp \ loop_controls.cpp \ - loop_unroll.cpp + loop_unroll.cpp \ + lower_noise.cpp BUILT_SOURCES = glsl_parser.h glsl_parser.cpp glsl_lexer.cpp CLEANFILES = $(BUILT_SOURCES) diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index df25673..5347158 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -55,3 +55,4 @@ bool do_swizzle_swizzle(exec_list *instructions); bool do_tree_grafting(exec_list *instructions); bool do_vec_index_to_cond_assign(exec_list *instructions); bool do_vec_index_to_swizzle(exec_list *instructions); +bool lower_noise(exec_list *instructions); diff --git a/src/glsl/lower_noise.cpp b/src/glsl/lower_noise.cpp new file mode 100644 index 000..cb32d28 --- /dev/null +++ b/src/glsl/lower_noise.cpp @@ -0,0 +1,71 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file lower_noise.cpp + * IR lower pass to remove noise opcodes. + * + * \author Ian Romanick ian.d.roman...@intel.com + */ + +#include ir.h +#include ir_rvalue_visitor.h + +class lower_noise_visitor : public ir_rvalue_visitor { +public: + lower_noise_visitor() : progress(false) + { + /* empty */ + } + + void handle_rvalue(ir_rvalue **rvalue) + { + if (!*rvalue) +return; + + ir_expression *expr = (*rvalue)-as_expression(); + if (!expr) +return; + + /* In the future, ir_unop_noise may be replaced by a call to a function + * that implements noise. No hardware has a noise instruction. + */ + if (expr-operation == ir_unop_noise) { +*rvalue = ir_constant::zero(talloc_parent(expr), expr-type); +this-progress = true; + } + } + + bool progress; +}; + + +bool +lower_noise(exec_list *instructions) +{ + lower_noise_visitor v; + + visit_list_elements(v, instructions); + + return v.progress; +} ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl2: Add EmitNoNoise flag, use it to remove noise opcodes
Module: Mesa Branch: master Commit: 2b70dbfe091af5ae7c788e16275e1af2cb1c284c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b70dbfe091af5ae7c788e16275e1af2cb1c284c Author: Ian Romanick ian.d.roman...@intel.com Date: Thu Sep 9 15:25:32 2010 -0700 glsl2: Add EmitNoNoise flag, use it to remove noise opcodes --- src/mesa/drivers/dri/i915/i915_context.c |1 + src/mesa/drivers/dri/i965/brw_context.c |1 + src/mesa/main/mtypes.h |1 + src/mesa/main/shaderapi.c| 13 ++--- src/mesa/program/ir_to_mesa.cpp |3 +++ 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 845ec2c..450e66e 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -179,6 +179,7 @@ i915CreateContext(int api, */ ctx-ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = GL_TRUE; ctx-ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoIfs = GL_TRUE; + ctx-ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoNoise = GL_TRUE; ctx-Const.MaxDrawBuffers = 1; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index daa281e..b8283b4 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -114,6 +114,7 @@ GLboolean brwCreateContext( int api, for (i = 0; i = MESA_SHADER_FRAGMENT; i++) { ctx-ShaderCompilerOptions[i].EmitCondCodes = GL_TRUE; ctx-ShaderCompilerOptions[i].EmitNVTempInitialization = GL_TRUE; + ctx-ShaderCompilerOptions[i].EmitNoNoise = GL_TRUE; } ctx-Const.VertexProgram.MaxNativeInstructions = (16 * 1024); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 96fd914..bcd324b 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2199,6 +2199,7 @@ struct gl_shader_compiler_options GLboolean EmitNoFunctions; GLboolean EmitNoCont; /** Emit CONT opcode? */ GLboolean EmitNoMainReturn;/** Emit CONT/RET opcodes? */ + GLboolean EmitNoNoise; /** Emit NOISE opcodes? */ GLuint MaxUnrollIterations; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index c32c09f..c25d2a1 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -96,21 +96,12 @@ _mesa_init_shader_state(GLcontext *ctx) */ struct gl_shader_compiler_options options; GLuint i; - options.EmitHighLevelInstructions = GL_TRUE; - options.EmitCondCodes = GL_FALSE; - options.EmitComments = GL_FALSE; - options.EmitNoIfs = GL_FALSE; - options.EmitNoLoops = GL_FALSE; - options.EmitNoFunctions = GL_FALSE; - options.EmitNoCont = GL_FALSE; - options.EmitNoMainReturn = GL_FALSE; + + memset(options, 0, sizeof(options)); options.MaxUnrollIterations = 32; /* Default pragma settings */ - options.DefaultPragmas.IgnoreOptimize = GL_FALSE; - options.DefaultPragmas.IgnoreDebug = GL_FALSE; options.DefaultPragmas.Optimize = GL_TRUE; - options.DefaultPragmas.Debug = GL_FALSE; for(i = 0; i MESA_SHADER_TYPES; ++i) memcpy(ctx-ShaderCompilerOptions[i], options, sizeof(options)); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7307c85..6e7deae 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2734,6 +2734,9 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) if (options-EmitNoIfs) progress = do_if_to_cond_assign(ir) || progress; +if (options-EmitNoNoise) + progress = lower_noise(ir) || progress; + progress = do_vec_index_to_cond_assign(ir) || progress; } while (progress); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl2: Implement noise[1234] built-in functions using ir_unop_noise
Module: Mesa Branch: master Commit: 1f3c7d968c4313dbb71bc93306556cc9292d06ef URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f3c7d968c4313dbb71bc93306556cc9292d06ef Author: Ian Romanick ian.d.roman...@intel.com Date: Wed Sep 1 21:23:52 2010 -0700 glsl2: Implement noise[1234] built-in functions using ir_unop_noise --- src/glsl/builtin_function.cpp | 281 + src/glsl/builtins/ir/noise1 |8 +- src/glsl/builtins/ir/noise2 | 75 +--- src/glsl/builtins/ir/noise3 | 87 +++--- src/glsl/builtins/ir/noise4 | 111 ++--- 5 files changed, 458 insertions(+), 104 deletions(-) diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 7e40cd7..05b2bc4 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -2054,82 +2054,259 @@ static const char *builtin_noise1 = (signature float\n (parameters\n (declare (in) float x))\n -((return (constant float (0)\n +((return (expression float noise (var_ref x)\n (signature float\n (parameters\n (declare (in) vec2 x))\n -((return (constant float (0)\n +((return (expression float noise (var_ref x)\n (signature float\n (parameters\n (declare (in) vec3 x))\n -((return (constant float (0)\n +((return (expression float noise (var_ref x)\n (signature float\n (parameters\n (declare (in) vec4 x))\n -((return (constant float (0)\n +((return (expression float noise (var_ref x)\n ))\n ; static const char *builtin_noise2 = ((function noise2\n - (signature vec2\n -(parameters\n - (declare (in) float x))\n -((return (constant vec2 (0 0)\n - (signature vec2\n -(parameters\n - (declare (in) vec2 x))\n -((return (constant vec2 (0 0)\n - (signature vec2\n -(parameters\n - (declare (in) vec3 x))\n -((return (constant vec2 (0 0)\n - (signature vec2\n -(parameters\n - (declare (in) vec4 x))\n -((return (constant vec2 (0 0)\n + (signature vec2\n + (parameters (declare (in) vec4 p))\n + (\n + (declare () float a)\n + (declare () float b)\n + (declare () vec2 t)\n + \n + (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n + (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)\n + (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n + (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n + (return (var_ref t))\n + ))\n + \n + (signature vec2\n + (parameters (declare (in) vec3 p))\n + (\n + (declare () float a)\n + (declare () float b)\n + (declare () vec2 t)\n + \n + (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n + (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)\n + (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n + (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n + (return (var_ref t))\n + ))\n + \n + (signature vec2\n + (parameters\n + (declare (in ) vec2 p)\n + )\n + (\n + (declare () float a)\n + (declare () float b)\n + (declare () vec2 t)\n + \n + (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n + (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)\n + (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n + (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n + (return (var_ref t))\n + ))\n + \n + (signature vec2\n + (parameters\n + (declare (in ) float p)\n + )\n + (\n + (declare () float a)\n + (declare () float b)\n + (declare () vec2 t)\n + \n + (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n + (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)\n + (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n + (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n + (return (var_ref t))\n + ))\n ))\n ; static const char *builtin_noise3 = ((function noise3\n - (signature vec3\n -(parameters\n -
Mesa (master): Revert glapi: Implement optional dispatch logging
Module: Mesa Branch: master Commit: 042a333028eba49f21b45cafaf9dd15d34c68033 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=042a333028eba49f21b45cafaf9dd15d34c68033 Author: Kristian Høgsberg k...@bitplanet.net Date: Thu Sep 9 18:59:49 2010 -0400 Revert glapi: Implement optional dispatch logging This reverts commit b9abc6139a310677a37754ea7172d976dbf56979 and the follow on fixes (7aae704 and 6fe1b47). It's changing the glapi/driver ABI and causes a number of problems for debug/non-debug builds. --- src/mapi/glapi/glapi.h |8 +--- src/mapi/glapi/glapi_dispatch.c| 80 ++- src/mesa/drivers/dri/common/dri_test.c | 12 - src/mesa/main/context.c| 35 +- src/mesa/main/context.h|3 - src/mesa/main/debug.c |6 +-- src/mesa/main/dlist.c |8 ++-- src/mesa/main/mtypes.h |3 +- 8 files changed, 25 insertions(+), 130 deletions(-) diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index 2fa5802..a0bb078 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -94,7 +94,7 @@ _GLAPI_EXPORT extern __thread void * _glapi_tls_Context _GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; _GLAPI_EXPORT extern const void *_glapi_Context; -# define GET_DISPATCH(t) _glapi_tls_Dispatch +# define GET_DISPATCH() _glapi_tls_Dispatch # define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context #else @@ -167,12 +167,6 @@ _glapi_get_proc_name(unsigned int offset); _GLAPI_EXPORT unsigned long _glthread_GetID(void); -_GLAPI_EXPORT int -_glapi_logging_available(void); - -_GLAPI_EXPORT void -_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), - void *data); /* * These stubs are kept so that the old DRI drivers still load. diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index c060c55..7421a36 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -41,6 +41,7 @@ #include glapi/glapitable.h #include glapi/glapidispatch.h + #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) #if defined(WIN32) @@ -57,12 +58,27 @@ #define NAME(func) gl##func #endif +#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ + +#define F stdout +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + fprintf MESSAGE;\ + CALL_ ## FUNC(GET_DISPATCH(), ARGS); + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + fprintf MESSAGE;\ + return CALL_ ## FUNC(GET_DISPATCH(), ARGS); + +#else + #define DISPATCH(FUNC, ARGS, MESSAGE) \ CALL_ ## FUNC(GET_DISPATCH(), ARGS); #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ return CALL_ ## FUNC(GET_DISPATCH(), ARGS); +#endif /* logging */ + #ifndef GLAPIENTRY #define GLAPIENTRY @@ -75,67 +91,3 @@ #include glapi/glapitemp.h #endif /* USE_X86_ASM */ - - -#ifdef DEBUG - -static void *logger_data; -static void (*logger_func)(void *data, const char *fmt, ...); -static struct _glapi_table *real_dispatch; /* FIXME: This need to be TLS etc */ - -#define KEYWORD1 static -#define KEYWORD1_ALT static -#define KEYWORD2 -#define NAME(func) log_##func -#define F logger_data - -static void -log_Unused(void) -{ -} - -#define DISPATCH(FUNC, ARGS, MESSAGE) \ - logger_func MESSAGE;\ - CALL_ ## FUNC(real_dispatch, ARGS); - -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - logger_func MESSAGE;\ - return CALL_ ## FUNC(real_dispatch, ARGS); - -#define DISPATCH_TABLE_NAME __glapi_logging_table - -#define TABLE_ENTRY(func) (_glapi_proc) log_##func - -#include glapi/glapitemp.h - -int -_glapi_logging_available(void) -{ - return 1; -} - -void -_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), - void *data) -{ - real_dispatch = GET_DISPATCH(); - logger_func = func; - logger_data = data; - _glapi_set_dispatch(__glapi_logging_table); -} - -#else - -int -_glapi_logging_available(void) -{ - return 0; -} - -void -_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), - void *data) -{ -} - -#endif diff --git a/src/mesa/drivers/dri/common/dri_test.c b/src/mesa/drivers/dri/common/dri_test.c index 8a47316..793f0c3 100644 --- a/src/mesa/drivers/dri/common/dri_test.c +++ b/src/mesa/drivers/dri/common/dri_test.c @@ -82,18 +82,6 @@ _glthread_GetID(void) return 0; } -PUBLIC int -_glapi_logging_available(void) -{ - return 0; -} - -PUBLIC void -_glapi_enable_logging(void (*func)(void *data, const char *fmt, ...), - void *data) -{ -} - int main(int argc, char** argv) { void* p = __driDriverExtensions; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index
Mesa (master): glsl2: Fix scons build for all platforms
Module: Mesa Branch: master Commit: 379e2e77badfaa367e1fb47a870a7b5dbcb6a7a6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=379e2e77badfaa367e1fb47a870a7b5dbcb6a7a6 Author: Jakob Bornecrantz wallbra...@gmail.com Date: Fri Sep 10 01:16:19 2010 +0200 glsl2: Fix scons build for all platforms --- src/glsl/SConscript |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/glsl/SConscript b/src/glsl/SConscript index 1ea876e..a568342 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -72,6 +72,7 @@ sources = [ 'loop_analysis.cpp', 'loop_controls.cpp', 'loop_unroll.cpp', +'lower_noise.cpp', 's_expression.cpp', ] ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): graw: fix array size, indentation,
Module: Mesa Branch: master Commit: d851dae919f77180ab70035ad621ea0424162c43 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d851dae919f77180ab70035ad621ea0424162c43 Author: Brian Paul bri...@vmware.com Date: Thu Sep 9 15:11:37 2010 -0600 graw: fix array size, indentation, --- src/gallium/tests/graw/tri.c | 17 ++--- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index 4dbd2c0..8f68fc7 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -31,16 +31,19 @@ struct vertex { float color[4]; }; -static struct vertex vertices[4] = +static struct vertex vertices[3] = { - { { 0.0f, -0.9f, 0.0f, 1.0f }, - { 1.0f, 0.0f, 0.0f, 1.0f } + { + { 0.0f, -0.9f, 0.0f, 1.0f }, + { 1.0f, 0.0f, 0.0f, 1.0f } }, - { { -0.9f, 0.9f, 0.0f, 1.0f }, - { 0.0f, 1.0f, 0.0f, 1.0f } + { + { -0.9f, 0.9f, 0.0f, 1.0f }, + { 0.0f, 1.0f, 0.0f, 1.0f } }, - { { 0.9f, 0.9f, 0.0f, 1.0f }, - { 0.0f, 0.0f, 1.0f, 1.0f } + { + { 0.9f, 0.9f, 0.0f, 1.0f }, + { 0.0f, 0.0f, 1.0f, 1.0f } } }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): winsys: emit warning in null_sw_displaytarget_create()
Module: Mesa Branch: master Commit: 5c3f6787909e765e1887fe67d013d6b2b2613b3f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c3f6787909e765e1887fe67d013d6b2b2613b3f Author: Brian Paul bri...@vmware.com Date: Thu Sep 9 18:50:49 2010 -0600 winsys: emit warning in null_sw_displaytarget_create() --- src/gallium/winsys/sw/null/null_sw_winsys.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/gallium/winsys/sw/null/null_sw_winsys.c b/src/gallium/winsys/sw/null/null_sw_winsys.c index 157efa9..73b777f 100644 --- a/src/gallium/winsys/sw/null/null_sw_winsys.c +++ b/src/gallium/winsys/sw/null/null_sw_winsys.c @@ -35,6 +35,7 @@ * @author Jose Fonseca */ +#include stdio.h #include pipe/p_format.h #include util/u_memory.h @@ -85,6 +86,7 @@ null_sw_displaytarget_create(struct sw_winsys *winsys, unsigned alignment, unsigned *stride) { + fprintf(stderr, null_sw_displaytarget_create() returning NULL\n); return NULL; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw: minor reformatting
Module: Mesa Branch: master Commit: 451dfe541393c553e78c9c037a907c1214d3b4ed URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=451dfe541393c553e78c9c037a907c1214d3b4ed Author: Brian Paul bri...@vmware.com Date: Thu Sep 9 18:52:27 2010 -0600 draw: minor reformatting --- src/gallium/auxiliary/draw/draw_pipe_aaline.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index c0135f5..eac2111 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -373,8 +373,7 @@ generate_aaline_fs(struct aaline_stage *aaline) aaline-fs-sampler_unit = transform.freeSampler; - aaline-fs-aaline_fs - = aaline-driver_create_fs_state(pipe, aaline_fs); + aaline-fs-aaline_fs = aaline-driver_create_fs_state(pipe, aaline_fs); if (aaline-fs-aaline_fs == NULL) goto fail; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): graw: added test for finding shader mem leaks
Module: Mesa Branch: master Commit: 48fda8c446c127298e8a523a321d4da131c2834d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=48fda8c446c127298e8a523a321d4da131c2834d Author: Brian Paul bri...@vmware.com Date: Thu Sep 9 19:18:45 2010 -0600 graw: added test for finding shader mem leaks --- src/gallium/tests/graw/SConscript|1 + src/gallium/tests/graw/shader-leak.c | 266 ++ 2 files changed, 267 insertions(+), 0 deletions(-) diff --git a/src/gallium/tests/graw/SConscript b/src/gallium/tests/graw/SConscript index 860a17e..ffde619 100644 --- a/src/gallium/tests/graw/SConscript +++ b/src/gallium/tests/graw/SConscript @@ -25,6 +25,7 @@ progs = [ 'fs-test', 'vs-test', 'gs-test', +'shader-leak', 'tri-gs', ] diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c new file mode 100644 index 000..ec30871 --- /dev/null +++ b/src/gallium/tests/graw/shader-leak.c @@ -0,0 +1,266 @@ +/** + * Create shaders in a loop to test memory usage. + */ + +#include stdio.h +#include state_tracker/graw.h +#include pipe/p_screen.h +#include pipe/p_context.h +#include pipe/p_state.h +#include pipe/p_defines.h + +#include util/u_debug.h /* debug_dump_surface_bmp() */ +#include util/u_memory.h /* Offset() */ +#include util/u_draw_quad.h + + +static int num_iters = 100; + + +enum pipe_format formats[] = { + PIPE_FORMAT_R8G8B8A8_UNORM, + PIPE_FORMAT_B8G8R8A8_UNORM, + PIPE_FORMAT_NONE +}; + +static const int WIDTH = 300; +static const int HEIGHT = 300; + +static struct pipe_screen *screen = NULL; +static struct pipe_context *ctx = NULL; +static struct pipe_surface *surf = NULL; +static void *window = NULL; + +struct vertex { + float position[4]; + float color[4]; +}; + +static struct vertex vertices[1] = +{ + { + { 0.0f, -0.9f, 0.0f, 1.0f }, + { 1.0f, 0.0f, 0.0f, 1.0f } + } +}; + + + + +static void set_viewport( float x, float y, + float width, float height, + float near, float far) +{ + float z = far; + float half_width = (float)width / 2.0f; + float half_height = (float)height / 2.0f; + float half_depth = ((float)far - (float)near) / 2.0f; + struct pipe_viewport_state vp; + + vp.scale[0] = half_width; + vp.scale[1] = half_height; + vp.scale[2] = half_depth; + vp.scale[3] = 1.0f; + + vp.translate[0] = half_width + x; + vp.translate[1] = half_height + y; + vp.translate[2] = half_depth + z; + vp.translate[3] = 0.0f; + + ctx-set_viewport_state( ctx, vp ); +} + +static void set_vertices( void ) +{ + struct pipe_vertex_element ve[2]; + struct pipe_vertex_buffer vbuf; + void *handle; + + memset(ve, 0, sizeof ve); + + ve[0].src_offset = Offset(struct vertex, position); + ve[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + ve[1].src_offset = Offset(struct vertex, color); + ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + + handle = ctx-create_vertex_elements_state(ctx, 2, ve); + ctx-bind_vertex_elements_state(ctx, handle); + + + vbuf.stride = sizeof(struct vertex); + vbuf.max_index = sizeof(vertices) / vbuf.stride; + vbuf.buffer_offset = 0; + vbuf.buffer = screen-user_buffer_create(screen, +vertices, +sizeof(vertices), +PIPE_BIND_VERTEX_BUFFER); + + ctx-set_vertex_buffers(ctx, 1, vbuf); +} + +static void set_vertex_shader( void ) +{ + void *handle; + const char *text = + VERT\n + DCL IN[0]\n + DCL IN[1]\n + DCL OUT[0], POSITION\n + DCL OUT[1], COLOR\n +0: MOV OUT[1], IN[1]\n +1: MOV OUT[0], IN[0]\n +2: END\n; + + handle = graw_parse_vertex_shader(ctx, text); + ctx-bind_vs_state(ctx, handle); +} + + + +static void * +set_fragment_shader( void ) +{ + void *handle; + const char *text = + FRAG\n + DCL IN[0], COLOR, LINEAR\n + DCL OUT[0], COLOR\n + DCL TEMP[0..1]\n +0: MUL TEMP[0], IN[0], IN[0]\n +1: ADD TEMP[1], IN[0], IN[0]\n +2: SUB OUT[0], TEMP[0], TEMP[1]\n +3: END\n; + + handle = graw_parse_fragment_shader(ctx, text); + return handle; +} + + +static void draw( void ) +{ + float clear_color[4] = {0, 0, 0, 1}; + int i; + + printf(Creating %d shaders\n, num_iters); + + for (i = 0; i num_iters; i++) { + void *fs = set_fragment_shader(); + + ctx-bind_fs_state(ctx, fs); + + ctx-clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); + util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, 1); + ctx-flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + + ctx-bind_fs_state(ctx, NULL); + ctx-delete_fs_state(ctx, fs); + } + + screen-flush_frontbuffer(screen, surf, window); + ctx-destroy(ctx); + + exit(0); +} + + +static void init( void ) +{ + struct pipe_framebuffer_state fb; + struct pipe_resource *tex, templat; +
Mesa (master): r600g: don't need 3 bos here.
Module: Mesa Branch: master Commit: e795ca8f3175fa6fd97b6b2ef2775e3f8803012a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e795ca8f3175fa6fd97b6b2ef2775e3f8803012a Author: Dave Airlie airl...@redhat.com Date: Fri Sep 10 11:22:41 2010 +1000 r600g: don't need 3 bos here. the code should reloc correctly a single BO 3 times. --- src/gallium/drivers/r600/r600_hw_states.c |8 ++-- src/gallium/winsys/r600/drm/r600_states.h |4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 5572336..4de3eae 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -120,12 +120,8 @@ static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate, rtex = (struct r600_resource_texture*)state-cbufs[cb]-texture; rbuffer = rtex-resource; rstate-bo[0] = radeon_bo_incref(rscreen-rw, rbuffer-bo); - rstate-bo[1] = radeon_bo_incref(rscreen-rw, rbuffer-bo); - rstate-bo[2] = radeon_bo_incref(rscreen-rw, rbuffer-bo); - rstate-placement[0] = RADEON_GEM_DOMAIN_GTT; - rstate-placement[2] = RADEON_GEM_DOMAIN_GTT; - rstate-placement[4] = RADEON_GEM_DOMAIN_GTT; - rstate-nbo = 3; + rstate-placement[0] = RADEON_GEM_DOMAIN_VRAM; + rstate-nbo = 1; pitch = (rtex-pitch[level] / rtex-bpt) / 8 - 1; slice = (rtex-pitch[level] / rtex-bpt) * state-cbufs[cb]-height / 64 - 1; diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index 06f6c77..a0175fb 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -404,8 +404,8 @@ static const struct radeon_register R600_names_CB0[] = { {0x000280A0, 0, 0, CB_COLOR0_INFO}, {0x00028060, 0, 0, CB_COLOR0_SIZE}, {0x00028080, 0, 0, CB_COLOR0_VIEW}, - {0x000280E0, 1, 1, CB_COLOR0_FRAG}, - {0x000280C0, 1, 2, CB_COLOR0_TILE}, + {0x000280E0, 1, 0, CB_COLOR0_FRAG}, + {0x000280C0, 1, 0, CB_COLOR0_TILE}, {0x00028100, 0, 0, CB_COLOR0_MASK}, }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: align flushing of cb/db with DDX/r600c.
Module: Mesa Branch: master Commit: 42da02743358fd4b212f47d2727340dcd0578b5a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=42da02743358fd4b212f47d2727340dcd0578b5a Author: Dave Airlie airl...@redhat.com Date: Fri Sep 10 11:27:31 2010 +1000 r600g: align flushing of cb/db with DDX/r600c. the DDX and r600c both flush cb/db after the draw is emitted, as long as they do that, r600g can't be different, as it races. We end up with r600g flush, set CB, DDX set CB, flush. This was causing misrendering on my evergreen, where sometimes the drawing would go to an old CB. --- src/gallium/drivers/r600/r600_context.h |3 + src/gallium/drivers/r600/r600_state.c | 55 ++ src/gallium/drivers/r600/radeon.h |2 + src/gallium/winsys/r600/drm/r600_state.c | 61 ++--- src/gallium/winsys/r600/drm/r600_states.h |6 +++ 5 files changed, 95 insertions(+), 32 deletions(-) diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index eb37069..76a05f8 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -119,6 +119,9 @@ struct r600_context_hw_states { struct radeon_state scissor; struct radeon_state dsa; struct radeon_state cb_cntl; + + struct radeon_state db_flush; + struct radeon_state cb_flush; }; #define R600_MAX_CONSTANT 256 /* magic */ diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 93b0cf1..28c686a 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -595,6 +595,54 @@ static void r600_bind_shader_sampler(struct r600_context *rctx, struct r600_shad } } + +static int setup_cb_flush(struct r600_context *rctx, struct radeon_state *flush) +{ + struct r600_screen *rscreen = rctx-screen; + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + struct pipe_surface *surf; + int i; + + radeon_state_init(flush, rscreen-rw, R600_STATE_CB_FLUSH, 0, 0); + + for (i = 0; i rctx-framebuffer-state.framebuffer.nr_cbufs; i++) { + surf = rctx-framebuffer-state.framebuffer.cbufs[i]; + + rtex = (struct r600_resource_texture*)surf-texture; + rbuffer = rtex-resource; + /* just need to the bo to the flush list */ + flush-bo[i] = radeon_bo_incref(rscreen-rw, rbuffer-bo); + flush-placement[i] = RADEON_GEM_DOMAIN_VRAM; + } + flush-nbo = rctx-framebuffer-state.framebuffer.nr_cbufs; + return radeon_state_pm4(flush); +} + +static int setup_db_flush(struct r600_context *rctx, struct radeon_state *flush) +{ + struct r600_screen *rscreen = rctx-screen; + struct r600_resource_texture *rtex; + struct r600_resource *rbuffer; + struct pipe_surface *surf; + int i; + + surf = rctx-framebuffer-state.framebuffer.zsbuf; + + if (!surf) + return 0; + + radeon_state_init(flush, rscreen-rw, R600_STATE_DB_FLUSH, 0, 0); + rtex = (struct r600_resource_texture*)surf-texture; + rbuffer = rtex-resource; + /* just need to the bo to the flush list */ + flush-bo[0] = radeon_bo_incref(rscreen-rw, rbuffer-bo); + flush-placement[0] = RADEON_GEM_DOMAIN_VRAM; + + flush-nbo = 1; + return radeon_state_pm4(flush); +} + int r600_context_hw_states(struct pipe_context *ctx) { struct r600_context *rctx = r600_context(ctx); @@ -605,6 +653,10 @@ int r600_context_hw_states(struct pipe_context *ctx) rctx-vtbl-scissor(rctx, rctx-hw_states.scissor); rctx-vtbl-dsa(rctx, rctx-hw_states.dsa); rctx-vtbl-cb_cntl(rctx, rctx-hw_states.cb_cntl); + + /* setup flushes */ + setup_db_flush(rctx, rctx-hw_states.db_flush); + setup_cb_flush(rctx, rctx-hw_states.cb_flush); /* bind states */ radeon_draw_bind(rctx-draw, rctx-hw_states.rasterizer); @@ -614,6 +666,9 @@ int r600_context_hw_states(struct pipe_context *ctx) radeon_draw_bind(rctx-draw, rctx-config); + radeon_draw_bind(rctx-draw, rctx-hw_states.db_flush); + radeon_draw_bind(rctx-draw, rctx-hw_states.cb_flush); + if (rctx-viewport) { radeon_draw_bind(rctx-draw, rctx-viewport-rstate[0]); } diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index 0a8cb73..5759f36 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -212,6 +212,8 @@ enum r600_stype { R600_STATE_UCP, R600_STATE_VGT, R600_STATE_DRAW, + R600_STATE_CB_FLUSH, + R600_STATE_DB_FLUSH, }; #include r600_states_inc.h diff --git a/src/gallium/winsys/r600/drm/r600_state.c
Mesa (master): i965: Add switch cases for ir_unop_noise, which should have been lowered.
Module: Mesa Branch: master Commit: 6ef5f212343c0557c4fca272d8236226c1a7c87a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ef5f212343c0557c4fca272d8236226c1a7c87a Author: Eric Anholt e...@anholt.net Date: Thu Sep 9 19:49:58 2010 -0700 i965: Add switch cases for ir_unop_noise, which should have been lowered. Fixes compiler warnings. --- src/mesa/drivers/dri/i965/brw_fs.cpp |4 .../dri/i965/brw_fs_channel_expressions.cpp|3 +++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index c23e7ce..cf5c521 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -753,6 +753,10 @@ fs_visitor::visit(ir_expression *ir) assert(!not reached: should be handled by brw_channel_expressions); break; + case ir_unop_noise: + assert(!not reached: should be handled by lower_noise); + break; + case ir_unop_sqrt: emit(fs_inst(FS_OPCODE_SQRT, this-result, op[0])); break; diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp index d8d58a9..4786140 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp @@ -356,6 +356,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir) assign(ir, 0, last); break; } + case ir_unop_noise: + assert(!noise should have been broken down to function call); + break; } ir-remove(); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: fix regression in multi-buffer tests since CB flush merge
Module: Mesa Branch: master Commit: ab686d340a5e98ee9fc2c586ad14c25c4c1e2503 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab686d340a5e98ee9fc2c586ad14c25c4c1e2503 Author: Dave Airlie airl...@redhat.com Date: Fri Sep 10 13:48:41 2010 +1000 r600g: fix regression in multi-buffer tests since CB flush merge --- src/gallium/winsys/r600/drm/r600_states.h | 28 ++-- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h index 7793738..50b25a9 100644 --- a/src/gallium/winsys/r600/drm/r600_states.h +++ b/src/gallium/winsys/r600/drm/r600_states.h @@ -414,8 +414,8 @@ static const struct radeon_register R600_names_CB1[] = { {0x000280A4, 0, 0, CB_COLOR1_INFO}, {0x00028064, 0, 0, CB_COLOR1_SIZE}, {0x00028084, 0, 0, CB_COLOR1_VIEW}, - {0x000280E4, 1, 1, CB_COLOR1_FRAG}, - {0x000280C4, 1, 2, CB_COLOR1_TILE}, + {0x000280E4, 1, 0, CB_COLOR1_FRAG}, + {0x000280C4, 1, 0, CB_COLOR1_TILE}, {0x00028104, 0, 0, CB_COLOR1_MASK}, }; @@ -424,8 +424,8 @@ static const struct radeon_register R600_names_CB2[] = { {0x000280A8, 0, 0, CB_COLOR2_INFO}, {0x00028068, 0, 0, CB_COLOR2_SIZE}, {0x00028088, 0, 0, CB_COLOR2_VIEW}, - {0x000280E8, 1, 1, CB_COLOR2_FRAG}, - {0x000280C8, 1, 2, CB_COLOR2_TILE}, + {0x000280E8, 1, 0, CB_COLOR2_FRAG}, + {0x000280C8, 1, 0, CB_COLOR2_TILE}, {0x00028108, 0, 0, CB_COLOR2_MASK}, }; @@ -434,8 +434,8 @@ static const struct radeon_register R600_names_CB3[] = { {0x000280AC, 0, 0, CB_COLOR3_INFO}, {0x0002806C, 0, 0, CB_COLOR3_SIZE}, {0x0002808C, 0, 0, CB_COLOR3_VIEW}, - {0x000280EC, 1, 1, CB_COLOR3_FRAG}, - {0x000280CC, 1, 2, CB_COLOR3_TILE}, + {0x000280EC, 1, 0, CB_COLOR3_FRAG}, + {0x000280CC, 1, 0, CB_COLOR3_TILE}, {0x0002810C, 0, 0, CB_COLOR3_MASK}, }; @@ -444,8 +444,8 @@ static const struct radeon_register R600_names_CB4[] = { {0x000280B0, 0, 0, CB_COLOR4_INFO}, {0x00028070, 0, 0, CB_COLOR4_SIZE}, {0x00028090, 0, 0, CB_COLOR4_VIEW}, - {0x000280F0, 1, 1, CB_COLOR4_FRAG}, - {0x000280D0, 1, 2, CB_COLOR4_TILE}, + {0x000280F0, 1, 0, CB_COLOR4_FRAG}, + {0x000280D0, 1, 0, CB_COLOR4_TILE}, {0x00028110, 0, 0, CB_COLOR4_MASK}, }; @@ -454,8 +454,8 @@ static const struct radeon_register R600_names_CB5[] = { {0x000280B4, 0, 0, CB_COLOR5_INFO}, {0x00028074, 0, 0, CB_COLOR5_SIZE}, {0x00028094, 0, 0, CB_COLOR5_VIEW}, - {0x000280F4, 1, 1, CB_COLOR5_FRAG}, - {0x000280D4, 1, 2, CB_COLOR5_TILE}, + {0x000280F4, 1, 0, CB_COLOR5_FRAG}, + {0x000280D4, 1, 0, CB_COLOR5_TILE}, {0x00028114, 0, 0, CB_COLOR5_MASK}, }; @@ -464,8 +464,8 @@ static const struct radeon_register R600_names_CB6[] = { {0x000280B8, 0, 0, CB_COLOR6_INFO}, {0x00028078, 0, 0, CB_COLOR6_SIZE}, {0x00028098, 0, 0, CB_COLOR6_VIEW}, - {0x000280F8, 1, 1, CB_COLOR6_FRAG}, - {0x000280D8, 1, 2, CB_COLOR6_TILE}, + {0x000280F8, 1, 0, CB_COLOR6_FRAG}, + {0x000280D8, 1, 0, CB_COLOR6_TILE}, {0x00028118, 0, 0, CB_COLOR6_MASK}, }; @@ -474,8 +474,8 @@ static const struct radeon_register R600_names_CB7[] = { {0x000280BC, 0, 0, CB_COLOR7_INFO}, {0x0002807C, 0, 0, CB_COLOR7_SIZE}, {0x0002809C, 0, 0, CB_COLOR7_VIEW}, - {0x000280FC, 1, 1, CB_COLOR7_FRAG}, - {0x000280DC, 1, 2, CB_COLOR7_TILE}, + {0x000280FC, 1, 0, CB_COLOR7_FRAG}, + {0x000280DC, 1, 0, CB_COLOR7_TILE}, {0x0002811C, 0, 0, CB_COLOR7_MASK}, }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: evergreen CBs are more sane to support with a single state
Module: Mesa Branch: master Commit: ad5ada4372356583599a84f50a43ca688165e18f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad5ada4372356583599a84f50a43ca688165e18f Author: Dave Airlie airl...@redhat.com Date: Fri Sep 10 13:50:31 2010 +1000 r600g: evergreen CBs are more sane to support with a single state --- src/gallium/drivers/r600/eg_hw_states.c |2 +- src/gallium/winsys/r600/drm/eg_states.h | 74 +- src/gallium/winsys/r600/drm/r600_state.c |9 +--- 3 files changed, 3 insertions(+), 82 deletions(-) diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 9e704f0..97b9997 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -117,7 +117,7 @@ static void eg_cb(struct r600_context *rctx, struct radeon_state *rstate, unsigned format, swap, ntype; const struct util_format_description *desc; - radeon_state_init(rstate, rscreen-rw, R600_STATE_CB0 + cb, 0, 0); + radeon_state_init(rstate, rscreen-rw, R600_STATE_CB0, cb, 0); rtex = (struct r600_resource_texture*)state-cbufs[cb]-texture; rbuffer = rtex-resource; rstate-bo[0] = radeon_bo_incref(rscreen-rw, rbuffer-bo); diff --git a/src/gallium/winsys/r600/drm/eg_states.h b/src/gallium/winsys/r600/drm/eg_states.h index 0334e63..c26ba6c 100644 --- a/src/gallium/winsys/r600/drm/eg_states.h +++ b/src/gallium/winsys/r600/drm/eg_states.h @@ -391,7 +391,7 @@ static const struct radeon_register EG_names_GS_SAMPLER_BORDER[] = { {0xA80C, 0, 0, TD_GS_SAMPLER0_BORDER_ALPHA}, }; -static const struct radeon_register EG_names_CB0[] = { +static const struct radeon_register EG_names_CB[] = { {0x00028C60, 1, 0, CB_COLOR0_BASE}, {0x00028C64, 0, 0, CB_COLOR0_PITCH}, {0x00028C68, 0, 0, CB_COLOR0_SLICE}, @@ -401,78 +401,6 @@ static const struct radeon_register EG_names_CB0[] = { {0x00028C78, 0, 0, CB_COLOR0_DIM}, }; -/* TODO */ -static const struct radeon_register EG_names_CB1[] = { - {0x00028044, 1, 0, CB_COLOR1_BASE}, - {0x000280A4, 0, 0, CB_COLOR1_INFO}, - {0x00028064, 0, 0, CB_COLOR1_SIZE}, - {0x00028084, 0, 0, CB_COLOR1_VIEW}, - {0x000280E4, 1, 1, CB_COLOR1_FRAG}, - {0x000280C4, 1, 2, CB_COLOR1_TILE}, - {0x00028104, 0, 0, CB_COLOR1_MASK}, -}; - -static const struct radeon_register EG_names_CB2[] = { - {0x00028048, 1, 0, CB_COLOR2_BASE}, - {0x000280A8, 0, 0, CB_COLOR2_INFO}, - {0x00028068, 0, 0, CB_COLOR2_SIZE}, - {0x00028088, 0, 0, CB_COLOR2_VIEW}, - {0x000280E8, 1, 1, CB_COLOR2_FRAG}, - {0x000280C8, 1, 2, CB_COLOR2_TILE}, - {0x00028108, 0, 0, CB_COLOR2_MASK}, -}; - -static const struct radeon_register EG_names_CB3[] = { - {0x0002804C, 1, 0, CB_COLOR3_BASE}, - {0x000280AC, 0, 0, CB_COLOR3_INFO}, - {0x0002806C, 0, 0, CB_COLOR3_SIZE}, - {0x0002808C, 0, 0, CB_COLOR3_VIEW}, - {0x000280EC, 1, 1, CB_COLOR3_FRAG}, - {0x000280CC, 1, 2, CB_COLOR3_TILE}, - {0x0002810C, 0, 0, CB_COLOR3_MASK}, -}; - -static const struct radeon_register EG_names_CB4[] = { - {0x00028050, 1, 0, CB_COLOR4_BASE}, - {0x000280B0, 0, 0, CB_COLOR4_INFO}, - {0x00028070, 0, 0, CB_COLOR4_SIZE}, - {0x00028090, 0, 0, CB_COLOR4_VIEW}, - {0x000280F0, 1, 1, CB_COLOR4_FRAG}, - {0x000280D0, 1, 2, CB_COLOR4_TILE}, - {0x00028110, 0, 0, CB_COLOR4_MASK}, -}; - -static const struct radeon_register EG_names_CB5[] = { - {0x00028054, 1, 0, CB_COLOR5_BASE}, - {0x000280B4, 0, 0, CB_COLOR5_INFO}, - {0x00028074, 0, 0, CB_COLOR5_SIZE}, - {0x00028094, 0, 0, CB_COLOR5_VIEW}, - {0x000280F4, 1, 1, CB_COLOR5_FRAG}, - {0x000280D4, 1, 2, CB_COLOR5_TILE}, - {0x00028114, 0, 0, CB_COLOR5_MASK}, -}; - -static const struct radeon_register EG_names_CB6[] = { - {0x00028058, 1, 0, CB_COLOR6_BASE}, - {0x000280B8, 0, 0, CB_COLOR6_INFO}, - {0x00028078, 0, 0, CB_COLOR6_SIZE}, - {0x00028098, 0, 0, CB_COLOR6_VIEW}, - {0x000280F8, 1, 1, CB_COLOR6_FRAG}, - {0x000280D8, 1, 2, CB_COLOR6_TILE}, - {0x00028118, 0, 0, CB_COLOR6_MASK}, -}; - -static const struct radeon_register EG_names_CB7[] = { - {0x0002805C, 1, 0, CB_COLOR7_BASE}, - {0x000280BC, 0, 0, CB_COLOR7_INFO}, - {0x0002807C, 0, 0, CB_COLOR7_SIZE}, - {0x0002809C, 0, 0, CB_COLOR7_VIEW}, - {0x000280FC, 1, 1, CB_COLOR7_FRAG}, - {0x000280DC, 1, 2, CB_COLOR7_TILE}, - {0x0002811C, 0, 0, CB_COLOR7_MASK}, -}; -/* TODO */ - /* different - TODO */ static const struct radeon_register EG_names_DB[] = { {0x00028014, 1, 0, DB_HTILE_DATA_BASE}, diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index d6f996a..4a0111b 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -111,14
Mesa (master): r600g: add multi-buffer flush support properly.
Module: Mesa Branch: master Commit: 7d564fe459d29e471946bd47838069504480 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d564fe459d29e471946bd47838069504480 Author: Dave Airlie airl...@redhat.com Date: Fri Sep 10 13:50:16 2010 +1000 r600g: add multi-buffer flush support properly. --- src/gallium/winsys/r600/drm/r600_state.c | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index 3570ee1..d6f996a 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -308,7 +308,7 @@ static int r600_state_pm4_generic(struct radeon_state *state) return r; } -static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags) +static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags, int bufs_are_cbs) { unsigned i, j, add, size; @@ -327,6 +327,8 @@ static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags) for (i = 0; i state-nreloc; i++) { size = (state-bo[state-reloc_bo_id[i]]-size + 255) 8; state-pm4[state-cpm4++] = PKT3(PKT3_SURFACE_SYNC, 3); + if (bufs_are_cbs) + flags |= S_0085F0_CB0_DEST_BASE_ENA(1 i); state-pm4[state-cpm4++] = flags; state-pm4[state-cpm4++] = size; state-pm4[state-cpm4++] = 0x; @@ -425,7 +427,7 @@ static int r700_state_pm4_config(struct radeon_state *state) static int r600_state_pm4_shader(struct radeon_state *state) { - r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1)); + r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1), 0); return r600_state_pm4_generic(state); } @@ -508,8 +510,7 @@ static int r600_state_pm4_cb_flush(struct radeon_state *state) if (!state-nbo) return 0; - r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1) | - S_0085F0_CB0_DEST_BASE_ENA(1)); + r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1), 1); return 0; } @@ -520,7 +521,7 @@ static int r600_state_pm4_db_flush(struct radeon_state *state) return 0; r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) | - S_0085F0_DB_DEST_BASE_ENA(1)); + S_0085F0_DB_DEST_BASE_ENA(1), 0); return 0; } @@ -553,7 +554,7 @@ static int r600_state_pm4_resource(struct radeon_state *state) fprintf(stderr, %s need %d bo got %d\n, __func__, nbo, state-nbo); return -EINVAL; } - r600_state_pm4_with_flush(state, flags); + r600_state_pm4_with_flush(state, flags, 0); offset = regs[0].offset + soffset; if (state-radeon-family = CHIP_CEDAR) nres = 8; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: fix warning in r600 pipe driver
Module: Mesa Branch: master Commit: cc1b3b1013d1fb1f1f25ade20a68d8bdfe14f5f7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cc1b3b1013d1fb1f1f25ade20a68d8bdfe14f5f7 Author: Dave Airlie airl...@redhat.com Date: Fri Sep 10 14:07:49 2010 +1000 r600g: fix warning in r600 pipe driver --- src/gallium/drivers/r600/r600_asm.c | 25 + src/gallium/drivers/r600/r600_hw_states.c |3 +-- src/gallium/drivers/r600/r600_state.c |1 - 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 4664105..9e5406f 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -220,6 +220,7 @@ static int init_gpr(struct r600_bc_alu *alu) return 0; } +#if 0 static int reserve_gpr(struct r600_bc_alu *alu, unsigned sel, unsigned chan, unsigned cycle) { if (alu-hw_gpr[cycle][chan] 0) @@ -299,14 +300,7 @@ static int cycle_for_vector_bank_swizzle(const int swiz, const int sel, unsigned return ret; } -static int is_const(int sel) -{ - if (sel 255 sel 512) - return 1; - if (sel = V_SQ_ALU_SRC_0 sel = V_SQ_ALU_SRC_LITERAL) - return 1; - return 0; -} + static void update_chan_counter(struct r600_bc_alu *alu, int *chan_counter) { @@ -323,7 +317,6 @@ static void update_chan_counter(struct r600_bc_alu *alu, int *chan_counter) } } -#if 0 /* we need something like this I think - but this is bogus */ int check_read_slots(struct r600_bc *bc, struct r600_bc_alu *alu_first) { @@ -348,13 +341,22 @@ int check_read_slots(struct r600_bc *bc, struct r600_bc_alu *alu_first) } #endif +static int is_const(int sel) +{ + if (sel 255 sel 512) + return 1; + if (sel = V_SQ_ALU_SRC_0 sel = V_SQ_ALU_SRC_LITERAL) + return 1; + return 0; +} + static int check_scalar(struct r600_bc *bc, struct r600_bc_alu *alu) { unsigned swizzle_key; if (alu-bank_swizzle_force) { alu-bank_swizzle = alu-bank_swizzle_force; - return; + return 0; } swizzle_key = (is_const(alu-src[0].sel) ? 4 : 0 ) + (is_const(alu-src[1].sel) ? 2 : 0 ) + @@ -370,7 +372,7 @@ static int check_vector(struct r600_bc *bc, struct r600_bc_alu *alu) if (alu-bank_swizzle_force) { alu-bank_swizzle = alu-bank_swizzle_force; - return; + return 0; } swizzle_key = (is_const(alu-src[0].sel) ? 4 : 0 ) + (is_const(alu-src[1].sel) ? 2 : 0 ) + @@ -408,7 +410,6 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int { struct r600_bc_alu *nalu = r600_bc_alu(); struct r600_bc_alu *lalu; - struct r600_bc_alu *curr_bs_head; int i, r; if (nalu == NULL) diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 3d3e87d..768202a 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -1084,10 +1084,9 @@ void r600_set_constant_buffer_mem(struct pipe_context *ctx, { struct r600_screen *rscreen = r600_screen(ctx-screen); struct r600_context *rctx = r600_context(ctx); - unsigned nconstant = 0, i, type, shader_class, size; + unsigned nconstant = 0, type, shader_class, size; struct radeon_state *rstate, *rstates; struct r600_resource *rbuffer = (struct r600_resource*)buffer; - u32 *ptr; type = R600_STATE_CBUF; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 9203f44..8816592 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -108,7 +108,6 @@ static void r600_sampler_view_destroy(struct pipe_context *ctx, { struct r600_context_state *rstate = (struct r600_context_state *)state; struct r600_context *rctx = r600_context(ctx); - int i; /* need to search list of vs/ps sampler views and remove it from any - uggh */ r600_remove_sampler_view(rctx-ps_sampler, rstate); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: fixup CB state numbering header
Module: Mesa Branch: master Commit: f61b241ebabf2d8db9b96f7860afe79bec980df7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f61b241ebabf2d8db9b96f7860afe79bec980df7 Author: Dave Airlie airl...@redhat.com Date: Fri Sep 10 21:58:43 2010 +1000 r600g: fixup CB state numbering header --- src/gallium/drivers/r600/eg_hw_states.c| 12 ++-- src/gallium/drivers/r600/eg_states_inc.h | 111 ++-- src/gallium/drivers/r600/r600_states_inc.h |8 ++ 3 files changed, 36 insertions(+), 95 deletions(-) diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 97b9997..c9cf328 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -140,12 +140,12 @@ static void eg_cb(struct r600_context *rctx, struct radeon_state *rstate, S_028C70_SOURCE_FORMAT(1) | S_028C70_NUMBER_TYPE(ntype); - rstate-states[EG_CB0__CB_COLOR0_BASE] = state-cbufs[cb]-offset 8; - rstate-states[EG_CB0__CB_COLOR0_INFO] = color_info; - rstate-states[EG_CB0__CB_COLOR0_PITCH] = S_028C64_PITCH_TILE_MAX(pitch); - rstate-states[EG_CB0__CB_COLOR0_SLICE] = S_028C68_SLICE_TILE_MAX(slice); - rstate-states[EG_CB0__CB_COLOR0_VIEW] = 0x; - rstate-states[EG_CB0__CB_COLOR0_ATTRIB] = S_028C74_NON_DISP_TILING_ORDER(1); + rstate-states[EG_CB__CB_COLOR0_BASE] = state-cbufs[cb]-offset 8; + rstate-states[EG_CB__CB_COLOR0_INFO] = color_info; + rstate-states[EG_CB__CB_COLOR0_PITCH] = S_028C64_PITCH_TILE_MAX(pitch); + rstate-states[EG_CB__CB_COLOR0_SLICE] = S_028C68_SLICE_TILE_MAX(slice); + rstate-states[EG_CB__CB_COLOR0_VIEW] = 0x; + rstate-states[EG_CB__CB_COLOR0_ATTRIB] = S_028C74_NON_DISP_TILING_ORDER(1); radeon_state_pm4(rstate); } diff --git a/src/gallium/drivers/r600/eg_states_inc.h b/src/gallium/drivers/r600/eg_states_inc.h index ebfc36c..462f31c 100644 --- a/src/gallium/drivers/r600/eg_states_inc.h +++ b/src/gallium/drivers/r600/eg_states_inc.h @@ -330,7 +330,8 @@ #define EG_FS_RESOURCE__RESOURCE320_WORD4 4 #define EG_FS_RESOURCE__RESOURCE320_WORD5 5 #define EG_FS_RESOURCE__RESOURCE320_WORD6 6 -#define EG_FS_RESOURCE_SIZE7 +#define EG_FS_RESOURCE__RESOURCE320_WORD7 7 +#define EG_FS_RESOURCE_SIZE8 #define EG_FS_RESOURCE_PM4 128 /* EG_GS_RESOURCE */ @@ -341,7 +342,8 @@ #define EG_GS_RESOURCE__RESOURCE336_WORD4 4 #define EG_GS_RESOURCE__RESOURCE336_WORD5 5 #define EG_GS_RESOURCE__RESOURCE336_WORD6 6 -#define EG_GS_RESOURCE_SIZE7 +#define EG_GS_RESOURCE__RESOURCE336_WORD7 7 +#define EG_GS_RESOURCE_SIZE8 #define EG_GS_RESOURCE_PM4 128 /* EG_PS_SAMPLER */ @@ -389,93 +391,16 @@ #define EG_GS_SAMPLER_BORDER_SIZE 4 #define EG_GS_SAMPLER_BORDER_PM4 128 -/* EG_CB0 */ -#define EG_CB0__CB_COLOR0_BASE 0 -#define EG_CB0__CB_COLOR0_PITCH1 -#define EG_CB0__CB_COLOR0_SLICE2 -#define EG_CB0__CB_COLOR0_VIEW 3 -#define EG_CB0__CB_COLOR0_INFO 4 -#define EG_CB0__CB_COLOR0_ATTRIB 5 -#define EG_CB0__CB_COLOR0_DIM 6 -#define EG_CB0_SIZE7 -#define EG_CB0_PM4 128 - -/* EG_CB1 */ -#define EG_CB1__CB_COLOR1_BASE 0 -#define EG_CB1__CB_COLOR1_INFO 1 -#define EG_CB1__CB_COLOR1_SIZE 2 -#define EG_CB1__CB_COLOR1_VIEW 3 -#define EG_CB1__CB_COLOR1_FRAG 4 -#define EG_CB1__CB_COLOR1_TILE 5 -#define EG_CB1__CB_COLOR1_MASK 6 -#define EG_CB1_SIZE7 -#define EG_CB1_PM4 128 - -/* EG_CB2 */ -#define EG_CB2__CB_COLOR2_BASE 0 -#define EG_CB2__CB_COLOR2_INFO 1 -#define EG_CB2__CB_COLOR2_SIZE 2 -#define EG_CB2__CB_COLOR2_VIEW 3 -#define EG_CB2__CB_COLOR2_FRAG 4 -#define EG_CB2__CB_COLOR2_TILE 5 -#define EG_CB2__CB_COLOR2_MASK 6 -#define EG_CB2_SIZE7 -#define EG_CB2_PM4 128 - -/* EG_CB3 */ -#define EG_CB3__CB_COLOR3_BASE 0 -#define EG_CB3__CB_COLOR3_INFO 1 -#define EG_CB3__CB_COLOR3_SIZE 2 -#define EG_CB3__CB_COLOR3_VIEW 3 -#define EG_CB3__CB_COLOR3_FRAG 4 -#define EG_CB3__CB_COLOR3_TILE 5 -#define EG_CB3__CB_COLOR3_MASK 6 -#define EG_CB3_SIZE7 -#define EG_CB3_PM4 128 - -/* EG_CB4 */ -#define EG_CB4__CB_COLOR4_BASE 0 -#define EG_CB4__CB_COLOR4_INFO 1 -#define EG_CB4__CB_COLOR4_SIZE 2 -#define EG_CB4__CB_COLOR4_VIEW 3 -#define EG_CB4__CB_COLOR4_FRAG 4 -#define EG_CB4__CB_COLOR4_TILE 5 -#define EG_CB4__CB_COLOR4_MASK 6 -#define EG_CB4_SIZE7 -#define EG_CB4_PM4 128 - -/* EG_CB5 */ -#define EG_CB5__CB_COLOR5_BASE 0 -#define
Mesa (master): r600g: fixup state calculations for picking states.
Module: Mesa Branch: master Commit: fcae8ca57512f84c51b7445456aab7ec92a21254 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fcae8ca57512f84c51b7445456aab7ec92a21254 Author: Dave Airlie airl...@redhat.com Date: Fri Sep 10 22:41:00 2010 +1000 r600g: fixup state calculations for picking states. for evergreen I ended up using a non-contig array of states, but this code needs a bit of fixing up to deal with that. --- src/gallium/drivers/r600/radeon.h |1 + src/gallium/winsys/r600/drm/r600_state.c |1 + src/gallium/winsys/r600/drm/radeon.c | 15 +-- src/gallium/winsys/r600/drm/radeon_ctx.c | 19 +-- src/gallium/winsys/r600/drm/radeon_draw.c |2 +- src/gallium/winsys/r600/drm/radeon_priv.h |3 +-- src/gallium/winsys/r600/drm/radeon_state.c |4 ++-- 7 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h index cd063e4..7991821 100644 --- a/src/gallium/drivers/r600/radeon.h +++ b/src/gallium/drivers/r600/radeon.h @@ -214,6 +214,7 @@ enum r600_stype { R600_STATE_DRAW, R600_STATE_CB_FLUSH, R600_STATE_DB_FLUSH, + R600_STATE_MAX, }; #include r600_states_inc.h diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c index 4a0111b..b8ef89d 100644 --- a/src/gallium/winsys/r600/drm/r600_state.c +++ b/src/gallium/winsys/r600/drm/r600_state.c @@ -632,6 +632,7 @@ static void build_types_array(struct radeon *radeon, struct radeon_stype_info *t } } } + radeon-max_states = id; radeon-stype = types; radeon-nstype = size; } diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c index 64ccc7d..ccf6060 100644 --- a/src/gallium/winsys/r600/drm/radeon.c +++ b/src/gallium/winsys/r600/drm/radeon.c @@ -45,7 +45,7 @@ static int radeon_get_device(struct radeon *radeon) struct radeon *radeon_new(int fd, unsigned device) { struct radeon *radeon; - int r, i, id; + int r, i, id, j, k; radeon = calloc(1, sizeof(*radeon)); if (radeon == NULL) { @@ -120,19 +120,6 @@ struct radeon *radeon_new(int fd, unsigned device) __func__, radeon-device); break; } - radeon-state_type_id = calloc(radeon-nstype, sizeof(unsigned)); - if (radeon-state_type_id == NULL) { - return radeon_decref(radeon); - } - for (i = 0, id = 0; i radeon-nstype; i++) { - radeon-state_type_id[i] = id; - for (int j = 0; j radeon-nstype; j++) { - if (radeon-stype[j].stype != i) - continue; - id += radeon-stype[j].num; - } - } - radeon-nstate_per_shader = id; return radeon; } diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c index 5d9cdca..bd0916a 100644 --- a/src/gallium/winsys/r600/drm/radeon_ctx.c +++ b/src/gallium/winsys/r600/drm/radeon_ctx.c @@ -259,25 +259,24 @@ int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw) { unsigned previous_cdwords; int r = 0; + int i; - for (int i = 0; i (ctx-radeon-nstate_per_shader * R600_SHADER_MAX); i++) { + for (i = 0; i ctx-radeon-max_states; i++) { r = radeon_ctx_state_bo(ctx, draw-state[i]); if (r) return r; } previous_cdwords = ctx-cdwords; - for (int i = 0, id = 0; i ctx-radeon-nstate_per_shader; i++) { - for (int j = 0; j R600_SHADER_MAX; j++) { - id = j * ctx-radeon-nstate_per_shader + i; - if (draw-state[id]) { - r = radeon_ctx_state_schedule(ctx, draw-state[id]); - if (r) { - ctx-cdwords = previous_cdwords; - return r; - } + for (i = 0; i ctx-radeon-max_states; i++) { + if (draw-state[i]) { + r = radeon_ctx_state_schedule(ctx, draw-state[i]); + if (r) { + ctx-cdwords = previous_cdwords; + return r; } } } + return 0; } diff --git a/src/gallium/winsys/r600/drm/radeon_draw.c b/src/gallium/winsys/r600/drm/radeon_draw.c index b992c4a..a126901 100644 --- a/src/gallium/winsys/r600/drm/radeon_draw.c +++ b/src/gallium/winsys/r600/drm/radeon_draw.c @@ -34,7 +34,7 @@ int radeon_draw_init(struct radeon_draw *draw, struct radeon *radeon) { draw-radeon = radeon; - draw-state = calloc(radeon-nstate_per_shader * R600_SHADER_MAX,