diff options
Diffstat (limited to 'lib/mesa/src')
44 files changed, 478 insertions, 353 deletions
diff --git a/lib/mesa/src/amd/registers/makeregheader.py b/lib/mesa/src/amd/registers/makeregheader.py index 472e6e491..770d67847 100644 --- a/lib/mesa/src/amd/registers/makeregheader.py +++ b/lib/mesa/src/amd/registers/makeregheader.py @@ -112,6 +112,23 @@ def get_chips_comment(chips, parent=None): return ', '.join(comment) +def detect_conflict(regdb, field_in_type1, field_in_type2): + """ + Returns False if field_in_type1 and field_in_type2 can be merged + into a single field = if writing to field_in_type1 bits won't + overwrite adjacent fields in type2, and the other way around. + """ + for idx, type_refs in enumerate([field_in_type1.type_refs, field_in_type2.type_refs]): + ref = field_in_type2 if idx == 0 else field_in_type1 + for type_ref in type_refs: + for field in regdb.register_type(type_ref).fields: + # If a different field in the other type starts in + # the tested field's bits[0, 1] interval + if (field.bits[0] > ref.bits[0] and + field.bits[0] <= ref.bits[1]): + return True + + return False class HeaderWriter(object): def __init__(self, regdb, guard=None): @@ -200,21 +217,10 @@ class HeaderWriter(object): if prev.bits[0] != line.bits[0]: continue - if prev.bits[1] < line.bits[1]: + if prev.bits[1] != line.bits[1]: # Current line's field extends beyond the range of prev. # Need to check for conflicts - conflict = False - for type_ref in prev.type_refs: - for field in regdb.register_type(type_ref).fields: - # The only possible conflict is for a prev field - # that starts at a higher bit. - if (field.bits[0] > line.bits[0] and - field.bits[0] <= line.bits[1]): - conflict = True - break - if conflict: - break - if conflict: + if detect_conflict(regdb, prev, line): continue prev.bits[1] = max(prev.bits[1], line.bits[1]) diff --git a/lib/mesa/src/broadcom/ci/piglit-v3d-rpi4-fails.txt b/lib/mesa/src/broadcom/ci/piglit-v3d-rpi4-fails.txt index 7067a0963..48b78a2f5 100644 --- a/lib/mesa/src/broadcom/ci/piglit-v3d-rpi4-fails.txt +++ b/lib/mesa/src/broadcom/ci/piglit-v3d-rpi4-fails.txt @@ -93,7 +93,6 @@ spec@ext_framebuffer_object@fbo-blending-formats,Fail spec@ext_framebuffer_object@getteximage-formats init-by-clear-and-render,Fail spec@ext_framebuffer_object@getteximage-formats init-by-rendering,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export,Fail -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export-tex,Crash spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_ayuv,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_xyuv,Fail spec@ext_packed_depth_stencil@texwrap formats bordercolor,Fail diff --git a/lib/mesa/src/broadcom/compiler/nir_to_vir.c b/lib/mesa/src/broadcom/compiler/nir_to_vir.c index e313a82d7..c70d12881 100644 --- a/lib/mesa/src/broadcom/compiler/nir_to_vir.c +++ b/lib/mesa/src/broadcom/compiler/nir_to_vir.c @@ -3456,6 +3456,10 @@ ntq_emit_instr(struct v3d_compile *c, nir_instr *instr) break; case nir_instr_type_jump: + /* Always flush TMU before jumping to another block, for the + * same reasons as in ntq_emit_block. + */ + ntq_flush_tmu(c); if (vir_in_nonuniform_control_flow(c)) ntq_emit_jump(c, nir_instr_as_jump(instr)); else diff --git a/lib/mesa/src/compiler/nir/nir_lower_io_to_vector.c b/lib/mesa/src/compiler/nir/nir_lower_io_to_vector.c index 4271f15bd..d394a59f4 100644 --- a/lib/mesa/src/compiler/nir/nir_lower_io_to_vector.c +++ b/lib/mesa/src/compiler/nir/nir_lower_io_to_vector.c @@ -621,6 +621,7 @@ nir_vectorize_tess_levels_impl(nir_function_impl *impl) } else { b.cursor = nir_after_instr(instr); nir_ssa_def *val = &intrin->dest.ssa; + val->num_components = intrin->num_components; nir_ssa_def *comp = nir_channel(&b, val, index); nir_ssa_def_rewrite_uses_after(val, comp, comp->parent_instr); } diff --git a/lib/mesa/src/compiler/nir/nir_lower_mediump.c b/lib/mesa/src/compiler/nir/nir_lower_mediump.c index 0cc58c1e7..4df1cce24 100644 --- a/lib/mesa/src/compiler/nir/nir_lower_mediump.c +++ b/lib/mesa/src/compiler/nir/nir_lower_mediump.c @@ -121,7 +121,13 @@ nir_recompute_io_bases(nir_function_impl *impl, nir_variable_mode modes) } } - nir_metadata_preserve(impl, nir_metadata_all); + if (changed) { + nir_metadata_preserve(impl, nir_metadata_dominance | + nir_metadata_block_index); + } else { + nir_metadata_preserve(impl, nir_metadata_all); + } + return changed; } @@ -224,10 +230,16 @@ nir_lower_mediump_io(nir_shader *nir, nir_variable_mode modes, } } - if (changed) + if (changed && use_16bit_slots) nir_recompute_io_bases(impl, modes); - nir_metadata_preserve(impl, nir_metadata_all); + if (changed) { + nir_metadata_preserve(impl, nir_metadata_dominance | + nir_metadata_block_index); + } else { + nir_metadata_preserve(impl, nir_metadata_all); + } + return changed; } @@ -286,7 +298,13 @@ nir_force_mediump_io(nir_shader *nir, nir_variable_mode modes, } } - nir_metadata_preserve(impl, nir_metadata_all); + if (changed) { + nir_metadata_preserve(impl, nir_metadata_dominance | + nir_metadata_block_index); + } else { + nir_metadata_preserve(impl, nir_metadata_all); + } + return changed; } @@ -326,7 +344,13 @@ nir_unpack_16bit_varying_slots(nir_shader *nir, nir_variable_mode modes) if (changed) nir_recompute_io_bases(impl, modes); - nir_metadata_preserve(impl, nir_metadata_all); + if (changed) { + nir_metadata_preserve(impl, nir_metadata_dominance | + nir_metadata_block_index); + } else { + nir_metadata_preserve(impl, nir_metadata_all); + } + return changed; } @@ -515,7 +539,13 @@ nir_fold_16bit_sampler_conversions(nir_shader *nir, } } - nir_metadata_preserve(impl, nir_metadata_all); + if (changed) { + nir_metadata_preserve(impl, nir_metadata_dominance | + nir_metadata_block_index); + } else { + nir_metadata_preserve(impl, nir_metadata_all); + } + return changed; } @@ -606,6 +636,12 @@ nir_legalize_16bit_sampler_srcs(nir_shader *nir, } } - nir_metadata_preserve(impl, nir_metadata_all); + if (changed) { + nir_metadata_preserve(impl, nir_metadata_dominance | + nir_metadata_block_index); + } else { + nir_metadata_preserve(impl, nir_metadata_all); + } + return changed; } diff --git a/lib/mesa/src/drm-shim/device.c b/lib/mesa/src/drm-shim/device.c index a70189cd7..211eb2e57 100644 --- a/lib/mesa/src/drm-shim/device.c +++ b/lib/mesa/src/drm-shim/device.c @@ -57,6 +57,8 @@ memfd_create(const char *name, unsigned int flags) /* Global state for the shim shared between libc, core, and driver. */ struct shim_device shim_device; +long shim_page_size; + static uint32_t uint_key_hash(const void *key) { @@ -88,7 +90,21 @@ drm_shim_device_init(void) ASSERTED int ret = ftruncate(shim_device.mem_fd, SHIM_MEM_SIZE); assert(ret == 0); - util_vma_heap_init(&shim_device.mem_heap, 4096, SHIM_MEM_SIZE - 4096); + /* The man page for mmap() says + * + * offset must be a multiple of the page size as returned by + * sysconf(_SC_PAGE_SIZE). + * + * Depending on the configuration of the kernel, this may not be 4096. Get + * this page size once and use it as the page size throughout, ensuring that + * are offsets are page-size aligned as required. Otherwise, mmap will fail + * with EINVAL. + */ + + shim_page_size = sysconf(_SC_PAGE_SIZE); + + util_vma_heap_init(&shim_device.mem_heap, shim_page_size, + SHIM_MEM_SIZE - shim_page_size); drm_shim_driver_init(); } @@ -270,7 +286,7 @@ drm_shim_bo_init(struct shim_bo *bo, size_t size) { mtx_lock(&shim_device.mem_lock); - bo->mem_addr = util_vma_heap_alloc(&shim_device.mem_heap, size, 4096); + bo->mem_addr = util_vma_heap_alloc(&shim_device.mem_heap, size, shim_page_size); mtx_unlock(&shim_device.mem_lock); assert(bo->mem_addr); @@ -361,5 +377,8 @@ drm_shim_mmap(struct shim_fd *shim_fd, size_t length, int prot, int flags, { struct shim_bo *bo = (void *)(uintptr_t)offset; + /* The offset we pass to mmap must be aligned to the page size */ + assert((bo->mem_addr & (shim_page_size - 1)) == 0); + return mmap(NULL, length, prot, flags, shim_device.mem_fd, bo->mem_addr); } diff --git a/lib/mesa/src/freedreno/ci/deqp-freedreno-a630-fails.txt b/lib/mesa/src/freedreno/ci/deqp-freedreno-a630-fails.txt index fb1305099..9ecc65566 100644 --- a/lib/mesa/src/freedreno/ci/deqp-freedreno-a630-fails.txt +++ b/lib/mesa/src/freedreno/ci/deqp-freedreno-a630-fails.txt @@ -20,28 +20,8 @@ dEQP-VK.api.info.vulkan1p2.property_extensions_consistency,Fail dEQP-VK.api.info.vulkan1p2_limits_validation.khr_multiview,Fail dEQP-VK.compute.basic.max_local_size_x,Crash dEQP-VK.compute.basic.max_local_size_y,Crash -dEQP-VK.draw.shader_viewport_index.fragment_shader_10,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_12,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_13,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_14,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_16,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_2,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_4,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_5,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_6,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_8,Fail -dEQP-VK.draw.shader_viewport_index.fragment_shader_9,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_10,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_11,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_13,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_14,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_15,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_2,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_3,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_5,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_6,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_7,Fail -dEQP-VK.draw.shader_viewport_index.vertex_shader_9,Fail + +# only fails with TU_DEBUG=forcebin dEQP-VK.glsl.atomic_operations.add_unsigned_geometry,Fail dEQP-VK.glsl.atomic_operations.and_signed_geometry,Fail dEQP-VK.glsl.atomic_operations.and_unsigned_geometry,Fail diff --git a/lib/mesa/src/freedreno/ci/traces-freedreno.yml b/lib/mesa/src/freedreno/ci/traces-freedreno.yml index 7a4519dc0..0404b03eb 100644 --- a/lib/mesa/src/freedreno/ci/traces-freedreno.yml +++ b/lib/mesa/src/freedreno/ci/traces-freedreno.yml @@ -25,42 +25,42 @@ traces: - device: freedreno-a306 checksum: b7083a7937196ac6f842e8ef13cfc916 - device: freedreno-a530 - checksum: b28f6833b13fac0df6fe304352afcf35 + checksum: 0058d07ff9500fd20e501f8c16a72d1d - device: freedreno-a630 - checksum: e0fb7ba5ade1430cd4ca6fc154cc7f10 + checksum: 1d04a606014f00663e0d078903d190c8 - path: glmark2/buffer-columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata.rdc expectations: - device: freedreno-a306 checksum: 0bfc8ac9a4a3bd47314f9008afb45f0a - device: freedreno-a530 - checksum: 4d71da5b01aa21b515c9d1d1b2c09e77 + checksum: b338ef8bae35eaf675dec27aaf8a3afe - device: freedreno-a630 - checksum: 2093474baae398a13fb34964f7030d76 + checksum: 6c00e3f05fab4b0df449451803b2749a - path: glmark2/buffer-columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map.rdc expectations: - device: freedreno-a306 checksum: 91c22606e51dfb1f56fb013f93b04d59 - device: freedreno-a530 - checksum: 13e83d575ae3c542605829e055bb031d + checksum: f2708c99b0e85c2c2e5fb111e204e59a - device: freedreno-a630 - checksum: 46c816a88d187e943e36386839e92256 + checksum: 5706da41ae1877086e7ac2dc9af66e81 - path: glmark2/bump-bump-render=height.rdc expectations: - device: freedreno-a306 checksum: 3af5caeda959374c6ec40b83a9b3e97f # a530/a630: grid-like rendering glitches since "ir3: nir_op_f2f16 should round to even" - device: freedreno-a530 - checksum: 9e7b9cb09460206748b24a1476a7768e + checksum: bfa8557cd352b832e915c3c553b14c1f - device: freedreno-a630 - checksum: 9e7b9cb09460206748b24a1476a7768e + checksum: bfa8557cd352b832e915c3c553b14c1f - path: glmark2/bump-bump-render=high-poly.rdc expectations: - device: freedreno-a306 checksum: 3da86a6a84f34dbcb5d9eec5ba045c62 - device: freedreno-a530 - checksum: ef671e7a585443e395d566873a8174c0 + checksum: 737a729713c894596b7cb4c1726239af - device: freedreno-a630 - checksum: ef671e7a585443e395d566873a8174c0 + checksum: 737a729713c894596b7cb4c1726239af - path: glmark2/bump-bump-render=normals.rdc expectations: - device: freedreno-a306 @@ -104,9 +104,9 @@ traces: - device: freedreno-a306 checksum: c828e30f64b132e6f34341204794c5a8 - device: freedreno-a530 - checksum: 353c40f356495df95c3e5a61c94a726a + checksum: d750bb0972cf14a4c0bc35896d87da16 - device: freedreno-a630 - checksum: 353c40f356495df95c3e5a61c94a726a + checksum: d750bb0972cf14a4c0bc35896d87da16 - path: glmark2/desktop-effect=shadow:windows=4.rdc expectations: - device: freedreno-a306 @@ -120,17 +120,17 @@ traces: - device: freedreno-a306 checksum: 1869797f68f587cc62244eadd41baf95 - device: freedreno-a530 - checksum: 14df4ace23bfe591501ed322afcd9dc0 + checksum: b38d1d3ebe30ea3df97713515dab3df0 - device: freedreno-a630 - checksum: 14df4ace23bfe591501ed322afcd9dc0 + checksum: b38d1d3ebe30ea3df97713515dab3df0 - path: glmark2/effect2d-kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;.rdc expectations: - device: freedreno-a306 checksum: cf71e5d389dfdae7472382c53b49eaef - device: freedreno-a530 - checksum: 6383e75f0a168d1eeb7516e5f727ddfc + checksum: 2964d37446db126a5fe462b1ba4542cd - device: freedreno-a630 - checksum: 6383e75f0a168d1eeb7516e5f727ddfc + checksum: 2964d37446db126a5fe462b1ba4542cd - path: glmark2/function-fragment-complexity=low:fragment-steps=5.rdc expectations: - device: freedreno-a306 @@ -158,7 +158,7 @@ traces: - device: freedreno-a530 checksum: 03af8343dc2bbd22980834927d9d1a16 - device: freedreno-a630 - checksum: 1612f9c774de1962ee9f4fd3ba73cce3 + checksum: ecb647d14dae3876eb2a4282633d84f5 - path: glmark2/glmark2-build-use-vbo-true.rdc expectations: - device: freedreno-a306 @@ -166,23 +166,23 @@ traces: - device: freedreno-a530 checksum: 63a59de04ca767950282468cd80c062f - device: freedreno-a630 - checksum: d093fdee65a24595d5a54297d03001d9 + checksum: b2608bba0f80ef93809e42399fb77124 - path: glmark2/ideas-speed=duration.rdc expectations: - device: freedreno-a306 checksum: 72ddec13685aa042b30dd4dd222bc49a - device: freedreno-a530 - checksum: 657a2ff690ca935ea39a0a7a79076cf4 + checksum: 87cd4c706b56f814908fbf60e04152bb - device: freedreno-a630 - checksum: 5af85c3501a34a07275548fd390a31a1 + checksum: e2c3f5163ef85818b85f1af634077f30 - path: glmark2/jellyfish.rdc expectations: - device: freedreno-a306 checksum: 8cc0303047975fa226fa68629e7ac93a - device: freedreno-a530 - checksum: bd326e1e25453e91a63a8bbe1089394c + checksum: 98a5c541d56980be9880aa6b210300c7 - device: freedreno-a630 - checksum: e57fbf07975de65176eb10713b7e4da6 + checksum: 117212f2d89cbf09f0d81ca0d6b9e3f3 - path: glmark2/loop-fragment-loop=false:fragment-steps=5:vertex-steps=5.rdc expectations: - device: freedreno-a306 @@ -220,15 +220,15 @@ traces: - device: freedreno-a530 checksum: cb5badf3cac77f776f0e1420ab5e190e - device: freedreno-a630 - checksum: 8c9a18bdfad94d6da823382991f9b843 + checksum: e482fd686d39decbec52ada682d93890 - path: glmark2/refract.rdc expectations: - device: freedreno-a306 checksum: 448602efa203ac6eff95b3101c40572c - device: freedreno-a530 - checksum: 4302ab80ec105246cf61ba2d720eee18 + checksum: 48a9bdb712ad04476ffb397e9a63cd1c - device: freedreno-a630 - checksum: 4302ab80ec105246cf61ba2d720eee18 + checksum: 48a9bdb712ad04476ffb397e9a63cd1c - path: glmark2/shading-shading=blinn-phong-inf.rdc expectations: - device: freedreno-a306 @@ -236,17 +236,17 @@ traces: # Some speckling on the main specular highlight on a530/a630 that may just be # mediump artifacts - device: freedreno-a530 - checksum: 9afbe4ea0f8eaa92311754c618e946cc + checksum: 562772bffd90b5e85375dfe4eff28d81 - device: freedreno-a630 - checksum: 9afbe4ea0f8eaa92311754c618e946cc + checksum: 562772bffd90b5e85375dfe4eff28d81 - path: glmark2/shading-shading=cel.rdc expectations: - device: freedreno-a306 checksum: 7914b440e99eaaa66e671371e2353a0f - device: freedreno-a530 - checksum: 7afbb21948358b00cf6a1c553b6a7980 + checksum: 168fd41e4a8c1064d8e37353e2b2a887 - device: freedreno-a630 - checksum: 7afbb21948358b00cf6a1c553b6a7980 + checksum: 168fd41e4a8c1064d8e37353e2b2a887 - path: glmark2/shading-shading=gouraud.rdc expectations: - device: freedreno-a306 @@ -254,7 +254,7 @@ traces: - device: freedreno-a530 checksum: 6b7749b1eefee122c9124bb907736287 - device: freedreno-a630 - checksum: 49ee0d0703093195b6e692ac907590f6 + checksum: bd9058f041bd2d59c039cccdb7d50bf7 - path: glmark2/shading-shading=phong.rdc expectations: - device: freedreno-a306 @@ -262,42 +262,42 @@ traces: # Some speckling on the main specular highlight on a530/a630 that may just be # mediump artifacts - device: freedreno-a530 - checksum: ca4983b8c4e08de7515630a2ff14276c + checksum: f227a5d0471b5bf2de636f519e38f1cb - device: freedreno-a630 - checksum: ca4983b8c4e08de7515630a2ff14276c + checksum: f227a5d0471b5bf2de636f519e38f1cb - path: glmark2/shadow.rdc expectations: - device: freedreno-a306 checksum: 6e2a5e5b7ecbbd7f75f9ca4ed2ca4d7a - device: freedreno-a530 - checksum: c4da97ac3648174f23ca41074ccd1100 + checksum: feab953ba1f1122ccf3c098d4616e16a - device: freedreno-a630 - checksum: b1b0447da2b706f3eddb82c43edbbe7f + checksum: d8b5931669733240797f1acf5d98db25 - path: glmark2/texture-texture-filter=linear.rdc expectations: - device: freedreno-a306 checksum: 8da00127c5e5d446569ca23b72bb40bc - device: freedreno-a530 - checksum: e07b6c9b1898e0556a80f446ce20226b + checksum: fc1ead41d49ca6bfe45ba90df02eea16 - device: freedreno-a630 - checksum: 0aa02a7ea3e4a7ada675fb66c54a41f6 + checksum: b4beeda82884d2e6de549b16cd9b90e8 - path: glmark2/texture-texture-filter=mipmap.rdc expectations: # Crashes on a3xx? # - device: freedreno-a306 # checksum: 1ae1036fcaae693b3bf36a1d2d6bbc64 - device: freedreno-a530 - checksum: e331303c1f65534edb9bf3fedfee2c8b + checksum: bceecf4e627b34ecf6b324506c91f3e1 - device: freedreno-a630 - checksum: 99ad7718220e9cb8e05767e17f4bd690 + checksum: 27e1cdb7e8f3f5bb6a61ebf02927d201 - path: glmark2/texture-texture-filter=nearest.rdc expectations: - device: freedreno-a306 checksum: 1ae1036fcaae693b3bf36a1d2d6bbc64 - device: freedreno-a530 - checksum: 27612b5ea9597f9d7c7f3df3025fd112 + checksum: 719477c58bdbc8d0cb1f1c5a9c0b1a45 - device: freedreno-a630 - checksum: b0f6e888784b7018d796aa3e3cd32aa2 + checksum: 84409b1b3c75e52ef43fa331f60c549f - path: glxgears/glxgears-2.trace expectations: # inner rings are flat shaded when they should be smooth diff --git a/lib/mesa/src/freedreno/ir3/ir3_compiler_nir.c b/lib/mesa/src/freedreno/ir3/ir3_compiler_nir.c index 5b8bfce4d..a1e9f1800 100644 --- a/lib/mesa/src/freedreno/ir3/ir3_compiler_nir.c +++ b/lib/mesa/src/freedreno/ir3/ir3_compiler_nir.c @@ -259,8 +259,15 @@ create_cov(struct ir3_context *ctx, struct ir3_instruction *src, struct ir3_instruction *cov = ir3_COV(ctx->block, src, src_type, dst_type); - if (op == nir_op_f2f16 || op == nir_op_f2f16_rtne) + if (op == nir_op_f2f16_rtne) { cov->regs[0]->flags |= IR3_REG_EVEN; + } else if (op == nir_op_f2f16) { + unsigned execution_mode = ctx->s->info.float_controls_execution_mode; + nir_rounding_mode rounding_mode = + nir_get_rounding_mode_from_float_controls(execution_mode, nir_type_float16); + if (rounding_mode == nir_rounding_mode_rtne) + cov->regs[0]->flags |= IR3_REG_EVEN; + } return cov; } @@ -3513,7 +3520,8 @@ static bool output_slot_used_for_binning(gl_varying_slot slot) { return slot == VARYING_SLOT_POS || slot == VARYING_SLOT_PSIZ || - slot == VARYING_SLOT_CLIP_DIST0 || slot == VARYING_SLOT_CLIP_DIST1; + slot == VARYING_SLOT_CLIP_DIST0 || slot == VARYING_SLOT_CLIP_DIST1 || + slot == VARYING_SLOT_VIEWPORT; } static void diff --git a/lib/mesa/src/freedreno/ir3/meson.build b/lib/mesa/src/freedreno/ir3/meson.build index 534dd02b8..76052680f 100644 --- a/lib/mesa/src/freedreno/ir3/meson.build +++ b/lib/mesa/src/freedreno/ir3/meson.build @@ -121,6 +121,7 @@ test('ir3_disasm', executable( 'ir3_disasm', 'tests/disasm.c', + link_args : [ld_args_build_id], link_with: [libfreedreno_ir3, libir3decode], dependencies: [idep_mesautil, idep_nir], include_directories: [inc_freedreno, inc_include, inc_src, inc_gallium], diff --git a/lib/mesa/src/gallium/auxiliary/nir/nir_to_tgsi_info.c b/lib/mesa/src/gallium/auxiliary/nir/nir_to_tgsi_info.c index ded0ff6af..65fc8d2d6 100644 --- a/lib/mesa/src/gallium/auxiliary/nir/nir_to_tgsi_info.c +++ b/lib/mesa/src/gallium/auxiliary/nir/nir_to_tgsi_info.c @@ -579,13 +579,13 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir, info->indirect_files |= 1 << TGSI_FILE_INPUT; info->file_max[TGSI_FILE_INPUT] = info->num_inputs - 1; } else { - int max = -1; + int max = info->file_max[TGSI_FILE_INPUT] = -1; nir_foreach_shader_in_variable(var, nir) { - int slots = glsl_count_attribute_slots(var->type, false); - int tmax = var->data.driver_location + slots - 1; - if (tmax > max) - max = tmax; - info->file_max[TGSI_FILE_INPUT] = max; + int slots = glsl_count_attribute_slots(var->type, false); + int tmax = var->data.driver_location + slots - 1; + if (tmax > max) + max = tmax; + info->file_max[TGSI_FILE_INPUT] = max; } } diff --git a/lib/mesa/src/gallium/drivers/iris/iris_context.h b/lib/mesa/src/gallium/drivers/iris/iris_context.h index a7dde354c..a273b6765 100644 --- a/lib/mesa/src/gallium/drivers/iris/iris_context.h +++ b/lib/mesa/src/gallium/drivers/iris/iris_context.h @@ -205,10 +205,15 @@ struct iris_base_prog_key { unsigned program_string_id; }; +/** + * Note, we need to take care to have padding explicitly declared + * for key since we will directly memcmp the whole struct. + */ struct iris_vue_prog_key { struct iris_base_prog_key base; unsigned nr_userclip_plane_consts:4; + unsigned padding:28; }; struct iris_vs_prog_key { diff --git a/lib/mesa/src/gallium/drivers/iris/iris_state.c b/lib/mesa/src/gallium/drivers/iris/iris_state.c index e493eea0b..9571aed33 100644 --- a/lib/mesa/src/gallium/drivers/iris/iris_state.c +++ b/lib/mesa/src/gallium/drivers/iris/iris_state.c @@ -6905,7 +6905,8 @@ iris_upload_gpgpu_walker(struct iris_context *ice, const unsigned threads = DIV_ROUND_UP(group_size, simd_size); - if (stage_dirty & IRIS_STAGE_DIRTY_CS) { + if ((stage_dirty & IRIS_STAGE_DIRTY_CS) || + cs_prog_data->local_size[0] == 0 /* Variable local group size */) { /* The MEDIA_VFE_STATE documentation for Gfx8+ says: * * "A stalling PIPE_CONTROL is required before MEDIA_VFE_STATE unless diff --git a/lib/mesa/src/gallium/drivers/lima/lima_draw.c b/lib/mesa/src/gallium/drivers/lima/lima_draw.c index fc218eea5..3b3b276b2 100644 --- a/lib/mesa/src/gallium/drivers/lima/lima_draw.c +++ b/lib/mesa/src/gallium/drivers/lima/lima_draw.c @@ -72,14 +72,14 @@ lima_clip_scissor_to_viewport(struct lima_context *ctx) viewport_left = MAX2(ctx->viewport.left, 0); cscissor->minx = MAX2(cscissor->minx, viewport_left); - viewport_right = MIN2(ctx->viewport.right, fb->base.width); + viewport_right = MIN2(MAX2(ctx->viewport.right, 0), fb->base.width); cscissor->maxx = MIN2(cscissor->maxx, viewport_right); if (cscissor->minx > cscissor->maxx) cscissor->minx = cscissor->maxx; viewport_bottom = MAX2(ctx->viewport.bottom, 0); cscissor->miny = MAX2(cscissor->miny, viewport_bottom); - viewport_top = MIN2(ctx->viewport.top, fb->base.height); + viewport_top = MIN2(MAX2(ctx->viewport.top, 0), fb->base.height); cscissor->maxy = MIN2(cscissor->maxy, viewport_top); if (cscissor->miny > cscissor->maxy) cscissor->miny = cscissor->maxy; @@ -195,6 +195,7 @@ enum lima_attrib_type { LIMA_ATTRIB_FLOAT = 0x000, LIMA_ATTRIB_I32 = 0x001, LIMA_ATTRIB_U32 = 0x002, + LIMA_ATTRIB_FP16 = 0x003, LIMA_ATTRIB_I16 = 0x004, LIMA_ATTRIB_U16 = 0x005, LIMA_ATTRIB_I8 = 0x006, @@ -217,7 +218,10 @@ lima_pipe_format_to_attrib_type(enum pipe_format format) switch (c->type) { case UTIL_FORMAT_TYPE_FLOAT: - return LIMA_ATTRIB_FLOAT; + if (c->size == 16) + return LIMA_ATTRIB_FP16; + else + return LIMA_ATTRIB_FLOAT; case UTIL_FORMAT_TYPE_FIXED: return LIMA_ATTRIB_FIXED; case UTIL_FORMAT_TYPE_SIGNED: diff --git a/lib/mesa/src/gallium/drivers/lima/lima_resource.c b/lib/mesa/src/gallium/drivers/lima/lima_resource.c index d16a0b0b7..a8954eb72 100644 --- a/lib/mesa/src/gallium/drivers/lima/lima_resource.c +++ b/lib/mesa/src/gallium/drivers/lima/lima_resource.c @@ -412,9 +412,8 @@ lima_resource_get_handle(struct pipe_screen *pscreen, else handle->modifier = DRM_FORMAT_MOD_LINEAR; - if (handle->type == WINSYS_HANDLE_TYPE_KMS && screen->ro && - renderonly_get_handle(res->scanout, handle)) - return true; + if (handle->type == WINSYS_HANDLE_TYPE_KMS && screen->ro) + return renderonly_get_handle(res->scanout, handle); if (!lima_bo_export(res->bo, handle)) return false; @@ -424,6 +423,35 @@ lima_resource_get_handle(struct pipe_screen *pscreen, return true; } +static bool +lima_resource_get_param(struct pipe_screen *pscreen, + struct pipe_context *pctx, + struct pipe_resource *pres, + unsigned plane, unsigned layer, unsigned level, + enum pipe_resource_param param, + unsigned usage, uint64_t *value) +{ + struct lima_resource *res = lima_resource(pres); + + switch (param) { + case PIPE_RESOURCE_PARAM_STRIDE: + *value = res->levels[level].stride; + return true; + case PIPE_RESOURCE_PARAM_OFFSET: + *value = res->levels[level].offset; + return true; + case PIPE_RESOURCE_PARAM_MODIFIER: + if (res->tiled) + *value = DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED; + else + *value = DRM_FORMAT_MOD_LINEAR; + + return true; + default: + return false; + } +} + static void get_scissor_from_box(struct pipe_scissor_state *s, const struct pipe_box *b, int h) @@ -519,6 +547,7 @@ lima_resource_screen_init(struct lima_screen *screen) screen->base.resource_from_handle = lima_resource_from_handle; screen->base.resource_destroy = lima_resource_destroy; screen->base.resource_get_handle = lima_resource_get_handle; + screen->base.resource_get_param = lima_resource_get_param; screen->base.set_damage_region = lima_resource_set_damage_region; } diff --git a/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt b/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt index 8f16479af..44fc9081f 100644 --- a/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt +++ b/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt @@ -6,7 +6,6 @@ api/clenqueuemigratememobjects: skip api/clgetextensionfunctionaddressforplatform: skip api/clgetkernelarginfo: skip api/cllinkprogram: skip -api/clsetkernelarg/set kernel argument for cl_int3: fail interop/egl_khr_cl_event2: skip program/build/include-directories: fail program/build/math-intrinsics: fail diff --git a/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt b/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt index d4507a5c2..919b13a84 100644 --- a/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt +++ b/lib/mesa/src/gallium/drivers/llvmpipe/ci/llvmpipe-quick_gl.txt @@ -474,12 +474,6 @@ spec/arb_internalformat_query/misc. api error checks: skip spec/arb_pipeline_statistics_query/arb_pipeline_statistics_query-frag: fail spec/arb_post_depth_coverage/arb_post_depth_coverage-multisampling: fail spec/arb_program_interface_query/arb_program_interface_query-getprogramresourceindex/'vs_input2[1][0]' on gl_program_input: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_int: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_unsigned_int: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_unsigned_int64_arb: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_int: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_unsigned_int: fail -spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_unsigned_int64_arb: fail spec/arb_sample_locations/test: skip spec/arb_sample_shading/builtin-gl-num-samples 16: skip spec/arb_sample_shading/builtin-gl-num-samples 32: skip diff --git a/lib/mesa/src/gallium/drivers/llvmpipe/lp_query.c b/lib/mesa/src/gallium/drivers/llvmpipe/lp_query.c index 703512d01..38c1319a4 100644 --- a/lib/mesa/src/gallium/drivers/llvmpipe/lp_query.c +++ b/lib/mesa/src/gallium/drivers/llvmpipe/lp_query.c @@ -139,6 +139,17 @@ llvmpipe_get_query_result(struct pipe_context *pipe, } } break; + case PIPE_QUERY_TIME_ELAPSED: { + uint64_t start = (uint64_t)-1, end = 0; + for (i = 0; i < num_threads; i++) { + if (pq->start[i] && pq->start[i] < start) + start = pq->start[i]; + if (pq->end[i] && pq->end[i] > end) + end = pq->end[i]; + } + *result = end - start; + break; + } case PIPE_QUERY_TIMESTAMP_DISJOINT: { struct pipe_query_data_timestamp_disjoint *td = (struct pipe_query_data_timestamp_disjoint *)vresult; @@ -260,6 +271,17 @@ llvmpipe_get_query_result_resource(struct pipe_context *pipe, } } break; + case PIPE_QUERY_TIME_ELAPSED: { + uint64_t start = (uint64_t)-1, end = 0; + for (i = 0; i < num_threads; i++) { + if (pq->start[i] && pq->start[i] < start) + start = pq->start[i]; + if (pq->end[i] && pq->end[i] > end) + end = pq->end[i]; + } + value = end - start; + break; + } case PIPE_QUERY_SO_STATISTICS: value = pq->num_primitives_written[0]; value2 = pq->num_primitives_generated[0]; diff --git a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp index 54d3cd794..f1c6e85d6 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp @@ -1292,7 +1292,7 @@ Converter::parseNIR() info->prop.cp.numThreads[0] = nir->info.cs.local_size[0]; info->prop.cp.numThreads[1] = nir->info.cs.local_size[1]; info->prop.cp.numThreads[2] = nir->info.cs.local_size[2]; - info_out->bin.smemSize += nir->info.shared_size; + info_out->bin.smemSize = std::max(info_out->bin.smemSize, nir->info.shared_size); break; case Program::TYPE_FRAGMENT: info_out->prop.fp.earlyFragTests = nir->info.fs.early_fragment_tests; diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_resource.c b/lib/mesa/src/gallium/drivers/panfrost/pan_resource.c index c189eec26..0e1f43efb 100644 --- a/lib/mesa/src/gallium/drivers/panfrost/pan_resource.c +++ b/lib/mesa/src/gallium/drivers/panfrost/pan_resource.c @@ -157,13 +157,14 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, if (handle->type == WINSYS_HANDLE_TYPE_SHARED) { return false; } else if (handle->type == WINSYS_HANDLE_TYPE_KMS) { - if (renderonly_get_handle(scanout, handle)) + if (dev->ro) { + return renderonly_get_handle(scanout, handle); + } else { + handle->handle = rsrc->image.data.bo->gem_handle; + handle->stride = rsrc->image.layout.slices[0].line_stride; + handle->offset = rsrc->image.layout.slices[0].offset; return true; - - handle->handle = rsrc->image.data.bo->gem_handle; - handle->stride = rsrc->image.layout.slices[0].line_stride; - handle->offset = rsrc->image.layout.slices[0].offset; - return TRUE; + } } else if (handle->type == WINSYS_HANDLE_TYPE_FD) { if (scanout) { struct drm_prime_handle args = { @@ -195,6 +196,30 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, return false; } +static bool +panfrost_resource_get_param(struct pipe_screen *pscreen, + struct pipe_context *pctx, struct pipe_resource *prsc, + unsigned plane, unsigned layer, unsigned level, + enum pipe_resource_param param, + unsigned usage, uint64_t *value) +{ + struct panfrost_resource *rsrc = (struct panfrost_resource *) prsc; + + switch (param) { + case PIPE_RESOURCE_PARAM_STRIDE: + *value = rsrc->image.layout.slices[level].line_stride; + return true; + case PIPE_RESOURCE_PARAM_OFFSET: + *value = rsrc->image.layout.slices[level].offset; + return true; + case PIPE_RESOURCE_PARAM_MODIFIER: + *value = rsrc->image.layout.modifier; + return true; + default: + return false; + } +} + static void panfrost_flush_resource(struct pipe_context *pctx, struct pipe_resource *prsc) { @@ -1303,6 +1328,7 @@ panfrost_resource_screen_init(struct pipe_screen *pscreen) pscreen->resource_destroy = u_transfer_helper_resource_destroy; pscreen->resource_from_handle = panfrost_resource_from_handle; pscreen->resource_get_handle = panfrost_resource_get_handle; + pscreen->resource_get_param = panfrost_resource_get_param; pscreen->transfer_helper = u_transfer_helper_create(&transfer_vtbl, true, false, fake_rgtc, true); diff --git a/lib/mesa/src/gallium/drivers/v3d/v3d_resource.c b/lib/mesa/src/gallium/drivers/v3d/v3d_resource.c index 602ba6d84..cc56d02da 100644 --- a/lib/mesa/src/gallium/drivers/v3d/v3d_resource.c +++ b/lib/mesa/src/gallium/drivers/v3d/v3d_resource.c @@ -397,6 +397,21 @@ v3d_resource_destroy(struct pipe_screen *pscreen, free(rsc); } +static uint64_t +v3d_resource_modifier(struct v3d_resource *rsc) +{ + if (rsc->tiled) { + /* A shared tiled buffer should always be allocated as UIF, + * not UBLINEAR or LT. + */ + assert(rsc->slices[0].tiling == VC5_TILING_UIF_XOR || + rsc->slices[0].tiling == VC5_TILING_UIF_NO_XOR); + return DRM_FORMAT_MOD_BROADCOM_UIF; + } else { + return DRM_FORMAT_MOD_LINEAR; + } +} + static bool v3d_resource_get_handle(struct pipe_screen *pscreen, struct pipe_context *pctx, @@ -410,6 +425,7 @@ v3d_resource_get_handle(struct pipe_screen *pscreen, whandle->stride = rsc->slices[0].stride; whandle->offset = 0; + whandle->modifier = v3d_resource_modifier(rsc); /* If we're passing some reference to our BO out to some other part of * the system, then we can't do any optimizations about only us being @@ -417,26 +433,16 @@ v3d_resource_get_handle(struct pipe_screen *pscreen, */ bo->private = false; - if (rsc->tiled) { - /* A shared tiled buffer should always be allocated as UIF, - * not UBLINEAR or LT. - */ - assert(rsc->slices[0].tiling == VC5_TILING_UIF_XOR || - rsc->slices[0].tiling == VC5_TILING_UIF_NO_XOR); - whandle->modifier = DRM_FORMAT_MOD_BROADCOM_UIF; - } else { - whandle->modifier = DRM_FORMAT_MOD_LINEAR; - } - switch (whandle->type) { case WINSYS_HANDLE_TYPE_SHARED: return v3d_bo_flink(bo, &whandle->handle); case WINSYS_HANDLE_TYPE_KMS: if (screen->ro) { - assert(rsc->scanout); - bool ok = renderonly_get_handle(rsc->scanout, whandle); - whandle->stride = rsc->slices[0].stride; - return ok; + if (renderonly_get_handle(rsc->scanout, whandle)) { + whandle->stride = rsc->slices[0].stride; + return true; + } + return false; } whandle->handle = bo->handle; return true; @@ -448,6 +454,30 @@ v3d_resource_get_handle(struct pipe_screen *pscreen, return false; } +static bool +v3d_resource_get_param(struct pipe_screen *pscreen, + struct pipe_context *pctx, struct pipe_resource *prsc, + unsigned plane, unsigned layer, unsigned level, + enum pipe_resource_param param, + unsigned usage, uint64_t *value) +{ + struct v3d_resource *rsc = v3d_resource(prsc); + + switch (param) { + case PIPE_RESOURCE_PARAM_STRIDE: + *value = rsc->slices[level].stride; + return true; + case PIPE_RESOURCE_PARAM_OFFSET: + *value = 0; + return true; + case PIPE_RESOURCE_PARAM_MODIFIER: + *value = v3d_resource_modifier(rsc); + return true; + default: + return false; + } +} + #define PAGE_UB_ROWS (VC5_UIFCFG_PAGE_SIZE / VC5_UIFBLOCK_ROW_SIZE) #define PAGE_UB_ROWS_TIMES_1_5 ((PAGE_UB_ROWS * 3) >> 1) #define PAGE_CACHE_UB_ROWS (VC5_PAGE_CACHE_SIZE / VC5_UIFBLOCK_ROW_SIZE) @@ -929,10 +959,6 @@ v3d_resource_from_handle(struct pipe_screen *pscreen, renderonly_create_gpu_import_for_resource(prsc, screen->ro, NULL); - if (!rsc->scanout) { - fprintf(stderr, "Failed to create scanout resource.\n"); - goto fail; - } } if (rsc->tiled && whandle->stride != slice->stride) { @@ -1152,6 +1178,7 @@ v3d_resource_screen_init(struct pipe_screen *pscreen) pscreen->resource_create = u_transfer_helper_resource_create; pscreen->resource_from_handle = v3d_resource_from_handle; pscreen->resource_get_handle = v3d_resource_get_handle; + pscreen->resource_get_param = v3d_resource_get_param; pscreen->resource_destroy = u_transfer_helper_resource_destroy; pscreen->transfer_helper = u_transfer_helper_create(&transfer_vtbl, true, false, diff --git a/lib/mesa/src/gallium/drivers/zink/zink_compiler.c b/lib/mesa/src/gallium/drivers/zink/zink_compiler.c index cff1f6d67..c91d97dc7 100644 --- a/lib/mesa/src/gallium/drivers/zink/zink_compiler.c +++ b/lib/mesa/src/gallium/drivers/zink/zink_compiler.c @@ -746,7 +746,7 @@ unbreak_bos(nir_shader *shader) const struct glsl_type *type = glsl_without_array(var->type); if (type_is_counter(type)) continue; - unsigned size = glsl_count_attribute_slots(type, false); + unsigned size = glsl_count_attribute_slots(glsl_type_is_array(var->type) ? var->type : type, false); if (var->data.mode == nir_var_mem_ubo) max_ubo_size = MAX2(max_ubo_size, size); else diff --git a/lib/mesa/src/gallium/drivers/zink/zink_extensions.py b/lib/mesa/src/gallium/drivers/zink/zink_extensions.py index 656cfdf17..e55bb8415 100644 --- a/lib/mesa/src/gallium/drivers/zink/zink_extensions.py +++ b/lib/mesa/src/gallium/drivers/zink/zink_extensions.py @@ -25,8 +25,8 @@ from xml.etree import ElementTree from typing import List,Tuple class Version: - device_version : Tuple[int, int, int] = (1,0,0) - struct_version : Tuple[int, int] = (1,0) + device_version = (1,0,0) + struct_version = (1,0) def __init__(self, version, struct=()): self.device_version = version @@ -59,16 +59,16 @@ class Version: + '_' + struct) class Extension: - name : str = None - alias : str = None - is_required : bool = False - is_nonstandard : bool = False - enable_conds : List[str] = None + name = None + alias = None + is_required = False + is_nonstandard = False + enable_conds = None # these are specific to zink_device_info.py: - has_properties : bool = False - has_features : bool = False - guard : bool = False + has_properties = False + has_features = False + guard = False # these are specific to zink_instance.py: core_since : Version = None @@ -147,14 +147,14 @@ Layer = Extension class ExtensionRegistryEntry: # type of extension - right now it's either "instance" or "device" - ext_type : str = "" + ext_type = "" # the version in which the extension is promoted to core VK - promoted_in : Version = None + promoted_in = None # functions added by the extension are referred to as "commands" in the registry - commands : List[str] = None - constants : List[str] = None - features_struct : str = None - properties_struct : str = None + commands = None + constants = None + features_struct = None + properties_struct = None class ExtensionRegistry: # key = extension name, value = registry entry diff --git a/lib/mesa/src/gallium/drivers/zink/zink_format.c b/lib/mesa/src/gallium/drivers/zink/zink_format.c index 18b6d4ef6..1578bd479 100644 --- a/lib/mesa/src/gallium/drivers/zink/zink_format.c +++ b/lib/mesa/src/gallium/drivers/zink/zink_format.c @@ -77,7 +77,6 @@ static const VkFormat formats[PIPE_FORMAT_COUNT] = { MAP_FORMAT_NORM(R8G8B8A8) MAP_FORMAT_SCALED(R8G8B8A8) MAP_FORMAT_INT(R8G8B8A8) - MAP_FORMAT_SRGB(R8G8B8A8) MAP_FORMAT_NORM(B8G8R8A8) MAP_FORMAT_SCALED(B8G8R8A8) MAP_FORMAT_INT(B8G8R8A8) diff --git a/lib/mesa/src/gallium/frontends/clover/core/kernel.cpp b/lib/mesa/src/gallium/frontends/clover/core/kernel.cpp index 3f58973ff..c265b4b37 100644 --- a/lib/mesa/src/gallium/frontends/clover/core/kernel.cpp +++ b/lib/mesa/src/gallium/frontends/clover/core/kernel.cpp @@ -247,7 +247,7 @@ kernel::exec_context::bind(intrusive_ptr<command_queue> _q, case module::argument::constant_buffer: { auto arg = argument::create(marg); cl_mem buf = kern._constant_buffers.at(&q->device()).get(); - arg->set(q->device().address_bits() / 8, &buf); + arg->set(sizeof(buf), &buf); arg->bind(*this, marg); break; } diff --git a/lib/mesa/src/gallium/frontends/clover/nir/invocation.cpp b/lib/mesa/src/gallium/frontends/clover/nir/invocation.cpp index 197eda8b9..1982af04c 100644 --- a/lib/mesa/src/gallium/frontends/clover/nir/invocation.cpp +++ b/lib/mesa/src/gallium/frontends/clover/nir/invocation.cpp @@ -324,8 +324,8 @@ clover_lower_nir(nir_shader *nir, std::vector<module::argument> &args, "constant_buffer_addr"); constant_var->data.location = args.size(); - args.emplace_back(module::argument::global, - pointer_bit_size / 8, pointer_bit_size / 8, pointer_bit_size / 8, + args.emplace_back(module::argument::global, sizeof(cl_mem), + pointer_bit_size / 8, pointer_bit_size / 8, module::argument::zero_ext, module::argument::constant_buffer); } diff --git a/lib/mesa/src/gallium/frontends/clover/spirv/invocation.cpp b/lib/mesa/src/gallium/frontends/clover/spirv/invocation.cpp index ec425e2c7..ce1e85f7b 100644 --- a/lib/mesa/src/gallium/frontends/clover/spirv/invocation.cpp +++ b/lib/mesa/src/gallium/frontends/clover/spirv/invocation.cpp @@ -330,9 +330,8 @@ namespace { const auto elem_size = types_iter->second.size; const auto elem_nbs = get<uint32_t>(inst, 3); - const auto size = elem_size * elem_nbs; - const auto align = elem_size * util_next_power_of_two(elem_nbs); - types[id] = { module::argument::scalar, size, size, align, + const auto size = elem_size * (elem_nbs != 3 ? elem_nbs : 4); + types[id] = { module::argument::scalar, size, size, size, module::argument::zero_ext }; types[id].info.address_qualifier = CL_KERNEL_ARG_ADDRESS_PRIVATE; break; diff --git a/lib/mesa/src/gallium/frontends/dri/dri_context.c b/lib/mesa/src/gallium/frontends/dri/dri_context.c index 39eae5f75..55bfa224b 100644 --- a/lib/mesa/src/gallium/frontends/dri/dri_context.c +++ b/lib/mesa/src/gallium/frontends/dri/dri_context.c @@ -271,6 +271,8 @@ dri_unbind_context(__DRIcontext * cPriv) stapi->make_current(stapi, NULL, NULL, NULL); } } + ctx->dPriv = NULL; + ctx->rPriv = NULL; return GL_TRUE; } diff --git a/lib/mesa/src/gallium/frontends/lavapipe/lvp_execute.c b/lib/mesa/src/gallium/frontends/lavapipe/lvp_execute.c index c1e6e396b..0412f86ae 100644 --- a/lib/mesa/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/lib/mesa/src/gallium/frontends/lavapipe/lvp_execute.c @@ -632,7 +632,7 @@ static void handle_graphics_pipeline(struct lvp_cmd_buffer_entry *cmd, unsigned location = vi->pVertexAttributeDescriptions[i].location; state->ve[location].src_offset = vi->pVertexAttributeDescriptions[i].offset; state->ve[location].vertex_buffer_index = vi->pVertexAttributeDescriptions[i].binding; - state->ve[location].src_format = vk_format_to_pipe(vi->pVertexAttributeDescriptions[i].format); + state->ve[location].src_format = lvp_vk_format_to_pipe_format(vi->pVertexAttributeDescriptions[i].format); switch (vi->pVertexBindingDescriptions[vi->pVertexAttributeDescriptions[i].binding].inputRate) { case VK_VERTEX_INPUT_RATE_VERTEX: @@ -853,11 +853,11 @@ static void fill_sampler_view_stage(struct rendering_state *state, enum pipe_format pformat; if (iv->subresourceRange.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT) - pformat = vk_format_to_pipe(iv->format); + pformat = lvp_vk_format_to_pipe_format(iv->format); else if (iv->subresourceRange.aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT) - pformat = util_format_stencil_only(vk_format_to_pipe(iv->format)); + pformat = util_format_stencil_only(lvp_vk_format_to_pipe_format(iv->format)); else - pformat = vk_format_to_pipe(iv->format); + pformat = lvp_vk_format_to_pipe_format(iv->format); u_sampler_view_default_template(&templ, iv->image->bo, pformat); @@ -955,11 +955,11 @@ static void fill_image_view_stage(struct rendering_state *state, idx += dyn_info->stage[stage].image_count; state->iv[p_stage][idx].resource = iv->image->bo; if (iv->subresourceRange.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT) - state->iv[p_stage][idx].format = vk_format_to_pipe(iv->format); + state->iv[p_stage][idx].format = lvp_vk_format_to_pipe_format(iv->format); else if (iv->subresourceRange.aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT) - state->iv[p_stage][idx].format = util_format_stencil_only(vk_format_to_pipe(iv->format)); + state->iv[p_stage][idx].format = util_format_stencil_only(lvp_vk_format_to_pipe_format(iv->format)); else - state->iv[p_stage][idx].format = vk_format_to_pipe(iv->format); + state->iv[p_stage][idx].format = lvp_vk_format_to_pipe_format(iv->format); if (iv->view_type == VK_IMAGE_VIEW_TYPE_3D) { state->iv[p_stage][idx].u.tex.first_layer = 0; @@ -1212,7 +1212,7 @@ static struct pipe_surface *create_img_surface(struct rendering_state *state, int base_layer, int layer_count) { return create_img_surface_bo(state, &imgv->subresourceRange, imgv->image->bo, - vk_format_to_pipe(format), width, height, base_layer, layer_count, 0); + lvp_vk_format_to_pipe_format(format), width, height, base_layer, layer_count, 0); } static void add_img_view_surface(struct rendering_state *state, diff --git a/lib/mesa/src/gallium/frontends/lavapipe/lvp_formats.c b/lib/mesa/src/gallium/frontends/lavapipe/lvp_formats.c index 30a38c20f..84fc34fb0 100644 --- a/lib/mesa/src/gallium/frontends/lavapipe/lvp_formats.c +++ b/lib/mesa/src/gallium/frontends/lavapipe/lvp_formats.c @@ -26,138 +26,6 @@ #include "util/u_math.h" #include "vk_util.h" -#define COMMON_NAME(x) [VK_FORMAT_##x] = PIPE_FORMAT_##x - -#define FLOAT_NAME(x) [VK_FORMAT_##x##_SFLOAT] = PIPE_FORMAT_##x##_FLOAT - -static enum pipe_format format_to_vk_table[VK_FORMAT_ASTC_12x12_SRGB_BLOCK + 1] = { - - COMMON_NAME(R8_UNORM), - COMMON_NAME(R8G8_UNORM), - COMMON_NAME(R8G8B8_UNORM), - COMMON_NAME(R8G8B8A8_UNORM), - - COMMON_NAME(R8_SNORM), - COMMON_NAME(R8G8_SNORM), - COMMON_NAME(R8G8B8_SNORM), - COMMON_NAME(R8G8B8A8_SNORM), - - // COMMON_NAME(R8_SRGB), - COMMON_NAME(R8G8B8_SRGB), - COMMON_NAME(R8G8B8A8_SRGB), - - COMMON_NAME(B8G8R8A8_UNORM), - COMMON_NAME(R8G8B8A8_SRGB), - COMMON_NAME(B8G8R8A8_SRGB), - - COMMON_NAME(R8_UINT), - COMMON_NAME(R8G8_UINT), - COMMON_NAME(R8G8B8_UINT), - COMMON_NAME(R8G8B8A8_UINT), - - COMMON_NAME(R16_UINT), - COMMON_NAME(R16G16_UINT), - COMMON_NAME(R16G16B16_UINT), - COMMON_NAME(R16G16B16A16_UINT), - - COMMON_NAME(R32_UINT), - COMMON_NAME(R32G32_UINT), - COMMON_NAME(R32G32B32_UINT), - COMMON_NAME(R32G32B32A32_UINT), - - COMMON_NAME(R8_SINT), - COMMON_NAME(R8G8_SINT), - COMMON_NAME(R8G8B8_SINT), - COMMON_NAME(R8G8B8A8_SINT), - - COMMON_NAME(R16_SINT), - COMMON_NAME(R16G16_SINT), - COMMON_NAME(R16G16B16_SINT), - COMMON_NAME(R16G16B16A16_SINT), - - COMMON_NAME(R32_SINT), - COMMON_NAME(R32G32_SINT), - COMMON_NAME(R32G32B32_SINT), - COMMON_NAME(R32G32B32A32_SINT), - - COMMON_NAME(R16_UNORM), - COMMON_NAME(R16G16_UNORM), - COMMON_NAME(R16G16B16A16_UNORM), - - COMMON_NAME(R16_SNORM), - COMMON_NAME(R16G16_SNORM), - COMMON_NAME(R16G16B16A16_SNORM), - FLOAT_NAME(R16), - FLOAT_NAME(R16G16), - FLOAT_NAME(R16G16B16), - FLOAT_NAME(R16G16B16A16), - - FLOAT_NAME(R32), - FLOAT_NAME(R32G32), - FLOAT_NAME(R32G32B32), - FLOAT_NAME(R32G32B32A32), - - COMMON_NAME(S8_UINT), - [VK_FORMAT_UNDEFINED] = PIPE_FORMAT_NONE, - [VK_FORMAT_R5G6B5_UNORM_PACK16] = PIPE_FORMAT_B5G6R5_UNORM, - [VK_FORMAT_A1R5G5B5_UNORM_PACK16] = PIPE_FORMAT_B5G5R5A1_UNORM, - [VK_FORMAT_B4G4R4A4_UNORM_PACK16] = PIPE_FORMAT_A4R4G4B4_UNORM, - [VK_FORMAT_D16_UNORM] = PIPE_FORMAT_Z16_UNORM, - - [VK_FORMAT_A8B8G8R8_UNORM_PACK32] = PIPE_FORMAT_R8G8B8A8_UNORM, - [VK_FORMAT_A8B8G8R8_SNORM_PACK32] = PIPE_FORMAT_R8G8B8A8_SNORM, - [VK_FORMAT_A8B8G8R8_UINT_PACK32] = PIPE_FORMAT_R8G8B8A8_UINT, - [VK_FORMAT_A8B8G8R8_SINT_PACK32] = PIPE_FORMAT_R8G8B8A8_SINT, - [VK_FORMAT_A8B8G8R8_SRGB_PACK32] = PIPE_FORMAT_R8G8B8A8_SRGB, - - [VK_FORMAT_A2B10G10R10_UNORM_PACK32] = PIPE_FORMAT_R10G10B10A2_UNORM, - [VK_FORMAT_A2B10G10R10_SNORM_PACK32] = PIPE_FORMAT_R10G10B10A2_SNORM, - [VK_FORMAT_A2R10G10B10_UNORM_PACK32] = PIPE_FORMAT_B10G10R10A2_UNORM, - [VK_FORMAT_A2R10G10B10_SNORM_PACK32] = PIPE_FORMAT_B10G10R10A2_SNORM, - - [VK_FORMAT_A2B10G10R10_UINT_PACK32] = PIPE_FORMAT_R10G10B10A2_UINT, - [VK_FORMAT_A2R10G10B10_UINT_PACK32] = PIPE_FORMAT_B10G10R10A2_UINT, - [VK_FORMAT_A2B10G10R10_USCALED_PACK32] = PIPE_FORMAT_R10G10B10A2_USCALED, - [VK_FORMAT_A2B10G10R10_SSCALED_PACK32] = PIPE_FORMAT_R10G10B10A2_SSCALED, - [VK_FORMAT_A2R10G10B10_USCALED_PACK32] = PIPE_FORMAT_B10G10R10A2_USCALED, - [VK_FORMAT_A2R10G10B10_SSCALED_PACK32] = PIPE_FORMAT_B10G10R10A2_SSCALED, - - [VK_FORMAT_B10G11R11_UFLOAT_PACK32] = PIPE_FORMAT_R11G11B10_FLOAT, - [VK_FORMAT_E5B9G9R9_UFLOAT_PACK32] = PIPE_FORMAT_R9G9B9E5_FLOAT, - - [VK_FORMAT_X8_D24_UNORM_PACK32] = PIPE_FORMAT_Z24X8_UNORM, - [VK_FORMAT_D32_SFLOAT] = PIPE_FORMAT_Z32_FLOAT, - [VK_FORMAT_D24_UNORM_S8_UINT] = PIPE_FORMAT_Z24_UNORM_S8_UINT, - [VK_FORMAT_D32_SFLOAT_S8_UINT] = PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, - - [VK_FORMAT_BC1_RGB_UNORM_BLOCK] = PIPE_FORMAT_DXT1_RGB, - [VK_FORMAT_BC1_RGBA_UNORM_BLOCK] = PIPE_FORMAT_DXT1_RGBA, - [VK_FORMAT_BC2_UNORM_BLOCK] = PIPE_FORMAT_DXT3_RGBA, - [VK_FORMAT_BC3_UNORM_BLOCK] = PIPE_FORMAT_DXT5_RGBA, - [VK_FORMAT_BC4_UNORM_BLOCK] = PIPE_FORMAT_RGTC1_UNORM, - [VK_FORMAT_BC5_UNORM_BLOCK] = PIPE_FORMAT_RGTC2_UNORM, - - [VK_FORMAT_BC1_RGB_SRGB_BLOCK] = PIPE_FORMAT_DXT1_SRGB, - [VK_FORMAT_BC1_RGBA_SRGB_BLOCK] = PIPE_FORMAT_DXT1_SRGBA, - [VK_FORMAT_BC2_SRGB_BLOCK] = PIPE_FORMAT_DXT3_SRGBA, - [VK_FORMAT_BC3_SRGB_BLOCK] = PIPE_FORMAT_DXT5_SRGBA, - - [VK_FORMAT_BC4_SNORM_BLOCK] = PIPE_FORMAT_RGTC1_SNORM, - [VK_FORMAT_BC5_SNORM_BLOCK] = PIPE_FORMAT_RGTC2_SNORM, - - [VK_FORMAT_BC6H_UFLOAT_BLOCK] = PIPE_FORMAT_BPTC_RGB_UFLOAT, - [VK_FORMAT_BC6H_SFLOAT_BLOCK] = PIPE_FORMAT_BPTC_RGB_FLOAT, - [VK_FORMAT_BC7_UNORM_BLOCK] = PIPE_FORMAT_BPTC_RGBA_UNORM, - [VK_FORMAT_BC7_SRGB_BLOCK] = PIPE_FORMAT_BPTC_SRGBA, -}; - -enum pipe_format vk_format_to_pipe(VkFormat format) -{ - if (format > VK_FORMAT_ASTC_12x12_SRGB_BLOCK) - return PIPE_FORMAT_NONE; - return format_to_vk_table[format]; -} - static bool lvp_is_filter_minmax_format_supported(VkFormat format) { /* From the Vulkan spec 1.1.71: @@ -192,7 +60,7 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d VkFormat format, VkFormatProperties *out_properties) { - enum pipe_format pformat = vk_format_to_pipe(format); + enum pipe_format pformat = lvp_vk_format_to_pipe_format(format); unsigned features = 0, buffer_features = 0; if (pformat == PIPE_FORMAT_NONE) { out_properties->linearTilingFeatures = 0; @@ -302,7 +170,7 @@ static VkResult lvp_get_image_format_properties(struct lvp_physical_device *phys uint32_t maxMipLevels; uint32_t maxArraySize; VkSampleCountFlags sampleCounts = VK_SAMPLE_COUNT_1_BIT; - enum pipe_format pformat = vk_format_to_pipe(info->format); + enum pipe_format pformat = lvp_vk_format_to_pipe_format(info->format); lvp_physical_device_get_format_properties(physical_device, info->format, &format_props); if (info->tiling == VK_IMAGE_TILING_LINEAR) { diff --git a/lib/mesa/src/gallium/frontends/lavapipe/lvp_image.c b/lib/mesa/src/gallium/frontends/lavapipe/lvp_image.c index 6ea29c950..68facac8a 100644 --- a/lib/mesa/src/gallium/frontends/lavapipe/lvp_image.c +++ b/lib/mesa/src/gallium/frontends/lavapipe/lvp_image.c @@ -79,7 +79,7 @@ lvp_image_create(VkDevice _device, if (pCreateInfo->usage & VK_IMAGE_USAGE_STORAGE_BIT) template.bind |= PIPE_BIND_SHADER_IMAGE; - template.format = vk_format_to_pipe(pCreateInfo->format); + template.format = lvp_vk_format_to_pipe_format(pCreateInfo->format); template.width0 = pCreateInfo->extent.width; template.height0 = pCreateInfo->extent.height; template.depth0 = pCreateInfo->extent.depth; @@ -199,7 +199,7 @@ lvp_CreateImageView(VkDevice _device, VK_OBJECT_TYPE_IMAGE_VIEW); view->view_type = pCreateInfo->viewType; view->format = pCreateInfo->format; - view->pformat = vk_format_to_pipe(pCreateInfo->format); + view->pformat = lvp_vk_format_to_pipe_format(pCreateInfo->format); view->components = pCreateInfo->components; view->subresourceRange = pCreateInfo->subresourceRange; view->image = image; @@ -402,7 +402,7 @@ lvp_CreateBufferView(VkDevice _device, VK_OBJECT_TYPE_BUFFER_VIEW); view->buffer = buffer; view->format = pCreateInfo->format; - view->pformat = vk_format_to_pipe(pCreateInfo->format); + view->pformat = lvp_vk_format_to_pipe_format(pCreateInfo->format); view->offset = pCreateInfo->offset; view->range = pCreateInfo->range; *pView = lvp_buffer_view_to_handle(view); diff --git a/lib/mesa/src/gallium/frontends/lavapipe/lvp_private.h b/lib/mesa/src/gallium/frontends/lavapipe/lvp_private.h index 4567b09db..8a57be932 100644 --- a/lib/mesa/src/gallium/frontends/lavapipe/lvp_private.h +++ b/lib/mesa/src/gallium/frontends/lavapipe/lvp_private.h @@ -54,6 +54,7 @@ typedef uint32_t xcb_window_t; #include "vk_physical_device.h" #include "vk_shader_module.h" #include "vk_util.h" +#include "vk_format.h" #include "wsi_common.h" @@ -1107,31 +1108,39 @@ VkResult lvp_execute_cmds(struct lvp_device *device, struct lvp_image *lvp_swapchain_get_image(VkSwapchainKHR swapchain, uint32_t index); -enum pipe_format vk_format_to_pipe(VkFormat format); -static inline VkImageAspectFlags -vk_format_aspects(VkFormat format) +static inline enum pipe_format +lvp_vk_format_to_pipe_format(VkFormat format) { - switch (format) { - case VK_FORMAT_UNDEFINED: - return 0; - - case VK_FORMAT_S8_UINT: - return VK_IMAGE_ASPECT_STENCIL_BIT; - - case VK_FORMAT_D16_UNORM_S8_UINT: - case VK_FORMAT_D24_UNORM_S8_UINT: - case VK_FORMAT_D32_SFLOAT_S8_UINT: - return VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; - - case VK_FORMAT_D16_UNORM: - case VK_FORMAT_X8_D24_UNORM_PACK32: - case VK_FORMAT_D32_SFLOAT: - return VK_IMAGE_ASPECT_DEPTH_BIT; - - default: - return VK_IMAGE_ASPECT_COLOR_BIT; - } + /* Some formats cause problems with CTS right now.*/ + if (format == VK_FORMAT_R4G4B4A4_UNORM_PACK16 || + format == VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT || /* VK_EXT_4444_formats */ + format == VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT || /* VK_EXT_4444_formats */ + format == VK_FORMAT_R5G5B5A1_UNORM_PACK16 || + format == VK_FORMAT_R8_SRGB || + format == VK_FORMAT_R8G8_SRGB || + format == VK_FORMAT_R64G64B64A64_SFLOAT || + format == VK_FORMAT_R64_SFLOAT || + format == VK_FORMAT_R64G64_SFLOAT || + format == VK_FORMAT_R64G64B64_SFLOAT || + format == VK_FORMAT_A2R10G10B10_SINT_PACK32 || + format == VK_FORMAT_A2B10G10R10_SINT_PACK32 || + format == VK_FORMAT_G8B8G8R8_422_UNORM || + format == VK_FORMAT_B8G8R8G8_422_UNORM || + format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM || + format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM || + format == VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM || + format == VK_FORMAT_G8_B8R8_2PLANE_422_UNORM || + format == VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM || + format == VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM || + format == VK_FORMAT_G16_B16R16_2PLANE_420_UNORM || + format == VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM || + format == VK_FORMAT_G16_B16R16_2PLANE_422_UNORM || + format == VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM || + format == VK_FORMAT_D16_UNORM_S8_UINT) + return PIPE_FORMAT_NONE; + + return vk_format_to_pipe_format(format); } #ifdef __cplusplus diff --git a/lib/mesa/src/gallium/frontends/nine/nine_shader.c b/lib/mesa/src/gallium/frontends/nine/nine_shader.c index b365362cf..af6dad67e 100644 --- a/lib/mesa/src/gallium/frontends/nine/nine_shader.c +++ b/lib/mesa/src/gallium/frontends/nine/nine_shader.c @@ -1010,7 +1010,7 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) struct ureg_dst tmp; assert(!param->rel || (IS_VS && param->file == D3DSPR_CONST) || - (D3DSPR_ADDR && tx->version.major == 3)); + (param->file == D3DSPR_INPUT && tx->version.major == 3)); switch (param->file) { diff --git a/lib/mesa/src/gallium/frontends/va/picture_h264_enc.c b/lib/mesa/src/gallium/frontends/va/picture_h264_enc.c index 4dfeeccce..7dad5a5b9 100644 --- a/lib/mesa/src/gallium/frontends/va/picture_h264_enc.c +++ b/lib/mesa/src/gallium/frontends/va/picture_h264_enc.c @@ -53,7 +53,7 @@ vlVaHandleVAEncPictureParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *cont context->coded_buf = coded_buf; _mesa_hash_table_insert(context->desc.h264enc.frame_idx, - UINT_TO_PTR(h264->CurrPic.picture_id), + UINT_TO_PTR(h264->CurrPic.picture_id + 1), UINT_TO_PTR(h264->frame_num)); if (h264->pic_fields.bits.idr_pic_flag == 1) @@ -84,12 +84,12 @@ vlVaHandleVAEncSliceParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *contex if (h264->RefPicList0[i].picture_id != VA_INVALID_ID) { if (context->desc.h264enc.ref_idx_l0 == VA_INVALID_ID) context->desc.h264enc.ref_idx_l0 = PTR_TO_UINT(util_hash_table_get(context->desc.h264enc.frame_idx, - UINT_TO_PTR(h264->RefPicList0[i].picture_id))); + UINT_TO_PTR(h264->RefPicList0[i].picture_id + 1))); } if (h264->RefPicList1[i].picture_id != VA_INVALID_ID && h264->slice_type == 1) { if (context->desc.h264enc.ref_idx_l1 == VA_INVALID_ID) context->desc.h264enc.ref_idx_l1 = PTR_TO_UINT(util_hash_table_get(context->desc.h264enc.frame_idx, - UINT_TO_PTR(h264->RefPicList1[i].picture_id))); + UINT_TO_PTR(h264->RefPicList1[i].picture_id + 1))); } } diff --git a/lib/mesa/src/gallium/frontends/va/picture_hevc_enc.c b/lib/mesa/src/gallium/frontends/va/picture_hevc_enc.c index 748574617..17bc252ae 100644 --- a/lib/mesa/src/gallium/frontends/va/picture_hevc_enc.c +++ b/lib/mesa/src/gallium/frontends/va/picture_hevc_enc.c @@ -83,7 +83,7 @@ vlVaHandleVAEncPictureParameterBufferTypeHEVC(vlVaDriver *drv, vlVaContext *cont context->desc.h265enc.pic.constrained_intra_pred_flag = h265->pic_fields.bits.constrained_intra_pred_flag; _mesa_hash_table_insert(context->desc.h265enc.frame_idx, - UINT_TO_PTR(h265->decoded_curr_pic.picture_id), + UINT_TO_PTR(h265->decoded_curr_pic.picture_id + 1), UINT_TO_PTR(context->desc.h265enc.frame_num)); return VA_STATUS_SUCCESS; @@ -102,12 +102,12 @@ vlVaHandleVAEncSliceParameterBufferTypeHEVC(vlVaDriver *drv, vlVaContext *contex if (h265->ref_pic_list0[i].picture_id != VA_INVALID_ID) { if (context->desc.h265enc.ref_idx_l0 == VA_INVALID_ID) context->desc.h265enc.ref_idx_l0 = PTR_TO_UINT(util_hash_table_get(context->desc.h265enc.frame_idx, - UINT_TO_PTR(h265->ref_pic_list0[i].picture_id))); + UINT_TO_PTR(h265->ref_pic_list0[i].picture_id + 1))); } if (h265->ref_pic_list1[i].picture_id != VA_INVALID_ID && h265->slice_type == 1) { if (context->desc.h265enc.ref_idx_l1 == VA_INVALID_ID) context->desc.h265enc.ref_idx_l1 = PTR_TO_UINT(util_hash_table_get(context->desc.h265enc.frame_idx, - UINT_TO_PTR(h265->ref_pic_list1[i].picture_id))); + UINT_TO_PTR(h265->ref_pic_list1[i].picture_id + 1))); } } diff --git a/lib/mesa/src/gallium/targets/graw-xlib/meson.build b/lib/mesa/src/gallium/targets/graw-xlib/meson.build index d7b5fc91d..c3308d90b 100644 --- a/lib/mesa/src/gallium/targets/graw-xlib/meson.build +++ b/lib/mesa/src/gallium/targets/graw-xlib/meson.build @@ -26,7 +26,7 @@ libgraw_xlib = shared_library( link_with : [ libgraw_util, libgallium, libws_xlib ], - dependencies : [idep_mesautil, driver_swrast], + dependencies : [idep_mesautil, driver_swrast, dep_x11], version : '1.0', ) diff --git a/lib/mesa/src/intel/vulkan/anv_android.c b/lib/mesa/src/intel/vulkan/anv_android.c index dee7b80cb..5014dc3d3 100644 --- a/lib/mesa/src/intel/vulkan/anv_android.c +++ b/lib/mesa/src/intel/vulkan/anv_android.c @@ -616,6 +616,59 @@ anv_image_from_gralloc(VkDevice device_h, return result; } +VkResult +anv_image_bind_from_gralloc(struct anv_device *device, + struct anv_image *image, + const VkNativeBufferANDROID *gralloc_info) +{ + /* Do not close the gralloc handle's dma_buf. The lifetime of the dma_buf + * must exceed that of the gralloc handle, and we do not own the gralloc + * handle. + */ + int dma_buf = gralloc_info->handle->data[0]; + + /* We need to set the WRITE flag on window system buffers so that GEM will + * know we're writing to them and synchronize uses on other rings (for + * example, if the display server uses the blitter ring). + * + * If this function fails and if the imported bo was resident in the cache, + * we should avoid updating the bo's flags. Therefore, we defer updating + * the flags until success is certain. + * + */ + struct anv_bo *bo = NULL; + VkResult result = anv_device_import_bo(device, dma_buf, + ANV_BO_ALLOC_IMPLICIT_SYNC | + ANV_BO_ALLOC_IMPLICIT_WRITE, + 0 /* client_address */, + &bo); + if (result != VK_SUCCESS) { + return vk_errorf(device, &device->vk.base, result, + "failed to import dma-buf from VkNativeBufferANDROID"); + } + + uint64_t img_size = image->bindings[ANV_IMAGE_MEMORY_BINDING_MAIN].memory_range.size; + if (img_size < bo->size) { + result = vk_errorf(device, &device->vk.base, VK_ERROR_INVALID_EXTERNAL_HANDLE, + "dma-buf from VkNativeBufferANDROID is too small for " + "VkImage: %"PRIu64"B < %"PRIu64"B", + bo->size, img_size); + anv_device_release_bo(device, bo); + return result; + } + + assert(!image->disjoint); + assert(image->n_planes == 1); + assert(image->planes[0].primary_surface.memory_range.binding == + ANV_IMAGE_MEMORY_BINDING_MAIN); + assert(image->bindings[ANV_IMAGE_MEMORY_BINDING_MAIN].address.bo == NULL); + assert(image->bindings[ANV_IMAGE_MEMORY_BINDING_MAIN].address.offset == 0); + image->bindings[ANV_IMAGE_MEMORY_BINDING_MAIN].address.bo = bo; + image->from_gralloc = true; + + return VK_SUCCESS; +} + static VkResult format_supported_with_usage(VkDevice device_h, VkFormat format, VkImageUsageFlags imageUsage) diff --git a/lib/mesa/src/intel/vulkan/anv_android.h b/lib/mesa/src/intel/vulkan/anv_android.h index 809b06036..22a43d204 100644 --- a/lib/mesa/src/intel/vulkan/anv_android.h +++ b/lib/mesa/src/intel/vulkan/anv_android.h @@ -38,6 +38,10 @@ VkResult anv_image_from_gralloc(VkDevice device_h, const VkAllocationCallbacks *alloc, VkImage *pImage); +VkResult anv_image_bind_from_gralloc(struct anv_device *device, + struct anv_image *image, + const VkNativeBufferANDROID *gralloc_info); + VkResult anv_image_from_external(VkDevice device_h, const VkImageCreateInfo *base_info, const VkExternalMemoryImageCreateInfo *create_info, diff --git a/lib/mesa/src/intel/vulkan/anv_android_stubs.c b/lib/mesa/src/intel/vulkan/anv_android_stubs.c index 3e773dfe7..f6b2d1c8d 100644 --- a/lib/mesa/src/intel/vulkan/anv_android_stubs.c +++ b/lib/mesa/src/intel/vulkan/anv_android_stubs.c @@ -33,6 +33,13 @@ anv_image_from_gralloc(VkDevice device_h, return VK_ERROR_EXTENSION_NOT_PRESENT; } +VkResult anv_image_bind_from_gralloc(struct anv_device *device, + struct anv_image *image, + const VkNativeBufferANDROID *gralloc_info) +{ + return VK_ERROR_EXTENSION_NOT_PRESENT; +} + uint64_t anv_ahw_usage_from_vk_usage(const VkImageCreateFlags vk_create, const VkImageUsageFlags vk_usage) diff --git a/lib/mesa/src/panfrost/lib/pan_blitter.c b/lib/mesa/src/panfrost/lib/pan_blitter.c index d2b7dd7f3..183432c43 100644 --- a/lib/mesa/src/panfrost/lib/pan_blitter.c +++ b/lib/mesa/src/panfrost/lib/pan_blitter.c @@ -219,7 +219,7 @@ pan_blitter_emit_bifrost_blend(const struct panfrost_device *dev, if (!iview) { cfg.enable = false; cfg.bifrost.internal.mode = MALI_BIFROST_BLEND_MODE_OFF; - return; + continue; } nir_alu_type type = diff --git a/lib/mesa/src/util/00-mesa-defaults.conf b/lib/mesa/src/util/00-mesa-defaults.conf index a6967fc68..29157324f 100644 --- a/lib/mesa/src/util/00-mesa-defaults.conf +++ b/lib/mesa/src/util/00-mesa-defaults.conf @@ -134,6 +134,10 @@ TODO: document the other workarounds. <option name="allow_glsl_builtin_variable_redeclaration" value="true" /> </application> + <application name="Full Bore" executable="fullbore"> + <option name="allow_glsl_builtin_variable_redeclaration" value="true" /> + </application> + <application name="RAGE (64-bit)" executable="Rage64.exe"> <option name="allow_glsl_builtin_variable_redeclaration" value="true" /> </application> @@ -516,6 +520,7 @@ TODO: document the other workarounds. <!-- Adaptive sync denylist follows below: --> <application name="gnome-shell" executable="gnome-shell"> <option name="adaptive_sync" value="false" /> + <option name="v3d_nonmsaa_texture_size_limit" value="true" /> </application> <application name="Desktop — Plasma" executable="plasmashell"> <option name="adaptive_sync" value="false" /> @@ -564,6 +569,7 @@ TODO: document the other workarounds. </application> <application name="mutter" executable="mutter"> <option name="adaptive_sync" value="false" /> + <option name="v3d_nonmsaa_texture_size_limit" value="true" /> </application> <application name="muffin" executable="muffin"> <option name="adaptive_sync" value="false" /> diff --git a/lib/mesa/src/util/fossilize_db.c b/lib/mesa/src/util/fossilize_db.c index 37f1d4cca..65ff85ad6 100644 --- a/lib/mesa/src/util/fossilize_db.c +++ b/lib/mesa/src/util/fossilize_db.c @@ -112,7 +112,7 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx) { uint64_t offset = ftell(db_idx); fseek(db_idx, 0, SEEK_END); - size_t len = ftell(db_idx); + uint64_t len = ftell(db_idx); uint64_t parsed_offset = offset; if (offset == len) @@ -120,8 +120,6 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx) fseek(db_idx, offset, SEEK_SET); while (offset < len) { - parsed_offset = offset; - char bytes_to_read[FOSSILIZE_BLOB_HASH_LENGTH + sizeof(struct foz_payload_header)]; struct foz_payload_header *header; @@ -149,28 +147,30 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx) char hash_str[FOSSILIZE_BLOB_HASH_LENGTH + 1] = {0}; memcpy(hash_str, bytes_to_read, FOSSILIZE_BLOB_HASH_LENGTH); - struct foz_db_entry *entry = ralloc(foz_db->mem_ctx, - struct foz_db_entry); - entry->header = *header; - entry->file_idx = file_idx; - _mesa_sha1_hex_to_sha1(entry->key, hash_str); - /* read cache item offset from index file */ uint64_t cache_offset; if (fread(&cache_offset, 1, sizeof(cache_offset), db_idx) != sizeof(cache_offset)) - return; + break; - entry->offset = cache_offset; + offset += header->payload_size; + parsed_offset = offset; /* Truncate the entry's hash string to a 64bit hash for use with a * 64bit hash table for looking up file offsets. */ hash_str[16] = '\0'; uint64_t key = strtoull(hash_str, NULL, 16); - _mesa_hash_table_u64_insert(foz_db->index_db, key, entry); - offset += header->payload_size; + struct foz_db_entry *entry = ralloc(foz_db->mem_ctx, + struct foz_db_entry); + entry->header = *header; + entry->file_idx = file_idx; + _mesa_sha1_hex_to_sha1(entry->key, hash_str); + + entry->offset = cache_offset; + + _mesa_hash_table_u64_insert(foz_db->index_db, key, entry); } @@ -204,8 +204,9 @@ load_foz_dbs(struct foz_db *foz_db, FILE *db_idx, uint8_t file_idx, size_t len = ftell(db_idx); rewind(db_idx); - /* Try not to take the lock if len > 0, but if it is 0 we take the lock to initialize the files. */ - if (len == 0) { + /* Try not to take the lock if len >= the size of the header, but if it is smaller we take the + * lock to potentially initialize the files. */ + if (len < sizeof(stream_reference_magic_and_version)) { /* Wait for 100 ms in case of contention, after that we prioritize getting the app started. */ int err = lock_file_with_timeout(foz_db->file[file_idx], 100000000); if (err == -1) @@ -246,6 +247,9 @@ load_foz_dbs(struct foz_db *foz_db, FILE *db_idx, uint8_t file_idx, sizeof(stream_reference_magic_and_version), db_idx) != sizeof(stream_reference_magic_and_version)) goto fail; + + fflush(foz_db->file[file_idx]); + fflush(db_idx); } flock(fileno(db_idx), LOCK_UN); @@ -288,6 +292,7 @@ foz_prepare(struct foz_db *foz_db, char *cache_path) return false; simple_mtx_init(&foz_db->mtx, mtx_plain); + simple_mtx_init(&foz_db->flock_mtx, mtx_plain); foz_db->mem_ctx = ralloc_context(NULL); foz_db->index_db = _mesa_hash_table_u64_create(NULL); @@ -340,7 +345,8 @@ foz_prepare(struct foz_db *foz_db, char *cache_path) void foz_destroy(struct foz_db *foz_db) { - fclose(foz_db->db_idx); + if (foz_db->db_idx) + fclose(foz_db->db_idx); for (unsigned i = 0; i < FOZ_MAX_DBS; i++) { if (foz_db->file[i]) fclose(foz_db->file[i]); @@ -349,6 +355,7 @@ foz_destroy(struct foz_db *foz_db) if (foz_db->mem_ctx) { _mesa_hash_table_u64_destroy(foz_db->index_db); ralloc_free(foz_db->mem_ctx); + simple_mtx_destroy(&foz_db->flock_mtx); simple_mtx_destroy(&foz_db->mtx); } } @@ -435,7 +442,12 @@ foz_write_entry(struct foz_db *foz_db, const uint8_t *cache_key_160bit, if (!foz_db->alive) return false; - /* Wait for 1 second. This is done outside of the mutex as I believe there is more potential + /* The flock is per-fd, not per thread, we do it outside of the main mutex to avoid having to + * wait in the mutex potentially blocking reads. We use the secondary flock_mtx to stop race + * conditions between the write threads sharing the same file descriptor. */ + simple_mtx_lock(&foz_db->flock_mtx); + + /* Wait for 1 second. This is done outside of the main mutex as I believe there is more potential * for file contention than mtx contention of significant length. */ int err = lock_file_with_timeout(foz_db->file[0], 1000000000); if (err == -1) @@ -453,6 +465,8 @@ foz_write_entry(struct foz_db *foz_db, const uint8_t *cache_key_160bit, _mesa_hash_table_u64_search(foz_db->index_db, hash); if (entry) { simple_mtx_unlock(&foz_db->mtx); + flock(fileno(foz_db->file[0]), LOCK_UN); + simple_mtx_unlock(&foz_db->flock_mtx); return NULL; } @@ -516,6 +530,7 @@ foz_write_entry(struct foz_db *foz_db, const uint8_t *cache_key_160bit, simple_mtx_unlock(&foz_db->mtx); flock(fileno(foz_db->db_idx), LOCK_UN); flock(fileno(foz_db->file[0]), LOCK_UN); + simple_mtx_unlock(&foz_db->flock_mtx); return true; @@ -524,6 +539,7 @@ fail: fail_file: flock(fileno(foz_db->db_idx), LOCK_UN); flock(fileno(foz_db->file[0]), LOCK_UN); + simple_mtx_unlock(&foz_db->flock_mtx); return false; } #else diff --git a/lib/mesa/src/util/fossilize_db.h b/lib/mesa/src/util/fossilize_db.h index 9b6d34122..e05aef9e4 100644 --- a/lib/mesa/src/util/fossilize_db.h +++ b/lib/mesa/src/util/fossilize_db.h @@ -76,6 +76,7 @@ struct foz_db { FILE *file[FOZ_MAX_DBS]; /* An array of all foz dbs */ FILE *db_idx; /* The default writable foz db idx */ simple_mtx_t mtx; /* Mutex for file/hash table read/writes */ + simple_mtx_t flock_mtx; /* Mutex for flocking the file for writes */ void *mem_ctx; struct hash_table_u64 *index_db; /* Hash table of all foz db entries */ bool alive; diff --git a/lib/mesa/src/vulkan/wsi/wsi_common_win32.c b/lib/mesa/src/vulkan/wsi/wsi_common_win32.c index fa6f898e5..82731f5f9 100644 --- a/lib/mesa/src/vulkan/wsi/wsi_common_win32.c +++ b/lib/mesa/src/vulkan/wsi/wsi_common_win32.c @@ -383,7 +383,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain, .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .pNext = &memory_dedicated_info, .allocationSize = reqs.size, - .memoryTypeIndex = select_memory_type(wsi, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, + .memoryTypeIndex = select_memory_type(wsi, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, reqs.memoryTypeBits), }; result = wsi->AllocateMemory(chain->device, &memory_info, @@ -534,7 +534,7 @@ wsi_win32_queue_present(struct wsi_swapchain *drv_chain, char *dptr = image->ppvBits; result = chain->base.wsi->MapMemory(chain->base.device, image->base.memory, - 0, 0, 0, (void**)&ptr); + 0, image->base.sizes[0], 0, (void**)&ptr); for (unsigned h = 0; h < chain->extent.height; h++) { memcpy(dptr, ptr, chain->extent.width * 4); |