Mesa (master): radv: use correct alloc function when loading from disk
Module: Mesa Branch: master Commit: e92405c55aa885bee5dfb05fac032cab5e419290 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e92405c55aa885bee5dfb05fac032cab5e419290 Author: Timothy ArceriDate: Tue Oct 31 11:31:19 2017 +1100 radv: use correct alloc function when loading from disk Fixes regression in: dEQP-VK.api.object_management.alloc_callback_fail.graphics_pipeline Fixes: 1e84e53712ae "radv: add cache items to in memory cache when reading from disk" Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_pipeline_cache.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c index 91470d1419..2904b62e6b 100644 --- a/src/amd/vulkan/radv_pipeline_cache.c +++ b/src/amd/vulkan/radv_pipeline_cache.c @@ -276,7 +276,20 @@ radv_create_shader_variants_from_pipeline_cache(struct radv_device *device, pthread_mutex_unlock(>mutex); return false; } else { - radv_pipeline_cache_add_entry(cache, entry); + size_t size = entry_size(entry); + struct cache_entry *new_entry = vk_alloc(>alloc, size, 8, + VK_SYSTEM_ALLOCATION_SCOPE_CACHE); + if (!new_entry) { + free(entry); + pthread_mutex_unlock(>mutex); + return false; + } + + memcpy(new_entry, entry, entry_size(entry)); + free(entry); + entry = new_entry; + + radv_pipeline_cache_add_entry(cache, new_entry); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Fix ARB_indirect_parameters logic.
Module: Mesa Branch: master Commit: 048d4c45c94eb8d99f2a53f3bf200b2c6a9f9629 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=048d4c45c94eb8d99f2a53f3bf200b2c6a9f9629 Author: Plamena ManolovaDate: Mon Oct 30 21:14:24 2017 + i965: Fix ARB_indirect_parameters logic. This patch modifies the ARB_indirect_parameters logic in brw_draw_prims, so that our implementation isn't affected if another application attempts to use predicates. Previously we were using a predicate with a DELTAS_EQUAL comparison operation and relying on the MI_PREDICATE_DATA register being 0. Our code to initialize MI_PREDICATE_DATA to 0 was incorrect, so we were accidentally using whatever value was written there. Because the kernel does not initialize the MI_PREDICATE_DATA register on hardware context creation, we might inherit the value from whatever context was last running on the GPU (likely another process). The Haswell command parser also does not currently allow us to write the MI_PREDICATE_DATA register. Rather than fixing this and requiring an updated kernel, we switch to a different approach which uses a SRCS_EQUAL predicate that makes no assumptions about the states of any of the predicate registers. Fixes Piglit's spec/arb_indirect_parameters/tf-count-arrays test. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103085 Signed-off-by: Plamena Manolova Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_draw.c | 47 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 58145fad77..809e7221b2 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -875,7 +875,6 @@ brw_draw_prims(struct gl_context *ctx, struct brw_context *brw = brw_context(ctx); const struct gl_vertex_array **arrays = ctx->Array._DrawArrays; int predicate_state = brw->predicate.state; - int combine_op = MI_PREDICATE_COMBINEOP_SET; struct brw_transform_feedback_object *xfb_obj = (struct brw_transform_feedback_object *) gl_xfb_obj; @@ -919,49 +918,35 @@ brw_draw_prims(struct gl_context *ctx, * to it. */ -if (brw->draw.draw_params_count_bo && -predicate_state == BRW_PREDICATE_STATE_USE_BIT) { - /* We need to empty the MI_PREDICATE_DATA register since it might - * already be set. - */ - - BEGIN_BATCH(4); - OUT_BATCH(MI_PREDICATE_DATA); - OUT_BATCH(0u); - OUT_BATCH(MI_PREDICATE_DATA + 4); - OUT_BATCH(0u); - ADVANCE_BATCH(); - - /* We need to combine the results of both predicates.*/ - combine_op = MI_PREDICATE_COMBINEOP_AND; - } - for (i = 0; i < nr_prims; i++) { /* Implementation of ARB_indirect_parameters via predicates */ if (brw->draw.draw_params_count_bo) { - struct brw_bo *draw_id_bo = NULL; - uint32_t draw_id_offset; - - intel_upload_data(brw, [i].draw_id, 4, 4, _id_bo, - _id_offset); - brw_emit_pipe_control_flush(brw, PIPE_CONTROL_FLUSH_ENABLE); + /* Upload the current draw count from the draw parameters buffer to + * MI_PREDICATE_SRC0. + */ brw_load_register_mem(brw, MI_PREDICATE_SRC0, brw->draw.draw_params_count_bo, brw->draw.draw_params_count_offset); - brw_load_register_mem(brw, MI_PREDICATE_SRC1, draw_id_bo, - draw_id_offset); + /* Zero the top 32-bits of MI_PREDICATE_SRC0 */ + brw_load_register_imm32(brw, MI_PREDICATE_SRC0 + 4, 0); + /* Upload the id of the current primitive to MI_PREDICATE_SRC1. */ + brw_load_register_imm64(brw, MI_PREDICATE_SRC1, prims[i].draw_id); BEGIN_BATCH(1); - OUT_BATCH(GEN7_MI_PREDICATE | - MI_PREDICATE_LOADOP_LOADINV | combine_op | - MI_PREDICATE_COMPAREOP_DELTAS_EQUAL); + if (i == 0 && brw->predicate.state != BRW_PREDICATE_STATE_USE_BIT) { +OUT_BATCH(GEN7_MI_PREDICATE | MI_PREDICATE_LOADOP_LOADINV | + MI_PREDICATE_COMBINEOP_SET | + MI_PREDICATE_COMPAREOP_SRCS_EQUAL); + } else { +OUT_BATCH(GEN7_MI_PREDICATE | + MI_PREDICATE_LOADOP_LOAD | MI_PREDICATE_COMBINEOP_XOR | + MI_PREDICATE_COMPAREOP_SRCS_EQUAL); + } ADVANCE_BATCH(); brw->predicate.state = BRW_PREDICATE_STATE_USE_BIT; - - brw_bo_unreference(draw_id_bo); } brw_draw_single_prim(ctx, arrays, [i], i, xfb_obj, stream, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Don' t flag BRW_NEW_SURFACES unless some push constants are dirty.
Module: Mesa Branch: master Commit: 877dd14e88de6ee115617a2a6412e86ba67db443 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=877dd14e88de6ee115617a2a6412e86ba67db443 Author: Kenneth GraunkeDate: Fri Oct 20 15:38:52 2017 -0700 i965: Don't flag BRW_NEW_SURFACES unless some push constants are dirty. Due to a gaffe on my part, we were re-emitting all binding table entries on every single draw call. The push_constant_packets atom listens to BRW_NEW_DRAW_CALL, but skips emitting 3DSTATE_CONSTANT_XS for each stage unless stage_state->push_constants_dirty is true. However, it flagged BRW_NEW_SURFACES unconditionally at the end, by mistake. Instead, it should only flag it if we actually emit 3DSTATE_CONSTANT_XS for a stage. We can move it a few lines up, inside the loop - the early continues will skip over it if push constants aren't dirty for a stage. With INTEL_NO_HW=1 set, improves performance of GFXBench5 gl_driver_2 on Apollolake at 1280x720 by 1.01122% +/- 0.470723% (n=35). Reviewed-by: Rafael Antognolli --- src/mesa/drivers/dri/i965/genX_state_upload.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index 98f69522de..b7a6cd7361 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -3117,9 +3117,8 @@ genX(upload_push_constant_packets)(struct brw_context *brw) } stage_state->push_constants_dirty = false; + brw->ctx.NewDriverState |= GEN_GEN >= 9 ? BRW_NEW_SURFACES : 0; } - - brw->ctx.NewDriverState |= GEN_GEN >= 9 ? BRW_NEW_SURFACES : 0; } const struct brw_tracked_state genX(push_constant_packets) = { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel/genxml: Fix decoding of groups with fields smaller than a DWord.
Module: Mesa Branch: master Commit: 28fcf5cd9443ac688692c1f14e31cf4f43fd56d0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=28fcf5cd9443ac688692c1f14e31cf4f43fd56d0 Author: Kenneth GraunkeDate: Wed Oct 25 20:33:33 2017 -0700 intel/genxml: Fix decoding of groups with fields smaller than a DWord. Groups containing fields smaller than a DWord were not being decoded correctly. For example: gen_field_iterator_next would properly walk over each element of the array, incrementing group_iter, and calling iter_group_offset_bits() to advance to the proper DWord. However, the code to print the actual values only considered iter->field->start/end, which are 0 and 3 in the above example. So it would always fetch bits 3:0 of the current DWord when printing values, instead of advancing to each element of the array, printing bits 0-3, 4-7, 8-11, and so on. To fix this, we add new iter->start/end tracking, which properly advances for each instance of a group's field. Caught by Matt Turner while working on 3DSTATE_VF_COMPONENT_PACKING, with a patch to convert it to use an array of bitfields (the example above). This also fixes the decoding of 3DSTATE_SBE's "Attribute Active Component Format" fields. Reviewed-by: Jordan Justen --- src/intel/common/gen_decoder.c | 24 ++-- src/intel/common/gen_decoder.h | 2 ++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index cd1894b85f..3aeaece2ae 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -843,8 +843,12 @@ iter_advance_field(struct gen_field_iterator *iter) strncpy(iter->name, iter->field->name, sizeof(iter->name)); else memset(iter->name, 0, sizeof(iter->name)); - iter->dword = iter_group_offset_bits(iter, iter->group_iter) / 32 + - iter->field->start / 32; + + int group_member_offset = iter_group_offset_bits(iter, iter->group_iter); + + iter->start = group_member_offset + iter->field->start; + iter->end = group_member_offset + iter->field->end; + iter->dword = iter->start / 32; iter->struct_desc = NULL; return true; @@ -861,7 +865,7 @@ gen_field_iterator_next(struct gen_field_iterator *iter) if (!iter_advance_field(iter)) return false; - if ((iter->field->end - iter->field->start) > 32) + if ((iter->end - iter->start) > 32) v.qw = ((uint64_t) iter->p[iter->dword+1] << 32) | iter->p[iter->dword]; else v.qw = iter->p[iter->dword]; @@ -871,13 +875,13 @@ gen_field_iterator_next(struct gen_field_iterator *iter) switch (iter->field->type.kind) { case GEN_TYPE_UNKNOWN: case GEN_TYPE_INT: { - uint64_t value = field(v.qw, iter->field->start, iter->field->end); + uint64_t value = field(v.qw, iter->start, iter->end); snprintf(iter->value, sizeof(iter->value), "%"PRId64, value); enum_name = gen_get_enum_name(>field->inline_enum, value); break; } case GEN_TYPE_UINT: { - uint64_t value = field(v.qw, iter->field->start, iter->field->end); + uint64_t value = field(v.qw, iter->start, iter->end); snprintf(iter->value, sizeof(iter->value), "%"PRIu64, value); enum_name = gen_get_enum_name(>field->inline_enum, value); break; @@ -886,7 +890,7 @@ gen_field_iterator_next(struct gen_field_iterator *iter) const char *true_string = iter->print_colors ? "\e[0;35mtrue\e[0m" : "true"; snprintf(iter->value, sizeof(iter->value), "%s", - field(v.qw, iter->field->start, iter->field->end) ? + field(v.qw, iter->start, iter->end) ? true_string : "false"); break; } @@ -896,7 +900,7 @@ gen_field_iterator_next(struct gen_field_iterator *iter) case GEN_TYPE_ADDRESS: case GEN_TYPE_OFFSET: snprintf(iter->value, sizeof(iter->value), "0x%08"PRIx64, - field_address(v.qw, iter->field->start, iter->field->end)); + field_address(v.qw, iter->start, iter->end)); break; case GEN_TYPE_STRUCT: snprintf(iter->value, sizeof(iter->value), "", @@ -907,8 +911,8 @@ gen_field_iterator_next(struct gen_field_iterator *iter) break; case GEN_TYPE_UFIXED: snprintf(iter->value, sizeof(iter->value), "%f", - (float) field(v.qw, iter->field->start, - iter->field->end) / (1 << iter->field->type.f)); + (float) field(v.qw, iter->start, iter->end) / + (1 << iter->field->type.f)); break; case GEN_TYPE_SFIXED: /* FIXME: Sign extend extracted field. */ @@ -917,7 +921,7 @@ gen_field_iterator_next(struct gen_field_iterator *iter) case GEN_TYPE_MBO: break; case GEN_TYPE_ENUM: { - uint64_t value = field(v.qw, iter->field->start, iter->field->end); + uint64_t value = field(v.qw, iter->start,
Mesa (master): glsl: Fix bad formatting in a comment
Module: Mesa Branch: master Commit: 53c7b8bdca5c6ef8db511f979bc2ca6467ee82c6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=53c7b8bdca5c6ef8db511f979bc2ca6467ee82c6 Author: Ian RomanickDate: Thu Oct 26 15:32:09 2017 -0700 glsl: Fix bad formatting in a comment Trivial Signed-off-by: Ian Romanick --- src/compiler/glsl/ir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index 070d7b3ffd..d5a255eb8b 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -457,7 +457,7 @@ public: * * For the first declaration below, there will be an \c ir_variable named * "instance" whose type and whose instance_type will be the same -* \cglsl_type. For the second declaration, there will be an \c ir_variable +* \c glsl_type. For the second declaration, there will be an \c ir_variable * named "f" whose type is float and whose instance_type is B2. * * "instance" is an interface instance variable, but "f" is not. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): 31 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a77c763fe769b37d154585114b403b7755b9e17 Author: Eric AnholtDate: Fri Oct 27 15:52:22 2017 -0700 broadcom/vc5: Force blending to treat alpha as 1 for formats without alpha. Fixes fbo-blending-formats on RGB8 and 565. We will still need to demote blending to shader code in the MRT case to fix it in general, but that can be added when we start doing 32F blending (which also needs to be done in the shader). URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=61bb0df60e08d0b5707879c49beed899d46eaf9a Author: Eric Anholt Date: Fri Oct 27 14:41:35 2017 -0700 broadcom/vc5: Do BGRA vs RGBA swapping for the BLEND_CONSTANT_COLOR. Fixes many of the fbo-blending-formats tests. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e3c7beb1e60a47e1f5dd12d28ac3f328555a543 Author: Eric Anholt Date: Fri Oct 27 14:13:46 2017 -0700 broadcom/vc5: Pack clear colors according to the TLB internal format/type. The previous packing I did got us all the R*16F and R*32F formats, where the pipe format basically matched the TLB's format, but since the clear color will just be memcpyed to the TLB, we should be looking at its format for deciding how to pack. Fixes RGB565, RGB5_A1 and RGBA10 fbo-clear-formats tests and improves . URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=828299d1bd3f98179cd82939d25d919f2022541e Author: Eric Anholt Date: Mon Oct 30 10:13:52 2017 -0700 broadcom/vc5: Don't do r/b channel swapping on 565. The HW's format actually matches the gallium format. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e5df1897c8782a7d1bfbc11fa4bef47177db404 Author: Eric Anholt Date: Fri Oct 27 14:08:02 2017 -0700 broadcom/vc5: Use the proper gallium format for our RGB10_A2. This keeps us from needing our own reswizzling of the B vs R fields. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d1809a6d6ecbefa7b1ab2e28607adc9b85e8974 Author: Eric Anholt Date: Fri Oct 27 13:27:22 2017 -0700 broadcom/vc5: Add some comments about the texture/output format ordering. The output formats are consistent with their channels appearing from low to high in their name. Textures are interpreted the same way, but their names may have the channels swapped around. I'm retaining the texture names so that we are consistent with the documentation, but I want to leave a warning for others. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d6088f2a34570ef34d0e202c66d92dbe0f57994 Author: Eric Anholt Date: Thu Oct 26 16:03:59 2017 -0700 broadcom/vc5: Drop duplicated setup of clip_window_height_in_pixels. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b32786de6f78559615c1c28953fdd80c9751069 Author: Eric Anholt Date: Thu Oct 26 15:59:21 2017 -0700 broadcom/vc5: Don't forget to actually turn on stencil testing. I had the rest of stencil state set up, but forgot to actually enable it in the higher level configuration bits packet. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d2619a6b3d94a02b21fdc8fc49c1542e82bc7d8 Author: Eric Anholt Date: Thu Oct 26 15:40:38 2017 -0700 broadcom/vc5: Stop lowering negates to subs. In the case of fneg(0.0), we were getting back 0.0 instead of -0.0. We were also needing an immediate 0 value for ineg, when there's an opcode to do the job properly. Fixes fs-floatBitsToInt-neg.shader_test. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a797f0eb6371efb78bee5f5aea73c5cdcfbcd030 Author: Eric Anholt Date: Wed Oct 25 13:00:44 2017 -0700 broadcom/vc5: Set up MSAA texture type according to the internal format. It gets most of EXT_framebuffer_multisample-formats passing, but doesn't really work for texture views. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe6fc579cbdc040a9bd62170c3713546dd112ae5 Author: Eric Anholt Date: Wed Oct 25 12:51:04 2017 -0700 broadcom/vc5: Use the sampler view's format, not the resource's. This should help with texture views, though I just noticed this while reading the code. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ec4b4178f5df2353e97eb6e414040a46bfc728d Author: Eric Anholt Date: Wed Oct 25 12:29:51 2017 -0700 broadcom/vc5: Emit raw loads for MSAA buffers. Similar to stores, but we also need to emit dummy stores in between each load, to flush out the previous queued load. URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=464f1fb73301709cdb33600a7230db59427d1870 Author: Eric Anholt Date: Tue Oct 24 13:28:53 2017 -0700
Mesa (master): git_sha1_gen: create empty file in fallback path
Module: Mesa Branch: master Commit: 2117d0331020874c28bb66b0596467f960259eb7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2117d0331020874c28bb66b0596467f960259eb7 Author: Eric EngestromDate: Sun Oct 29 22:06:28 2017 + git_sha1_gen: create empty file in fallback path I missed this part in my conversion, the old stream redirection meant the file was always created. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103496 Fixes: 7088622e5fb506b64c90 "buildsys: move file regeneration logic to the script itself" Signed-off-by: Eric Engestrom Reviewed-by: Dylan Baker --- bin/git_sha1_gen.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/git_sha1_gen.py b/bin/git_sha1_gen.py index 7b9267b59e..68a87e72ec 100755 --- a/bin/git_sha1_gen.py +++ b/bin/git_sha1_gen.py @@ -45,3 +45,5 @@ if git_sha1: quit() with open(args.output, 'w') as git_sha1_h: git_sha1_h.write(new_sha1) +else: +open(args.output, 'w').close() ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: common: silence compiler warning
Module: Mesa Branch: master Commit: a1faf48636f438992b17be50dec656a0c74c5585 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1faf48636f438992b17be50dec656a0c74c5585 Author: Lionel LandwerlinDate: Fri Oct 27 17:44:14 2017 +0100 intel: common: silence compiler warning Signed-off-by: Lionel Landwerlin Reviewed-by: Jordan Justen --- src/intel/common/gen_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index 85880143f0..cd1894b85f 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -569,7 +569,7 @@ gen_spec_load(const struct gen_device_info *devinfo) { struct parser_context ctx; void *buf; - uint8_t *text_data; + uint8_t *text_data = NULL; uint32_t text_offset = 0, text_length = 0, total_length; uint32_t gen_10 = devinfo_to_gen(devinfo); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl/linker: Check that re-declared, inter-shader built-in blocks match
Module: Mesa Branch: master Commit: f9de7f55969e981f6e98a41fce04bc3a2a8280eb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9de7f55969e981f6e98a41fce04bc3a2a8280eb Author: Eduardo Lima MitevDate: Sun Mar 5 20:28:43 2017 +0100 glsl/linker: Check that re-declared, inter-shader built-in blocks match >From GLSL 4.5 spec, section "7.1 Built-In Language Variables", page 130 of the PDF states: "If multiple shaders using members of a built-in block belonging to the same interface are linked together in the same program, they must all redeclare the built-in block in the same way, as described in section 4.3.9 “Interface Blocks” for interface-block matching, or a link-time error will result." Fixes: * GL45-CTS.CommonBugs.CommonBug_PerVertexValidation v2 (Neil Roberts): Explicitly look for gl_PerVertex in the symbol tables instead of waiting to find a variable in the interface. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102677 Reviewed-by: Kenneth Graunke Signed-off-by: Eduardo Lima Mitev Signed-off-by: Neil Roberts --- src/compiler/glsl/link_interface_blocks.cpp | 29 + 1 file changed, 29 insertions(+) diff --git a/src/compiler/glsl/link_interface_blocks.cpp b/src/compiler/glsl/link_interface_blocks.cpp index 7037c7776d..510d4f71bb 100644 --- a/src/compiler/glsl/link_interface_blocks.cpp +++ b/src/compiler/glsl/link_interface_blocks.cpp @@ -364,6 +364,35 @@ validate_interstage_inout_blocks(struct gl_shader_program *prog, consumer->Stage != MESA_SHADER_FRAGMENT) || consumer->Stage == MESA_SHADER_GEOMETRY; + /* Check that block re-declarations of gl_PerVertex are compatible +* across shaders: From OpenGL Shading Language 4.5, section +* "7.1 Built-In Language Variables", page 130 of the PDF: +* +*"If multiple shaders using members of a built-in block belonging +* to the same interface are linked together in the same program, +* they must all redeclare the built-in block in the same way, as +* described in section 4.3.9 “Interface Blocks” for interface-block +* matching, or a link-time error will result." +* +* This is done explicitly outside of iterating the member variable +* declarations because it is possible that the variables are not used and +* so they would have been optimised out. +*/ + const glsl_type *consumer_iface = + consumer->symbols->get_interface("gl_PerVertex", + ir_var_shader_in); + + const glsl_type *producer_iface = + producer->symbols->get_interface("gl_PerVertex", + ir_var_shader_out); + + if (producer_iface && consumer_iface && + interstage_member_mismatch(prog, consumer_iface, producer_iface)) { + linker_error(prog, "Incompatible or missing gl_PerVertex re-declaration " + "in consecutive shaders"); + return; + } + /* Add output interfaces from the producer to the symbol table. */ foreach_in_list(ir_instruction, node, producer->ir) { ir_variable *var = node->as_variable(); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl_parser_extra: Add utility to copy symbols between symbol tables
Module: Mesa Branch: master Commit: 4c62a270a99d443316e29020377465a90a6968c0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c62a270a99d443316e29020377465a90a6968c0 Author: Eduardo Lima MitevDate: Sun Mar 5 20:28:41 2017 +0100 glsl_parser_extra: Add utility to copy symbols between symbol tables Some symbols gathered in the symbols table during parsing are needed later for the compile and link stages, so they are moved along the process. Currently, only functions and non-temporary variables are copied between symbol tables. However, the built-in gl_PerVertex interface blocks are also needed during the linking stage (the last step), to match re-declared blocks of inter-stage shaders. This patch adds a new utility function that will factorize current code that copies functions and variables between two symbol tables, and in addition will copy explicitly declared gl_PerVertex blocks too. The function will be used in a subsequent patch. v2 (Neil Roberts): Allow the src symbol table to be NULL and explicitly copy the gl_PerVertex symbols in case they are not referenced in the exec_list. Reviewed-by: Kenneth Graunke Signed-off-by: Eduardo Lima Mitev Signed-off-by: Neil Roberts --- src/compiler/glsl/glsl_parser_extras.cpp | 43 src/compiler/glsl/glsl_parser_extras.h | 5 2 files changed, 48 insertions(+) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 94ceb5eb87..97c7b4d782 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1852,6 +1852,49 @@ set_shader_inout_layout(struct gl_shader *shader, shader->bound_image = state->bound_image_specified; } +/* src can be NULL if only the symbols found in the exec_list should be + * copied + */ +void +_mesa_glsl_copy_symbols_from_table(struct exec_list *shader_ir, + struct glsl_symbol_table *src, + struct glsl_symbol_table *dest) +{ + foreach_in_list (ir_instruction, ir, shader_ir) { + switch (ir->ir_type) { + case ir_type_function: + dest->add_function((ir_function *) ir); + break; + case ir_type_variable: { + ir_variable *const var = (ir_variable *) ir; + + if (var->data.mode != ir_var_temporary) +dest->add_variable(var); + break; + } + default: + break; + } + } + + if (src != NULL) { + /* Explicitly copy the gl_PerVertex interface definitions because these + * are needed to check they are the same during the interstage link. + * They can’t necessarily be found via the exec_list because the members + * might not be referenced. The GL spec still requires that they match + * in that case. + */ + const glsl_type *iface = + src->get_interface("gl_PerVertex", ir_var_shader_in); + if (iface) + dest->add_interface(iface->name, iface, ir_var_shader_in); + + iface = src->get_interface("gl_PerVertex", ir_var_shader_out); + if (iface) + dest->add_interface(iface->name, iface, ir_var_shader_out); + } +} + extern "C" { static void diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index fb35813087..2e98bc72e7 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -948,6 +948,11 @@ extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log, extern void _mesa_destroy_shader_compiler(void); extern void _mesa_destroy_shader_compiler_caches(void); +extern void +_mesa_glsl_copy_symbols_from_table(struct exec_list *shader_ir, + struct glsl_symbol_table *src, + struct glsl_symbol_table *dest); + #ifdef __cplusplus } #endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Use the utility function to copy symbols between symbol tables
Module: Mesa Branch: master Commit: f5fe99ac85e15b705612bd9e7599cc974c2a121b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5fe99ac85e15b705612bd9e7599cc974c2a121b Author: Eduardo Lima MitevDate: Sun Mar 5 20:28:42 2017 +0100 glsl: Use the utility function to copy symbols between symbol tables This effectively factorizes a couple of similar routines. v2 (Neil Roberts): Non-trivial rebase on master Reviewed-by: Kenneth Graunke Signed-off-by: Eduardo Lima Mitev Signed-off-by: Neil Roberts --- src/compiler/glsl/glsl_parser_extras.cpp | 25 +++-- src/compiler/glsl/linker.cpp | 16 +++- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 97c7b4d782..822301a584 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1968,6 +1968,7 @@ do_late_parsing_checks(struct _mesa_glsl_parse_state *state) static void opt_shader_and_create_symbol_table(struct gl_context *ctx, + struct glsl_symbol_table *source_symbols, struct gl_shader *shader) { assert(shader->CompileStatus != compile_failure && @@ -2025,22 +2026,8 @@ opt_shader_and_create_symbol_table(struct gl_context *ctx, * We don't have to worry about types or interface-types here because those * are fly-weights that are looked up by glsl_type. */ - foreach_in_list (ir_instruction, ir, shader->ir) { - switch (ir->ir_type) { - case ir_type_function: - shader->symbols->add_function((ir_function *) ir); - break; - case ir_type_variable: { - ir_variable *const var = (ir_variable *) ir; - - if (var->data.mode != ir_var_temporary) -shader->symbols->add_variable(var); - break; - } - default: - break; - } - } + _mesa_glsl_copy_symbols_from_table(shader->ir, source_symbols, + shader->symbols); } void @@ -2077,7 +2064,9 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, return; if (shader->CompileStatus == compiled_no_opts) { - opt_shader_and_create_symbol_table(ctx, shader); + opt_shader_and_create_symbol_table(ctx, +NULL, /* source_symbols */ +shader); shader->CompileStatus = compile_success; return; } @@ -2138,7 +2127,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, lower_subroutine(shader->ir, state); if (!ctx->Cache || force_recompile) - opt_shader_and_create_symbol_table(ctx, shader); + opt_shader_and_create_symbol_table(ctx, state->symbols, shader); else { reparent_ir(shader->ir, shader->ir); shader->CompileStatus = compiled_no_opts; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index f827b68555..004529157e 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1255,21 +1255,11 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog, * Populates a shaders symbol table with all global declarations */ static void -populate_symbol_table(gl_linked_shader *sh) +populate_symbol_table(gl_linked_shader *sh, glsl_symbol_table *symbols) { sh->symbols = new(sh) glsl_symbol_table; - foreach_in_list(ir_instruction, inst, sh->ir) { - ir_variable *var; - ir_function *func; - - if ((func = inst->as_function()) != NULL) { - sh->symbols->add_function(func); - } else if ((var = inst->as_variable()) != NULL) { - if (var->data.mode != ir_var_temporary) -sh->symbols->add_variable(var); - } - } + _mesa_glsl_copy_symbols_from_table(sh->ir, symbols, sh->symbols); } @@ -2288,7 +2278,7 @@ link_intrastage_shaders(void *mem_ctx, link_bindless_layout_qualifiers(prog, shader_list, num_shaders); - populate_symbol_table(linked); + populate_symbol_table(linked, shader_list[0]->symbols); /* The pointer to the main function in the final linked shader (i.e., the * copy of the original shader that contained the main function). ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: remove unused variable
Module: Mesa Branch: master Commit: ceaad79f8593007ca387ae06460a70ae606314eb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ceaad79f8593007ca387ae06460a70ae606314eb Author: Eric EngestromDate: Mon Oct 30 10:35:34 2017 + i965: remove unused variable Fixes: 2c873060d3578c7004c0 "i965: Delete unused brw_vs_prog_data::nr_attributes field." Cc: Kenneth Graunke Signed-off-by: Eric Engestrom Reviewed-by: Eduardo Lima Mitev --- src/intel/compiler/brw_vec4.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp index 4a87b28822..c21d3f49c2 100644 --- a/src/intel/compiler/brw_vec4.cpp +++ b/src/intel/compiler/brw_vec4.cpp @@ -2815,9 +2815,6 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data, nr_attribute_slots++; } - unsigned nr_attributes = nr_attribute_slots - - DIV_ROUND_UP(_mesa_bitcount_64(shader->info.double_inputs_read), 2); - /* The 3DSTATE_VS documentation lists the lower bound on "Vertex URB Entry * Read Length" as 1 in vec4 mode, and 0 in SIMD8 mode. Empirically, in * vec4 mode, the hardware appears to wedge unless we read something. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meson: wire up egl/android
Module: Mesa Branch: master Commit: c5ec1556859b7d33637c9fad13d3473c7b2f9eb3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5ec1556859b7d33637c9fad13d3473c7b2f9eb3 Author: Eric EngestromDate: Tue Oct 24 16:08:15 2017 +0100 meson: wire up egl/android Cc: Rob Herring Cc: Tomasz Figa Signed-off-by: Eric Engestrom Reviewed-by: Dylan Baker --- meson.build | 15 --- src/egl/meson.build | 5 - 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 8988deae78..24d997b3e0 100644 --- a/meson.build +++ b/meson.build @@ -150,7 +150,7 @@ endif # TODO: other OSes with_dri_platform = 'drm' -# TODO: android platform +with_platform_android = false with_platform_wayland = false with_platform_x11 = false with_platform_drm = false @@ -159,6 +159,7 @@ egl_native_platform = '' _platforms = get_option('platforms') if _platforms != '' _split = _platforms.split(',') + with_platform_android = _split.contains('android') with_platform_x11 = _split.contains('x11') with_platform_wayland = _split.contains('wayland') with_platform_drm = _split.contains('drm') @@ -250,8 +251,8 @@ if _vulkan_drivers != '' with_intel_vk = _split.contains('intel') with_amd_vk = _split.contains('amd') with_any_vk = with_amd_vk or with_intel_vk - if not (with_platform_x11 or with_platform_wayland) -error('Vulkan requires at least one platform (x11, wayland)') + if not (with_platform_x11 or with_platform_wayland or with_platform_android) +error('Vulkan requires at least one platform (x11, wayland, android)') endif endif @@ -328,6 +329,14 @@ endif if with_platform_surfaceless pre_args += '-DHAVE_SURFACELESS_PLATFORM' endif +if with_platform_android + dep_android = [ +dependency('cutils'), +dependency('hardware'), +dependency('sync'), + ] + pre_args += '-DHAVE_ANDROID_PLATFORM' +endif prog_python2 = find_program('python2') has_mako = run_command(prog_python2, '-c', 'import mako') diff --git a/src/egl/meson.build b/src/egl/meson.build index ea7ae06761..cc51671f9d 100644 --- a/src/egl/meson.build +++ b/src/egl/meson.build @@ -129,7 +129,10 @@ if with_platform_wayland 'wayland/wayland-egl', 'wayland/wayland-drm', ) endif -# TODO: android +if with_platform_android + deps_for_egl += dep_android + files_egl += files('drivers/dri2/platform_android.c') +endif # TODO: glvnd ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl/parser: Silence unused parameter warning
Module: Mesa Branch: master Commit: fc07ab165b1aaf6a64e61ade9eb605165146cd96 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc07ab165b1aaf6a64e61ade9eb605165146cd96 Author: Ian RomanickDate: Mon Sep 25 18:07:50 2017 -0700 glsl/parser: Silence unused parameter warning glsl/glsl_parser_extras.cpp: In constructor ‘ast_struct_specifier::ast_struct_specifier(void*, const char*, ast_declarator_list*)’: glsl/glsl_parser_extras.cpp:1675:50: warning: unused parameter ‘lin_ctx’ [-Wunused-parameter] ast_struct_specifier::ast_struct_specifier(void *lin_ctx, const char *identifier, ^~~ Signed-off-by: Ian Romanick Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/ast.h | 4 ++-- src/compiler/glsl/glsl_parser.yy | 4 ++-- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h index 3bf4b08580..1be86ac17d 100644 --- a/src/compiler/glsl/ast.h +++ b/src/compiler/glsl/ast.h @@ -832,8 +832,8 @@ class ast_declarator_list; class ast_struct_specifier : public ast_node { public: - ast_struct_specifier(void *lin_ctx, const char *identifier, - ast_declarator_list *declarator_list); + ast_struct_specifier(const char *identifier, +ast_declarator_list *declarator_list); virtual void print(void) const; virtual ir_rvalue *hir(exec_list *instructions, diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 7b93d34fa3..3e555cf356 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -2377,14 +2377,14 @@ struct_specifier: STRUCT any_identifier '{' struct_declaration_list '}' { void *ctx = state->linalloc; - $$ = new(ctx) ast_struct_specifier(ctx, $2, $4); + $$ = new(ctx) ast_struct_specifier($2, $4); $$->set_location_range(@2, @5); state->symbols->add_type($2, glsl_type::void_type); } | STRUCT '{' struct_declaration_list '}' { void *ctx = state->linalloc; - $$ = new(ctx) ast_struct_specifier(ctx, NULL, $3); + $$ = new(ctx) ast_struct_specifier(NULL, $3); $$->set_location_range(@2, @4); } ; diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 51d835bc53..77c0ea206f 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1672,7 +1672,7 @@ ast_struct_specifier::print(void) const } -ast_struct_specifier::ast_struct_specifier(void *lin_ctx, const char *identifier, +ast_struct_specifier::ast_struct_specifier(const char *identifier, ast_declarator_list *declarator_list) { if (identifier == NULL) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl/parser: Return the glsl_type object from the lexer
Module: Mesa Branch: master Commit: 747c057530a1da32860f3881ca73a0d648e8f317 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=747c057530a1da32860f3881ca73a0d648e8f317 Author: Ian RomanickDate: Wed Sep 20 16:05:54 2017 -0500 glsl/parser: Return the glsl_type object from the lexer This allows us to use a single token for every built-in type except void. textdata bss dec hex filename 8275163 269336 294072 8838571 86ddab 32-bit i965_dri.so before 8255243 268856 294072 8818171 868dfb 32-bit i965_dri.so after 7836963 346552 420592 8604107 8349cb 64-bit i965_dri.so before 7815195 345592 420592 8581379 82f103 64-bit i965_dri.so after Yes, the 64-bit binary shrinks by 21k. Signed-off-by: Ian Romanick Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/glsl_lexer.ll | 304 ++- src/compiler/glsl/glsl_parser.yy | 160 ++--- 2 files changed, 182 insertions(+), 282 deletions(-) diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll index bdd8df16f9..5dad6eeb04 100644 --- a/src/compiler/glsl/glsl_lexer.ll +++ b/src/compiler/glsl/glsl_lexer.ll @@ -87,6 +87,34 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *, } while (0) /** + * Like KEYWORD_WITH_ALT, but used for built-in GLSL types + */ +#define TYPE_WITH_ALT(reserved_glsl, reserved_glsl_es, \ + allowed_glsl, allowed_glsl_es,\ + alt_expr, gtype) \ + do { \ + if (yyextra->is_version(allowed_glsl, allowed_glsl_es) \ + || (alt_expr)) { \ +yylval->type = gtype; \ +return BASIC_TYPE_TOK; \ + } else if (yyextra->is_version(reserved_glsl,\ + reserved_glsl_es)) { \ +_mesa_glsl_error(yylloc, yyextra, \ + "illegal use of reserved word `%s'", yytext); \ +return ERROR_TOK; \ + } else { \ +return classify_identifier(yyextra, yytext, yyleng, yylval); \ + } \ + } while (0) + +#define TYPE(reserved_glsl, reserved_glsl_es, \ + allowed_glsl, allowed_glsl_es,\ + gtype)\ + TYPE_WITH_ALT(reserved_glsl, reserved_glsl_es, \ + allowed_glsl, allowed_glsl_es, \ + false, gtype) + +/** * A macro for handling keywords that have been present in GLSL since * its origin, but were changed into reserved words in GLSL 3.00 ES. */ @@ -101,6 +129,21 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *, } \ } while (0) +/** + * Like DEPRECATED_ES_KEYWORD, but for types + */ +#define DEPRECATED_ES_TYPE(gtype) \ + do { \ + if (yyextra->is_version(0, 300)) { \ +_mesa_glsl_error(yylloc, yyextra, \ + "illegal use of reserved word `%s'", yytext); \ +return ERROR_TOK; \ + } else { \ +yylval->type = gtype; \ + return BASIC_TYPE_TOK; \ + } \ + } while (0) + static int literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state, YYSTYPE *lval, YYLTYPE *lloc, int base) @@ -285,10 +328,10 @@ HASH ^{SPC}#{SPC} attribute DEPRECATED_ES_KEYWORD(ATTRIBUTE); const return CONST_TOK; -bool return BOOL_TOK; -float return FLOAT_TOK; -intreturn INT_TOK; -uint KEYWORD(130, 300, 130, 300, UINT_TOK); +bool { yylval->type = glsl_type::bool_type; return BASIC_TYPE_TOK; } +float { yylval->type = glsl_type::float_type; return BASIC_TYPE_TOK; } +int{ yylval->type = glsl_type::int_type; return BASIC_TYPE_TOK; } +uint TYPE(130, 300, 130, 300,
Mesa (master): glsl/parser: Move anonymous struct name handling to the parser
Module: Mesa Branch: master Commit: 792acfc44aabc09a19a1d2ef77369159ddb41e66 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=792acfc44aabc09a19a1d2ef77369159ddb41e66 Author: Ian RomanickDate: Mon Sep 25 20:29:35 2017 -0700 glsl/parser: Move anonymous struct name handling to the parser There are two callers of the constructor, and they are right next to each other. Move the "#anon_struct" name handling to the parser so that the conditional can be removed. I've also deleted part of the comment (about the memory leak) because I don't think it's quite accurate or relevant. textdata bss dec hex filename 8310399 269336 294072 8873807 87674f 32-bit i965_dri.so before 8310339 269336 294072 8873747 876713 32-bit i965_dri.so after 7845611 346552 420592 8612755 836b93 64-bit i965_dri.so before 7845579 346552 420592 8612723 836b73 64-bit i965_dri.so after Signed-off-by: Ian Romanick Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/glsl_parser.yy | 10 +- src/compiler/glsl/glsl_parser_extras.cpp | 15 ++- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 3e555cf356..58bbf6f838 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -2384,7 +2384,15 @@ struct_specifier: | STRUCT '{' struct_declaration_list '}' { void *ctx = state->linalloc; - $$ = new(ctx) ast_struct_specifier(NULL, $3); + + /* All anonymous structs have the same name. This simplifies matching of + * globals whose type is an unnamed struct. + * + * It also avoids a memory leak when the same shader is compiled over and + * over again. + */ + $$ = new(ctx) ast_struct_specifier("#anon_struct", $3); + $$->set_location_range(@2, @4); } ; diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 77c0ea206f..94ceb5eb87 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1674,21 +1674,10 @@ ast_struct_specifier::print(void) const ast_struct_specifier::ast_struct_specifier(const char *identifier, ast_declarator_list *declarator_list) + : name(identifier), layout(NULL), declarations(), is_declaration(true), + type(NULL) { - if (identifier == NULL) { - /* All anonymous structs have the same name. This simplifies matching of - * globals whose type is an unnamed struct. - * - * It also avoids a memory leak when the same shader is compiled over and - * over again. - */ - identifier = "#anon_struct"; - } - name = identifier; this->declarations.push_degenerate_list_at_head(_list->link); - is_declaration = true; - layout = NULL; - type = NULL; } void ast_subroutine_list::print(void) const ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl/parser: Allocate identifier inside classify_identifier
Module: Mesa Branch: master Commit: 4171900cf15f2c81a1f119e1fb92772f6c355199 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4171900cf15f2c81a1f119e1fb92772f6c355199 Author: Ian RomanickDate: Thu Sep 21 12:14:04 2017 -0500 glsl/parser: Allocate identifier inside classify_identifier Passing YYSTYPE into classify_identifier enables a later patch. textdata bss dec hex filename 8310339 269336 294072 8873747 876713 32-bit i965_dri.so before 8275163 269336 294072 8838571 86ddab 32-bit i965_dri.so after 7845579 346552 420592 8612723 836b73 64-bit i965_dri.so before 7836963 346552 420592 8604107 8349cb 64-bit i965_dri.so after Yes, the 64-bit binary shrinks by 8k. Signed-off-by: Ian Romanick Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/glsl_lexer.ll | 44 ++--- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll index 56519bf92d..bdd8df16f9 100644 --- a/src/compiler/glsl/glsl_lexer.ll +++ b/src/compiler/glsl/glsl_lexer.ll @@ -28,7 +28,8 @@ #include "glsl_parser_extras.h" #include "glsl_parser.h" -static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); +static int classify_identifier(struct _mesa_glsl_parse_state *, const char *, + unsigned name_len, YYSTYPE *output); #ifdef _MSC_VER #define YY_NO_UNISTD_H @@ -81,14 +82,7 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); "illegal use of reserved word `%s'", yytext); \ return ERROR_TOK; \ } else { \ -/* We're not doing linear_strdup here, to avoid an implicit\ - * call on strlen() for the length of the string, as this is \ - * already found by flex and stored in yyleng */ \ -void *mem_ctx = yyextra->linalloc; \ - char *id = (char *) linear_alloc_child(mem_ctx, yyleng + 1); \ - memcpy(id, yytext, yyleng + 1);\ - yylval->identifier = id; \ -return classify_identifier(yyextra, yytext); \ +return classify_identifier(yyextra, yytext, yyleng, yylval); \ } \ } while (0) @@ -460,15 +454,7 @@ layout { || yyextra->ARB_tessellation_shader_enable) { return LAYOUT_TOK; } else { - /* We're not doing linear_strdup here, to avoid an implicit call - * on strlen() for the length of the string, as this is already - * found by flex and stored in yyleng - */ - void *mem_ctx = yyextra->linalloc; - char *id = (char *) linear_alloc_child(mem_ctx, yyleng + 1); - memcpy(id, yytext, yyleng + 1); - yylval->identifier = id; - return classify_identifier(yyextra, yytext); + return classify_identifier(yyextra, yytext, yyleng, yylval); } } @@ -637,21 +623,12 @@ u64vec4 KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, U64V [_a-zA-Z][_a-zA-Z0-9]* { struct _mesa_glsl_parse_state *state = yyextra; - void *ctx = state->linalloc; if (state->es_shader && yyleng > 1024) { _mesa_glsl_error(yylloc, state, "Identifier `%s' exceeds 1024 characters", yytext); - } else { - /* We're not doing linear_strdup here, to avoid an implicit call - * on strlen() for the length of the string, as this is already - * found by flex and stored in yyleng - */ - char *id = (char *) linear_alloc_child(ctx, yyleng + 1); - memcpy(id, yytext, yyleng + 1); - yylval->identifier = id; } - return classify_identifier(state, yytext); + return classify_identifier(state, yytext, yyleng, yylval); } \. { struct _mesa_glsl_parse_state *state = yyextra; @@ -663,8 +640,17 @@ u64vec4KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, U64V
Mesa (master): glsl/parser: Track built-in types using the glsl_type directly
Module: Mesa Branch: master Commit: 34f7e761bc61d3086c1e4e42285c31678b256107 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=34f7e761bc61d3086c1e4e42285c31678b256107 Author: Ian RomanickDate: Wed Sep 20 16:19:15 2017 -0500 glsl/parser: Track built-in types using the glsl_type directly Without the lexer changes, tests/glslparsertest/glsl2/tex_rect-02.frag fails. Before this change, the parser would determine that sampler2DRect is not a valid type because the call to state->symbols->get_type() in ast_type_specifier::glsl_type() would return NULL. Since ast_type_specifier::glsl_type() is now going to return the glsl_type pointer that it received from the lexer, it doesn't have an opportunity to generate an error. textdata bss dec hex filename 8255243 268856 294072 8818171 868dfb 32-bit i965_dri.so before 8255291 268856 294072 8818219 868e2b 32-bit i965_dri.so after 7815195 345592 420592 8581379 82f103 64-bit i965_dri.so before 7815339 345592 420592 8581523 82f193 64-bit i965_dri.so after Signed-off-by: Ian Romanick Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/ast.h | 13 +++-- src/compiler/glsl/ast_to_hir.cpp | 4 +++- src/compiler/glsl/glsl_lexer.ll | 21 + src/compiler/glsl/glsl_parser.yy | 2 +- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h index 1be86ac17d..eee2248281 100644 --- a/src/compiler/glsl/ast.h +++ b/src/compiler/glsl/ast.h @@ -27,6 +27,7 @@ #include "list.h" #include "glsl_parser_extras.h" +#include "compiler/glsl_types.h" struct _mesa_glsl_parse_state; @@ -853,7 +854,7 @@ class ast_type_specifier : public ast_node { public: /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) - : type_name(name), structure(NULL), array_specifier(NULL), + : type(NULL), type_name(name), structure(NULL), array_specifier(NULL), default_precision(ast_precision_none) { /* empty */ @@ -861,12 +862,19 @@ public: /** Construct a type specifier from a structure definition */ ast_type_specifier(ast_struct_specifier *s) - : type_name(s->name), structure(s), array_specifier(NULL), + : type(NULL), type_name(s->name), structure(s), array_specifier(NULL), default_precision(ast_precision_none) { /* empty */ } + ast_type_specifier(const glsl_type *t) + : type(t), type_name(t->name), structure(NULL), array_specifier(NULL), +default_precision(ast_precision_none) + { + /* empty */ + } + const struct glsl_type *glsl_type(const char **name, struct _mesa_glsl_parse_state *state) const; @@ -875,6 +883,7 @@ public: ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *); + const struct glsl_type *type; const char *type_name; ast_struct_specifier *structure; diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index d7c8b47f9d..6090ee9257 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -2361,7 +2361,9 @@ ast_type_specifier::glsl_type(const char **name, { const struct glsl_type *type; - if (structure) + if (this->type != NULL) + type = this->type; + else if (structure) type = structure->type; else type = state->symbols->get_type(this->type_name); diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll index 5dad6eeb04..d2278ba01d 100644 --- a/src/compiler/glsl/glsl_lexer.ll +++ b/src/compiler/glsl/glsl_lexer.ll @@ -132,18 +132,23 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *, /** * Like DEPRECATED_ES_KEYWORD, but for types */ -#define DEPRECATED_ES_TYPE(gtype) \ +#define DEPRECATED_ES_TYPE_WITH_ALT(alt_expr, gtype) \ do { \ if (yyextra->is_version(0, 300)) { \ -_mesa_glsl_error(yylloc, yyextra, \ - "illegal use of reserved word `%s'", yytext); \ -return ERROR_TOK; \ - } else { \ -yylval->type = gtype; \ + _mesa_glsl_error(yylloc, yyextra, \ + "illegal use of reserved word `%s'", yytext); \ + return ERROR_TOK; \ + } else if (alt_expr) { \ + yylval->type = gtype; \ return BASIC_TYPE_TOK;
Mesa (master): glsl: Remove ir_binop_greater and ir_binop_lequal expressions
Module: Mesa Branch: master Commit: 6403efbe7458d05cf117adb41c8a152ed6e28bdd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6403efbe7458d05cf117adb41c8a152ed6e28bdd Author: Ian RomanickDate: Fri May 8 12:55:00 2015 -0700 glsl: Remove ir_binop_greater and ir_binop_lequal expressions NIR does not have these instructions. TGSI and Mesa IR both implement them using < and >=, repsectively. Removing them deletes a bunch of code and means I don't have to add code to the SPIR-V generator for them. v2: Rebase on 2+ years of change... and fix a major bug added in the rebase. textdata bss dec hex filename 8255291 268856 294072 8818219 868e2b 32-bit i965_dri.so before 8254235 268856 294072 8817163 868a0b 32-bit i965_dri.so after 7815339 345592 420592 8581523 82f193 64-bit i965_dri.so before 7813995 345560 420592 8580147 82ec33 64-bit i965_dri.so after Signed-off-by: Ian Romanick Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/ast_to_hir.cpp | 13 -- src/compiler/glsl/builtin_functions.cpp| 23 - src/compiler/glsl/glsl_to_nir.cpp | 24 - src/compiler/glsl/ir.cpp | 2 -- src/compiler/glsl/ir_builder.cpp | 4 +-- src/compiler/glsl/ir_builder_print_visitor.cpp | 2 -- src/compiler/glsl/ir_expression_operation.py | 2 -- src/compiler/glsl/ir_validate.cpp | 2 -- src/compiler/glsl/loop_analysis.cpp| 23 +++-- src/compiler/glsl/opt_algebraic.cpp| 4 --- .../glsl/tests/lower_jumps/create_test_cases.py| 2 +- src/intel/compiler/brw_shader.cpp | 4 --- src/mesa/program/ir_to_mesa.cpp| 30 -- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 20 --- 14 files changed, 39 insertions(+), 116 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 6090ee9257..441404f86d 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -1337,8 +1337,8 @@ ast_expression::do_hir(exec_list *instructions, ir_binop_lshift, ir_binop_rshift, ir_binop_less, - ir_binop_greater, - ir_binop_lequal, + ir_binop_less,/* This is correct. See the ast_greater case below. */ + ir_binop_gequal, /* This is correct. See the ast_lequal case below. */ ir_binop_gequal, ir_binop_all_equal, ir_binop_any_nequal, @@ -1487,6 +1487,15 @@ ast_expression::do_hir(exec_list *instructions, assert(type->is_error() || (type->is_boolean() && type->is_scalar())); + /* Like NIR, GLSL IR does not have opcodes for > or <=. Instead, swap + * the arguments and use < or >=. + */ + if (this->oper == ast_greater || this->oper == ast_lequal) { + ir_rvalue *const tmp = op[0]; + op[0] = op[1]; + op[1] = tmp; + } + result = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); error_emitted = type->is_error(); diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index 9df9671f13..530cdc0264 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -744,7 +744,8 @@ private: ir_expression_operation opcode, const glsl_type *return_type, const glsl_type *param0_type, -const glsl_type *param1_type); +const glsl_type *param1_type, +bool swap_operands = false); #define B0(X) ir_function_signature *_##X(); #define B1(X) ir_function_signature *_##X(const glsl_type *); @@ -3634,12 +3635,18 @@ builtin_builder::binop(builtin_available_predicate avail, ir_expression_operation opcode, const glsl_type *return_type, const glsl_type *param0_type, - const glsl_type *param1_type) + const glsl_type *param1_type, + bool swap_operands) { ir_variable *x = in_var(param0_type, "x"); ir_variable *y = in_var(param1_type, "y"); MAKE_SIG(return_type, avail, 2, x, y); - body.emit(ret(expr(opcode, x, y))); + + if (swap_operands) + body.emit(ret(expr(opcode, y, x))); + else + body.emit(ret(expr(opcode, x, y))); + return sig; } @@ -4972,16 +4979,18 @@ ir_function_signature * builtin_builder::_lessThanEqual(builtin_available_predicate avail, const glsl_type *type) { - return binop(avail, ir_binop_lequal, -
Mesa (master): glsl: Silence unused parameter warnings
Module: Mesa Branch: master Commit: d70e8ef1c19ed4f1899c829f79be318deb22704e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d70e8ef1c19ed4f1899c829f79be318deb22704e Author: Ian RomanickDate: Mon Sep 25 18:06:17 2017 -0700 glsl: Silence unused parameter warnings glsl/standalone_scaffolding.cpp: In function ‘GLbitfield _mesa_program_state_flags(const gl_state_index*)’: glsl/standalone_scaffolding.cpp:103:66: warning: unused parameter ‘state’ [-Wunused-parameter] _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]) ^ glsl/standalone_scaffolding.cpp: In function ‘char* _mesa_program_state_string(const gl_state_index*)’: glsl/standalone_scaffolding.cpp:109:67: warning: unused parameter ‘state’ [-Wunused-parameter] _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) ^ glsl/standalone_scaffolding.cpp: In function ‘void _mesa_delete_shader(gl_context*, gl_shader*)’: glsl/standalone_scaffolding.cpp:115:40: warning: unused parameter ‘ctx’ [-Wunused-parameter] _mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh) ^~~ glsl/standalone_scaffolding.cpp: In function ‘void _mesa_delete_linked_shader(gl_context*, gl_linked_shader*)’: glsl/standalone_scaffolding.cpp:123:47: warning: unused parameter ‘ctx’ [-Wunused-parameter] _mesa_delete_linked_shader(struct gl_context *ctx, ^~~ Signed-off-by: Ian Romanick Reviewed-by: Nicolai Hähnle --- src/compiler/glsl/standalone.cpp | 7 --- src/compiler/glsl/standalone_scaffolding.cpp | 8 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index 2f74813182..85e94a1095 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -101,7 +101,7 @@ private: }; static void -init_gl_program(struct gl_program *prog, GLenum target, bool is_arb_asm) +init_gl_program(struct gl_program *prog, bool is_arb_asm) { prog->RefCount = 1; prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; @@ -109,7 +109,8 @@ init_gl_program(struct gl_program *prog, GLenum target, bool is_arb_asm) } static struct gl_program * -new_program(struct gl_context *ctx, GLenum target, GLuint id, bool is_arb_asm) +new_program(UNUSED struct gl_context *ctx, GLenum target, +UNUSED GLuint id, bool is_arb_asm) { switch (target) { case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ @@ -119,7 +120,7 @@ new_program(struct gl_context *ctx, GLenum target, GLuint id, bool is_arb_asm) case GL_FRAGMENT_PROGRAM_ARB: case GL_COMPUTE_PROGRAM_NV: { struct gl_program *prog = rzalloc(NULL, struct gl_program); - init_gl_program(prog, target, is_arb_asm); + init_gl_program(prog, is_arb_asm); return prog; } default: diff --git a/src/compiler/glsl/standalone_scaffolding.cpp b/src/compiler/glsl/standalone_scaffolding.cpp index bc91682636..34065a9fe1 100644 --- a/src/compiler/glsl/standalone_scaffolding.cpp +++ b/src/compiler/glsl/standalone_scaffolding.cpp @@ -100,19 +100,19 @@ _mesa_new_shader(GLuint name, gl_shader_stage stage) } GLbitfield -_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]) +_mesa_program_state_flags(UNUSED const gl_state_index state[STATE_LENGTH]) { return 0; } char * -_mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) +_mesa_program_state_string(UNUSED const gl_state_index state[STATE_LENGTH]) { return NULL; } void -_mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh) +_mesa_delete_shader(struct gl_context *, struct gl_shader *sh) { free((void *)sh->Source); free(sh->Label); @@ -120,7 +120,7 @@ _mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh) } void -_mesa_delete_linked_shader(struct gl_context *ctx, +_mesa_delete_linked_shader(struct gl_context *, struct gl_linked_shader *sh) { ralloc_free(sh); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): Android: move drivers' symlinks to /vendor (v2)
Module: Mesa Branch: master Commit: 7dae419aa7c34af820c08896acef3b65d855188e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7dae419aa7c34af820c08896acef3b65d855188e Author: Mauro RossiDate: Fri Oct 27 21:54:14 2017 +0200 Android: move drivers' symlinks to /vendor (v2) Having moved gallium_dri.so library to /vendor/lib/dri also symlinks need to be coherently created using TARGET_OUT_VENDOR instead of TARGET_OUT or all non Intel drivers will not be loaded with Android N and earlier, thus causing SurfaceFlinger SIGABRT (v2) simplification of post install command Fixes: c3f75d483c ("Android: move libraries to /vendor") Cc: 17.3 Reviewed-by: Tapani Pälli (v1) Reviewed-by: Rob Herring (v1) Reviewed-by: Emil Velikov --- src/gallium/targets/dri/Android.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk index e40288c21b..5a3fda65d4 100644 --- a/src/gallium/targets/dri/Android.mk +++ b/src/gallium/targets/dri/Android.mk @@ -68,8 +68,9 @@ LOCAL_SHARED_LIBRARIES += $(sort $(GALLIUM_SHARED_LIBS)) ifneq ($(filter 5 6 7, $(MESA_ANDROID_MAJOR_VERSION)),) LOCAL_POST_INSTALL_CMD := \ $(foreach l, lib $(if $(filter true,$(TARGET_IS_64_BIT)),lib64), \ - mkdir -p $(TARGET_OUT)/$(l)/$(MESA_DRI_MODULE_REL_PATH); \ - $(foreach d, $(GALLIUM_TARGET_DRIVERS), ln -sf gallium_dri.so $(TARGET_OUT)/$(l)/$(MESA_DRI_MODULE_REL_PATH)/$(d)_dri.so;) \ + $(eval MESA_DRI_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(l)/$(MESA_DRI_MODULE_REL_PATH)) \ + mkdir -p $(MESA_DRI_MODULE_PATH); \ + $(foreach d, $(GALLIUM_TARGET_DRIVERS), ln -sf gallium_dri.so $(MESA_DRI_MODULE_PATH)/$(d)_dri.so;) \ ) else LOCAL_MODULE_SYMLINKS := $(foreach d, $(GALLIUM_TARGET_DRIVERS), $(d)_dri.so) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): Revert "foo"
Module: Mesa Branch: master Commit: fc7816fd4ed33c7909345a5fbffac48d3afcc7fe URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc7816fd4ed33c7909345a5fbffac48d3afcc7fe Author: Emil VelikovDate: Mon Oct 30 15:32:56 2017 + Revert "foo" This reverts commit 27d5a7bce09aef83d3349cca5f3777007b3b94b6. I fat fingered it, failing to reset the checkout before applying the sequential commit. --- src/compiler/glsl/linker.cpp | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index e7ec9b7bc0..f827b68555 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3653,21 +3653,21 @@ included_in_packed_varying(ir_variable *var, const char *name) if (strncmp(var->name, "packed:", 7) != 0) return false; - const char *token = var->name + 7; + char *list = strdup(var->name + 7); + assert(list); + + bool found = false; + char *saveptr; + char *token = strtok_r(list, ",", ); while (token) { - const char *next_token = strchr(list, ' '); - if (next_token) { - len = token - next_token; - next_token++; - } else { - len = strlen(token); + if (strcmp(token, name) == 0) { + found = true; + break; } - if (strncmp(token, name, MAX2(len, strlen(name)) == 0) - return true; - - token = next_token; + token = strtok_r(NULL, ",", ); } - return false; + free(list); + return found; } /** ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): foo
Module: Mesa Branch: master Commit: 27d5a7bce09aef83d3349cca5f3777007b3b94b6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=27d5a7bce09aef83d3349cca5f3777007b3b94b6 Author: Emil VelikovDate: Wed Oct 25 14:52:55 2017 +0100 foo Signed-off-by: Emil Velikov --- src/compiler/glsl/linker.cpp | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index f827b68555..e7ec9b7bc0 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3653,21 +3653,21 @@ included_in_packed_varying(ir_variable *var, const char *name) if (strncmp(var->name, "packed:", 7) != 0) return false; - char *list = strdup(var->name + 7); - assert(list); - - bool found = false; - char *saveptr; - char *token = strtok_r(list, ",", ); + const char *token = var->name + 7; while (token) { - if (strcmp(token, name) == 0) { - found = true; - break; + const char *next_token = strchr(list, ' '); + if (next_token) { + len = token - next_token; + next_token++; + } else { + len = strlen(token); } - token = strtok_r(NULL, ",", ); + if (strncmp(token, name, MAX2(len, strlen(name)) == 0) + return true; + + token = next_token; } - free(list); - return found; + return false; } /** ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs/release-calendar: update - 17.3.0-rc2 is out
Module: Mesa Branch: master Commit: 6997d222f54e897efb3cee08964b162825a7f111 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6997d222f54e897efb3cee08964b162825a7f111 Author: Emil VelikovDate: Mon Oct 30 15:24:00 2017 + docs/release-calendar: update - 17.3.0-rc2 is out Signed-off-by: Emil Velikov --- docs/release-calendar.html | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/release-calendar.html b/docs/release-calendar.html index 024f21167a..64d99bb0cd 100644 --- a/docs/release-calendar.html +++ b/docs/release-calendar.html @@ -58,13 +58,7 @@ if you'd like to nominate a patch in the next stable release. Final planned release for the 17.2 series -17.3 -2017-10-27 -17.3.0-rc2 -Emil Velikov - - - +17.3 2017-11-03 17.3.0-rc3 Emil Velikov ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: hashtable: make hashing prototypes match
Module: Mesa Branch: master Commit: a8b1715b8ab974518f9713b82955f049a2c1c7ec URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8b1715b8ab974518f9713b82955f049a2c1c7ec Author: Lionel LandwerlinDate: Fri Oct 27 17:43:45 2017 +0100 util: hashtable: make hashing prototypes match It seems nobody's using the string hashing function. If you try to pass it directly to the hashtable creation function, you'll get compiler warning for non matching prototypes. Let's make them match. Signed-off-by: Lionel Landwerlin Reviewed-by: Kenneth Graunke --- src/util/hash_table.c | 3 ++- src/util/hash_table.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/hash_table.c b/src/util/hash_table.c index 1bda2149b9..b7421a0144 100644 --- a/src/util/hash_table.c +++ b/src/util/hash_table.c @@ -476,9 +476,10 @@ _mesa_hash_data(const void *data, size_t size) /** FNV-1a string hash implementation */ uint32_t -_mesa_hash_string(const char *key) +_mesa_hash_string(const void *_key) { uint32_t hash = _mesa_fnv32_1a_offset_bias; + const char *key = _key; while (*key != 0) { hash = _mesa_fnv32_1a_accumulate(hash, *key); diff --git a/src/util/hash_table.h b/src/util/hash_table.h index cf939130fc..d3e0758b26 100644 --- a/src/util/hash_table.h +++ b/src/util/hash_table.h @@ -94,7 +94,7 @@ _mesa_hash_table_random_entry(struct hash_table *ht, bool (*predicate)(struct hash_entry *entry)); uint32_t _mesa_hash_data(const void *data, size_t size); -uint32_t _mesa_hash_string(const char *key); +uint32_t _mesa_hash_string(const void *key); bool _mesa_key_string_equal(const void *a, const void *b); bool _mesa_key_pointer_equal(const void *a, const void *b); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): docs: add release notes for 17.2.4
Module: Mesa Branch: master Commit: bccb0740147ad84d2e9f09b5b497fba19269824c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bccb0740147ad84d2e9f09b5b497fba19269824c Author: Andres GomezDate: Mon Oct 30 16:46:20 2017 +0200 docs: add release notes for 17.2.4 Signed-off-by: Andres Gomez --- docs/relnotes/17.2.4.html | 131 ++ 1 file changed, 131 insertions(+) diff --git a/docs/relnotes/17.2.4.html b/docs/relnotes/17.2.4.html new file mode 100644 index 00..cfe9ecbb4f --- /dev/null +++ b/docs/relnotes/17.2.4.html @@ -0,0 +1,131 @@ +http://www.w3.org/TR/html4/loose.dtd;> + + + + Mesa Release Notes + + + + + + The Mesa 3D Graphics Library + + + + + +Mesa 17.2.4 Release Notes / October 30, 2017 + + +Mesa 17.2.4 is a bug fix release which fixes bugs found since the 17.2.3 release. + + +Mesa 17.2.4 implements the OpenGL 4.5 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 4.5. OpenGL +4.5 is only available if requested at context creation +because compatibility contexts are not supported. + + + +SHA256 checksums + +TBD + + + +New features +None + + +Bug fixes + + +https://bugs.freedesktop.org/show_bug.cgi?id=102774;>Bug 102774 - [BDW] [Bisected] Absolute constant buffers break VAAPI in mpv + +https://bugs.freedesktop.org/show_bug.cgi?id=103388;>Bug 103388 - Linking libcltgsi.la (llvm/codegen/libclllvm_la-common.lo) fails with error: no match for 'operator-' with GCC-7, Mesa from Git and current LLVM revisions + + + + +Changes +Andres Gomez (8): + + cherry-ignore: configure.ac: rework llvm detection and handling + cherry-ignore: glsl: fix derived cs variables + cherry-ignore: added 17.3 nominations. + cherry-ignore: radv: Don't use vgpr indexing for outputs on GFX9. + cherry-ignore: radv: Disallow indirect outputs for GS on GFX9 as well. + cherry-ignore: mesa/bufferobj: don't double negate the range + cherry-ignore: broadcom/vc5: Propagate vc4 aliasing fix to vc5. + Update version to 17.2.4 + + +Bas Nieuwenhuizen (1): + + ac/nir: Fix nir_texop_lod on GFX for 1D arrays. + + +Dave Airlie (1): + + radv/image: bump all the offset to uint64_t. + + +Emil Velikov (1): + + docs: add sha256 checksums for 17.2.3 + + +Henri Verbeet (1): + + vulkan/wsi: Free the event in x11_manage_fifo_queues(). + + +Jan Vesely (1): + + clover: Fix compilation after clang r315871 + + +Jason Ekstrand (4): + + nir/intrinsics: Set the correct num_indices for load_output + intel/fs: Handle flag read/write aliasing in needs_src_copy + anv/pipeline: Call nir_lower_system_valaues after brw_preprocess_nir + intel/eu: Use EXECUTE_1 for JMPI + + +Kenneth Graunke (1): + + i965: Revert absolute mode for constant buffer pointers. + + +Marek Olšák (1): + + Revert "mesa: fix texture updates for ATI_fragment_shader" + + +Matthew Nicholls (1): + + ac/nir: generate correct instruction for atomic min/max on unsigned images + + +Michel Dänzer (1): + + st/mesa: Initialize textures array in st_framebuffer_validate + + +Samuel Pitoiset (1): + + radv: add the draw count buffer to the list of buffers + + +Stefan Schake (1): + + broadcom/vc4: Fix aliasing issue + + + + + + ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (17.2): docs: add sha256 checksums for 17.2.4
Module: Mesa Branch: 17.2 Commit: 1b10d0851a1cca85e7fb65eaae636bc56f43b7e8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b10d0851a1cca85e7fb65eaae636bc56f43b7e8 Author: Andres GomezDate: Mon Oct 30 16:53:44 2017 +0200 docs: add sha256 checksums for 17.2.4 Signed-off-by: Andres Gomez --- docs/relnotes/17.2.4.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/relnotes/17.2.4.html b/docs/relnotes/17.2.4.html index cfe9ecbb4f..218e1a4eef 100644 --- a/docs/relnotes/17.2.4.html +++ b/docs/relnotes/17.2.4.html @@ -31,7 +31,8 @@ because compatibility contexts are not supported. SHA256 checksums -TBD +cb266edc5cf7226219ebaf556ca2e03dff282e0324d20afd80423a5754d1272c mesa-17.2.4.tar.gz +5ba408fecd6e1132e5490eec1a2f04466214e4c65c8b89b331be844768c2e550 mesa-17.2.4.tar.xz ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa: tag mesa-17.2.4: mesa-17.2.4
Module: Mesa Branch: refs/tags/mesa-17.2.4 Tag:fad1438b1acbe079fe8b3cd5231c59c177588148 URL: http://cgit.freedesktop.org/mesa/mesa/tag/?id=fad1438b1acbe079fe8b3cd5231c59c177588148 Tagger: Andres GomezDate: Mon Oct 30 16:52:16 2017 +0200 mesa-17.2.4 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (17.2): Update version to 17.2.4
Module: Mesa Branch: 17.2 Commit: fe9dc0fad61236a841b484dcf72de01e0c6d2835 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe9dc0fad61236a841b484dcf72de01e0c6d2835 Author: Andres GomezDate: Mon Oct 30 16:37:41 2017 +0200 Update version to 17.2.4 Signed-off-by: Andres Gomez --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index afbe6330a8..97dbfc86f5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -17.2.3 +17.2.4 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (17.2): docs: add release notes for 17.2.4
Module: Mesa Branch: 17.2 Commit: a4b72e2643b71d37697e2288a5f61e333b1a62fd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4b72e2643b71d37697e2288a5f61e333b1a62fd Author: Andres GomezDate: Mon Oct 30 16:46:20 2017 +0200 docs: add release notes for 17.2.4 Signed-off-by: Andres Gomez --- docs/relnotes/17.2.4.html | 131 ++ 1 file changed, 131 insertions(+) diff --git a/docs/relnotes/17.2.4.html b/docs/relnotes/17.2.4.html new file mode 100644 index 00..cfe9ecbb4f --- /dev/null +++ b/docs/relnotes/17.2.4.html @@ -0,0 +1,131 @@ +http://www.w3.org/TR/html4/loose.dtd;> + + + + Mesa Release Notes + + + + + + The Mesa 3D Graphics Library + + + + + +Mesa 17.2.4 Release Notes / October 30, 2017 + + +Mesa 17.2.4 is a bug fix release which fixes bugs found since the 17.2.3 release. + + +Mesa 17.2.4 implements the OpenGL 4.5 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 4.5. OpenGL +4.5 is only available if requested at context creation +because compatibility contexts are not supported. + + + +SHA256 checksums + +TBD + + + +New features +None + + +Bug fixes + + +https://bugs.freedesktop.org/show_bug.cgi?id=102774;>Bug 102774 - [BDW] [Bisected] Absolute constant buffers break VAAPI in mpv + +https://bugs.freedesktop.org/show_bug.cgi?id=103388;>Bug 103388 - Linking libcltgsi.la (llvm/codegen/libclllvm_la-common.lo) fails with error: no match for 'operator-' with GCC-7, Mesa from Git and current LLVM revisions + + + + +Changes +Andres Gomez (8): + + cherry-ignore: configure.ac: rework llvm detection and handling + cherry-ignore: glsl: fix derived cs variables + cherry-ignore: added 17.3 nominations. + cherry-ignore: radv: Don't use vgpr indexing for outputs on GFX9. + cherry-ignore: radv: Disallow indirect outputs for GS on GFX9 as well. + cherry-ignore: mesa/bufferobj: don't double negate the range + cherry-ignore: broadcom/vc5: Propagate vc4 aliasing fix to vc5. + Update version to 17.2.4 + + +Bas Nieuwenhuizen (1): + + ac/nir: Fix nir_texop_lod on GFX for 1D arrays. + + +Dave Airlie (1): + + radv/image: bump all the offset to uint64_t. + + +Emil Velikov (1): + + docs: add sha256 checksums for 17.2.3 + + +Henri Verbeet (1): + + vulkan/wsi: Free the event in x11_manage_fifo_queues(). + + +Jan Vesely (1): + + clover: Fix compilation after clang r315871 + + +Jason Ekstrand (4): + + nir/intrinsics: Set the correct num_indices for load_output + intel/fs: Handle flag read/write aliasing in needs_src_copy + anv/pipeline: Call nir_lower_system_valaues after brw_preprocess_nir + intel/eu: Use EXECUTE_1 for JMPI + + +Kenneth Graunke (1): + + i965: Revert absolute mode for constant buffer pointers. + + +Marek Olšák (1): + + Revert "mesa: fix texture updates for ATI_fragment_shader" + + +Matthew Nicholls (1): + + ac/nir: generate correct instruction for atomic min/max on unsigned images + + +Michel Dänzer (1): + + st/mesa: Initialize textures array in st_framebuffer_validate + + +Samuel Pitoiset (1): + + radv: add the draw count buffer to the list of buffers + + +Stefan Schake (1): + + broadcom/vc4: Fix aliasing issue + + + + + + ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa: tag mesa-17.3.0-rc2: mesa-17.3.0-rc2
Module: Mesa Branch: refs/tags/mesa-17.3.0-rc2 Tag:29b37af0cdc185580d9e30a407f972618cb1d7d1 URL: http://cgit.freedesktop.org/mesa/mesa/tag/?id=29b37af0cdc185580d9e30a407f972618cb1d7d1 Tagger: Emil VelikovDate: Mon Oct 30 14:40:07 2017 + mesa-17.3.0-rc2 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (17.3): 31 new commits
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3eb187f3760866143a9aebe904aefa0e7b0105aa Author: Emil VelikovDate: Mon Oct 30 13:52:46 2017 + Update version to 17.3.0-rc2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c20849f9c30864d5aa183aaf7075916bb7ea4f2 Author: Eric Engestrom Date: Thu Oct 26 17:13:47 2017 +0100 wayland-egl: fix wayland cflags Fixes: 80bfff5c4f1d4d8c842a0 "wayland-egl: adds CFLAGS for wayland.egl.h include" Suggested-by: Daniel Stone Signed-off-by: Eric Engestrom Acked-by: Emil Velikov Acked-by: Tobias Klausmann (cherry picked from commit 866c8a94d45fd88ea1e3a49c00a0ee5e589e4577) URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb09360ea51140ef84f5516ae668299d7a48cc77 Author: Eric Engestrom Date: Wed Oct 25 14:08:58 2017 +0100 vc4: fix release build Mesa's DEBUG and assert's NDEBUG are not tied to each other, so we need to explicitly compile this code out. Fixes: 3df78928786134874eafa "vc4: Drop reloc_count tracking for debug asserts on non-debug builds." Cc: Eric Anholt Signed-off-by: Eric Engestrom Reviewed-by: Eric Anholt (cherry picked from commit 5d44e35a8f3967b40db153fdcedb9294d44ae5c4) URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=166432283814507a1b69d0546b32dfcd0b107474 Author: Samuel Pitoiset Date: Thu Oct 26 18:08:19 2017 +0200 radeonsi: update hack for HTILE corruption in ARK: Survival Evolved It appears that flushing the DB metadata is actually not sufficient since the driver uses the new VS blit shaders. This looks quite strange though, but it seems like we need to flush DB for fixing the corruption. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102955 Fixes: 69ccb9dae7 (radeonsi: use new VS blit shaders (VS inputs in SGPRs) Signed-off-by: Samuel Pitoiset Reviewed-by: Marek Olšák (cherry picked from commit dd79aa4ad30df205076be25f6bbf42768abea20a) URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7e625df6966588c4e71a8d13e147792a76215b2 Author: Daniel Stone Date: Thu Oct 26 11:56:22 2017 +0100 meson: wayland-egl depends on wayland-client Since wayland-egl.h is currently provided by the core Wayland package, depend on wayland-client to make sure we get it in our include path. Signed-off-by: Daniel Stone Acked-by: Emil Velikov Fixes: 108d257a16 ("meson: build libEGL") Cc: Tobias Klausmann Cc: Dylan Baker Cc: Gert Wollny (cherry picked from commit 9f7ed60b3eae9d3d20805e79c9ab67674619e2cd) URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5addf041efe3f5874bbcfa1a950f25f2b192bbf0 Author: Jason Ekstrand Date: Thu Aug 31 11:42:00 2017 -0700 intel/eu: Use EXECUTE_1 for JMPI The PRM says "The execution size must be 1." In 73137997e23ff6c11, the execution size was set to 1 when it should have been BRW_EXECUTE_1 (which maps to 0). Later, in dc2d3a7f5c217a7cee9, JMPI was used for line AA on gen6 and earlier and we started manually stomping the exeution size to BRW_EXECUTE_1 in the generator. This commit fixes the original bug and makes brw_JMPI just do the right thing. Reviewed-by: Matt Turner Fixes: 73137997e23ff6c1145d036315d1a9ad96651281 (cherry picked from commit 562b8d458c2de262019da2c056f75cb9feb5ee54) URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4b6883ebc8802d82c2389361b852088b76c00b7 Author: Bas Nieuwenhuizen Date: Wed Oct 25 03:43:00 2017 +0200 radv: Fix truncation issue hexifying the cache uuid for the disk cache. Going from binary to hex has a 2x blowup. Fixes: 14216252923 'radv: create on-disk shader cache' Reviewed-by: Dave Airlie (cherry picked from commit 5bfbab2fdcc5b1fcb3a0d0b8cce19c5492c7de68) URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=70ee0a45250c4121b800843d1f5c3c66b78988ff Author: Eric Anholt Date: Tue Oct 17 15:41:25 2017 -0700 i965: Fix memmem compiler warnings. gcc is throwing this warning in my meson build: ../src/intel/compiler/brw_eu_validate.c:50:11: warning argument 1 null where non-null expected [-Wnonnull] return memmem(haystack.str, haystack.len, ^~
Mesa (master): radv: Fix -Wformat-security issue
Module: Mesa Branch: master Commit: 134a40d2a67fa8e76b0b101e2fcaa63e80e23056 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=134a40d2a67fa8e76b0b101e2fcaa63e80e23056 Author: Alex SmithDate: Mon Oct 30 08:38:14 2017 + radv: Fix -Wformat-security issue Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103513 Fixes: de889794134e ("radv: Implement VK_AMD_shader_info") Signed-off-by: Alex Smith Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Samuel Pitoiset --- src/amd/vulkan/radv_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index c9edb28ba2..9162612284 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -680,7 +680,7 @@ radv_shader_dump_stats(struct radv_device *device, generate_shader_stats(device, variant, stage, buf); fprintf(file, "\n%s:\n", radv_get_shader_name(variant, stage)); - fprintf(file, buf->buf); + fprintf(file, "%s", buf->buf); _mesa_string_buffer_destroy(buf); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radv: add cache items to in memory cache when reading from disk
Module: Mesa Branch: master Commit: 1e84e53712aed4892fbaf98e6f26ffdf76f06165 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e84e53712aed4892fbaf98e6f26ffdf76f06165 Author: Timothy ArceriDate: Thu Oct 26 09:35:48 2017 +1100 radv: add cache items to in memory cache when reading from disk Otherwise we will leak them, load duplicates from disk rather than memory and never write items loaded from disk to the apps pipeline cache. Fixes: fd24be134ffd 'radv: make use of on-disk cache' Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_pipeline_cache.c | 141 ++- 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c index 441e2257d5..91470d1419 100644 --- a/src/amd/vulkan/radv_pipeline_cache.c +++ b/src/amd/vulkan/radv_pipeline_cache.c @@ -172,6 +172,75 @@ radv_pipeline_cache_search(struct radv_pipeline_cache *cache, return entry; } +static void +radv_pipeline_cache_set_entry(struct radv_pipeline_cache *cache, + struct cache_entry *entry) +{ + const uint32_t mask = cache->table_size - 1; + const uint32_t start = entry->sha1_dw[0]; + + /* We'll always be able to insert when we get here. */ + assert(cache->kernel_count < cache->table_size / 2); + + for (uint32_t i = 0; i < cache->table_size; i++) { + const uint32_t index = (start + i) & mask; + if (!cache->hash_table[index]) { + cache->hash_table[index] = entry; + break; + } + } + + cache->total_size += entry_size(entry); + cache->kernel_count++; +} + + +static VkResult +radv_pipeline_cache_grow(struct radv_pipeline_cache *cache) +{ + const uint32_t table_size = cache->table_size * 2; + const uint32_t old_table_size = cache->table_size; + const size_t byte_size = table_size * sizeof(cache->hash_table[0]); + struct cache_entry **table; + struct cache_entry **old_table = cache->hash_table; + + table = malloc(byte_size); + if (table == NULL) + return VK_ERROR_OUT_OF_HOST_MEMORY; + + cache->hash_table = table; + cache->table_size = table_size; + cache->kernel_count = 0; + cache->total_size = 0; + + memset(cache->hash_table, 0, byte_size); + for (uint32_t i = 0; i < old_table_size; i++) { + struct cache_entry *entry = old_table[i]; + if (!entry) + continue; + + radv_pipeline_cache_set_entry(cache, entry); + } + + free(old_table); + + return VK_SUCCESS; +} + +static void +radv_pipeline_cache_add_entry(struct radv_pipeline_cache *cache, + struct cache_entry *entry) +{ + if (cache->kernel_count == cache->table_size / 2) + radv_pipeline_cache_grow(cache); + + /* Failing to grow that hash table isn't fatal, but may mean we don't +* have enough space to add this new kernel. Only add it if there's room. +*/ + if (cache->kernel_count < cache->table_size / 2) + radv_pipeline_cache_set_entry(cache, entry); +} + bool radv_create_shader_variants_from_pipeline_cache(struct radv_device *device, struct radv_pipeline_cache *cache, @@ -206,6 +275,8 @@ radv_create_shader_variants_from_pipeline_cache(struct radv_device *device, if (!entry) { pthread_mutex_unlock(>mutex); return false; + } else { + radv_pipeline_cache_add_entry(cache, entry); } } @@ -251,76 +322,6 @@ radv_create_shader_variants_from_pipeline_cache(struct radv_device *device, return true; } - -static void -radv_pipeline_cache_set_entry(struct radv_pipeline_cache *cache, - struct cache_entry *entry) -{ - const uint32_t mask = cache->table_size - 1; - const uint32_t start = entry->sha1_dw[0]; - - /* We'll always be able to insert when we get here. */ - assert(cache->kernel_count < cache->table_size / 2); - - for (uint32_t i = 0; i < cache->table_size; i++) { - const uint32_t index = (start + i) & mask; - if (!cache->hash_table[index]) { - cache->hash_table[index] = entry; - break; - } - } - - cache->total_size += entry_size(entry); - cache->kernel_count++; -} - - -static VkResult -radv_pipeline_cache_grow(struct radv_pipeline_cache *cache) -{ - const uint32_t table_size = cache->table_size * 2; - const uint32_t old_table_size = cache->table_size; - const size_t byte_size = table_size * sizeof(cache->hash_table[0]); - struct cache_entry
Mesa (master): i965: fix blorp stage_prog_data->param leak
Module: Mesa Branch: master Commit: 446c5726ecb968d06a6607e0df42be1cb74948c4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=446c5726ecb968d06a6607e0df42be1cb74948c4 Author: Tapani PälliDate: Fri Oct 27 14:49:40 2017 +0300 i965: fix blorp stage_prog_data->param leak Patch uses mem_ctx for allocation to ensure param array gets freed later. ==6164== 48 bytes in 1 blocks are definitely lost in loss record 61 of 193 ==6164==at 0x4C2EB6B: malloc (vg_replace_malloc.c:299) ==6164==by 0x12E31C6C: ralloc_size (ralloc.c:121) ==6164==by 0x130189F1: fs_visitor::assign_constant_locations() (brw_fs.cpp:2095) ==6164==by 0x13022D32: fs_visitor::optimize() (brw_fs.cpp:5715) ==6164==by 0x13024D5A: fs_visitor::run_fs(bool, bool) (brw_fs.cpp:6229) ==6164==by 0x1302549A: brw_compile_fs (brw_fs.cpp:6570) ==6164==by 0x130C4B07: blorp_compile_fs (blorp.c:194) ==6164==by 0x130D384B: blorp_params_get_clear_kernel (blorp_clear.c:79) ==6164==by 0x130D3C56: blorp_fast_clear (blorp_clear.c:332) ==6164==by 0x12EFA439: do_single_blorp_clear (brw_blorp.c:1261) ==6164==by 0x12EFC4AF: brw_blorp_clear_color (brw_blorp.c:1326) ==6164==by 0x12EFF72B: brw_clear (brw_clear.c:297) Fixes: 8d90e28839 ("intel/compiler: Allocate pull_param in assign_constant_locations") Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin Cc: mesa-sta...@lists.freedesktop.org --- src/intel/compiler/brw_fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 2dee841c09..e546792255 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -2092,7 +2092,7 @@ fs_visitor::assign_constant_locations() */ uint32_t *param = stage_prog_data->param; stage_prog_data->nr_params = num_push_constants; - stage_prog_data->param = ralloc_array(NULL, uint32_t, num_push_constants); + stage_prog_data->param = ralloc_array(mem_ctx, uint32_t, num_push_constants); if (num_pull_constants > 0) { stage_prog_data->nr_pull_params = num_pull_constants; stage_prog_data->pull_param = ralloc_array(NULL, uint32_t, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit