platform/upstream/mesa.git
3 years agopan/bi: Don't inline 64-bit constants
Alyssa Rosenzweig [Wed, 17 Feb 2021 19:13:30 +0000 (14:13 -0500)]
pan/bi: Don't inline 64-bit constants

Will drop the upper bits incorrectly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopan/bi: Fix RA of node 0 again
Alyssa Rosenzweig [Tue, 16 Feb 2021 15:46:19 +0000 (10:46 -0500)]
pan/bi: Fix RA of node 0 again

Botched rebase.

Fixes: c578ca73939 ("pan/bi: Add interference per clause")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Remove useless check
Alyssa Rosenzweig [Wed, 17 Feb 2021 04:02:11 +0000 (23:02 -0500)]
panfrost: Remove useless check

Already checked in format_supported (only difference being cube map
arrays but the extension isn't advertised yet anyway due to missing
geometry shaders.)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Set border colour on Bifrost sampler
Alyssa Rosenzweig [Wed, 17 Feb 2021 02:28:34 +0000 (21:28 -0500)]
panfrost: Set border colour on Bifrost sampler

Passes dEQP-GLES31.functional.texture.border_clamp.*

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Take panfrost_dev for AFBC selection
Alyssa Rosenzweig [Wed, 17 Feb 2021 03:47:01 +0000 (22:47 -0500)]
panfrost: Take panfrost_dev for AFBC selection

This appears to be architecture dependent.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Spell fix
Alyssa Rosenzweig [Wed, 17 Feb 2021 03:35:43 +0000 (22:35 -0500)]
panfrost: Spell fix

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Fix NULL deref for an empty frag shader
Alyssa Rosenzweig [Wed, 17 Feb 2021 03:30:42 +0000 (22:30 -0500)]
panfrost: Fix NULL deref for an empty frag shader

Fixes debug builds of dEQP-GLES31.functional.stencil_texturing.render.*

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Add RT conversion sysval
Alyssa Rosenzweig [Tue, 16 Feb 2021 23:11:07 +0000 (18:11 -0500)]
panfrost: Add RT conversion sysval

Contains the InternalConversionDescriptor corresponding to the selected
render target, ready to be fed into LD_TILE.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Export bifrost_get_blend_desc with type size
Alyssa Rosenzweig [Tue, 16 Feb 2021 23:10:43 +0000 (18:10 -0500)]
panfrost: Export bifrost_get_blend_desc with type size

Will be used to lower EXT_shader_framebuffer_fetch on Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Flesh out allow_forward_pixel_to_kill check
Alyssa Rosenzweig [Tue, 16 Feb 2021 23:10:08 +0000 (18:10 -0500)]
panfrost: Flesh out allow_forward_pixel_to_kill check

A few cases missed, probably some more bugs hidden here!

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Handle PIPE_FORMAT_NONE as 'constant'
Alyssa Rosenzweig [Tue, 16 Feb 2021 19:07:26 +0000 (14:07 -0500)]
panfrost: Handle PIPE_FORMAT_NONE as 'constant'

We can use the constant format anywhere safely as a 0-component format,
which will map fine for PIPE_FORMAT_NONE. Used so
ARB_framebuffer_no_attachments can probe.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Flesh out pixel kill / zs update
Alyssa Rosenzweig [Tue, 16 Feb 2021 18:23:34 +0000 (13:23 -0500)]
panfrost: Flesh out pixel kill / zs update

Add some notes on what the useful combinations do and flesh out the
logic. Fixes fails in
dEQP-GLES31.functional.image_load_store.early_fragment_tests.*

It's still not entirely clear to me what the difference between "force
early" and "weak early" is from the driver's perspective, though I
suspect there are performance implications to getting it wrong. Follow
what the blob does in case of doubt..

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Track coverage, early fragment tests
Alyssa Rosenzweig [Tue, 16 Feb 2021 18:23:08 +0000 (13:23 -0500)]
panfrost: Track coverage, early fragment tests

These extra pieces of data are needed to correctly compute pixel kill /
zs update settings.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopanfrost: Label groups in GenXML
Alyssa Rosenzweig [Tue, 16 Feb 2021 18:11:30 +0000 (13:11 -0500)]
panfrost: Label groups in GenXML

Helps debug pandecode issues.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopan/decode: Disambiguate border colours
Alyssa Rosenzweig [Wed, 17 Feb 2021 03:18:04 +0000 (22:18 -0500)]
pan/decode: Disambiguate border colours

Can be small ints that will just be 0.0 if interpreted as float.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopan/decode: Pretty print 22-bit pixel formats
Alyssa Rosenzweig [Wed, 17 Feb 2021 02:54:35 +0000 (21:54 -0500)]
pan/decode: Pretty print 22-bit pixel formats

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Suggested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopan/decode: Fix tiler printing on Bifrost
Alyssa Rosenzweig [Tue, 16 Feb 2021 18:09:59 +0000 (13:09 -0500)]
pan/decode: Fix tiler printing on Bifrost

Fixes: 9d682ad7f99 ("pan/decode: Only print local storage for vertex jobs")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopan/bi: Implement barriers
Alyssa Rosenzweig [Tue, 16 Feb 2021 19:18:10 +0000 (14:18 -0500)]
pan/bi: Implement barriers

Only control barriers are meaningful upon a closer read.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agopan/bi: Stub scoreboarding
Alyssa Rosenzweig [Fri, 12 Feb 2021 21:50:08 +0000 (16:50 -0500)]
pan/bi: Stub scoreboarding

This is not a real implementation. But I'm working on barriers right
now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>

3 years agomicrosoft/clc: Use driver_location for metadata instead of re-computing offsets
Jesse Natalie [Thu, 18 Feb 2021 19:13:25 +0000 (11:13 -0800)]
microsoft/clc: Use driver_location for metadata instead of re-computing offsets

Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138>

3 years agomicrosoft/clc: Move inline samplers to the end of the variable list
Jesse Natalie [Thu, 18 Feb 2021 19:05:43 +0000 (11:05 -0800)]
microsoft/clc: Move inline samplers to the end of the variable list

Since inline samplers are uniforms, just like kernel args, and
nir_lower_vars_to_explicit_types will assign driver_location based
on order in the variable list, move the inline samplers to the end
of the list to prevent them from creating gaps in the kernel arg
offsets.

Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138>

3 years agomicrosoft/clc: Fix wrap modes for inline samplers for integer textures
Jesse Natalie [Thu, 18 Feb 2021 19:04:23 +0000 (11:04 -0800)]
microsoft/clc: Fix wrap modes for inline samplers for integer textures

Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138>

3 years agomicrosoft/clc: Let lower_vars_to_explicit_types fill kernel input driver_location
Jesse Natalie [Thu, 18 Feb 2021 18:28:20 +0000 (10:28 -0800)]
microsoft/clc: Let lower_vars_to_explicit_types fill kernel input driver_location

Importantly, also run that before mucking with the variable list via image lowering,
which removes and inserts variables, making the driver_location no longer line up
with metadata.

Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138>

3 years agointel/mi_builder: Add tests for gen_mi_z and gen_mi_nz
Jason Ekstrand [Thu, 18 Feb 2021 00:20:41 +0000 (18:20 -0600)]
intel/mi_builder: Add tests for gen_mi_z and gen_mi_nz

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9116>

3 years agointel/mi_builder: Rewrite unit tests in terms of constant folding
Jason Ekstrand [Thu, 18 Feb 2021 00:20:24 +0000 (18:20 -0600)]
intel/mi_builder: Rewrite unit tests in terms of constant folding

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9116>

3 years agointel/mi_builder: Add constant folding
Jason Ekstrand [Thu, 18 Feb 2021 00:19:54 +0000 (18:19 -0600)]
intel/mi_builder: Add constant folding

This also serves as pretty clear documentation of each helper's
semantics.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9116>

3 years agointel/mi_builder: Short-circuit shifts in more cases
Jason Ekstrand [Thu, 18 Feb 2021 15:34:34 +0000 (09:34 -0600)]
intel/mi_builder: Short-circuit shifts in more cases

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9116>

3 years agointel/mi_builder: Fix a misleading comment
Jason Ekstrand [Thu, 18 Feb 2021 15:37:44 +0000 (09:37 -0600)]
intel/mi_builder: Fix a misleading comment

This doesn't actually assume the top 32 bits of the source value are
zero.  Instead, it does (src >> shift) & UINT32_MAX regardless of what
the top bits of src are.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9116>

3 years agointel/mi_builder: Delete a bogus comment
Jason Ekstrand [Thu, 18 Feb 2021 00:18:56 +0000 (18:18 -0600)]
intel/mi_builder: Delete a bogus comment

It actually returns ~0/0.  We're about to make things more self-
documenting so we can delete the comment instead of fixing it.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9116>

3 years agointel/mi_builder: Create a context in the tests
Jason Ekstrand [Thu, 18 Feb 2021 02:00:53 +0000 (20:00 -0600)]
intel/mi_builder: Create a context in the tests

This makes them work on the simulator

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9116>

3 years agonouveau: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 19:30:28 +0000 (14:30 -0500)]
nouveau: Silence a warning at -Og

   ../src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp: In member function ‘void nv50_ir::AlgebraicOpt::handleCVT_EXTBF(nv50_ir::Instruction*)’:
   ../src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp:2238:57: warning: ‘offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Just set it to 0 to handle the corner case.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agonouveau: Silence some warnings at -Og
Adam Jackson [Tue, 26 Jan 2021 19:27:48 +0000 (14:27 -0500)]
nouveau: Silence some warnings at -Og

   ../src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp: In member function ‘bool {anonymous}::Converter::handleInstruction(const tgsi_full_instruction*)’:
   ../src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp:3419:22: warning: ‘src1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    3419 |          geni = mkOp3(op, dstTy, dst0[c], fetchSrc(0, c), src1, mkImm(0x1f));
   ../src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp:3272:15: warning: ‘val1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    3272 |          mkOp1(OP_EX2, TYPE_F32, dst0[1], val1);

Can't happen, just initialize them to NULL.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agogallivm: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 19:20:30 +0000 (14:20 -0500)]
gallivm: Silence a warning at -Og

   ../src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c: In function ‘lp_build_sample_image_linear’:
   ../src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c:1412:24: warning: ‘have_corners’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    1412 |          have_corner = LLVMBuildLoad(builder, have_corners, "");

I don't think you can get here and really not have it initialized, but
if you _could_ then it would clearly be wrong to do anything, so do
nothing instead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agovl: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 19:17:52 +0000 (14:17 -0500)]
vl: Silence a warning at -Og

   ../src/gallium/auxiliary/vl/vl_winsys_dri.c: In function ‘vl_dri2_screen_texture_from_drawable’:
   ../src/gallium/auxiliary/vl/vl_winsys_dri.c:239:34: warning: ‘back_left’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     239 |    dri2_handle.stride = back_left->pitch;

The server would be broken if it failed to inform us of the back left
buffer, but let's leave nothing to chance.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agonir/ttn: Silence some warnings at -Og
Adam Jackson [Tue, 26 Jan 2021 19:16:05 +0000 (14:16 -0500)]
nir/ttn: Silence some warnings at -Og

   ../src/gallium/auxiliary/nir/tgsi_to_nir.c: In function ‘ttn_mem’:
   ../src/gallium/auxiliary/nir/tgsi_to_nir.c:1724:15: warning: ‘op’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    1724 |       instr = nir_intrinsic_instr_create(b->shader, op);
   ../src/gallium/auxiliary/nir/tgsi_to_nir.c:1697:15: warning: ‘op’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    1697 |       instr = nir_intrinsic_instr_create(b->shader, op);

Add some more unreachable() to make this go away.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agogallivm: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 19:14:02 +0000 (14:14 -0500)]
gallivm: Silence a warning at -Og

   ../src/gallium/auxiliary/gallivm/lp_bld_arit.c: In function ‘lp_build_round_arch’:
   ../src/gallium/auxiliary/gallivm/lp_bld_arit.c:2042:7: warning: ‘intrinsic_root’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    2042 |       lp_format_intrinsic(intrinsic, sizeof intrinsic, intrinsic_root, bld->vec_type);

Can't happen, mark it unreachable.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agoloader: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 19:11:52 +0000 (14:11 -0500)]
loader: Silence a warning at -Og

   ../src/loader/loader_dri3_helper.c: In function ‘dri3_free_buffers’:
   ../src/loader/loader_dri3_helper.c:2022:46: warning: ‘n_id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    2022 |    for (buf_id = first_id; buf_id < first_id + n_id; buf_id++) {

Can't happen, mark it unreachable.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agoglsl: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 19:11:04 +0000 (14:11 -0500)]
glsl: Silence a warning at -Og

   ../src/compiler/glsl/gl_nir_link_uniforms.c:1786:50: warning: ‘blocks’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    1786 |             const struct gl_uniform_block *const block =

Just do nothing if we somehow fail to initialize blocks.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agoglsl: Silence some warnings at -Og
Adam Jackson [Tue, 26 Jan 2021 19:04:14 +0000 (14:04 -0500)]
glsl: Silence some warnings at -Og

   ./src/compiler/glsl/link_uniforms.cpp: In member function ‘virtual void parcel_out_uniform_storage::visit_field(const glsl_type*, const char*, bool, const glsl_type*, glsl_interface_packing, bool)’:
   ../src/compiler/glsl/link_uniforms.cpp:1171:61: warning: ‘id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    1171 |       calculate_array_size_and_stride(prog, &this->uniforms[id],

   ../src/compiler/glsl/link_uniform_initializers.cpp: In function ‘gl_uniform_storage* linker::get_storage(gl_shader_program*, const char*)’:
   ../src/compiler/glsl/link_uniform_initializers.cpp:41:42: warning: ‘id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      41 |       return &prog->data->UniformStorage[id];

Can't happen, but flow control apparently can't prove it.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agoglsl: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 19:01:26 +0000 (14:01 -0500)]
glsl: Silence a warning at -Og

   ../src/compiler/glsl/gl_nir_link_uniforms.c: In function ‘gl_nir_link_uniforms’:
   ../src/compiler/glsl/gl_nir_link_uniforms.c:1747:39: warning: ‘num_blocks’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    1747 |                for (unsigned i = 0; i < num_blocks; i++) {

Don't have the patience to seee how you'd hit this but doing nothing is
clearly the right edge case behavior.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agosoftfloat: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 18:48:22 +0000 (13:48 -0500)]
softfloat: Silence a warning at -Og

   ../src/util/softfloat.c: In function ‘_mesa_shift_right_jam_m’:
   ../src/util/softfloat.c:432:16: warning: ‘tmp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     432 |         *tmp++ = 0;

You could actually hit this if you called _mesa_shift_right_jam_m with
size_words = 0 and dist < 32. Not that you'd _do_ that, but. In this
case do nothing instead of writing through an uninitialized pointer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agonir: Silence a warning at -Og
Adam Jackson [Tue, 26 Jan 2021 18:18:29 +0000 (13:18 -0500)]
nir: Silence a warning at -Og

This throws a curious warning:

   In file included from ../src/compiler/nir/nir.h:32,
                    from ../src/compiler/nir/nir_opt_if.c:24:
   ../src/compiler/nir/nir_opt_if.c: In function ‘opt_if_loop_last_continue’:
   ../src/compiler/glsl/list.h:415:64: warning: ‘nif’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     415 |    return !exec_list_is_empty(list) ? list->tail_sentinel.prev : NULL;
         |                                                                ^

What's going on here is not enough of the optimizer has run to be able
to prove that nif is always initialized. So just handle the "can't
happen" case as if it could.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

3 years agogallium/trace: remove transfer_map assert
Mike Blumenkrantz [Wed, 17 Feb 2021 18:58:27 +0000 (13:58 -0500)]
gallium/trace: remove transfer_map assert

this breaks tracing with tc due to the "latest" mechanism which maintains
copies of resources

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9107>

3 years agopanfrost: Fix uniform_count on Midgard
Alyssa Rosenzweig [Wed, 17 Feb 2021 20:36:13 +0000 (15:36 -0500)]
panfrost: Fix uniform_count on Midgard

The compiler ABI specifies push uniforms at a 4-byte granularity (like
Bifrost), but Midgard require a 16-byte granularity. As such if the
number of pushed words is not a multiple of 4, there is a buffer overrun
at shader load time. Ordinarily this is inaccessible so the garbage is
ignored.

However, there was a great deal of confusion around the `uniform_cutoff`
variable. In some cases (such a full glmark2 run on a 64-bit processor),
the push uniforms would be at the end of a BO and the overrun would
cause a page fault.

Remove uniform_cutoff entirely and work with count directly to avoid
faulting, and round the count up to be defensive.

Closes: #4289
Fixes: ed810eb0a0c ("panfrost: Don't truncate uniform_count")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9109>

3 years agozink: enable GL_CLAMP cap
Mike Blumenkrantz [Thu, 28 Jan 2021 04:40:40 +0000 (23:40 -0500)]
zink: enable GL_CLAMP cap

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8756>

3 years agomesa/st: add PIPE_CAP_GL_CLAMP
Mike Blumenkrantz [Mon, 25 Jan 2021 22:37:29 +0000 (17:37 -0500)]
mesa/st: add PIPE_CAP_GL_CLAMP

when this is not set, this triggers shader and sampler state updates any time a sampler
starts or stops using GL_CLAMP, applying bitmasks needed to run nir_lower_tex
and setting CLAMP_TO_BORDER/CLAMP_TO_EDGE as necessary to mimic the behavior

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8756>

3 years agomesa/st: add pipe_sampler_state::border_color_is_integer
Mike Blumenkrantz [Mon, 25 Jan 2021 20:31:15 +0000 (15:31 -0500)]
mesa/st: add pipe_sampler_state::border_color_is_integer

some drivers need to know whether the border color format is integer,
so this allows disambiguation between samplers based on format types

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8756>

3 years agonir/lower_tex: rewrite tex/txb -> txd/txl before saturating srcs
Mike Blumenkrantz [Fri, 12 Feb 2021 22:15:06 +0000 (17:15 -0500)]
nir/lower_tex: rewrite tex/txb -> txd/txl before saturating srcs

this fixes mipmapping with saturate by saturating the coord param while
passing an additional param (partial derivatives or lod) that uses the
unsaturated coord value

Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8756>

3 years agoaco: Disallow LSHS temp-only I/O when VS output is written indirectly.
Timur Kristóf [Tue, 9 Feb 2021 18:20:52 +0000 (19:20 +0100)]
aco: Disallow LSHS temp-only I/O when VS output is written indirectly.

Cc: mesa-stable
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9100>

3 years agoradv/llvm: Fix reporting LDS stats of tess control shaders.
Timur Kristóf [Wed, 17 Feb 2021 12:55:04 +0000 (13:55 +0100)]
radv/llvm: Fix reporting LDS stats of tess control shaders.

The LLVM backend forgot to set config->lds_size, which is used
for reporting LDS stats.

Fixes: cf89bdb9ba9c7a7ba39d142ee3c83e0379c2092a "radv: align the LDS size in calculate_tess_lds_size()"
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9098>

3 years agoaco: Fix LDS statistics of tess control shaders.
Timur Kristóf [Wed, 17 Feb 2021 12:26:01 +0000 (13:26 +0100)]
aco: Fix LDS statistics of tess control shaders.

The calculate_tess_lds_size function already returns the size in blocks
of the encoding granule, but we forgot to adjust config->lds_size.
This variable is not used to actually set the LDS size used for TCS,
but by ACO to make scheduling decisions.

Fossil DB stats on Sienna Cichlid:
Please note that the +3729.43% is NOT a regression.
The real LDS size used didn't change, it was just reported incorrectly.

Totals from 1342 (0.96% of 139391) affected shaders:
VGPRs: 60880 -> 80240 (+31.80%); split: -0.05%, +31.85%
CodeSize: 3378456 -> 3381224 (+0.08%); split: -0.23%, +0.31%
LDS: 687104 -> 26312192 (+3729.43%)
MaxWaves: 29794 -> 23962 (-19.57%)
Instrs: 644194 -> 644610 (+0.06%); split: -0.32%, +0.39%
Cycles: 2675068 -> 2676804 (+0.06%); split: -0.31%, +0.38%
VMEM: 428840 -> 517418 (+20.66%); split: +22.53%, -1.88%
SMEM: 91831 -> 88587 (-3.53%); split: +5.70%, -9.23%
VClause: 22740 -> 19384 (-14.76%); split: -16.18%, +1.42%
SClause: 19116 -> 18373 (-3.89%); split: -4.34%, +0.46%
Copies: 66662 -> 63448 (-4.82%); split: -5.55%, +0.73%

Fixes: cf89bdb9ba9c7a7ba39d142ee3c83e0379c2092a "radv: align the LDS size in calculate_tess_lds_size()"
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9098>

3 years agoanv: track buffer creation flags
Lionel Landwerlin [Fri, 18 Dec 2020 14:19:16 +0000 (16:19 +0200)]
anv: track buffer creation flags

So we know a buffer is protected.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9127>

3 years agoanv: track command buffer pool flags
Lionel Landwerlin [Thu, 10 Dec 2020 14:00:58 +0000 (16:00 +0200)]
anv: track command buffer pool flags

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9127>

3 years agoisl: add external parameter to isl_mocs()
Lionel Landwerlin [Mon, 14 Dec 2020 09:11:59 +0000 (11:11 +0200)]
isl: add external parameter to isl_mocs()

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9127>

3 years agogenxml: Add PIPE_CONTROL protected memory bits
Lionel Landwerlin [Fri, 18 Dec 2020 09:35:30 +0000 (11:35 +0200)]
genxml: Add PIPE_CONTROL protected memory bits

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9127>

3 years agogenxml: add MI_SET_APPID on Gen12+
Lionel Landwerlin [Fri, 4 Dec 2020 10:49:02 +0000 (12:49 +0200)]
genxml: add MI_SET_APPID on Gen12+

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9127>

3 years agoradv: use the pipeline key as hash for pipeline bind markers
Samuel Pitoiset [Tue, 16 Feb 2021 16:31:52 +0000 (17:31 +0100)]
radv: use the pipeline key as hash for pipeline bind markers

It's way easier to identify a pipeline compared to a random CPU addr.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9083>

3 years agoradv: only emit pipeline bind markers for application pipelines
Samuel Pitoiset [Tue, 16 Feb 2021 16:28:12 +0000 (17:28 +0100)]
radv: only emit pipeline bind markers for application pipelines

We don't want to emit markers for internal operations.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9083>

3 years agoradv: add support for user event markers with SQTT
Samuel Pitoiset [Wed, 17 Feb 2021 12:57:09 +0000 (13:57 +0100)]
radv: add support for user event markers with SQTT

This enables VK_EXT_debug_marker only if SQTT is enabled, otherwise
it's just useless.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9099>

3 years agoanv/android: Re-implement AcquireImageANDROID
Jason Ekstrand [Mon, 1 Feb 2021 21:03:33 +0000 (15:03 -0600)]
anv/android: Re-implement AcquireImageANDROID

Instead of doing a vkQueueSubmit() and hoping for the best, use the
actual sync FD that gets passed in from SurfaceFlinger.  The semaphore
and fence FD import functions already handle the -1 case for us so the
implementation is almost trivial.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chad Versace <chad@kiwitree.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8814>

3 years agonv50/ir: Initialize ValueDef member origin in constructors.
Vinson Lee [Sun, 14 Feb 2021 06:03:15 +0000 (22:03 -0800)]
nv50/ir: Initialize ValueDef member origin in constructors.

Fix defects reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member origin is not initialized in this
constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9036>

3 years agolavapipe: set viewport state dirty on first execute
Dave Airlie [Tue, 9 Feb 2021 06:23:39 +0000 (16:23 +1000)]
lavapipe: set viewport state dirty on first execute

This makes sure the viewport state gets emitted so that
draw gets viewports setup and the vertex shader doesn't crash.

Fixes bug uncovered with dEQP-VK.api.descriptor_set_layout_lifetime.graphics
once asan fix was done.

Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9093>

3 years agolavapipe: avoid pointer to pipeline layout in execution
Dave Airlie [Thu, 11 Feb 2021 01:53:24 +0000 (11:53 +1000)]
lavapipe: avoid pointer to pipeline layout in execution

pipeline layout lifetime is only during command buffer recording,
Don't store pointers to it, just extract them around it.

Fixes asan use-after-free in
dEQP-VK.api.pipeline.pipeline_layout.lifetime.destroy_after_end

Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9093>

3 years agolavapipe: add reference counting to descriptor set layout
Dave Airlie [Tue, 9 Feb 2021 03:44:58 +0000 (13:44 +1000)]
lavapipe: add reference counting to descriptor set layout

asan flagged some use after frees, copy the anv solution
of refcounting the descriptor set layout objects.

dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.*

Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9093>

3 years agoci/freedreno: Drop the "arm64" in front of job names.
Eric Anholt [Tue, 16 Feb 2021 00:22:30 +0000 (16:22 -0800)]
ci/freedreno: Drop the "arm64" in front of job names.

All our jobs are arm64, and it made it hard to find jobs in the gitlab UI
which loves to truncate names.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9070>

3 years agoci/freedreno: Add a fractional gles31 run with asan enabled.
Eric Anholt [Tue, 15 Dec 2020 23:47:51 +0000 (15:47 -0800)]
ci/freedreno: Add a fractional gles31 run with asan enabled.

We have to disable the GLSL unit tests because with asan it runs way too
much code under qemu and times out.  Those unit tests have coverage on
x86, anyway.

I also included a vulkan run, which is disabled by default due to timeouts
that I need to sort out still.  It should be a useful tool for turnip
devs, though.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9070>

3 years agoci: Allow better customization of the name of the artifacts for minio.
Eric Anholt [Mon, 15 Feb 2021 20:35:41 +0000 (12:35 -0800)]
ci: Allow better customization of the name of the artifacts for minio.

To have asan testing, we need two different sets of artifacts per arch.
Plus, "UPLOAD_FOR_LAVA" was misnamed at this point anyway.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9070>

3 years agomesa/st: Make sure to unbind cb0 on transition away from gs/tess shaders.
Eric Anholt [Mon, 15 Feb 2021 22:52:12 +0000 (14:52 -0800)]
mesa/st: Make sure to unbind cb0 on transition away from gs/tess shaders.

This atom tries to unbind cb0 when it's not used any more (the params &&
params->NumParameters check), but if you transitioned to not having a
gs/tess enabled at all, you'd skip unbinding it.  This was mostly
harmless, since if you don't have a GS, why are you looking at GS
constants?  However, if a new program came along that didn't use cb0 at
all, we wouldn't end up in this atom to get the disable, and now you have
a GS enabled but a GS constbuf pointing at potentially freed data.

Dereferencing the freed cb0 data ended up happening in freedreno's
fallback UBO upload path with this combination of tests (which execute in
that order):

dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.uniform.geometry.sampler2darray
dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.const_literal_fragment
dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.dynamically_uniform_geometry

and it seems also affected softpipe as well.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9070>

3 years agov3d/qpu: Avoid leaking memory in the QPU disasm test.
Eric Anholt [Mon, 15 Feb 2021 19:02:58 +0000 (11:02 -0800)]
v3d/qpu: Avoid leaking memory in the QPU disasm test.

Required to run this test under ASan, as we'll be soon doing for building
ARM drivers with asan testing.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9070>

3 years agofreedreno: driver-thread annotations
Rob Clark [Fri, 12 Feb 2021 20:42:01 +0000 (12:42 -0800)]
freedreno: driver-thread annotations

Use clangs thread-safety annotations to implement a virtual lock
protecting context fields that should only be accessed from driver-
thread.  This should let the compiler help us detect problems where
ctx is used unsafely from things that could be called by the fe/st
thread.

This does end up sprinkled far and wide, it would be nice if the
compiler could be a bit smarter about understanding call-graphs
(at least with static fxns), but at least it makes it clear where
things are called from which thread.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9061>

3 years agofreedreno: Split batch_flush_reset_dependencies()
Rob Clark [Mon, 15 Feb 2021 20:50:26 +0000 (12:50 -0800)]
freedreno: Split batch_flush_reset_dependencies()

Flushing a batch needs to happen on driver thread, but the reset-but-
dont-actually-flush case does not.  Decouple these two different cases
to prepare for thread-safety annotations.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9061>

3 years agofreedreno: Quiet fallthrough warnings
Rob Clark [Fri, 12 Feb 2021 21:13:57 +0000 (13:13 -0800)]
freedreno: Quiet fallthrough warnings

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9061>

3 years agomacros: Add thread-safety annotation macros
Kristian Høgsberg [Fri, 12 Feb 2021 20:26:47 +0000 (12:26 -0800)]
macros: Add thread-safety annotation macros

Extracted from !7529

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9061>

3 years agozink: move command pool to the batch
Mike Blumenkrantz [Tue, 8 Sep 2020 17:02:19 +0000 (13:02 -0400)]
zink: move command pool to the batch

this simplifies things for the future when batches will have multiple
cmdbufs, letting us skip having to track/apply resets for them

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9064>

3 years agozink: handle dual blending override from driconf
Mike Blumenkrantz [Wed, 23 Sep 2020 19:48:27 +0000 (15:48 -0400)]
zink: handle dual blending override from driconf

when this is enabled, we need to push gl_FragData[1] to location 0 and
index 1 so that it gets blended like the application expects

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9095>

3 years agoanv/formats: Advertise linear sampling on depth formats
Jason Ekstrand [Wed, 17 Feb 2021 21:08:12 +0000 (15:08 -0600)]
anv/formats: Advertise linear sampling on depth formats

They've all supported it since either forever or Iron Lake which is
equivalent to forever for Vulkan.

From Kenneth Graunke's GitLab review:

    "Linear blending of depth buffer data is usually fairly nonsense
    (something's 2 meters away?  another thing's 6 meters away?  let's
    just report 4 meters?)...but it's definitely a thing we can do, so
    we may as well let apps do it, and trust them not when it doesn't
    make sense."

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9110>

3 years agointel/anv: Fix condition for planar yuv surface
Anuj Phogat [Wed, 17 Feb 2021 22:24:20 +0000 (14:24 -0800)]
intel/anv: Fix condition for planar yuv surface

Test the sampler->conversion for NULL pointer before dereferencing it.

Fixes: Regressions in VulkanCTS.
Fixes: 226316116cd "intel/anv: Fix condition to set MipModeFilter for YUV surface"
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
3 years agoaco: remove special handling of load_helper_invocation
Daniel Schürmann [Tue, 16 Feb 2021 09:33:25 +0000 (10:33 +0100)]
aco: remove special handling of load_helper_invocation

These should now behave the same as is_helper_invocation.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9058>

3 years agonir: lower is/load_helper to zero if no helper lanes are needed
Daniel Schürmann [Mon, 15 Feb 2021 15:13:39 +0000 (16:13 +0100)]
nir: lower is/load_helper to zero if no helper lanes are needed

If there are no helper invocations required during the
execution of the shader, we can assume that there also
are no helper invocations active.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9058>

3 years agonir: lower load_helper to is_helper if the shader uses demote()
Daniel Schürmann [Mon, 15 Feb 2021 15:02:39 +0000 (16:02 +0100)]
nir: lower load_helper to is_helper if the shader uses demote()

load_helper_invocation is an Input Builtin, for which the
value should not change during the execution of a shader.
This new pass inserts an is_helper intrinsic before any
demote() instruction and re-uses its value.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9058>

3 years agointel/compiler: Use CMPN for min / max on Gen4 and Gen5
Ian Romanick [Sat, 13 Feb 2021 22:11:58 +0000 (14:11 -0800)]
intel/compiler: Use CMPN for min / max on Gen4 and Gen5

On Intel platforms before Gen6, there is no min or max instruction.
Instead, a comparison instruction (*more on this below) and a SEL
instruction are used.  Per other IEEE rules, the regular comparison
instruction, CMP, will always return false if either source is NaN.  A
sequence like

    cmp.l.f0.0(16)  null<1>F        g30<8,8,1>F     g22<8,8,1>F
    (+f0.0) sel(16) g8<1>F          g30<8,8,1>F     g22<8,8,1>F

will generate the wrong result for min if g22 is NaN.  The CMP will
return false, and the SEL will pick g22.

To account for this, the hardware has a special comparison instruction
CMPN.  This instruction behaves just like CMP, except if the second
source is NaN, it will return true.  The intention is to use it for min
and max.  This sequence will always generate the correct result:

    cmpn.l.f0.0(16) null<1>F        g30<8,8,1>F     g22<8,8,1>F
    (+f0.0) sel(16) g8<1>F          g30<8,8,1>F     g22<8,8,1>F

The problem is... for whatever reason, we don't emit CMPN.  There was
even a comment in lower_minmax that calls out this very issue!  The bug
is actually older than the "Fixes" below even implies.  That's just when
the comment was added.  That we know of, we never observed a failure
until #4254.

If src1 is known to be a number, either because it's not float or it's
an immediate number, use CMP.  This allows cmod propagation to still do
its thing.  Without this slight optimization, about 8,300 shaders from
shader-db are hurt on Iron Lake.

Fixes the following piglit tests (from piglit!475):

    tests/spec/glsl-1.20/execution/fs-nan-builtin-max.shader_test
    tests/spec/glsl-1.20/execution/fs-nan-builtin-min.shader_test
    tests/spec/glsl-1.20/execution/vs-nan-builtin-max.shader_test
    tests/spec/glsl-1.20/execution/vs-nan-builtin-min.shader_test

Closes: #4254
Fixes: 2f2c00c7279 ("i965: Lower min/max after optimization on Gen4/5.")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Iron Lake and GM45 had similar results. (Iron Lake shown)
total instructions in shared programs: 8115134 -> 8115135 (<.01%)
instructions in affected programs: 229 -> 230 (0.44%)
helped: 0

HURT: 1
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9027>

3 years agointel/compiler: Make the CMPN builder work like the CMP builder
Ian Romanick [Sat, 13 Feb 2021 21:22:41 +0000 (13:22 -0800)]
intel/compiler: Make the CMPN builder work like the CMP builder

Since the CMPN builder was never used, there was no reason to make its
interface usable. :)

Fixes: 2f2c00c7279 ("i965: Lower min/max after optimization on Gen4/5.")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9027>

3 years agointel/compiler: Enable the ability to emit CMPN instructions
Ian Romanick [Sat, 13 Feb 2021 22:11:30 +0000 (14:11 -0800)]
intel/compiler: Enable the ability to emit CMPN instructions

v2: Move checks to the EU validator.  Suggested by Jason.

Fixes: 2f2c00c7279 ("i965: Lower min/max after optimization on Gen4/5.")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9027>

3 years agointel/eu/validate: Add some checks for CMP and CMPN
Ian Romanick [Tue, 16 Feb 2021 18:51:56 +0000 (10:51 -0800)]
intel/eu/validate: Add some checks for CMP and CMPN

These checks were originally assertions elsewhere either in the existing
code or later in this MR.

Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9027>

3 years agovirgl: Drop a context dependency from part of the shader compile path.
Eric Anholt [Mon, 15 Feb 2021 20:10:18 +0000 (12:10 -0800)]
virgl: Drop a context dependency from part of the shader compile path.

We should be exposing PIPE_CAP_SHAREABLE_SHADERS, but we aren't.  Clear up
one place that was using it so the next person has less to look through,
and document what's left.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9088>

3 years agogallium: Flip the default value of PIPE_CAP_SHAREABLE_SHADERS.
Eric Anholt [Mon, 15 Feb 2021 19:49:33 +0000 (11:49 -0800)]
gallium: Flip the default value of PIPE_CAP_SHAREABLE_SHADERS.

We should be exposing it in every driver, since it's required eventually
to reduce jank.  Make drivers have to explicitly opt out instead of opt
in.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9088>

3 years agoci: build gfxreconstruct v0.9.5
Andres Gomez [Wed, 3 Feb 2021 21:35:29 +0000 (23:35 +0200)]
ci: build gfxreconstruct v0.9.5

https://github.com/LunarG/gfxreconstruct/issues/328 and
https://github.com/LunarG/gfxreconstruct/issues/402 are already fixed
in the "master" branch.

Updated the piglit version so it supports this version.

Additionally, LunarG's VulkanTools are not built any more since
GFXReconstruct is now able to generate screenshots on its own without
using the VK_LAYER_LUNARG_screenshot layer.

v2:
  - Explain the VulkanTools removal in the commit log (Martin).

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9032>

3 years agoci: only install piglit dependencies when installing piglit
Andres Gomez [Fri, 12 Feb 2021 21:34:44 +0000 (23:34 +0200)]
ci: only install piglit dependencies when installing piglit

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9032>

3 years agoci: remove pytest since we don't need it any more
Andres Gomez [Sat, 13 Feb 2021 19:33:14 +0000 (21:33 +0200)]
ci: remove pytest since we don't need it any more

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9032>

3 years agomicrosoft/clc: Only apply float scaling to 32bit fdiv
Jesse Natalie [Tue, 16 Feb 2021 23:49:59 +0000 (15:49 -0800)]
microsoft/clc: Only apply float scaling to 32bit fdiv

Reviewed By: Bill Kristiansen <billkris@microsoft.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9091>

3 years agointel/anv: Fix condition to set MipModeFilter for YUV surface
Anuj Phogat [Fri, 12 Feb 2021 01:44:32 +0000 (17:44 -0800)]
intel/anv: Fix condition to set MipModeFilter for YUV surface

Mip Mode Filter must be set to MIPFILTER_NONE for Planar YUV surfaces.
Add the missing condition to check for planar format.

Fixes: b24b93d5843 "anv: enable VK_KHR_sampler_ycbcr_conversion"
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
3 years agoci: piglit runner colors diff output on failures
Andres Gomez [Wed, 17 Feb 2021 13:05:47 +0000 (15:05 +0200)]
ci: piglit runner colors diff output on failures

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9104>

3 years agonir: Fix grammar error
Alyssa Rosenzweig [Tue, 16 Feb 2021 23:58:39 +0000 (18:58 -0500)]
nir: Fix grammar error

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9103>

3 years agoradv: do not allow to capture SQTT on the compute queue
Samuel Pitoiset [Wed, 17 Feb 2021 10:12:13 +0000 (11:12 +0100)]
radv: do not allow to capture SQTT on the compute queue

This currently hangs and I don't know why. It looks better to
print a message instead of hanging the whole system.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9097>

3 years agoradv: stop emitting pipeline bind markers
Samuel Pitoiset [Wed, 17 Feb 2021 09:39:40 +0000 (10:39 +0100)]
radv: stop emitting pipeline bind markers

RGP actually crashes if pipeline bind markers are emitted without
PSO correlation objects.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9097>

3 years agoradv: make sure to allocate enough space when emitting SQTT userdata
Samuel Pitoiset [Wed, 17 Feb 2021 09:28:44 +0000 (10:28 +0100)]
radv: make sure to allocate enough space when emitting SQTT userdata

If we emit a lot of markers, we might reach the limit easily.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9097>

3 years agoradv: remove an outdated TODO about SQTT cache flushes
Samuel Pitoiset [Wed, 17 Feb 2021 09:25:32 +0000 (10:25 +0100)]
radv: remove an outdated TODO about SQTT cache flushes

It's fully implemented now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9097>

3 years agoradv: move SQTT parameters initialization to radv_thread_trace_init()
Samuel Pitoiset [Wed, 17 Feb 2021 09:19:57 +0000 (10:19 +0100)]
radv: move SQTT parameters initialization to radv_thread_trace_init()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9097>

3 years agoradv: create the start/stop CS for SQTT dynamically
Samuel Pitoiset [Wed, 17 Feb 2021 09:16:40 +0000 (10:16 +0100)]
radv: create the start/stop CS for SQTT dynamically

This seems much cleaner and will help for future work. Also, this
might help if we want to dynamically change some SQTT parameters
in the future.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9097>

3 years agoci: tracie dashboard URLs only in the failure after the testcase
Andres Gomez [Tue, 9 Feb 2021 23:11:07 +0000 (01:11 +0200)]
ci: tracie dashboard URLs only in the failure after the testcase

When adding the direct link to the diff page in the resulting
JUnit XML file we were not correctly skipping the first line from the
matching range.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4261
Fixes: 27f8c466486 ("ci: recover tracie dashboard URLs for failing traces")
Signed-off-by: Andres Gomez <agomez@igalia.com>
Acked-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8939>