Mesa (master): i965/vec4/nir: remove emit_untyped_surface_read and emit_untyped_atomic at brw_vec4_visitor
Module: Mesa Branch: master Commit: d3a89a7c494d577fdf8f45c0d8735004a571e86b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3a89a7c494d577fdf8f45c0d8735004a571e86b Author: Alejandro PiñeiroDate: Fri Mar 4 17:32:08 2016 +0100 i965/vec4/nir: remove emit_untyped_surface_read and emit_untyped_atomic at brw_vec4_visitor surface_access emit_untyped_read and emit_untyped_atomic provides the same functionality. v2: surface parameter of emit_untyped_atomic is a const, no need to specify default predicate on emit_untyped_atomic, use retype (Francisco Jerez). Reviewed-by: Francisco Jerez --- src/mesa/drivers/dri/i965/brw_vec4.h | 7 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 36 +++-- src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 55 -- 3 files changed, 23 insertions(+), 75 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index 91771b8..d43a5a8 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -276,13 +276,6 @@ public: void emit_shader_time_end(); void emit_shader_time_write(int shader_time_subindex, src_reg value); - void emit_untyped_atomic(unsigned atomic_op, unsigned surf_index, -dst_reg dst, src_reg offset, src_reg src0, -src_reg src1); - - void emit_untyped_surface_read(unsigned surf_index, dst_reg dst, - src_reg offset); - src_reg get_scratch_offset(bblock_t *block, vec4_instruction *inst, src_reg *reladdr, int reg_offset); src_reg get_pull_constant_offset(bblock_t *block, vec4_instruction *inst, diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 9b721e5..0e716cf 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -724,24 +724,34 @@ vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr) (unsigned) instr->const_index[0]; src_reg offset = get_nir_src(instr->src[0], nir_type_int, instr->num_components); + const src_reg surface = brw_imm_ud(surf_index); + const vec4_builder bld = + vec4_builder(this).at_end().annotate(current_annotation, base_ir); + src_reg tmp; + dest = get_nir_dest(instr->dest); switch (instr->intrinsic) { - case nir_intrinsic_atomic_counter_inc: -emit_untyped_atomic(BRW_AOP_INC, surf_index, dest, offset, -src_reg(), src_reg()); -break; - case nir_intrinsic_atomic_counter_dec: -emit_untyped_atomic(BRW_AOP_PREDEC, surf_index, dest, offset, -src_reg(), src_reg()); -break; - case nir_intrinsic_atomic_counter_read: -emit_untyped_surface_read(surf_index, dest, offset); -break; - default: -unreachable("Unreachable"); + case nir_intrinsic_atomic_counter_inc: + tmp = emit_untyped_atomic(bld, surface, offset, + src_reg(), src_reg(), + 1, 1, + BRW_AOP_INC); + break; + case nir_intrinsic_atomic_counter_dec: + tmp = emit_untyped_atomic(bld, surface, offset, + src_reg(), src_reg(), + 1, 1, + BRW_AOP_PREDEC); + break; + case nir_intrinsic_atomic_counter_read: + tmp = emit_untyped_read(bld, surface, offset, 1, 1); + break; + default: + unreachable("Unreachable"); } + bld.MOV(retype(dest, tmp.type), tmp); brw_mark_surface_used(stage_prog_data, surf_index); break; } diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index cfd4d9b..d30330a 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -1115,61 +1115,6 @@ vec4_visitor::gs_end_primitive() } void -vec4_visitor::emit_untyped_atomic(unsigned atomic_op, unsigned surf_index, - dst_reg dst, src_reg surf_offset, - src_reg src0, src_reg src1) -{ - unsigned mlen = 1 + (src0.file != BAD_FILE) + (src1.file != BAD_FILE); - src_reg src_payload(this, glsl_type::uint_type, mlen); - dst_reg payload(src_payload); - payload.writemask = WRITEMASK_X; - - /* Set the atomic operation offset. */ - emit(MOV(offset(payload, 0), surf_offset)); - unsigned i = 1; - - /* Set the atomic operation arguments. */ - if (src0.file != BAD_FILE) { - emit(MOV(offset(payload, i), src0)); - i++; - } - - if
Mesa (master): i965/vec4/nir: no need to use surface_access:: to call emit_untyped_atomic
Module: Mesa Branch: master Commit: 0548844e866e4fe326432116f84fdf7e885fba9f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0548844e866e4fe326432116f84fdf7e885fba9f Author: Alejandro PiñeiroDate: Fri Mar 4 18:20:09 2016 +0100 i965/vec4/nir: no need to use surface_access:: to call emit_untyped_atomic Now that brw_vec4_visitor::emit_untyped_atomic was removed, there is no need to explicitly set it. Reviewed-by: Francisco Jerez --- src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 0e716cf..52977f1 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -878,12 +878,11 @@ vec4_visitor::nir_emit_ssbo_atomic(int op, nir_intrinsic_instr *instr) const vec4_builder bld = vec4_builder(this).at_end().annotate(current_annotation, base_ir); - src_reg atomic_result = - surface_access::emit_untyped_atomic(bld, surface, offset, - data1, data2, - 1 /* dims */, 1 /* rsize */, - op, - BRW_PREDICATE_NONE); + src_reg atomic_result = emit_untyped_atomic(bld, surface, offset, + data1, data2, + 1 /* dims */, 1 /* rsize */, + op, + BRW_PREDICATE_NONE); dest.type = atomic_result.type; bld.MOV(dest, atomic_result); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/vec4: pass the correct src_sz to emit_send at emit_untyped_atomic
Module: Mesa Branch: master Commit: 0c5c2e2c936a933d4e78acb36d1f5e56d020043c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c5c2e2c936a933d4e78acb36d1f5e56d020043c Author: Alejandro PiñeiroDate: Fri Mar 4 19:20:27 2016 +0100 i965/vec4: pass the correct src_sz to emit_send at emit_untyped_atomic If the src is invalid, so src size is zero, the src_sz passed to emit send should be zero too, instead of a default 1 if we are in a simd4x2 case. This can happens if using emit_untyped_atomic for an atomic dec/inc. v2: use the proper src_sz when calling emit_send, instead of just avoid loading src at emit_send if BAD_FILE (Francisco Jerez) Reviewed-by: Francisco Jerez --- src/mesa/drivers/dri/i965/brw_vec4_surface_builder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_surface_builder.cpp b/src/mesa/drivers/dri/i965/brw_vec4_surface_builder.cpp index 28002c5..1db349a 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_surface_builder.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_surface_builder.cpp @@ -221,7 +221,7 @@ namespace brw { emit_insert(bld, addr, dims, has_simd4x2), has_simd4x2 ? 1 : dims, emit_insert(bld, src_reg(srcs), size, has_simd4x2), - has_simd4x2 ? 1 : size, + has_simd4x2 && size ? 1 : size, surface, op, rsize, pred); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glcpp: Clean up most empty mid-rule actions left by previous commit.
Module: Mesa Branch: master Commit: e816c8b54a3b2a4e430e0c52eb4068480561b45e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e816c8b54a3b2a4e430e0c52eb4068480561b45e Author: Kenneth GraunkeDate: Fri Mar 4 18:47:39 2016 -0800 glcpp: Clean up most empty mid-rule actions left by previous commit. I didn't want to pollute the previous patch with all the $4 -> $3 changes. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/compiler/glsl/glcpp/glcpp-parse.y | 36 +-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y index a93a138..1f416a1 100644 --- a/src/compiler/glsl/glcpp/glcpp-parse.y +++ b/src/compiler/glsl/glcpp/glcpp-parse.y @@ -266,13 +266,13 @@ control_line: ralloc_asprintf_rewrite_tail (>output, >output_length, "\n"); } | control_line_error -| HASH_TOKEN LINE { } pp_tokens NEWLINE { +| HASH_TOKEN LINE pp_tokens NEWLINE { if (parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) { _glcpp_parser_expand_and_lex_from (parser, - LINE_EXPANDED, $4, + LINE_EXPANDED, $3, EXPANSION_MODE_IGNORE_DEFINED); } } @@ -280,23 +280,23 @@ control_line: control_line_success: HASH_TOKEN DEFINE_TOKEN { } define -| HASH_TOKEN UNDEF { } IDENTIFIER NEWLINE { +| HASH_TOKEN UNDEF IDENTIFIER NEWLINE { macro_t *macro; - if (strcmp("__LINE__", $4) == 0 - || strcmp("__FILE__", $4) == 0 - || strcmp("__VERSION__", $4) == 0 - || strncmp("GL_", $4, 3) == 0) + if (strcmp("__LINE__", $3) == 0 + || strcmp("__FILE__", $3) == 0 + || strcmp("__VERSION__", $3) == 0 + || strncmp("GL_", $3, 3) == 0) glcpp_error(& @1, parser, "Built-in (pre-defined)" " macro names cannot be undefined."); - macro = hash_table_find (parser->defines, $4); + macro = hash_table_find (parser->defines, $3); if (macro) { - hash_table_remove (parser->defines, $4); + hash_table_remove (parser->defines, $3); ralloc_free (macro); } - ralloc_free ($4); + ralloc_free ($3); } -| HASH_TOKEN IF { } pp_tokens NEWLINE { +| HASH_TOKEN IF pp_tokens NEWLINE { /* Be careful to only evaluate the 'if' expression if * we are not skipping. When we are skipping, we * simply push a new 0-valued 'if' onto the skip @@ -308,7 +308,7 @@ control_line_success: parser->skip_stack->type == SKIP_NO_SKIP) { _glcpp_parser_expand_and_lex_from (parser, - IF_EXPANDED, $4, + IF_EXPANDED, $3, EXPANSION_MODE_EVALUATE_DEFINED); } else @@ -327,14 +327,14 @@ control_line_success: } _glcpp_parser_skip_stack_push_if (parser, & @1, 0); } -| HASH_TOKEN IFDEF { } IDENTIFIER junk NEWLINE { - macro_t *macro = hash_table_find (parser->defines, $4); - ralloc_free ($4); +| HASH_TOKEN IFDEF IDENTIFIER junk NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $3); + ralloc_free ($3); _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); } -| HASH_TOKEN IFNDEF { } IDENTIFIER junk NEWLINE { - macro_t *macro = hash_table_find (parser->defines, $4); - ralloc_free ($4); +| HASH_TOKEN IFNDEF IDENTIFIER junk NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $3); + ralloc_free ($3); _glcpp_parser_skip_stack_push_if (parser, & @3, macro == NULL); } | HASH_TOKEN ELIF pp_tokens NEWLINE { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glcpp: Remove empty mid-rule action which changes test behavior.
Module: Mesa Branch: master Commit: ea9fa5ff056846029435d2969e1de8da33a5b50d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea9fa5ff056846029435d2969e1de8da33a5b50d Author: Kenneth GraunkeDate: Fri Mar 4 18:52:47 2016 -0800 glcpp: Remove empty mid-rule action which changes test behavior. Apparently this causes a slight difference in the parser's token expectations, leading to a different error message. It seems harmless, but I wanted to be cautious and separate it out. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/compiler/glsl/glcpp/glcpp-parse.y | 2 +- src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y index 1f416a1..e677811 100644 --- a/src/compiler/glsl/glcpp/glcpp-parse.y +++ b/src/compiler/glsl/glcpp/glcpp-parse.y @@ -279,7 +279,7 @@ control_line: ; control_line_success: - HASH_TOKEN DEFINE_TOKEN { } define + HASH_TOKEN DEFINE_TOKEN define | HASH_TOKEN UNDEF IDENTIFIER NEWLINE { macro_t *macro; if (strcmp("__LINE__", $3) == 0 diff --git a/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected b/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected index fd0b413..5206a5c 100644 --- a/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected +++ b/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected @@ -1,2 +1,2 @@ 0:1(9): preprocessor error: #define followed by a non-identifier: 123 -0:1(9): preprocessor error: syntax error, unexpected INTEGER_STRING, expecting FUNC_IDENTIFIER or OBJ_IDENTIFIER +0:1(9): preprocessor error: syntax error, unexpected INTEGER_STRING, expecting FUNC_IDENTIFIER or OBJ_IDENTIFIER or NEWLINE ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glcpp: Implicitly resolve version after the first non-space /hash token.
Module: Mesa Branch: master Commit: 07ec67d85ca652b76fb91abd68b6ad98e56a49df URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=07ec67d85ca652b76fb91abd68b6ad98e56a49df Author: Kenneth GraunkeDate: Fri Mar 4 18:26:00 2016 -0800 glcpp: Implicitly resolve version after the first non-space/hash token. We resolved the implicit version directive when processing control lines, such as #ifdef, to ensure any built-in macros exist. However, we failed to resolve it when handling ordinary text. For example, int x = __VERSION__; should resolve __VERSION__ to 110, but since we never resolved the implicit version, none of the built-in macros exist, so it was left as is. This also meant we allowed the following shader to slop through: 123 #version 120 Nothing would cause the implicit version to take effect, so when we saw the #version directive, we thought everything was peachy. This patch makes the lexer's per-token action resolve the implicit version on the first non-space/newline/hash token that isn't part of a #version directive, fulfilling the GLSL language spec: "The #version directive must occur in a shader before anything else, except for comments and white space." Because we emit #version as HASH_TOKEN then VERSION_TOKEN, we have to allow HASH_TOKEN to slop through as well, so we don't resolve the implicit version as soon as we see the # character. However, this is fine, because the parser's HASH_TOKEN NEWLINE rule does resolve the version, disallowing cases like: # #version 120 This patch also adds the above shaders as new glcpp tests. Fixes dEQP-GLES2.functional.shaders.preprocessor.predefined_macros. {gl_es_1_vertex,gl_es_1_fragment}. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/compiler/glsl/glcpp/glcpp-lex.l | 8 src/compiler/glsl/glcpp/glcpp.h | 1 + src/compiler/glsl/glcpp/tests/144-implicit-version.c| 1 + src/compiler/glsl/glcpp/tests/144-implicit-version.c.expected | 1 + src/compiler/glsl/glcpp/tests/145-version-first.c | 2 ++ src/compiler/glsl/glcpp/tests/145-version-first.c.expected | 3 +++ src/compiler/glsl/glcpp/tests/146-version-first-hash.c | 2 ++ src/compiler/glsl/glcpp/tests/146-version-first-hash.c.expected | 3 +++ 8 files changed, 21 insertions(+) diff --git a/src/compiler/glsl/glcpp/glcpp-lex.l b/src/compiler/glsl/glcpp/glcpp-lex.l index fa9aa50..071918e 100644 --- a/src/compiler/glsl/glcpp/glcpp-lex.l +++ b/src/compiler/glsl/glcpp/glcpp-lex.l @@ -120,6 +120,11 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); static int glcpp_lex_update_state_per_token (glcpp_parser_t *parser, int token) { + if (token != NEWLINE && token != SPACE && token != HASH_TOKEN && + !parser->lexing_version_directive) { + glcpp_parser_resolve_implicit_version(parser); + } + /* After the first non-space token in a line, we won't * allow any '#' to introduce a directive. */ if (token == NEWLINE) { @@ -285,6 +290,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? version{HSPACE}+ { BEGIN INITIAL; yyextra->space_tokens = 0; + yyextra->lexing_version_directive = 1; RETURN_STRING_TOKEN (VERSION_TOKEN); } @@ -536,6 +542,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } yyextra->space_tokens = 1; yyextra->lexing_directive = 0; + yyextra->lexing_version_directive = 0; yylineno++; yycolumn = 0; RETURN_TOKEN_NEVER_SKIP (NEWLINE); @@ -546,6 +553,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? glcpp_error(yylloc, yyextra, "Unterminated comment"); BEGIN DONE; /* Don't keep matching this rule forever. */ yyextra->lexing_directive = 0; + yyextra->lexing_version_directive = 0; if (! parser->last_token_was_newline) RETURN_TOKEN (NEWLINE); } diff --git a/src/compiler/glsl/glcpp/glcpp.h b/src/compiler/glsl/glcpp/glcpp.h index 70aa14b..d87e6b7 100644 --- a/src/compiler/glsl/glcpp/glcpp.h +++ b/src/compiler/glsl/glcpp/glcpp.h @@ -176,6 +176,7 @@ struct glcpp_parser { struct hash_table *defines; active_list_t *active; int lexing_directive; + int lexing_version_directive; int space_tokens; int last_token_was_newline; int last_token_was_space; diff --git a/src/compiler/glsl/glcpp/tests/144-implicit-version.c b/src/compiler/glsl/glcpp/tests/144-implicit-version.c new file mode 100644 index 000..7bf72fc --- /dev/null +++ b/src/compiler/glsl/glcpp/tests/144-implicit-version.c @@ -0,0 +1 @@ +int x = __VERSION__; diff --git a/src/compiler/glsl/glcpp/tests/144-implicit-version.c.expected b/src/compiler/glsl/glcpp/tests/144-implicit-version.c.expected new file mode 100644 index
Mesa (master): glcpp: Delete unnecessary implicit version resolves.
Module: Mesa Branch: master Commit: 639bbe3cb46c271aea57a9f849efe0d0f6d16e2a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=639bbe3cb46c271aea57a9f849efe0d0f6d16e2a Author: Kenneth GraunkeDate: Fri Mar 4 18:45:35 2016 -0800 glcpp: Delete unnecessary implicit version resolves. We now have a bigger hammer. The HASH_TOKEN NEWLINE rule still needs to exist to ensure the 146-version-hash-first.c test still passes. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/compiler/glsl/glcpp/glcpp-parse.y | 24 ++-- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y index 5c38f86..a93a138 100644 --- a/src/compiler/glsl/glcpp/glcpp-parse.y +++ b/src/compiler/glsl/glcpp/glcpp-parse.y @@ -266,9 +266,7 @@ control_line: ralloc_asprintf_rewrite_tail (>output, >output_length, "\n"); } | control_line_error -| HASH_TOKEN LINE { - glcpp_parser_resolve_implicit_version(parser); - } pp_tokens NEWLINE { +| HASH_TOKEN LINE { } pp_tokens NEWLINE { if (parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) @@ -281,12 +279,8 @@ control_line: ; control_line_success: - HASH_TOKEN DEFINE_TOKEN { - glcpp_parser_resolve_implicit_version(parser); - } define -| HASH_TOKEN UNDEF { - glcpp_parser_resolve_implicit_version(parser); - } IDENTIFIER NEWLINE { + HASH_TOKEN DEFINE_TOKEN { } define +| HASH_TOKEN UNDEF { } IDENTIFIER NEWLINE { macro_t *macro; if (strcmp("__LINE__", $4) == 0 || strcmp("__FILE__", $4) == 0 @@ -302,9 +296,7 @@ control_line_success: } ralloc_free ($4); } -| HASH_TOKEN IF { - glcpp_parser_resolve_implicit_version(parser); - } pp_tokens NEWLINE { +| HASH_TOKEN IF { } pp_tokens NEWLINE { /* Be careful to only evaluate the 'if' expression if * we are not skipping. When we are skipping, we * simply push a new 0-valued 'if' onto the skip @@ -335,16 +327,12 @@ control_line_success: } _glcpp_parser_skip_stack_push_if (parser, & @1, 0); } -| HASH_TOKEN IFDEF { - glcpp_parser_resolve_implicit_version(parser); - } IDENTIFIER junk NEWLINE { +| HASH_TOKEN IFDEF { } IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $4); ralloc_free ($4); _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); } -| HASH_TOKEN IFNDEF { - glcpp_parser_resolve_implicit_version(parser); - } IDENTIFIER junk NEWLINE { +| HASH_TOKEN IFNDEF { } IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $4); ralloc_free ($4); _glcpp_parser_skip_stack_push_if (parser, & @3, macro == NULL); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (vulkan): anv/bo_pool: Allow freeing BOs where the anv_bo is in the BO itself
Module: Mesa Branch: vulkan Commit: 8c2b9d152941f49d956bb2775a48158d1d10253b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c2b9d152941f49d956bb2775a48158d1d10253b Author: Jason EkstrandDate: Mon Mar 7 14:56:58 2016 -0800 anv/bo_pool: Allow freeing BOs where the anv_bo is in the BO itself --- src/intel/vulkan/anv_allocator.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 3b62bda..d7c0910 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -853,11 +853,13 @@ anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo) } void -anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo) +anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo_in) { - struct bo_pool_bo_link *link = bo->map; - link->bo = *bo; + /* Make a copy in case the anv_bo happens to be storred in the BO */ + struct anv_bo bo = *bo_in; + struct bo_pool_bo_link *link = bo.map; + link->bo = bo; - VG(VALGRIND_MEMPOOL_FREE(pool, bo->map)); + VG(VALGRIND_MEMPOOL_FREE(pool, bo.map)); anv_ptr_free_list_push(>free_list, link); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (vulkan): anv: Store CPU-side fence information in the BO
Module: Mesa Branch: vulkan Commit: 2308891edea4d8508d3e95f29c58b4089e96b5e7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2308891edea4d8508d3e95f29c58b4089e96b5e7 Author: Jason EkstrandDate: Mon Mar 7 13:45:25 2016 -0800 anv: Store CPU-side fence information in the BO This reduces the number of allocations a bit and cuts back on memory usage. Kind-of a micro-optimization but it also makes the error handling a bit simpler so it seems like a win. --- src/intel/vulkan/anv_device.c | 33 +++-- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 44eb0ed..768e2eb 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1383,29 +1383,31 @@ VkResult anv_CreateFence( VkFence*pFence) { ANV_FROM_HANDLE(anv_device, device, _device); + struct anv_bo fence_bo; struct anv_fence *fence; struct anv_batch batch; VkResult result; assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO); - fence = anv_alloc2(>alloc, pAllocator, sizeof(*fence), 8, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (fence == NULL) - return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - - result = anv_bo_pool_alloc(>batch_bo_pool, >bo); + result = anv_bo_pool_alloc(>batch_bo_pool, _bo); if (result != VK_SUCCESS) - goto fail; + return result; + + /* Fences are small. Just store the CPU data structure in the BO. */ + fence = fence_bo.map; + fence->bo = fence_bo; - batch.next = batch.start = fence->bo.map; + /* Place the batch after the CPU data but on its own cache line. */ + const uint32_t batch_offset = align_u32(sizeof(*fence), CACHELINE_SIZE); + batch.next = batch.start = fence->bo.map + batch_offset; batch.end = fence->bo.map + fence->bo.size; anv_batch_emit(, GEN7_MI_BATCH_BUFFER_END); anv_batch_emit(, GEN7_MI_NOOP); if (!device->info.has_llc) { - assert(((uintptr_t) fence->bo.map & CACHELINE_MASK) == 0); - assert(batch.next - fence->bo.map <= CACHELINE_SIZE); + assert(((uintptr_t) batch.start & CACHELINE_MASK) == 0); + assert(batch.next - batch.start <= CACHELINE_SIZE); __builtin_ia32_mfence(); __builtin_ia32_clflush(fence->bo.map); } @@ -1421,8 +1423,8 @@ VkResult anv_CreateFence( fence->execbuf.buffers_ptr = (uintptr_t) fence->exec2_objects; fence->execbuf.buffer_count = 1; - fence->execbuf.batch_start_offset = 0; - fence->execbuf.batch_len = batch.next - fence->bo.map; + fence->execbuf.batch_start_offset = batch.start - fence->bo.map; + fence->execbuf.batch_len = batch.next - batch.start; fence->execbuf.cliprects_ptr = 0; fence->execbuf.num_cliprects = 0; fence->execbuf.DR1 = 0; @@ -1438,11 +1440,6 @@ VkResult anv_CreateFence( *pFence = anv_fence_to_handle(fence); return VK_SUCCESS; - - fail: - anv_free2(>alloc, pAllocator, fence); - - return result; } void anv_DestroyFence( @@ -1453,8 +1450,8 @@ void anv_DestroyFence( ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_fence, fence, _fence); + assert(fence->bo.map == fence); anv_bo_pool_free(>batch_bo_pool, >bo); - anv_free2(>alloc, pAllocator, fence); } VkResult anv_ResetFences( ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (vulkan): anv/allocator: Move the alignment assert for the pointer free list
Module: Mesa Branch: vulkan Commit: 3d4f2b0927acaac05e87ed07ae492e39b4c82ff7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d4f2b0927acaac05e87ed07ae492e39b4c82ff7 Author: Jason EkstrandDate: Mon Mar 7 21:22:46 2016 -0800 anv/allocator: Move the alignment assert for the pointer free list Previously we asserted every time you tried to pack a pointer and a counter together. However, this wasn't really correct. In the case where you try to grab the last element of the list, the "next elemnet" value you get may be bogus if someonoe else got there first. This was leading to assertion failures even though the allocator would safely fall through to the failure case below. --- src/intel/vulkan/anv_allocator.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index d7c0910..385c63f 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -200,7 +200,6 @@ anv_free_list_push(union anv_free_list *list, void *map, int32_t offset) #define PFL_COUNT(x) ((uintptr_t)(x) & 0xfff) #define PFL_PTR(x) ((void *)((uintptr_t)(x) & ~0xfff)) #define PFL_PACK(ptr, count) ({ \ - assert(((uintptr_t)(ptr) & 0xfff) == 0); \ (void *)((uintptr_t)(ptr) | (uintptr_t)((count) & 0xfff)); \ }) @@ -230,6 +229,12 @@ anv_ptr_free_list_push(void **list, void *elem) void *old, *current; void **next_ptr = elem; + /* The pointer-based free list requires that the pointer be +* page-aligned. This is because we use the bottom 12 bits of the +* pointer to store a counter to solve the ABA concurrency problem. +*/ + assert(((uintptr_t)elem & 0xfff) == 0); + old = *list; do { current = old; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (vulkan): anv/allocator: Better casting in PFL macros
Module: Mesa Branch: vulkan Commit: f61d40adc2a09221453b7a87880e134a5424773e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f61d40adc2a09221453b7a87880e134a5424773e Author: Jason EkstrandDate: Mon Mar 7 21:27:55 2016 -0800 anv/allocator: Better casting in PFL macros We cast he constant 0xfff values to a uintptr_t before applying a bitwise negate to ensure that they are actually 64-bit when needed. Also, the count variable doesn't need to be explicitly cast, it will get upcast as needed by the "|" operation. --- src/intel/vulkan/anv_allocator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 385c63f..4fc8338 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -198,9 +198,9 @@ anv_free_list_push(union anv_free_list *list, void *map, int32_t offset) * means that the bottom 12 bits should all be zero. */ #define PFL_COUNT(x) ((uintptr_t)(x) & 0xfff) -#define PFL_PTR(x) ((void *)((uintptr_t)(x) & ~0xfff)) +#define PFL_PTR(x) ((void *)((uintptr_t)(x) & ~(uintptr_t)0xfff)) #define PFL_PACK(ptr, count) ({ \ - (void *)((uintptr_t)(ptr) | (uintptr_t)((count) & 0xfff)); \ + (void *)(((uintptr_t)(ptr) & ~(uintptr_t)0xfff) | ((count) & 0xfff)); \ }) static bool ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (vulkan): anv/device: Up device limits for 3D and array texture dimensions
Module: Mesa Branch: vulkan Commit: 181b142fbd176f24a73cabf209000a9187f275e8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=181b142fbd176f24a73cabf209000a9187f275e8 Author: Nanley CheryDate: Sat Mar 5 15:17:00 2016 -0800 anv/device: Up device limits for 3D and array texture dimensions The limit for these textures is 2048 not 1024. Signed-off-by: Nanley Chery Reviewed-by: Anuj Phogat --- src/intel/vulkan/anv_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 816f780..44eb0ed 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -421,9 +421,9 @@ void anv_GetPhysicalDeviceProperties( VkPhysicalDeviceLimits limits = { .maxImageDimension1D = (1 << 14), .maxImageDimension2D = (1 << 14), - .maxImageDimension3D = (1 << 10), + .maxImageDimension3D = (1 << 11), .maxImageDimensionCube= (1 << 14), - .maxImageArrayLayers = (1 << 10), + .maxImageArrayLayers = (1 << 11), .maxTexelBufferElements = 128 * 1024 * 1024, .maxUniformBufferRange= UINT32_MAX, .maxStorageBufferRange= UINT32_MAX, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/swr: fix issues preventing a 32-bit build
Module: Mesa Branch: master Commit: 90f9df3210b5b66585007ec4836bfca498fd45f0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=90f9df3210b5b66585007ec4836bfca498fd45f0 Author: Tim RowleyDate: Fri Mar 4 13:28:33 2016 -0600 gallium/swr: fix issues preventing a 32-bit build Not a currently tested configuration, but these couple of small changes allow a 32-bit build. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94383 Acked-by: Emil Velikov Acked-by: Brian Paul --- src/gallium/drivers/swr/rasterizer/common/os.h | 1 - src/gallium/drivers/swr/rasterizer/core/utils.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/common/os.h b/src/gallium/drivers/swr/rasterizer/common/os.h index 736d298..522ae0d 100644 --- a/src/gallium/drivers/swr/rasterizer/common/os.h +++ b/src/gallium/drivers/swr/rasterizer/common/os.h @@ -81,7 +81,6 @@ typedef CARD8 BOOL; typedef wchar_tWCHAR; typedef uint16_t UINT16; typedef intINT; -typedef int INT32; typedef unsigned int UINT; typedef uint32_t UINT32; typedef uint64_t UINT64; diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.h b/src/gallium/drivers/swr/rasterizer/core/utils.h index 8a59ef2..b9dc48c 100644 --- a/src/gallium/drivers/swr/rasterizer/core/utils.h +++ b/src/gallium/drivers/swr/rasterizer/core/utils.h @@ -676,7 +676,7 @@ struct UnrollerL { INLINE uint32_t ComputeCRC(uint32_t crc, const void *pData, uint32_t size) { -#if defined(_WIN64) || defined(__linux__) || defined(__gnu_linux__) +#if defined(_WIN64) || defined(__x86_64__) uint32_t sizeInQwords = size / sizeof(uint64_t); uint32_t sizeRemainderBytes = size % sizeof(uint64_t); uint64_t* pDataWords = (uint64_t*)pData; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/swr: remove use of UINT64 from swr_fence
Module: Mesa Branch: master Commit: 035d39b539473e81b5a4f637a5d644bd2031279d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=035d39b539473e81b5a4f637a5d644bd2031279d Author: Tim RowleyDate: Mon Mar 7 14:59:34 2016 -0600 gallium/swr: remove use of UINT64 from swr_fence Remove use of a win32-style type leaked from the swr rasterizer. Reviewed-by: Kenneth Graunke --- src/gallium/drivers/swr/swr_fence.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/swr/swr_fence.cpp b/src/gallium/drivers/swr/swr_fence.cpp index f97ea22..e80faee 100644 --- a/src/gallium/drivers/swr/swr_fence.cpp +++ b/src/gallium/drivers/swr/swr_fence.cpp @@ -37,7 +37,7 @@ * to SwrSync call. */ static void -swr_sync_cb(UINT64 userData, UINT64 userData2, UINT64 userData3) +swr_sync_cb(uint64_t userData, uint64_t userData2, uint64_t userData3) { struct swr_fence *fence = (struct swr_fence *)userData; @@ -53,7 +53,7 @@ swr_fence_submit(struct swr_context *ctx, struct pipe_fence_handle *fh) struct swr_fence *fence = swr_fence(fh); fence->write++; - SwrSync(ctx->swrContext, swr_sync_cb, (UINT64)fence, 0, 0); + SwrSync(ctx->swrContext, swr_sync_cb, (uint64_t)fence, 0, 0); } /* ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (vulkan): anv/device: Actually free the CPU-side fence struct again
Module: Mesa Branch: vulkan Commit: 428ffc9c13c24c30c317c2e985b9097956c583b0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=428ffc9c13c24c30c317c2e985b9097956c583b0 Author: Jason EkstrandDate: Mon Mar 7 14:48:35 2016 -0800 anv/device: Actually free the CPU-side fence struct again In 23de78768, when we switched from allocating individual BOs to using the pool for fences, we accidentally deleted the free. --- src/intel/vulkan/anv_device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 8aa1e61..816f780 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1454,6 +1454,7 @@ void anv_DestroyFence( ANV_FROM_HANDLE(anv_fence, fence, _fence); anv_bo_pool_free(>batch_bo_pool, >bo); + anv_free2(>alloc, pAllocator, fence); } VkResult anv_ResetFences( ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Make GenerateMipmap check the target before finding an object.
Module: Mesa Branch: master Commit: 2f8a43586eef549105ad2f41ca9173c17b7e3440 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f8a43586eef549105ad2f41ca9173c17b7e3440 Author: Kenneth GraunkeDate: Thu Mar 3 01:03:59 2016 -0800 mesa: Make GenerateMipmap check the target before finding an object. If glGenerateMipmap was called with a bogus target, then it would pass that to _mesa_get_current_tex_object(), which would raise a _mesa_problem() telling people to file bugs. We'd then do the proper error checking, raise an error, and bail. Doing the check first avoids the _mesa_problem(). The DSA variant doesn't take a target parameter, so we leave the target validation exactly as it was in that case. Fixes one dEQP GLES2 test: dEQP-GLES2.functional.negative_api.texture.generatemipmap.invalid_target. v2: Rebase on Antia's recent patch to this area. Signed-off-by: Kenneth Graunke Reviewed-by: Brian Paul [v1] Reviewed-by: Matt Turner --- src/mesa/main/genmipmap.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c index f9ef2d1..2a6 100644 --- a/src/mesa/main/genmipmap.c +++ b/src/mesa/main/genmipmap.c @@ -99,12 +99,6 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx, FLUSH_VERTICES(ctx, 0); - if (!_mesa_is_valid_generate_texture_mipmap_target(ctx, target)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGenerate%sMipmap(target=%s)", - suffix, _mesa_enum_to_string(target)); - return; - } - if (texObj->BaseLevel >= texObj->MaxLevel) { /* nothing to do */ return; @@ -159,6 +153,12 @@ _mesa_GenerateMipmap(GLenum target) struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); + if (!_mesa_is_valid_generate_texture_mipmap_target(ctx, target)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmap(target=%s)", + _mesa_enum_to_string(target)); + return; + } + texObj = _mesa_get_current_tex_object(ctx, target); if (!texObj) return; @@ -179,5 +179,11 @@ _mesa_GenerateTextureMipmap(GLuint texture) if (!texObj) return; + if (!_mesa_is_valid_generate_texture_mipmap_target(ctx, texObj->Target)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateTextureMipmap(target=%s)", + _mesa_enum_to_string(texObj->Target)); + return; + } + _mesa_generate_texture_mipmap(ctx, texObj, texObj->Target, true); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Change GLboolean to bool in GenerateMipmap target checker.
Module: Mesa Branch: master Commit: 1107e48b9af97fc51da551c6d1b3c628b0a42118 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1107e48b9af97fc51da551c6d1b3c628b0a42118 Author: Kenneth GraunkeDate: Thu Mar 3 21:38:32 2016 -0800 mesa: Change GLboolean to bool in GenerateMipmap target checker. This is not API facing, so just use bool. Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner --- src/mesa/main/genmipmap.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c index 2a6..6eacd42 100644 --- a/src/mesa/main/genmipmap.c +++ b/src/mesa/main/genmipmap.c @@ -42,14 +42,14 @@ bool _mesa_is_valid_generate_texture_mipmap_target(struct gl_context *ctx, GLenum target) { - GLboolean error; + bool error; switch (target) { case GL_TEXTURE_1D: error = _mesa_is_gles(ctx); break; case GL_TEXTURE_2D: - error = GL_FALSE; + error = false; break; case GL_TEXTURE_3D: error = ctx->API == API_OPENGLES; @@ -69,10 +69,10 @@ _mesa_is_valid_generate_texture_mipmap_target(struct gl_context *ctx, !ctx->Extensions.ARB_texture_cube_map_array; break; default: - error = GL_TRUE; + error = true; } - return (error != GL_TRUE); + return !error; } bool ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Add single declaration variables to the symbol table too.
Module: Mesa Branch: master Commit: c4960068d5d1b4f882734b0e686092a94c80c9bf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4960068d5d1b4f882734b0e686092a94c80c9bf Author: Kenneth GraunkeDate: Fri Mar 4 20:32:26 2016 -0800 glsl: Add single declaration variables to the symbol table too. The lexer/parser use a symbol table to classify identifiers as variables, functions, or structure types. For some reason, we neglected to add variables in simple declarations such as int x = 5; but did add subsequent variables in multi-declarations: int x = 5, y = 6; // y gets added, but not x, for some reason Fixes four dEQP-GLES2.functional.shaders.scoping.valid subcases: - local_int_variable_hides_struct_type_vertex - local_int_variable_hides_struct_type_fragment - local_struct_variable_hides_struct_type_vertex - local_struct_variable_hides_struct_type_fragment Signed-off-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- src/compiler/glsl/glsl_parser.yy | 4 1 file changed, 4 insertions(+) diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 3c4f0c7..78a4e5d 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -1062,6 +1062,7 @@ single_declaration: $$ = new(ctx) ast_declarator_list($1); $$->set_location_range(@1, @2); $$->declarations.push_tail(>link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | fully_specified_type any_identifier array_specifier { @@ -1072,6 +1073,7 @@ single_declaration: $$ = new(ctx) ast_declarator_list($1); $$->set_location_range(@1, @3); $$->declarations.push_tail(>link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | fully_specified_type any_identifier array_specifier '=' initializer { @@ -1082,6 +1084,7 @@ single_declaration: $$ = new(ctx) ast_declarator_list($1); $$->set_location_range(@1, @3); $$->declarations.push_tail(>link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | fully_specified_type any_identifier '=' initializer { @@ -1092,6 +1095,7 @@ single_declaration: $$ = new(ctx) ast_declarator_list($1); $$->set_location_range(@1, @2); $$->declarations.push_tail(>link); + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | INVARIANT variable_identifier { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Add function parameters to the parser symbol table.
Module: Mesa Branch: master Commit: af41c0b7e05f8d2b4b01a1a178b2bfa209236bfe URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=af41c0b7e05f8d2b4b01a1a178b2bfa209236bfe Author: Kenneth GraunkeDate: Fri Mar 4 21:19:49 2016 -0800 glsl: Add function parameters to the parser symbol table. In a shader such as: struct S { float f; } float identity(float S) { return S; } we would think that "S" in "return S" referred to a structure, even though it's shadowed by the "float S" parameter in the inner struct. This led to the parser's grammar seeing TYPE_IDENTIFIER and getting confused. Fixes dEQP-GLES2.functional.shaders.scoping.valid. function_parameter_hides_struct_type_{vertex,fragment}. Signed-off-by: Kenneth Graunke Reviewed-by: Timothy Arceri --- src/compiler/glsl/glsl_parser.yy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 78a4e5d..5ed051a 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -894,6 +894,7 @@ parameter_declarator: $$->type->set_location(@1); $$->type->specifier = $1; $$->identifier = $2; + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } | type_specifier any_identifier array_specifier { @@ -905,6 +906,7 @@ parameter_declarator: $$->type->specifier = $1; $$->identifier = $2; $$->array_specifier = $3; + state->symbols->add_variable(new(state) ir_variable(NULL, $2, ir_var_auto)); } ; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gm107/ir: add emission for ATOMS
Module: Mesa Branch: master Commit: 8f99c1bbce629b9d3db0321e2d74414772615637 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f99c1bbce629b9d3db0321e2d74414772615637 Author: Samuel PitoisetDate: Mon Mar 7 18:57:39 2016 +0100 gm107/ir: add emission for ATOMS This allows to perform atomic operations on shared memory. Signed-off-by: Samuel Pitoiset Reviewed-by: Ilia Mirkin --- .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 45 +- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp index 0e621e0..e079a57 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp @@ -177,6 +177,7 @@ private: void emitAL2P(); void emitIPA(); void emitATOM(); + void emitATOMS(); void emitCCTL(); void emitPIXLD(); @@ -2374,6 +2375,45 @@ CodeEmitterGM107::emitATOM() } void +CodeEmitterGM107::emitATOMS() +{ + unsigned dType, subOp; + + if (insn->subOp == NV50_IR_SUBOP_ATOM_CAS) { + switch (insn->dType) { + case TYPE_U32: dType = 0; break; + case TYPE_U64: dType = 1; break; + default: assert(!"unexpected dType"); dType = 0; break; + } + subOp = 4; + + emitInsn (0xee00); + emitField(0x34, 1, dType); + } else { + switch (insn->dType) { + case TYPE_U32: dType = 0; break; + case TYPE_S32: dType = 1; break; + case TYPE_U64: dType = 2; break; + case TYPE_S64: dType = 3; break; + default: assert(!"unexpected dType"); dType = 0; break; + } + + if (insn->subOp == NV50_IR_SUBOP_ATOM_EXCH) + subOp = 8; + else + subOp = insn->subOp; + + emitInsn (0xec00); + emitField(0x1c, 3, dType); + } + + emitField(0x34, 4, subOp); + emitGPR (0x14, insn->src(1)); + emitADDR (0x08, 0x12, 22, 0, insn->src(0)); + emitGPR (0x00, insn->def(0)); +} + +void CodeEmitterGM107::emitCCTL() { unsigned width; @@ -2967,7 +3007,10 @@ CodeEmitterGM107::emitInstruction(Instruction *i) } break; case OP_ATOM: - emitATOM(); + if (insn->src(0).getFile() == FILE_MEMORY_SHARED) + emitATOMS(); + else + emitATOM(); break; case OP_CCTL: emitCCTL(); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): tgsi: fix parsing of shared memory declarations
Module: Mesa Branch: master Commit: 7f8565f0b2bf54a8106ae9080386bb186609713d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f8565f0b2bf54a8106ae9080386bb186609713d Author: Samuel PitoisetDate: Mon Mar 7 18:52:19 2016 +0100 tgsi: fix parsing of shared memory declarations The SHARED TGSI keyword is only allowed with TGSI_FILE_MEMORY and not with TGSI_FILE_BUFFER. I have found this by using the nouveau_compiler from command line. Signed-off-by: Samuel Pitoiset Reviewed-by: Ilia Mirkin Cc: "11.2" --- src/gallium/auxiliary/tgsi/tgsi_text.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 91baa01..77598d2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -1388,7 +1388,9 @@ static boolean parse_declaration( struct translate_ctx *ctx ) if (str_match_nocase_whole(, "ATOMIC")) { decl.Declaration.Atomic = 1; ctx->cur = cur; - } else if (str_match_nocase_whole(, "SHARED")) { + } + } else if (file == TGSI_FILE_MEMORY) { + if (str_match_nocase_whole(, "SHARED")) { decl.Declaration.Shared = 1; ctx->cur = cur; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gk110/ir: add missing src predicate emission for BAR.RED
Module: Mesa Branch: master Commit: 8a109c0375ba1faa987329ab6355f7bcb497bd78 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a109c0375ba1faa987329ab6355f7bcb497bd78 Author: Samuel PitoisetDate: Sun Feb 28 22:44:24 2016 +0100 gk110/ir: add missing src predicate emission for BAR.RED Signed-off-by: Samuel Pitoiset Reviewed-by: Ilia Mirkin --- src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp index e5d638b..0d7d95e 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp @@ -1300,6 +1300,14 @@ CodeEmitterGK110::emitBAR(const Instruction *i) code[1] |= imm->reg.data.u32 >> 9; code[1] |= 0x4000; } + + if (i->srcExists(2) && (i->predSrc != 2)) { + srcId(i->src(2), 32 + 10); + if (i->src(2).mod == Modifier(NV50_IR_MOD_NOT)) + code[1] |= 1 << 13; + } else { + code[1] |= 7 << 10; + } } void CodeEmitterGK110::emitMEMBAR(const Instruction *i) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gk110/ir: allow to emit immediates for BAR
Module: Mesa Branch: master Commit: f4d2d491522aea8c7de46311c3f5e9c588307dd2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4d2d491522aea8c7de46311c3f5e9c588307dd2 Author: Samuel PitoisetDate: Sun Feb 28 22:43:50 2016 +0100 gk110/ir: allow to emit immediates for BAR Signed-off-by: Samuel Pitoiset Reviewed-by: Ilia Mirkin --- .../drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp | 23 -- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp index 0e7a237..e5d638b 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp @@ -1279,8 +1279,27 @@ CodeEmitterGK110::emitBAR(const Instruction *i) emitPredicate(i); - srcId(i->src(0), 10); - srcId(i->src(1), 23); + // barrier id + if (i->src(0).getFile() == FILE_GPR) { + srcId(i->src(0), 10); + } else { + ImmediateValue *imm = i->getSrc(0)->asImm(); + assert(imm); + code[0] |= imm->reg.data.u32 << 10; + code[1] |= 0x8000; + } + + // thread count + if (i->src(1).getFile() == FILE_GPR) { + srcId(i->src(1), 23); + } else { + ImmediateValue *imm = i->getSrc(0)->asImm(); + assert(imm); + assert(imm->reg.data.u32 <= 0xfff); + code[0] |= imm->reg.data.u32 << 23; + code[1] |= imm->reg.data.u32 >> 9; + code[1] |= 0x4000; + } } void CodeEmitterGK110::emitMEMBAR(const Instruction *i) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gm107/ir: add emission for BAR
Module: Mesa Branch: master Commit: c82086f7e9e251a7ad60f6aa1f64f011b14720b6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c82086f7e9e251a7ad60f6aa1f64f011b14720b6 Author: Samuel PitoisetDate: Tue Mar 1 18:57:58 2016 +0100 gm107/ir: add emission for BAR Signed-off-by: Samuel Pitoiset Reviewed-by: Ilia Mirkin --- .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 52 ++ 1 file changed, 52 insertions(+) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp index a383c53..0e621e0 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp @@ -194,6 +194,7 @@ private: void emitKIL(); void emitOUT(); + void emitBAR(); void emitMEMBAR(); void emitVOTE(); @@ -2649,6 +2650,54 @@ CodeEmitterGM107::emitOUT() } void +CodeEmitterGM107::emitBAR() +{ + uint8_t subop; + + emitInsn (0xf0a8); + + switch (insn->subOp) { + case NV50_IR_SUBOP_BAR_RED_POPC: subop = 0x02; break; + case NV50_IR_SUBOP_BAR_RED_AND: subop = 0x0a; break; + case NV50_IR_SUBOP_BAR_RED_OR: subop = 0x12; break; + case NV50_IR_SUBOP_BAR_ARRIVE: subop = 0x81; break; + default: + subop = 0x80; + assert(insn->subOp == NV50_IR_SUBOP_BAR_SYNC); + break; + } + + emitField(0x20, 8, subop); + + // barrier id + if (insn->src(0).getFile() == FILE_GPR) { + emitGPR(0x08, insn->src(0)); + } else { + ImmediateValue *imm = insn->getSrc(0)->asImm(); + assert(imm); + emitField(0x08, 8, imm->reg.data.u32); + emitField(0x2b, 1, 1); + } + + // thread count + if (insn->src(1).getFile() == FILE_GPR) { + emitGPR(0x14, insn->src(1)); + } else { + ImmediateValue *imm = insn->getSrc(0)->asImm(); + assert(imm); + emitField(0x14, 12, imm->reg.data.u32); + emitField(0x2c, 1, 1); + } + + if (insn->srcExists(2) && (insn->predSrc != 2)) { + emitPRED (0x27, insn->src(2)); + emitField(0x2a, 1, insn->src(2).mod == Modifier(NV50_IR_MOD_NOT)); + } else { + emitField(0x27, 3, 7); + } +} + +void CodeEmitterGM107::emitMEMBAR() { emitInsn (0xef98); @@ -2978,6 +3027,9 @@ CodeEmitterGM107::emitInstruction(Instruction *i) case OP_RESTART: emitOUT(); break; + case OP_BAR: + emitBAR(); + break; case OP_MEMBAR: emitMEMBAR(); break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nvc0/ir: make sure that thread count immediate for BAR fit
Module: Mesa Branch: master Commit: 5777e87bed9de5db9ab08a1388265978507bc88e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5777e87bed9de5db9ab08a1388265978507bc88e Author: Samuel PitoisetDate: Mon Mar 7 18:26:43 2016 +0100 nvc0/ir: make sure that thread count immediate for BAR fit The limit of the thread count immediate value is 12 bits. Signed-off-by: Samuel Pitoiset Reviewed-by: Ilia Mirkin --- src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp index 7bd7c73..8b9328b 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp @@ -1482,6 +1482,7 @@ CodeEmitterNVC0::emitBAR(const Instruction *i) } else { ImmediateValue *imm = i->getSrc(1)->asImm(); assert(imm); + assert(imm->reg.data.u32 <= 0xfff); code[0] |= imm->reg.data.u32 << 26; code[1] |= imm->reg.data.u32 >> 6; code[1] |= 0x4000; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gk110/ir: fix wrong emission of BAR.SYNC
Module: Mesa Branch: master Commit: cba89fdaa1e7360808cef0f6871930c90ca3ef4d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cba89fdaa1e7360808cef0f6871930c90ca3ef4d Author: Samuel PitoisetDate: Sun Feb 28 22:38:43 2016 +0100 gk110/ir: fix wrong emission of BAR.SYNC Signed-off-by: Samuel Pitoiset Reviewed-by: Ilia Mirkin --- src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp index 8512d0d..0e7a237 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp @@ -1273,7 +1273,6 @@ CodeEmitterGK110::emitBAR(const Instruction *i) case NV50_IR_SUBOP_BAR_RED_OR: code[1] |= 0x90; break; case NV50_IR_SUBOP_BAR_RED_POPC: code[1] |= 0x10; break; default: - code[1] |= 0x20; assert(i->subOp == NV50_IR_SUBOP_BAR_SYNC); break; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: also dump SVGA3D_BUFFER surfaces in svga_screen_cache_dump()
Module: Mesa Branch: master Commit: 903afc370fb925ce637c90d694ef1e4052a1a80f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=903afc370fb925ce637c90d694ef1e4052a1a80f Author: Brian PaulDate: Fri Mar 4 15:58:02 2016 -0700 svga: also dump SVGA3D_BUFFER surfaces in svga_screen_cache_dump() Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_screen_cache.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c index 5b44129..321c564 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.c +++ b/src/gallium/drivers/svga/svga_screen_cache.c @@ -563,8 +563,14 @@ svga_screen_cache_dump(const struct svga_screen *svgascreen) struct svga_host_surface_cache_entry *entry = LIST_ENTRY(struct svga_host_surface_cache_entry, curr, bucket_head); - if (entry->key.format != 37) { -debug_printf(" %u x %u x %u format %u\n", + if (entry->key.format == SVGA3D_BUFFER) { +debug_printf(" %p: buffer %u bytes\n", + entry->handle, + entry->key.size.width); + } + else { +debug_printf(" %p: %u x %u x %u format %u\n", + entry->handle, entry->key.size.width, entry->key.size.height, entry->key.size.depth, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: add new surface-write-flushes HUD query
Module: Mesa Branch: master Commit: 3af78b426ee05f9515439c20fc416202bff4539c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3af78b426ee05f9515439c20fc416202bff4539c Author: Brian PaulDate: Fri Mar 4 15:59:32 2016 -0700 svga: add new surface-write-flushes HUD query To know when we're flushing the command buffer because we need to write to surface in the command buffer. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_context.h | 16 +--- src/gallium/drivers/svga/svga_pipe_query.c | 9 + src/gallium/drivers/svga/svga_resource_texture.c | 4 +++- src/gallium/drivers/svga/svga_screen.c | 2 ++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 61e82a2..1976f98 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -54,16 +54,17 @@ #define SVGA_QUERY_NUM_BYTES_UPLOADED (PIPE_QUERY_DRIVER_SPECIFIC + 6) #define SVGA_QUERY_COMMAND_BUFFER_SIZE (PIPE_QUERY_DRIVER_SPECIFIC + 7) #define SVGA_QUERY_FLUSH_TIME (PIPE_QUERY_DRIVER_SPECIFIC + 8) +#define SVGA_QUERY_SURFACE_WRITE_FLUSHES (PIPE_QUERY_DRIVER_SPECIFIC + 9) /* running total counters */ -#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 9) -#define SVGA_QUERY_NUM_SHADERS (PIPE_QUERY_DRIVER_SPECIFIC + 10) -#define SVGA_QUERY_NUM_RESOURCES (PIPE_QUERY_DRIVER_SPECIFIC + 11) -#define SVGA_QUERY_NUM_STATE_OBJECTS (PIPE_QUERY_DRIVER_SPECIFIC + 12) -#define SVGA_QUERY_NUM_SURFACE_VIEWS (PIPE_QUERY_DRIVER_SPECIFIC + 13) -#define SVGA_QUERY_NUM_GENERATE_MIPMAP (PIPE_QUERY_DRIVER_SPECIFIC + 14) +#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 10) +#define SVGA_QUERY_NUM_SHADERS (PIPE_QUERY_DRIVER_SPECIFIC + 11) +#define SVGA_QUERY_NUM_RESOURCES (PIPE_QUERY_DRIVER_SPECIFIC + 12) +#define SVGA_QUERY_NUM_STATE_OBJECTS (PIPE_QUERY_DRIVER_SPECIFIC + 13) +#define SVGA_QUERY_NUM_SURFACE_VIEWS (PIPE_QUERY_DRIVER_SPECIFIC + 14) +#define SVGA_QUERY_NUM_GENERATE_MIPMAP (PIPE_QUERY_DRIVER_SPECIFIC + 15) /*SVGA_QUERY_MAX has to be last because it is size of an array*/ -#define SVGA_QUERY_MAX (PIPE_QUERY_DRIVER_SPECIFIC + 15) +#define SVGA_QUERY_MAX (PIPE_QUERY_DRIVER_SPECIFIC + 16) /** * Maximum supported number of constant buffers per shader @@ -506,6 +507,7 @@ struct svga_context uint64_t num_resources_mapped; /**< SVGA_QUERY_NUM_RESOURCES_MAPPED */ uint64_t command_buffer_size; /**< SVGA_QUERY_COMMAND_BUFFER_SIZE */ uint64_t flush_time; /**< SVGA_QUERY_FLUSH_TIME */ + uint64_t surface_write_flushes; /**< SVGA_QUERY_SURFACE_WRITE_FLUSHES */ uint64_t num_shaders; /**< SVGA_QUERY_NUM_SHADERS */ uint64_t num_state_objects;/**< SVGA_QUERY_NUM_STATE_OBJECTS */ uint64_t num_surface_views;/**< SVGA_QUERY_NUM_SURFACE_VIEWS */ diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 15decd4..845f4ef 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -729,6 +729,7 @@ svga_create_query(struct pipe_context *pipe, case SVGA_QUERY_NUM_BYTES_UPLOADED: case SVGA_QUERY_COMMAND_BUFFER_SIZE: case SVGA_QUERY_FLUSH_TIME: + case SVGA_QUERY_SURFACE_WRITE_FLUSHES: case SVGA_QUERY_MEMORY_USED: case SVGA_QUERY_NUM_SHADERS: case SVGA_QUERY_NUM_RESOURCES: @@ -800,6 +801,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q) case SVGA_QUERY_NUM_BYTES_UPLOADED: case SVGA_QUERY_COMMAND_BUFFER_SIZE: case SVGA_QUERY_FLUSH_TIME: + case SVGA_QUERY_SURFACE_WRITE_FLUSHES: case SVGA_QUERY_MEMORY_USED: case SVGA_QUERY_NUM_SHADERS: case SVGA_QUERY_NUM_RESOURCES: @@ -894,6 +896,9 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q) case SVGA_QUERY_FLUSH_TIME: sq->begin_count = svga->hud.flush_time; break; + case SVGA_QUERY_SURFACE_WRITE_FLUSHES: + sq->begin_count = svga->hud.surface_write_flushes; + break; case SVGA_QUERY_MEMORY_USED: case SVGA_QUERY_NUM_SHADERS: case SVGA_QUERY_NUM_RESOURCES: @@ -994,6 +999,9 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q) case SVGA_QUERY_FLUSH_TIME: sq->end_count = svga->hud.flush_time; break; + case SVGA_QUERY_SURFACE_WRITE_FLUSHES: + sq->end_count = svga->hud.surface_write_flushes; + break; case SVGA_QUERY_MEMORY_USED: case SVGA_QUERY_NUM_SHADERS: case SVGA_QUERY_NUM_RESOURCES: @@ -1094,6 +1102,7 @@ svga_get_query_result(struct pipe_context *pipe, case SVGA_QUERY_NUM_BYTES_UPLOADED: case SVGA_QUERY_COMMAND_BUFFER_SIZE: case
Mesa (master): svga: add new flush-time HUD query
Module: Mesa Branch: master Commit: 7e8cf3454624213f27b01f43ea6317d3bb51bb90 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e8cf3454624213f27b01f43ea6317d3bb51bb90 Author: Brian PaulDate: Fri Mar 4 09:14:34 2016 -0700 svga: add new flush-time HUD query To measure the time spent flushing the command buffer. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_context.c| 4 src/gallium/drivers/svga/svga_context.h| 16 +--- src/gallium/drivers/svga/svga_pipe_query.c | 9 + src/gallium/drivers/svga/svga_screen.c | 2 ++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index 32917cd..da42814 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -31,6 +31,7 @@ #include "util/u_memory.h" #include "util/u_bitmask.h" #include "util/u_upload_mgr.h" +#include "os/os_time.h" #include "svga_context.h" #include "svga_screen.h" @@ -299,6 +300,7 @@ void svga_context_flush( struct svga_context *svga, { struct svga_screen *svgascreen = svga_screen(svga->pipe.screen); struct pipe_fence_handle *fence = NULL; + uint64_t t0; svga->curr.nr_fbs = 0; @@ -312,7 +314,9 @@ void svga_context_flush( struct svga_context *svga, /* Flush pending commands to hardware: */ + t0 = os_time_get(); svga->swc->flush(svga->swc, ); + svga->hud.flush_time += (os_time_get() - t0); svga->hud.num_flushes++; diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 2a1ad14..61e82a2 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -53,16 +53,17 @@ #define SVGA_QUERY_NUM_RESOURCES_MAPPED(PIPE_QUERY_DRIVER_SPECIFIC + 5) #define SVGA_QUERY_NUM_BYTES_UPLOADED (PIPE_QUERY_DRIVER_SPECIFIC + 6) #define SVGA_QUERY_COMMAND_BUFFER_SIZE (PIPE_QUERY_DRIVER_SPECIFIC + 7) +#define SVGA_QUERY_FLUSH_TIME (PIPE_QUERY_DRIVER_SPECIFIC + 8) /* running total counters */ -#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 8) -#define SVGA_QUERY_NUM_SHADERS (PIPE_QUERY_DRIVER_SPECIFIC + 9) -#define SVGA_QUERY_NUM_RESOURCES (PIPE_QUERY_DRIVER_SPECIFIC + 10) -#define SVGA_QUERY_NUM_STATE_OBJECTS (PIPE_QUERY_DRIVER_SPECIFIC + 11) -#define SVGA_QUERY_NUM_SURFACE_VIEWS (PIPE_QUERY_DRIVER_SPECIFIC + 12) -#define SVGA_QUERY_NUM_GENERATE_MIPMAP (PIPE_QUERY_DRIVER_SPECIFIC + 13) +#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 9) +#define SVGA_QUERY_NUM_SHADERS (PIPE_QUERY_DRIVER_SPECIFIC + 10) +#define SVGA_QUERY_NUM_RESOURCES (PIPE_QUERY_DRIVER_SPECIFIC + 11) +#define SVGA_QUERY_NUM_STATE_OBJECTS (PIPE_QUERY_DRIVER_SPECIFIC + 12) +#define SVGA_QUERY_NUM_SURFACE_VIEWS (PIPE_QUERY_DRIVER_SPECIFIC + 13) +#define SVGA_QUERY_NUM_GENERATE_MIPMAP (PIPE_QUERY_DRIVER_SPECIFIC + 14) /*SVGA_QUERY_MAX has to be last because it is size of an array*/ -#define SVGA_QUERY_MAX (PIPE_QUERY_DRIVER_SPECIFIC + 14) +#define SVGA_QUERY_MAX (PIPE_QUERY_DRIVER_SPECIFIC + 15) /** * Maximum supported number of constant buffers per shader @@ -504,6 +505,7 @@ struct svga_context uint64_t map_buffer_time; /**< SVGA_QUERY_MAP_BUFFER_TIME */ uint64_t num_resources_mapped; /**< SVGA_QUERY_NUM_RESOURCES_MAPPED */ uint64_t command_buffer_size; /**< SVGA_QUERY_COMMAND_BUFFER_SIZE */ + uint64_t flush_time; /**< SVGA_QUERY_FLUSH_TIME */ uint64_t num_shaders; /**< SVGA_QUERY_NUM_SHADERS */ uint64_t num_state_objects;/**< SVGA_QUERY_NUM_STATE_OBJECTS */ uint64_t num_surface_views;/**< SVGA_QUERY_NUM_SURFACE_VIEWS */ diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 08adaed..15decd4 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -728,6 +728,7 @@ svga_create_query(struct pipe_context *pipe, case SVGA_QUERY_NUM_RESOURCES_MAPPED: case SVGA_QUERY_NUM_BYTES_UPLOADED: case SVGA_QUERY_COMMAND_BUFFER_SIZE: + case SVGA_QUERY_FLUSH_TIME: case SVGA_QUERY_MEMORY_USED: case SVGA_QUERY_NUM_SHADERS: case SVGA_QUERY_NUM_RESOURCES: @@ -798,6 +799,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q) case SVGA_QUERY_NUM_RESOURCES_MAPPED: case SVGA_QUERY_NUM_BYTES_UPLOADED: case SVGA_QUERY_COMMAND_BUFFER_SIZE: + case SVGA_QUERY_FLUSH_TIME: case SVGA_QUERY_MEMORY_USED: case SVGA_QUERY_NUM_SHADERS: case SVGA_QUERY_NUM_RESOURCES: @@ -889,6 +891,9 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q) case SVGA_QUERY_COMMAND_BUFFER_SIZE: sq->begin_count
Mesa (11.2): mesa: Make glGet queries initialize ctx-> Debug when necessary.
Module: Mesa Branch: 11.2 Commit: c9da4f896685e061947f41664d4fb7492a31327d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9da4f896685e061947f41664d4fb7492a31327d Author: Kenneth GraunkeDate: Wed Mar 2 23:19:27 2016 -0800 mesa: Make glGet queries initialize ctx->Debug when necessary. dEQP-GLES31.functional.debug.state_query.debug_group_stack_depth_* tries to call glGet on GL_DEBUG_GROUP_STACK_DEPTH right away, before doing any other debug setup. This should return 1. However, because ctx->Debug wasn't allocated, we bailed and returned 0. This patch removes the open-coded locking and switches the two glGet functions to use _mesa_lock_debug_state(), which takes care of allocating and initializing that state on the first time. It also conveniently takes care of unlocking on failure for us, so we don't need to handle that in every caller. Fixes dEQP-GLES31.functional.debug.state_query.debug_group_stack_depth_ {getboolean,getfloat,getinteger,getinteger64}. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Kenneth Graunke Reviewed-by: Ilia Mirkin Reviewed-by: Timothy Arceri Reviewed-by: Emil Velikov (cherry picked from commit b4b50b074beae9b679e5acdbb4b49193e539576d) --- src/mesa/main/debug_output.c | 20 ++-- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/mesa/main/debug_output.c b/src/mesa/main/debug_output.c index 10ee675..c2b9f05 100644 --- a/src/mesa/main/debug_output.c +++ b/src/mesa/main/debug_output.c @@ -761,15 +761,11 @@ _mesa_set_debug_state_int(struct gl_context *ctx, GLenum pname, GLint val) GLint _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname) { - struct gl_debug_state *debug; GLint val; - mtx_lock(>DebugMutex); - debug = ctx->Debug; - if (!debug) { - mtx_unlock(>DebugMutex); + struct gl_debug_state *debug = _mesa_lock_debug_state(ctx); + if (!debug) return 0; - } switch (pname) { case GL_DEBUG_OUTPUT: @@ -794,7 +790,7 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname) break; } - mtx_unlock(>DebugMutex); + _mesa_unlock_debug_state(ctx); return val; } @@ -806,15 +802,11 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname) void * _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname) { - struct gl_debug_state *debug; void *val; + struct gl_debug_state *debug = _mesa_lock_debug_state(ctx); - mtx_lock(>DebugMutex); - debug = ctx->Debug; - if (!debug) { - mtx_unlock(>DebugMutex); + if (!debug) return NULL; - } switch (pname) { case GL_DEBUG_CALLBACK_FUNCTION_ARB: @@ -829,7 +821,7 @@ _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname) break; } - mtx_unlock(>DebugMutex); + _mesa_unlock_debug_state(ctx); return val; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): radeonsi: Do colorformat endian swap for PIPE_USAGE_STAGING
Module: Mesa Branch: 11.2 Commit: a07e84278c06a8008087c0b9526b208cb257844a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a07e84278c06a8008087c0b9526b208cb257844a Author: Oded GabbayDate: Wed Mar 2 21:11:57 2016 +0200 radeonsi: Do colorformat endian swap for PIPE_USAGE_STAGING There is an old if statement (dated to 2011) that prevented doing endian swap for colorformat, in case the buffer is marked as PIPE_USAGE_STAGING. This is now wrong because st_ReadPixels() reads into a destination texture that is marked with PIPE_USAGE_STAGING. Therefore, even if the texture is rendered correctly to the monitor, when reading it back we get unswapped/wrong values. This patch makes the check_rgba() function in gl-1.0-readpixsanity piglit test pass in big-endian. Signed-off-by: Oded Gabbay Cc: "11.1 11.2" Reviewed-by: Marek Olšák (cherry picked from commit 914d4967d723c58ec073eef677237798c2dc9751) --- src/gallium/drivers/radeonsi/si_state.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 2dfdbeb..663ebb3 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2250,11 +2250,7 @@ static void si_initialize_color_surface(struct si_context *sctx, } assert(format != V_028C70_COLOR_INVALID); swap = r600_translate_colorswap(surf->base.format); - if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { - endian = V_028C70_ENDIAN_NONE; - } else { - endian = si_colorformat_endian_swap(format); - } + endian = si_colorformat_endian_swap(format); /* blend clamp should be set for all NORM/SRGB types */ if (ntype == V_028C70_NUMBER_UNORM || ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): virgl: add support for passing render condition flags to host.
Module: Mesa Branch: 11.2 Commit: 50c678c7069cf97178b97d6c46972680e8e6495e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=50c678c7069cf97178b97d6c46972680e8e6495e Author: Dave AirlieDate: Tue Mar 1 15:48:44 2016 +1000 virgl: add support for passing render condition flags to host. This just passes the extra blit info to fix the render condition tests. Cc: "11.2" Signed-off-by: Dave Airlie (cherry picked from commit ac222626adfc7a03bf537deba66bad5e57b2c91d) --- src/gallium/drivers/virgl/virgl_encode.c | 4 +++- src/gallium/drivers/virgl/virgl_protocol.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index 22fb529..1a1c40b 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -741,7 +741,9 @@ int virgl_encode_blit(struct virgl_context *ctx, virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_BLIT, 0, VIRGL_CMD_BLIT_SIZE)); tmp = VIRGL_CMD_BLIT_S0_MASK(blit->mask) | VIRGL_CMD_BLIT_S0_FILTER(blit->filter) | - VIRGL_CMD_BLIT_S0_SCISSOR_ENABLE(blit->scissor_enable); + VIRGL_CMD_BLIT_S0_SCISSOR_ENABLE(blit->scissor_enable) | + VIRGL_CMD_BLIT_S0_RENDER_CONDITION_ENABLE(blit->render_condition_enable) | + VIRGL_CMD_BLIT_S0_ALPHA_BLEND(blit->alpha_blend); virgl_encoder_write_dword(ctx->cbuf, tmp); virgl_encoder_write_dword(ctx->cbuf, (blit->scissor.minx | blit->scissor.miny << 16)); virgl_encoder_write_dword(ctx->cbuf, (blit->scissor.maxx | blit->scissor.maxy << 16)); diff --git a/src/gallium/drivers/virgl/virgl_protocol.h b/src/gallium/drivers/virgl/virgl_protocol.h index ca3142f..a2f1e81 100644 --- a/src/gallium/drivers/virgl/virgl_protocol.h +++ b/src/gallium/drivers/virgl/virgl_protocol.h @@ -388,6 +388,8 @@ enum virgl_context_cmd { #define VIRGL_CMD_BLIT_S0_MASK(x) (((x) & 0xff) << 0) #define VIRGL_CMD_BLIT_S0_FILTER(x) (((x) & 0x3) << 8) #define VIRGL_CMD_BLIT_S0_SCISSOR_ENABLE(x) (((x) & 0x1) << 10) +#define VIRGL_CMD_BLIT_S0_RENDER_CONDITION_ENABLE(x) (((x) & 0x1) << 11) +#define VIRGL_CMD_BLIT_S0_ALPHA_BLEND(x) (((x) & 0x1) << 12) #define VIRGL_CMD_BLIT_SCISSOR_MINX_MINY 2 #define VIRGL_CMD_BLIT_SCISSOR_MAXX_MAXY 3 #define VIRGL_CMD_BLIT_DST_RES_HANDLE 4 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): st/nine: Use Position input helper for ps3 declared inputs
Module: Mesa Branch: 11.2 Commit: ac909bf6f71e37d4fa795cbbafe90d8ecb6c8b16 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac909bf6f71e37d4fa795cbbafe90d8ecb6c8b16 Author: Axel DavyDate: Sun Feb 21 16:35:31 2016 +0100 st/nine: Use Position input helper for ps3 declared inputs When the semantic is Position (which can happen with index 0 only), use the helper to get Position input. Cc: "11.2" Signed-off-by: Axel Davy (cherry picked from commit 8a8affdfdace486f4e416e66e2dd0ed122505a90) --- src/gallium/state_trackers/nine/nine_shader.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index f0c5236..eb6479b 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -2052,9 +2052,16 @@ DECL_SPECIAL(DCL) unsigned interp_location = 0; /* SM3 only, SM2 input semantic determined by file */ assert(sem.reg.idx < Elements(tx->regs.v)); + +if (tgsi.Name == TGSI_SEMANTIC_POSITION) { +tx->regs.v[sem.reg.idx] = nine_get_position_input(tx); +return D3D_OK; +} + if (sem.reg.mod & NINED3DSPDM_CENTROID || (tgsi.Name == TGSI_SEMANTIC_COLOR && tx->info->force_color_in_centroid)) interp_location = TGSI_INTERPOLATE_LOC_CENTROID; + tx->regs.v[sem.reg.idx] = ureg_DECL_fs_input_cyl_centroid( ureg, tgsi.Name, tgsi.Index, nine_tgsi_to_interp_mode(), ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): mesa: Allow Get*() of several forgotten IsEnabled() pnames.
Module: Mesa Branch: 11.2 Commit: 3d32af2d59a486761fdb030cbccdf6e8308ff83f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d32af2d59a486761fdb030cbccdf6e8308ff83f Author: Kenneth GraunkeDate: Thu Mar 3 00:43:15 2016 -0800 mesa: Allow Get*() of several forgotten IsEnabled() pnames. From section 6.2 ("State Tables") of the GL 2.1 specification (the text also appears in the GL 3.0 and ES 3.1 specifications): "However, state variables for which IsEnabled is listed as the query command can also be obtained using GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev." GL_DEBUG_OUTPUT, GL_DEBUG_OUTPUT_SYNCHRONOUS, and GL_FRAGMENT_SHADER_ATI were missing from the glGet*() functions. All other IsEnabled() pnames look to be present, as far as I can tell. Fixes 8 dEQP-GLES31.functional.debug.state_query subtests: debug_output[_synchronous]_get{boolean,float,integer,integer64}. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Kenneth Graunke Reviewed-by: Ilia Mirkin Reviewed-by: Emil Velikov (cherry picked from commit aa37cbdff7bb1d2170f1603b02a8b8517255894f) --- src/mesa/main/get.c | 2 ++ src/mesa/main/get_hash_params.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index f40c570..4cc82d8 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1055,6 +1055,8 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu } break; /* GL_KHR_DEBUG */ + case GL_DEBUG_OUTPUT: + case GL_DEBUG_OUTPUT_SYNCHRONOUS: case GL_DEBUG_LOGGED_MESSAGES: case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH: case GL_DEBUG_GROUP_STACK_DEPTH: diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 07d2d20..f9d66f8 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -126,6 +126,8 @@ descriptor=[ [ "MAX_TEXTURE_MAX_ANISOTROPY_EXT", "CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy), extra_EXT_texture_filter_anisotropic" ], # GL_KHR_debug (GL 4.3)/ GL_ARB_debug_output + [ "DEBUG_OUTPUT", "LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA" ], + [ "DEBUG_OUTPUT_SYNCHRONOUS", "LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA" ], [ "DEBUG_LOGGED_MESSAGES", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], [ "DEBUG_NEXT_LOGGED_MESSAGE_LENGTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], [ "MAX_DEBUG_LOGGED_MESSAGES", "CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA" ], @@ -773,6 +775,7 @@ descriptor=[ [ "DEPTH_CLAMP", "CONTEXT_BOOL(Transform.DepthClamp), extra_ARB_depth_clamp" ], # GL_ATI_fragment_shader + [ "FRAGMENT_SHADER_ATI", "CONTEXT_BOOL(ATIFragmentShader.Enabled), extra_ATI_fragment_shader" ], [ "NUM_FRAGMENT_REGISTERS_ATI", "CONST(6), extra_ATI_fragment_shader" ], [ "NUM_FRAGMENT_CONSTANTS_ATI", "CONST(8), extra_ATI_fragment_shader" ], [ "NUM_PASSES_ATI", "CONST(2), extra_ATI_fragment_shader" ], ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): glsl: Initialize gl_shader_program::EmptyUniformLocations.
Module: Mesa Branch: 11.2 Commit: caa10464ab1e58d34a70ed38323613fefa52a766 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=caa10464ab1e58d34a70ed38323613fefa52a766 Author: Matt TurnerDate: Sat Feb 27 16:38:26 2016 -0800 glsl: Initialize gl_shader_program::EmptyUniformLocations. Commit 65dfb30 added exec_list EmptyUniformLocations, but only initialized the list if ARB_explicit_uniform_location was enabled, leading to crashes if the extension was not available. Cc: "11.2" Reviewed-by: Tapani Pälli (cherry picked from commit f3b68fc5fc806cbfd5e7d79b8679fd2bcbae71f4) --- src/compiler/glsl/linker.cpp | 1 - src/mesa/main/shaderobj.c| 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 5326bfd..3039232 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3180,7 +3180,6 @@ check_explicit_uniform_locations(struct gl_context *ctx, } } - exec_list_make_empty(>EmptyUniformLocations); struct empty_uniform_block *current_block = NULL; for (unsigned i = 0; i < prog->NumUniformRemapTable; i++) { diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 203ccef..9a4eb6b 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -240,6 +240,8 @@ init_shader_program(struct gl_shader_program *prog) prog->TransformFeedback.BufferMode = GL_INTERLEAVED_ATTRIBS; + exec_list_make_empty(>EmptyUniformLocations); + prog->InfoLog = ralloc_strdup(prog, ""); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa: tag mesa-11.2.0-rc3: Mesa 11.2.0-rc3 release candidate
Module: Mesa Branch: refs/tags/mesa-11.2.0-rc3 Tag:d737abd2f8fada9358a87e55eaa0d5a5403ceeaf URL: http://cgit.freedesktop.org/mesa/mesa/tag/?id=d737abd2f8fada9358a87e55eaa0d5a5403ceeaf Tagger: Emil VelikovDate: Mon Mar 7 10:06:47 2016 + Mesa 11.2.0-rc3 release candidate ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): st/nine: Fix second Multithreading issue with MANAGED buffers
Module: Mesa Branch: 11.2 Commit: d956cfebd5391e23b5ffdaf07b59f312acabe8d4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d956cfebd5391e23b5ffdaf07b59f312acabe8d4 Author: Axel DavyDate: Sat Feb 27 11:02:21 2016 +0100 st/nine: Fix second Multithreading issue with MANAGED buffers Here is another threading issue with MANAGED buffers: Thread 1: buffer creation Thread 1: buffer lock Thread 2: Draw call Thread 1: writes data Thread 1: Unlock Without this patch, the buffer is initially dirty and in the list of things to upload after its creation. The draw call will then upload the data and unset the dirty flag, and the Unlock won't trigger a second upload. Fixes regression introduced by cc0114f30b587a10766ec212afb3ad356099ef23: "st/nine: Implement Managed vertex/index buffers" Cc: "11.2" Signed-off-by: Axel Davy (cherry picked from commit 83bc2acfe90fd2e503bab4b5a586c1e2822863f5) --- src/gallium/state_trackers/nine/buffer9.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 6d5d9d6..1103741 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -182,6 +182,9 @@ NineBuffer9_Lock( struct NineBuffer9 *This, This->managed.dirty_box = box; } else { u_box_union_2d(>managed.dirty_box, >managed.dirty_box, ); +/* Do not upload while we are locking, we'll add it back later */ +if (!LIST_IS_EMPTY(>managed.list)) +list_delinit(>managed.list); } } *ppbData = (char *)This->managed.data + OffsetToLock; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): r600g: Do colorformat endian swap for PIPE_USAGE_STAGING
Module: Mesa Branch: 11.2 Commit: feb1972a80ee7009261289c40dad8fda696cd8d0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=feb1972a80ee7009261289c40dad8fda696cd8d0 Author: Oded GabbayDate: Wed Mar 2 21:11:49 2016 +0200 r600g: Do colorformat endian swap for PIPE_USAGE_STAGING There is an old if statement (dated to 2011) that prevented doing endian swap for colorformat, in case the buffer is marked as PIPE_USAGE_STAGING. This is now wrong because st_ReadPixels() reads into a destination texture that is marked with PIPE_USAGE_STAGING. Therefore, even if the texture is rendered correctly to the monitor, when reading it back we get unswapped/wrong values. This patch makes the check_rgba() function in gl-1.0-readpixsanity piglit test pass in big-endian. v2: removed duplicate call to r600_colorformat_endian_swap() inside evergreen_init_color_surface_rat() Signed-off-by: Oded Gabbay Cc: "11.1 11.2" Reviewed-by: Marek Olšák (cherry picked from commit ef5183faea98dfdaa1ca0c7368c4678a031dd804) --- src/gallium/drivers/r600/evergreen_state.c | 13 + src/gallium/drivers/r600/r600_state.c | 6 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 61d32c0..c6ac5ef 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -989,13 +989,6 @@ void evergreen_init_color_surface_rat(struct r600_context *rctx, MAX2(64, rctx->screen->b.info.pipe_interleave_bytes / block_size); unsigned pitch = align(pipe_buffer->width0, pitch_alignment); - /* XXX: This is copied from evergreen_init_color_surface(). I don't -* know why this is necessary. -*/ - if (pipe_buffer->usage == PIPE_USAGE_STAGING) { - endian = ENDIAN_NONE; - } - surf->cb_color_base = r600_resource(pipe_buffer)->gpu_address >> 8; surf->cb_color_pitch = (pitch / 8) - 1; @@ -1146,11 +1139,7 @@ void evergreen_init_color_surface(struct r600_context *rctx, swap = r600_translate_colorswap(surf->base.format); assert(swap != ~0); - if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { - endian = ENDIAN_NONE; - } else { - endian = r600_colorformat_endian_swap(format); - } + endian = r600_colorformat_endian_swap(format); /* blend clamp should be set for all NORM/SRGB types */ if (ntype == V_028C70_NUMBER_UNORM || ntype == V_028C70_NUMBER_SNORM || diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index f60e304..f902619 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -930,11 +930,7 @@ static void r600_init_color_surface(struct r600_context *rctx, swap = r600_translate_colorswap(surf->base.format); assert(swap != ~0); - if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { - endian = ENDIAN_NONE; - } else { - endian = r600_colorformat_endian_swap(format); - } + endian = r600_colorformat_endian_swap(format); /* set blend bypass according to docs if SINT/UINT or 8/24 COLOR variants */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): Update version to 11.2.0-rc3
Module: Mesa Branch: 11.2 Commit: 9f21fdd8e697a1a0868f4ec4573235325294b7b3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f21fdd8e697a1a0868f4ec4573235325294b7b3 Author: Emil VelikovDate: Mon Mar 7 09:19:12 2016 + Update version to 11.2.0-rc3 Signed-off-by: Emil Velikov --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b7ce1a2..1568ccd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -11.2.0-rc2 +11.2.0-rc3 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): st/nine: Introduce helper for Position shader input
Module: Mesa Branch: 11.2 Commit: 7073248f2f7e4c30af77526892ad9ff0f4e0aaed URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7073248f2f7e4c30af77526892ad9ff0f4e0aaed Author: Axel DavyDate: Sun Feb 21 16:30:15 2016 +0100 st/nine: Introduce helper for Position shader input Cc: "11.2" Signed-off-by: Axel Davy (cherry picked from commit f08c990af53e91114257b19e5679e2dbbc277e45) --- src/gallium/state_trackers/nine/nine_shader.c | 31 +-- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index a7a7da2..f0c5236 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -830,6 +830,18 @@ nine_ureg_dst_register(unsigned file, int index) return ureg_dst(ureg_src_register(file, index)); } +static inline struct ureg_src +nine_get_position_input(struct shader_translator *tx) +{ +struct ureg_program *ureg = tx->ureg; + +if (tx->wpos_is_sysval) +return ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); +else +return ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, + 0, TGSI_INTERPOLATE_LINEAR); +} + static struct ureg_src tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) { @@ -955,16 +967,8 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) case D3DSPR_MISCTYPE: switch (param->idx) { case D3DSMO_POSITION: - if (ureg_src_is_undef(tx->regs.vPos)) { - if (tx->wpos_is_sysval) { - tx->regs.vPos = - ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); - } else { - tx->regs.vPos = - ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); - } - } + if (ureg_src_is_undef(tx->regs.vPos)) + tx->regs.vPos = nine_get_position_input(tx); if (tx->shift_wpos) { /* TODO: do this only once */ struct ureg_dst wpos = tx_scratch(tx); @@ -3269,12 +3273,7 @@ shader_add_ps_fog_stage(struct shader_translator *tx, struct ureg_src src_col) } if (tx->info->fog_mode != D3DFOG_NONE) { -if (tx->wpos_is_sysval) { -depth = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); -} else { -depth = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); -} +depth = nine_get_position_input(tx); depth = ureg_scalar(depth, TGSI_SWIZZLE_Z); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): mesa/fbobject: propogate Layered when reusing attachments.
Module: Mesa Branch: 11.2 Commit: ae4a7a5962d418b3dc29325169f301ee4a8fc945 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae4a7a5962d418b3dc29325169f301ee4a8fc945 Author: Dave AirlieDate: Mon Feb 29 17:16:10 2016 +1000 mesa/fbobject: propogate Layered when reusing attachments. When reusing a depth attachment as a stencil, we need to propogate the layered bit, otherwise we fail to complete the framebuffer. discovered running ./bin/fbo-depth-array depth-layered-clear on virgl on haswell. Reviewed-by: Marek Olšák Cc: "11.1 11.2" Signed-off-by: Dave Airlie (cherry picked from commit 35859d5bbba998aa41ec87bc53d946add4662dea) --- src/mesa/main/fbobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 1f10050..621f84f 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2815,6 +2815,7 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb, dst_att->Complete = src_att->Complete; dst_att->TextureLevel = src_att->TextureLevel; dst_att->Zoffset = src_att->Zoffset; + dst_att->Layered = src_att->Layered; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): st/nine: Handle READONLY for buffer MANAGED pool
Module: Mesa Branch: 11.2 Commit: eda0880f77217233c2cb1acc538d55a6227da834 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eda0880f77217233c2cb1acc538d55a6227da834 Author: Axel DavyDate: Wed Feb 24 23:44:40 2016 +0100 st/nine: Handle READONLY for buffer MANAGED pool READONLY won't trigger an upload. Cc: "11.2" Signed-off-by: Axel Davy (cherry picked from commit 35c858c42c818d5bf5b4bfee03a342df52acface) --- src/gallium/state_trackers/nine/buffer9.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index e066fc5..8efb4ce 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -174,13 +174,16 @@ NineBuffer9_Lock( struct NineBuffer9 *This, u_box_1d(OffsetToLock, SizeToLock, ); if (This->base.pool == D3DPOOL_MANAGED) { -if (!This->managed.dirty) { -assert(LIST_IS_EMPTY(>managed.list)); -list_add(>managed.list, >base.base.device->update_buffers); -This->managed.dirty = TRUE; -This->managed.dirty_box = box; -} else { -u_box_union_2d(>managed.dirty_box, >managed.dirty_box, ); +/* READONLY doesn't dirty the buffer */ +if (!(Flags & D3DLOCK_READONLY)) { +if (!This->managed.dirty) { +assert(LIST_IS_EMPTY(>managed.list)); +list_add(>managed.list, >base.base.device->update_buffers); +This->managed.dirty = TRUE; +This->managed.dirty_box = box; +} else { +u_box_union_2d(>managed.dirty_box, >managed.dirty_box, ); +} } *ppbData = (char *)This->managed.data + OffsetToLock; DBG("returning pointer %p\n", *ppbData); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (11.2): st/nine: Fix Multithreading issue with MANAGED buffers
Module: Mesa Branch: 11.2 Commit: d29f41e1ba4414f4d3ed324ec44e389f6fceb51a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d29f41e1ba4414f4d3ed324ec44e389f6fceb51a Author: Axel DavyDate: Thu Feb 25 19:07:37 2016 +0100 st/nine: Fix Multithreading issue with MANAGED buffers d3d calls are protected by mutexes, however if app is doing in two threads: Thread 1: buffer Lock Thread 2: Draw call Thread 1: writes data Thread 1: Unlock Then before this patch, the Draw call would begin to upload the buffer. Solves this by moving the moment we add the buffer to the queue of things to upload (We move it from Lock time to Unlock time). Cc: "11.2" Signed-off-by: Axel Davy (cherry picked from commit 44246fe99d4c880b70a58043624bf023237009f5) --- src/gallium/state_trackers/nine/buffer9.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 8efb4ce..6d5d9d6 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -178,7 +178,6 @@ NineBuffer9_Lock( struct NineBuffer9 *This, if (!(Flags & D3DLOCK_READONLY)) { if (!This->managed.dirty) { assert(LIST_IS_EMPTY(>managed.list)); -list_add(>managed.list, >base.base.device->update_buffers); This->managed.dirty = TRUE; This->managed.dirty_box = box; } else { @@ -232,8 +231,13 @@ NineBuffer9_Unlock( struct NineBuffer9 *This ) user_assert(This->nmaps > 0, D3DERR_INVALIDCALL); if (This->base.pool != D3DPOOL_MANAGED) This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]); -else +else { This->nmaps--; +/* TODO: Fix this to upload at the first draw call needing the data, + * instead of at the next draw call */ +if (!This->nmaps && This->managed.dirty && LIST_IS_EMPTY(>managed.list)) +list_add(>managed.list, >base.base.device->update_buffers); +} return D3D_OK; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit