Re: [Mesa-dev] [PATCH] nouveau: Use targ in nv50_ir_generate_code
ping :) Em 27-08-2015 12:59, Marcos Paulo de Souza escreveu: instead of call prog->getTarget(), since the target never change in prog. Signed-off-by: Marcos Paulo de Souza <marcos.souza@gmail.com> --- src/gallium/drivers/nouveau/codegen/nv50_ir.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp index cce6055..1dad098 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp @@ -1195,7 +1195,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info) prog->print(); targ->parseDriverInfo(info); - prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_PRE_SSA); + targ->runLegalizePass(prog, nv50_ir::CG_STAGE_PRE_SSA); prog->convertToSSA(); @@ -1203,7 +1203,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info) prog->print(); prog->optimizeSSA(info->optLevel); - prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_SSA); + targ->runLegalizePass(prog, nv50_ir::CG_STAGE_SSA); if (prog->dbgFlags & NV50_IR_DEBUG_BASIC) prog->print(); @@ -1212,7 +1212,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info) ret = -4; goto out; } - prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_POST_RA); + targ->runLegalizePass(prog, nv50_ir::CG_STAGE_POST_RA); prog->optimizePostRA(info->optLevel); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nouveau: Use targ in nv50_ir_generate_code
Em 31-08-2015 13:31, Ilia Mirkin escreveu: On Mon, Aug 31, 2015 at 12:26 PM, Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de> wrote: On 31.08.2015 18:23, Ilia Mirkin wrote: On Mon, Aug 31, 2015 at 12:21 PM, Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de> wrote: On 31.08.2015 17:19, Marcos Paulo de souza wrote: ping :) Em 27-08-2015 12:59, Marcos Paulo de Souza escreveu: instead of call prog->getTarget(), since the target never change in prog. It is not changing now, don't know if it will in the future. Using prog->getTarget() may save us from hassling with this piece of code again. Plus it is more explicit to read in my eyes. but... targ gets used *right above* each one of those instances. Kill it alltogether, meaning lets use prog->getTarget() as a default pattern. Strongly disagree, it's shorter and clearer to just use 'targ' there, instead of wondering what it is that prog->getTarget() does. To keep everybody happy, maybe we can add some methods in prog and use the target member of program. What do you think? -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] nouveau: Use targ in nv50_ir_generate_code
instead of call prog-getTarget(), since the target never change in prog. Signed-off-by: Marcos Paulo de Souza marcos.souza@gmail.com --- src/gallium/drivers/nouveau/codegen/nv50_ir.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp index cce6055..1dad098 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp @@ -1195,7 +1195,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info) prog-print(); targ-parseDriverInfo(info); - prog-getTarget()-runLegalizePass(prog, nv50_ir::CG_STAGE_PRE_SSA); + targ-runLegalizePass(prog, nv50_ir::CG_STAGE_PRE_SSA); prog-convertToSSA(); @@ -1203,7 +1203,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info) prog-print(); prog-optimizeSSA(info-optLevel); - prog-getTarget()-runLegalizePass(prog, nv50_ir::CG_STAGE_SSA); + targ-runLegalizePass(prog, nv50_ir::CG_STAGE_SSA); if (prog-dbgFlags NV50_IR_DEBUG_BASIC) prog-print(); @@ -1212,7 +1212,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info) ret = -4; goto out; } - prog-getTarget()-runLegalizePass(prog, nv50_ir::CG_STAGE_POST_RA); + targ-runLegalizePass(prog, nv50_ir::CG_STAGE_POST_RA); prog-optimizePostRA(info-optLevel); -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] tgsi: set implicit array size for tess stages
From: Marcos Paulo de Souza marcos.souza@gmail.com --- src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index a6675c5..24e2dbd 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -259,7 +259,7 @@ struct translate_ctx struct tgsi_token *tokens_end; struct tgsi_header *header; unsigned processor : 4; - int implied_array_size : 5; + unsigned implied_array_size : 6; unsigned num_immediates; }; @@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx *ctx ) if (!parse_header( ctx )) return FALSE; + if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL || + ctx-processor == TGSI_PROCESSOR_TESS_EVAL) + ctx-implied_array_size = 32 ; + while (*ctx-cur != '\0') { uint label_val = 0; if (!eat_white( ctx-cur )) { -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] nouveau: recognize tess stages in nouveau_compiler
From: Marcos Paulo de Souza marcos.souza@gmail.com --- src/gallium/drivers/nouveau/nouveau_compiler.c | 4 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c index 8660498..495450b 100644 --- a/src/gallium/drivers/nouveau/nouveau_compiler.c +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c @@ -190,6 +190,10 @@ main(int argc, char *argv[]) type = PIPE_SHADER_GEOMETRY; else if (!strncmp(text, COMP, 4)) type = PIPE_SHADER_COMPUTE; + else if (!strncmp(text, TESS_CTRL, 9)) + type = PIPE_SHADER_TESS_CTRL; + else if (!strncmp(text, TESS_EVAL, 9)) + type = PIPE_SHADER_TESS_EVAL; else { _debug_printf(Unrecognized TGSI header\n); return 1; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] tgsi: Fix index printed in tgsi_dump and dst outputs
From: Marcos Paulo de Souza marcos.souza@gmail.com Before this patch, the tgsi_dumps was printing declaration as: DCL IN[][0][0], GENERIC[0] and now it is parsed correctly: DCL IN[][0], GENERIC[0] In the same way, for tess stages, the output addr now is parsed correctly, doing like src parser from: LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2] to: LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2] --- src/gallium/auxiliary/tgsi/tgsi_text.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 24e2dbd..141a3b1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -684,7 +684,13 @@ parse_register_dcl( * input primitive. so we want to declare just * the index relevant to the semantics which is in * the second bracket */ - if (ctx-processor == TGSI_PROCESSOR_GEOMETRY *file == TGSI_FILE_INPUT) { + + /* tessellation has similar constraints to geometry shader */ + bool is_in = *file == TGSI_FILE_INPUT; + bool is_out = *file == TGSI_FILE_OUTPUT; + if ((ctx-processor == TGSI_PROCESSOR_GEOMETRY is_i) || + (ctx-processor == TGSI_PROCESSOR_TESS_EVAL is_in) || + (ctx-processor == TGSI_PROCESSOR_TESS_CTRL (is_in || is_out))) { brackets[0] = brackets[1]; *num_brackets = 1; } else { @@ -740,6 +746,14 @@ parse_dst_operand( dst-Dimension.Indirect = 0; dst-Dimension.Dimension = 0; dst-Dimension.Index = bracket[0].index; + + if (bracket[0].ind_file != TGSI_FILE_NULL) { + dst-Dimension.Indirect = 1; + dst-DimIndirect.File = bracket[0].ind_file; + dst-DimIndirect.Index = bracket[0].ind_index; + dst-DimIndirect.Swizzle = bracket[0].ind_comp; + dst-DimIndirect.ArrayID = bracket[0].ind_array; + } bracket[0] = bracket[1]; } dst-Register.Index = bracket[0].index; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] nouveau: recognize tess stages in nouveau_compiler
From: Marcos Paulo de Souza marcos.souza@gmail.com --- src/gallium/drivers/nouveau/nouveau_compiler.c | 4 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c index 8660498..495450b 100644 --- a/src/gallium/drivers/nouveau/nouveau_compiler.c +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c @@ -190,6 +190,10 @@ main(int argc, char *argv[]) type = PIPE_SHADER_GEOMETRY; else if (!strncmp(text, COMP, 4)) type = PIPE_SHADER_COMPUTE; + else if (!strncmp(text, TESS_CTRL, 9)) + type = PIPE_SHADER_TESS_CTRL; + else if (!strncmp(text, TESS_EVAL, 9)) + type = PIPE_SHADER_TESS_EVAL; else { _debug_printf(Unrecognized TGSI header\n); return 1; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] tgsi: Fix index printed in tgsi_dump and dst outputs
From: Marcos Paulo de Souza marcos.souza@gmail.com Before this patch, the tgsi_dumps was printing declaration as: DCL IN[][0][0], GENERIC[0] and now it is parsed correctly: DCL IN[][0], GENERIC[0] In the same way, for tess stages, the output addr now is parsed correctly, doing like src parser from: LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2] to: LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2] --- src/gallium/auxiliary/tgsi/tgsi_text.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 24e2dbd..075f2cb 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -684,7 +684,13 @@ parse_register_dcl( * input primitive. so we want to declare just * the index relevant to the semantics which is in * the second bracket */ - if (ctx-processor == TGSI_PROCESSOR_GEOMETRY *file == TGSI_FILE_INPUT) { + + /* tessellation has similar constraints to geometry shader */ + bool is_in = *file == TGSI_FILE_INPUT; + bool is_out = *file == TGSI_FILE_OUTPUT; + if ((ctx-processor == TGSI_PROCESSOR_GEOMETRY is_in) || + (ctx-processor == TGSI_PROCESSOR_TESS_EVAL is_in) || + (ctx-processor == TGSI_PROCESSOR_TESS_CTRL (is_in || is_out))) { brackets[0] = brackets[1]; *num_brackets = 1; } else { @@ -740,6 +746,14 @@ parse_dst_operand( dst-Dimension.Indirect = 0; dst-Dimension.Dimension = 0; dst-Dimension.Index = bracket[0].index; + + if (bracket[0].ind_file != TGSI_FILE_NULL) { + dst-Dimension.Indirect = 1; + dst-DimIndirect.File = bracket[0].ind_file; + dst-DimIndirect.Index = bracket[0].ind_index; + dst-DimIndirect.Swizzle = bracket[0].ind_comp; + dst-DimIndirect.ArrayID = bracket[0].ind_array; + } bracket[0] = bracket[1]; } dst-Register.Index = bracket[0].index; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCHv2 0/3] Add tess stages to mesa/nouveau_compiler
From: Marcos Paulo de Souza marcos.souza@gmail.com Hi guys, first of all, sorry for the flood... my last bunch of patches were sent as a mistake... but now the compiling problem was solved :) I'm happy o send my first patches to mesa, and I have to say a huge thank you to Ilia Mirkin for all the help and tips to fix this problem in tess stages. I hope you like these patches! Marcos Paulo de Souza (3): tgsi: set implicit array size for tess stages tgsi: Fix index printed in tgsi_dump and dst outputs nouveau: recognize tess stages in nouveau_compiler src/gallium/auxiliary/tgsi/tgsi_text.c | 22 -- src/gallium/drivers/nouveau/nouveau_compiler.c | 4 2 files changed, 24 insertions(+), 2 deletions(-) -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] tgsi: set implicit array size for tess stages
From: Marcos Paulo de Souza marcos.souza@gmail.com --- src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index a6675c5..24e2dbd 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -259,7 +259,7 @@ struct translate_ctx struct tgsi_token *tokens_end; struct tgsi_header *header; unsigned processor : 4; - int implied_array_size : 5; + unsigned implied_array_size : 6; unsigned num_immediates; }; @@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx *ctx ) if (!parse_header( ctx )) return FALSE; + if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL || + ctx-processor == TGSI_PROCESSOR_TESS_EVAL) + ctx-implied_array_size = 32 ; + while (*ctx-cur != '\0') { uint label_val = 0; if (!eat_white( ctx-cur )) { -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval
Hi Ilia, Em 14-08-2015 01:45, Ilia Mirkin escreveu: On Fri, Aug 14, 2015 at 12:43 AM, Marcos Souza marcos.souza@gmail.com wrote: HI Ilia 2015-08-14 1:31 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu: On Fri, Aug 14, 2015 at 12:25 AM, Marcos Souza marcos.souza@gmail.com wrote: Hi Ilia, 2015-08-14 1:02 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu: On Thu, Aug 13, 2015 at 11:55 PM, Marcos Souza marcos.souza@gmail.com wrote: Hi Ilia, So i found the point here it addrs that double brackets, and the following patch solves it, but this is a right solution? If someone could guide me here, I could fix it :) diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 8ceb5b4..046471e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -302,10 +302,14 @@ iter_declaration( TXT([]); } - if (decl-Declaration.Dimension) { The issue is that the declaration is getting a dimension set by the parser, which in turn is causing it to print funny. It shouldn't be getting a dimension in the first place for those. The following patch fix the problem, is it the right place to put it? I don't think so. Just glanced at the code, look at parse_register_dcl /* for geometry shader we don't really care about * the first brackets it's always the size of the * input primitive. so we want to declare just * the index relevant to the semantics which is in * the second bracket */ if (ctx-processor == TGSI_PROCESSOR_GEOMETRY *file == TGSI_FILE_INPUT) { brackets[0] = brackets[1]; *num_brackets = 1; } Basically you need to extend this logic to similarly exclude (a) tess ctrl inputs and outputs (b) tess eval inputs Technically you need to exclude patch/tessinner/tessouter from that, but in practice they won't have an extra set of brackets either. Sorry for flooding the list, but I'm relaly excited about it :) So, this is the change you asked. It also solved the problem: diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 8647e4e..95c1daf 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -684,7 +684,12 @@ parse_register_dcl( * input primitive. so we want to declare just * the index relevant to the semantics which is in * the second bracket */ - if (ctx-processor == TGSI_PROCESSOR_GEOMETRY *file == TGSI_FILE_INPUT) { + + /* similarly from tessalation */ tessellation OK. + int exclude = (ctx-processor == TGSI_PROCESSOR_TESS_EVAL *file == TGSI_FILE_INPUT) || + (ctx-processor == TGSI_PROCESSOR_TESS_CTRL (*file == TGSI_FILE_INPUT || + *file == TGSI_FILE_OUTPUT)); Why is this separate from the geometry thing? I just separated because it's easier to read, since we have a lot of ANDs and ORs. But, if you think it's better, I could put it all together will geometry. + if ((ctx-processor == TGSI_PROCESSOR_GEOMETRY *file == TGSI_FILE_INPUT) || exclude) { brackets[0] = brackets[1]; *num_brackets = 1; } else { What do you think Ilia? Generally sounds good. Now I'll take a look about the last problem of LRP and MOV. -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval
From: Marcos Paulo de Souza marcos.souza@gmail.com Signed-off-by: Marcos Paulo de Souza marcos.souza.org Suggested-by: Ilia Mirkin imir...@alum.mit.edu --- src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +- src/gallium/drivers/nouveau/nouveau_compiler.c | 4 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index a6675c5..8647e4e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -259,7 +259,7 @@ struct translate_ctx struct tgsi_token *tokens_end; struct tgsi_header *header; unsigned processor : 4; - int implied_array_size : 5; + int implied_array_size : 6; unsigned num_immediates; }; @@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx *ctx ) if (!parse_header( ctx )) return FALSE; + if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL || + ctx-processor == TGSI_PROCESSOR_TESS_EVAL) + ctx-implied_array_size = 32 ; + while (*ctx-cur != '\0') { uint label_val = 0; if (!eat_white( ctx-cur )) { diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c index 8660498..495450b 100644 --- a/src/gallium/drivers/nouveau/nouveau_compiler.c +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c @@ -190,6 +190,10 @@ main(int argc, char *argv[]) type = PIPE_SHADER_GEOMETRY; else if (!strncmp(text, COMP, 4)) type = PIPE_SHADER_COMPUTE; + else if (!strncmp(text, TESS_CTRL, 9)) + type = PIPE_SHADER_TESS_CTRL; + else if (!strncmp(text, TESS_EVAL, 9)) + type = PIPE_SHADER_TESS_EVAL; else { _debug_printf(Unrecognized TGSI header\n); return 1; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev