mesa.git
4 years agov3d/compiler: Fix sorting the gs and fs inputs
Neil Roberts [Tue, 7 Jul 2020 00:02:19 +0000 (02:02 +0200)]
v3d/compiler: Fix sorting the gs and fs inputs

ntq_setup_fs_inputs and ntq_setup_gs_inputs sort the inputs according to
the driver location. This input array is then used to calculate the VPM
offset for the outputs in the previous stage. However, it wasn’t taking
into account variables that are packed into a single varying slot. In
that case they would have the same driver_location and are
distinguished by location_frac.

This patch makes it additionally sort by location_frac when the driver
locations are equal. This can happen when the compiler packs varyings
that are sized less than vec4. Without this fix, when the VPM is used to
transmit data free-form between the stages (such as VS->GS) then it
would end up writing to inconsistent locations.

Fixes dEQP tests such as:
dEQP-GLES31.functional.primitive_bounding_box.lines.global_state.
vertex_geometry_fragment.default_framebuffer_bbox_equal

Fixes: 5d578c27cec ("v3d: add initial compiler plumbing for geometry shaders")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5787>

4 years agopanfrost: add some missing fallthrough comments to bi_pack.c
Timothy Arceri [Mon, 6 Jul 2020 04:00:30 +0000 (14:00 +1000)]
panfrost: add some missing fallthrough comments to bi_pack.c

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

4 years agopanfrost: hide more unused code in bi_lower_combine.c
Timothy Arceri [Mon, 6 Jul 2020 03:50:06 +0000 (13:50 +1000)]
panfrost: hide more unused code in bi_lower_combine.c

Fixes some unused-function warnings.

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

4 years agopanfrost: add some missing fallthrough comments
Timothy Arceri [Mon, 6 Jul 2020 03:44:56 +0000 (13:44 +1000)]
panfrost: add some missing fallthrough comments

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

4 years agonouveau/nvc0: silence maybe-uninitialized warning
Timothy Arceri [Mon, 6 Jul 2020 03:20:04 +0000 (13:20 +1000)]
nouveau/nvc0: silence maybe-uninitialized warning

gcc is not smart enough to see that

   enum pipe_format dst_fmt;
   ...

   switch (data_size) {
   case 16:
      dst_fmt = PIPE_FORMAT_R32G32B32A32_UINT;
      ...
      break;
   case 12:
      /* RGB32 is not a valid RT format. This will be handled by the pushbuf
       * uploader.
       */
      break;
   case 8:
      dst_fmt = PIPE_FORMAT_R32G32_UINT;
      ...
      break;
   case 4:
      dst_fmt = PIPE_FORMAT_R32_UINT;
      ...
      break;
   case 2:
      dst_fmt = PIPE_FORMAT_R16_UINT;
      ...
      break;
   case 1:
      dst_fmt = PIPE_FORMAT_R8_UINT;
      break;
   default:
      assert(!"Unsupported element size");
      return;
   }

   ...

   if (data_size == 12) {
      ...
      return;
   }

Does not result in dst_fmt being uninitialized when it is used so
lets just initialise it to silence the warning.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5766>

4 years agoiris: silence maybe-uninitialized for stc_dst_aux_usage variable
Timothy Arceri [Mon, 6 Jul 2020 03:11:14 +0000 (13:11 +1000)]
iris: silence maybe-uninitialized for stc_dst_aux_usage variable

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5766>

4 years agoiris: fix maybe-uninitialized warning for initial_state variable
Timothy Arceri [Mon, 6 Jul 2020 03:02:34 +0000 (13:02 +1000)]
iris: fix maybe-uninitialized warning for initial_state variable

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5766>

4 years agoradeonsi: fix SI_NUM_ATOMS
Timothy Arceri [Tue, 7 Jul 2020 00:00:47 +0000 (10:00 +1000)]
radeonsi: fix SI_NUM_ATOMS

This is not used anywhere so maybe we should just drop it instead.

Fixes: 639b673fc3b8 ("radeonsi: don't use an indirect table for state atoms")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5766>

4 years agor600/radeonsi: silence zero-length-bounds gcc warnings
Timothy Arceri [Fri, 3 Jul 2020 02:06:09 +0000 (12:06 +1000)]
r600/radeonsi: silence zero-length-bounds gcc warnings

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

4 years agofreedreno/ir3: add support for a650 tess shared storage
Jonathan Marek [Mon, 6 Jul 2020 02:53:39 +0000 (22:53 -0400)]
freedreno/ir3: add support for a650 tess shared storage

A650 uses LDL/STL, and the "local_primitive_id" in tess ctrl shader comes
from bits 16-21 in the header instead of 0-5.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5764>

4 years agogallium: add PIPE_SHADER_CAP_GLSL_16BIT_TEMPS for LowerPrecisionTemporaries
Marek Olšák [Tue, 7 Jul 2020 00:45:27 +0000 (20:45 -0400)]
gallium: add PIPE_SHADER_CAP_GLSL_16BIT_TEMPS for LowerPrecisionTemporaries

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

4 years agoglsl: lower mediump temporaries to 16 bits except structures (v2)
Marek Olšák [Wed, 24 Jun 2020 12:09:48 +0000 (08:09 -0400)]
glsl: lower mediump temporaries to 16 bits except structures (v2)

Without this, NIR contains non-lowerable 32-bit phis for mediump variables.

Structures are not lowered yet.

v2: add the LowerPrecisionTemporaries option

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>

4 years agoglsl: Handle 16-bit types in loop analysis
Alyssa Rosenzweig [Mon, 6 Jul 2020 21:56:38 +0000 (17:56 -0400)]
glsl: Handle 16-bit types in loop analysis

Fixes crash with mediump lowering in:

dEQP-GLES2.functional.shaders.loops.do_while_constant_iterations.basic_mediump_float_fragment

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>

4 years agoglsl: add capability to lower mediump array types
Marek Olšák [Wed, 1 Jul 2020 20:49:04 +0000 (16:49 -0400)]
glsl: add capability to lower mediump array types

This is not needed for lowering expressions, because they always work with
basic types, but it will be needed for lowering variables.

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

4 years agoglsl: lower builtins to mediump that always return mediump or lowp
Marek Olšák [Wed, 1 Jul 2020 18:09:32 +0000 (14:09 -0400)]
glsl: lower builtins to mediump that always return mediump or lowp

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

4 years agoglsl: lower builtins to mediump that ignore precision of certain parameters
Marek Olšák [Wed, 1 Jul 2020 17:11:33 +0000 (13:11 -0400)]
glsl: lower builtins to mediump that ignore precision of certain parameters

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

4 years agoglsl: don't lower builtins to mediump that don't allow it
Marek Olšák [Wed, 1 Jul 2020 00:24:44 +0000 (20:24 -0400)]
glsl: don't lower builtins to mediump that don't allow it

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

4 years agoglsl: don't lower precision of textureSize
Marek Olšák [Fri, 26 Jun 2020 11:19:46 +0000 (07:19 -0400)]
glsl: don't lower precision of textureSize

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

4 years agoglsl: flatten a tautological conditional in lower_precision
Marek Olšák [Fri, 26 Jun 2020 11:16:41 +0000 (07:16 -0400)]
glsl: flatten a tautological conditional in lower_precision

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

4 years agoglsl: cleanups in lower_precision
Marek Olšák [Fri, 26 Jun 2020 07:43:25 +0000 (03:43 -0400)]
glsl: cleanups in lower_precision

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

4 years agoglsl: remove the return type from lower_precision
Marek Olšák [Wed, 24 Jun 2020 07:26:31 +0000 (03:26 -0400)]
glsl: remove the return type from lower_precision

It's unused.

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

4 years agoglsl: convert reusable lower_precision util code into helper functions
Marek Olšák [Wed, 24 Jun 2020 07:20:59 +0000 (03:20 -0400)]
glsl: convert reusable lower_precision util code into helper functions

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

4 years agoglsl: validate more stuff
Marek Olšák [Wed, 24 Jun 2020 06:39:38 +0000 (02:39 -0400)]
glsl: validate more stuff

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

4 years agoglsl: run validate_ir_tree if GLSL_VALIDATE=1 regardless of the build config
Marek Olšák [Wed, 24 Jun 2020 06:37:34 +0000 (02:37 -0400)]
glsl: run validate_ir_tree if GLSL_VALIDATE=1 regardless of the build config

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

4 years agoglsl: fix evaluating float16 constant expression matrices
Marek Olšák [Sat, 4 Jul 2020 21:43:50 +0000 (17:43 -0400)]
glsl: fix evaluating float16 constant expression matrices

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

4 years agoglsl: fix the type of ir_constant_data::u16
Marek Olšák [Sat, 4 Jul 2020 18:01:12 +0000 (14:01 -0400)]
glsl: fix the type of ir_constant_data::u16

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

4 years agoglsl: print constant initializers
Marek Olšák [Sat, 4 Jul 2020 21:13:27 +0000 (17:13 -0400)]
glsl: print constant initializers

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

4 years agoglsl: print precision qualifiers in IR dumps
Marek Olšák [Wed, 24 Jun 2020 03:10:16 +0000 (23:10 -0400)]
glsl: print precision qualifiers in IR dumps

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

4 years agoglsl: make print_type non-static for debugging
Marek Olšák [Sat, 4 Jul 2020 23:12:13 +0000 (19:12 -0400)]
glsl: make print_type non-static for debugging

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

4 years agoanv: Handle clamping of inverted depth ranges
Jason Ekstrand [Tue, 7 Jul 2020 16:08:31 +0000 (11:08 -0500)]
anv: Handle clamping of inverted depth ranges

Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5792>

4 years agollvmpipe: add ARB_post_depth_coverage support.
Dave Airlie [Thu, 26 Mar 2020 03:27:17 +0000 (13:27 +1000)]
llvmpipe: add ARB_post_depth_coverage support.

This doesn't pass thie piglits because currently they are broken
for case where GL upgrades 2 samples to 4

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5767>

4 years agoci/virgl: update results after streams fixes.
Dave Airlie [Fri, 3 Jul 2020 23:52:28 +0000 (09:52 +1000)]
ci/virgl: update results after streams fixes.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agodraw/gs: use mask to limit vertex emission.
Dave Airlie [Mon, 6 Jul 2020 02:06:46 +0000 (12:06 +1000)]
draw/gs: use mask to limit vertex emission.

When executing for a single primitive, the mask has only one active
lane, however the vertex emit emits for all the lanes, pass in
the active mask and write the excess lanes to the overflow slot.

Fixes:
glsl-1.50-gs-max-output -scan 1 20

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agodraw: free vertex info from geometry streams.
Dave Airlie [Fri, 19 Jun 2020 05:24:59 +0000 (15:24 +1000)]
draw: free vertex info from geometry streams.

This info needs to be freed for the non-0 stream.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agodraw: use common exit path in pipeline finish.
Dave Airlie [Fri, 19 Jun 2020 05:22:18 +0000 (15:22 +1000)]
draw: use common exit path in pipeline finish.

I need to add a missing free here, and it seems pointless duplication

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agodraw/gs: reverse the polarity of the invocation/prims execution
Dave Airlie [Tue, 14 Apr 2020 02:39:42 +0000 (12:39 +1000)]
draw/gs: reverse the polarity of the invocation/prims execution

The current code runs primitives per invocation, but the spec wants
invocations per primitive. However it means having to flush
after each invocation to get correct XFB behaviour

Fixes:
GTF-GL41.gtf40.GL3Tests.transform_feedback3.transform_feedback3_geometry_instanced

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agodraw: account primitive lengths for all streams.
Dave Airlie [Fri, 19 Jun 2020 05:04:19 +0000 (15:04 +1000)]
draw: account primitive lengths for all streams.

For correct XFB queries all streams must get primitive lengths
recorded. This allocates larger memory for per-stream lengths
and the shader write into them.

Fixes:
GTF-GL41.gtf40.GL3Tests.transform_feedback3.transform_feedback3_streams_queried
GTF-GL41.gtf40.GL3Tests.transform_feedback3.transform_feedback3_streams_overflow

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agogallivm/nir: end primitive for all streams.
Dave Airlie [Fri, 19 Jun 2020 05:03:25 +0000 (15:03 +1000)]
gallivm/nir: end primitive for all streams.

Call the end primitive for all streams so it can be accounted properly

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agogallivm/nir: don't access stream var outside bounds
Dave Airlie [Fri, 19 Jun 2020 06:18:22 +0000 (16:18 +1000)]
gallivm/nir: don't access stream var outside bounds

Since we allocate only enough for streams we see, don't access
out of bounds when streams are given

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agogallivm/gs_iface: pass stream into end primitive interface.
Dave Airlie [Fri, 19 Jun 2020 05:02:25 +0000 (15:02 +1000)]
gallivm/gs_iface: pass stream into end primitive interface.

This is just an API change for now

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agodraw/gs: only allocate memory for streams needed.
Dave Airlie [Fri, 19 Jun 2020 06:17:48 +0000 (16:17 +1000)]
draw/gs: only allocate memory for streams needed.

This just allocates the sizeing for streams that are needed.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agogallivm/draw/gs: pass vertex stream count into shader build
Dave Airlie [Fri, 19 Jun 2020 04:54:16 +0000 (14:54 +1000)]
gallivm/draw/gs: pass vertex stream count into shader build

The shader builder can avoid iterations using this info.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agodraw/gs: fix up current verts in output fetching.
Dave Airlie [Fri, 19 Jun 2020 04:44:59 +0000 (14:44 +1000)]
draw/gs: fix up current verts in output fetching.

This was wrong since I added multi-stream support in
draw/gs: track emitted prims + verts per stream

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agodraw: emit so primitives before ending empty pipeline.
Dave Airlie [Fri, 19 Jun 2020 04:37:19 +0000 (14:37 +1000)]
draw: emit so primitives before ending empty pipeline.

There may be non-stream 0 emitted primitives that have to be processed.

Fixes:
KHR-GL42.transform_feedback_overflow_query_ARB.multiple-streams-one-buffer-per-stream
KHR-GL42.transform_feedback_overflow_query_ARB.multiple-streams-multiple-buffers-per-stream

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agogallivm/nir: call end prim at end on all GS streams.
Dave Airlie [Thu, 26 Mar 2020 06:18:27 +0000 (16:18 +1000)]
gallivm/nir: call end prim at end on all GS streams.

Fixes: KHR-GL45.transform_feedback.draw_xfb_stream_test
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>

4 years agobroadcom/qpu: set VC5_QPU_RADDR_A out of the switch at _pack_branch
Neil Roberts [Sun, 5 Jul 2020 13:45:19 +0000 (15:45 +0200)]
broadcom/qpu: set VC5_QPU_RADDR_A out of the switch at _pack_branch

Detected after mesa added Wimplicit-fallthrough project wide.

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

4 years agoaco: use VOP2 version of v_mbcnt_hi_u32_b32 on GFX6/7
Rhys Perry [Wed, 24 Jun 2020 10:26:22 +0000 (11:26 +0100)]
aco: use VOP2 version of v_mbcnt_hi_u32_b32 on GFX6/7

fossil-db (Pitcairn):
Totals from 2172 (1.58% of 137414) affected shaders:
CodeSize: 7109080 -> 7100100 (-0.13%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5623>

4 years agoutil: Share a single function pointer for the 4-byte rgba unpack function.
Eric Anholt [Wed, 1 Jul 2020 20:33:21 +0000 (13:33 -0700)]
util: Share a single function pointer for the 4-byte rgba unpack function.

Everyone wants the same behavior, and this helps shrink the size of our
format description tables.

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

4 years agoutil: Remove the stub pack/unpack functions for YUV formats.
Eric Anholt [Thu, 2 Jul 2020 00:44:36 +0000 (17:44 -0700)]
util: Remove the stub pack/unpack functions for YUV formats.

If we can't pack/unpack them, the field is supposed to be NULL.

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

4 years agollvmpipe: Generalize "could llvmpipe fetch this format" check in unit testing.
Eric Anholt [Thu, 2 Jul 2020 23:39:02 +0000 (16:39 -0700)]
llvmpipe: Generalize "could llvmpipe fetch this format" check in unit testing.

This set of checks matched the "access" list in u_format_table.py that
controls initializing this this function pointer, so just use the function
pointer.

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

4 years agoutil: Use designated initializers to clean up the format tables' pack/unpack.
Eric Anholt [Wed, 1 Jul 2020 20:14:42 +0000 (13:14 -0700)]
util: Use designated initializers to clean up the format tables' pack/unpack.

The generated .c had a bunch of NULLs and notes for what kind of function
was being skipped, when we can just skip them by filling in the fields
with names.

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

4 years agoutil: Merge util_format_read_4* functions.
Eric Anholt [Wed, 1 Jul 2020 23:50:02 +0000 (16:50 -0700)]
util: Merge util_format_read_4* functions.

Everyone wants the same thing: unpack 4-bytes-per-channel data based on the
base type of the format.

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

4 years agoutil: Merge util_format_write_4* functions.
Eric Anholt [Wed, 1 Jul 2020 23:37:05 +0000 (16:37 -0700)]
util: Merge util_format_write_4* functions.

Everyone wants the same thing: pack 4-bytes-per-channel data based on the
base type of the format.

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

4 years agosvga: Reuse util_format_unpack_rgba().
Eric Anholt [Wed, 1 Jul 2020 23:27:38 +0000 (16:27 -0700)]
svga: Reuse util_format_unpack_rgba().

This assumes that pipe_color_union is a vec4, but that seems safe.

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

4 years agogallium/util: Move the Z/S handling to the outside of get_tile().
Eric Anholt [Wed, 1 Jul 2020 23:48:54 +0000 (16:48 -0700)]
gallium/util: Move the Z/S handling to the outside of get_tile().

This lets us drop the special case for S8_UINT, and makes our read_4 path
just like other callers.

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

4 years agogallium/util: Clean up the Z/S tile write path.
Eric Anholt [Wed, 1 Jul 2020 23:32:37 +0000 (16:32 -0700)]
gallium/util: Clean up the Z/S tile write path.

The switch statement is silly, we have a helper to detect all of Z/S.
And, take the time explain why all of Z/S tile writing is unimplemented.

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

4 years agogallium/util: Fix location of the comment about S8_UINT handling.
Eric Anholt [Wed, 1 Jul 2020 23:17:32 +0000 (16:17 -0700)]
gallium/util: Fix location of the comment about S8_UINT handling.

I clearly wrote it in the wrong place in "softpipe: Refactor
pipe_get/put_tile_rgba_* paths."

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

4 years agoetnaviv: Use the util_pack_color_union() helper.
Eric Anholt [Wed, 1 Jul 2020 23:14:40 +0000 (16:14 -0700)]
etnaviv: Use the util_pack_color_union() helper.

This snuck in since I cleaned up the other instances of it.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>

4 years agoutil: Remove unused util_format_planar_is_supported().
Eric Anholt [Wed, 1 Jul 2020 23:02:15 +0000 (16:02 -0700)]
util: Remove unused util_format_planar_is_supported().

Nothing calls it, and it should have been left in gallium, anyway.

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

4 years agosoftpipe: Clean up softpipe's SSBO load/store interpreting instructions.
Eric Anholt [Wed, 1 Jul 2020 21:30:42 +0000 (14:30 -0700)]
softpipe: Clean up softpipe's SSBO load/store interpreting instructions.

There's no need to go to all this trouble of setting up 16-byte vectors to
pack/unpack our 32-bit values, memcpy is really good at moving 4 bytes
around.

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

4 years agoutil: Mark util_format_description() as a const function.
Eric Anholt [Wed, 1 Jul 2020 20:33:21 +0000 (13:33 -0700)]
util: Mark util_format_description() as a const function.

It will return the same table every time with no other side effects, so we
want it to be CSEed.  Saves 3.5k on my aarch64 GL drivers, almost 9k on
turnip, but weirdly increases my x86 GL driver collection by ~3k.

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

4 years agonir: refactor nir_can_move_instr
Daniel Schürmann [Wed, 24 Jun 2020 10:23:05 +0000 (11:23 +0100)]
nir: refactor nir_can_move_instr

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

4 years agonir: also move vecN in case of nir_move_copies
Daniel Schürmann [Wed, 24 Jun 2020 10:14:18 +0000 (11:14 +0100)]
nir: also move vecN in case of nir_move_copies

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

4 years agoturnip: use global bo for clear blit shaders
Jonathan Marek [Mon, 6 Jul 2020 15:48:54 +0000 (11:48 -0400)]
turnip: use global bo for clear blit shaders

Fill the global bo will all possible shaders for 3D clear/blit. Note the
global bo size is still <4k (so this doesn't cost any extra memory), this
saves having to allocate shaders in sub_cs everytime the 3D path is used.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5776>

4 years agoaco: remove superflous (bool & exec) if the result comes from VOPC
Daniel Schürmann [Fri, 19 Jun 2020 15:09:48 +0000 (16:09 +0100)]
aco: remove superflous (bool & exec) if the result comes from VOPC

This works in cases where the VOPC instruction was executed with
the same exec mask.

Totals from affected shaders: (VEGA)
SGPRS: 1342204 -> 1342164 (-0.00 %)
VGPRS: 877220 -> 877220 (0.00 %)
Spilled SGPRs: 157800 -> 157800 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 118083212 -> 118021748 (-0.05 %) bytes
LDS: 26 -> 26 (0.00 %) blocks
Max Waves: 144024 -> 144024 (0.00 %)

Reviewed-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/5563>

4 years agoradv: enable zerovram for Quantic Dream games
Rhys Perry [Wed, 1 Jul 2020 15:00:55 +0000 (16:00 +0100)]
radv: enable zerovram for Quantic Dream games

Fixes various artifacts with Detroit: Become Human. This assumes other
Vulkan games using the same engine could have the same issues.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5710>

4 years agogitlab-ci: More stable URL for kernel and ramdisk artifacts, for LAVA
Tomeu Vizoso [Wed, 1 Apr 2020 11:07:46 +0000 (13:07 +0200)]
gitlab-ci: More stable URL for kernel and ramdisk artifacts, for LAVA

Place the kernel and ramdisk into a place in the file server so the URL
will only change when the contents also change.

Also put the Mesa build into a separate tarball so the ramdisk's
contents don't change every build.

With proper caching in place, all devices in the same farm need only to
download the mesa tarball once, saving time.

As we switch to MinIO for making kernels and rootfs available to LAVA
devices, we can stop using Docker to distribute them.

Instead, build when needed in separate jobs that push directly to MinIO,
from where LAVA devices can download them.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5515>

4 years agogitlab-ci: Build kernel drivers for a few ethernet USB dongles
Tomeu Vizoso [Mon, 15 Jun 2020 07:29:49 +0000 (09:29 +0200)]
gitlab-ci: Build kernel drivers for a few ethernet USB dongles

So LAVA devices can download traces and upload test results.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5515>

4 years agonv50/ir/nir: fix cache mode conversion
Karol Herbst [Mon, 6 Jul 2020 18:06:40 +0000 (20:06 +0200)]
nv50/ir/nir: fix cache mode conversion

The nir access qualifier is actually a bitfield, so we need to read out
like one.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5747>

4 years agogv100/ir: fix coherent and volatile memory access
Karol Herbst [Mon, 6 Jul 2020 14:57:07 +0000 (16:57 +0200)]
gv100/ir: fix coherent and volatile memory access

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5747>

4 years agogv100/ir: implement sample shading
Karol Herbst [Sat, 4 Jul 2020 20:12:10 +0000 (22:12 +0200)]
gv100/ir: implement sample shading

Fixes sample shading tests in the Khronos OpenGL(ES) CTS

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5747>

4 years agonv50/ir/nir: fix interpolation on explicit operations
Karol Herbst [Sat, 4 Jul 2020 09:32:14 +0000 (11:32 +0200)]
nv50/ir/nir: fix interpolation on explicit operations

Fixes a bunch of interpolate tests in the aosp GLES CTS

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5747>

4 years agoiris: Fix fast-clearing of depth via glClearTex(Sub)Image
Danylo Piliaiev [Thu, 2 Jul 2020 08:39:25 +0000 (11:39 +0300)]
iris: Fix fast-clearing of depth via glClearTex(Sub)Image

If we clear depth only texture via glClearTex(Sub)Image it may cause:
../src/intel/blorp/blorp_genX_exec.h:1554: blorp_emit_surface_states: Assertion `params->depth.enabled || params->stencil.enabled' failed.

due to clear_depth_stencil calling blorp_clear_depth_stencil when
depth is already fast-cleared and there is no stencil.

Fixes piglit test: arb_clear_texture-depth

Fixes: 51638cf18a532510f9e1fd8f36207b56d38137b8
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5770>

4 years agodocs: fixup envvar output
Erik Faye-Lund [Thu, 2 Jul 2020 12:15:57 +0000 (14:15 +0200)]
docs: fixup envvar output

Sphinx 2.x has changed how this works, and some of this whitespace now
gets stripped as a result. So let's instead actual whitespace as separate
text-nodes instead.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5706>

4 years agodocs: use svg for graphviz output
Erik Faye-Lund [Thu, 2 Jul 2020 11:24:06 +0000 (13:24 +0200)]
docs: use svg for graphviz output

This works a lot better on hidpi screens.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5706>

4 years agodocs: move gallium specific docs into gallium folder
Erik Faye-Lund [Tue, 30 Jun 2020 11:01:04 +0000 (13:01 +0200)]
docs: move gallium specific docs into gallium folder

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5706>

4 years agodocs: add an extension to generate redirects
Erik Faye-Lund [Thu, 2 Jul 2020 10:14:28 +0000 (12:14 +0200)]
docs: add an extension to generate redirects

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5706>

4 years agodocs: clean up gallium index-file
Erik Faye-Lund [Tue, 30 Jun 2020 10:51:04 +0000 (12:51 +0200)]
docs: clean up gallium index-file

This makes the TOC make much more sense.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5706>

4 years agomerge gallium docs into main docs
Erik Faye-Lund [Tue, 30 Jun 2020 10:44:19 +0000 (12:44 +0200)]
merge gallium docs into main docs

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5706>

4 years agoci: add graphviz to the .docs-base template
Erik Faye-Lund [Thu, 2 Jul 2020 11:09:36 +0000 (13:09 +0200)]
ci: add graphviz to the .docs-base template

The Gallium docs uses graphviz, so let's make sure it's installed first.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5706>

4 years agofreedreno: Sync registers with envytools
Connor Abbott [Fri, 19 Jun 2020 11:15:42 +0000 (13:15 +0200)]
freedreno: Sync registers with envytools

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

4 years agofreedreno: Include adreno_pm4.xml.h before adreno_a6xx.xml.h
Connor Abbott [Mon, 6 Jul 2020 11:35:43 +0000 (13:35 +0200)]
freedreno: Include adreno_pm4.xml.h before adreno_a6xx.xml.h

This matches the XML, and soon adreno_a6xx.xml will start including
types from adreno_pm4.xml.

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

4 years agogallium/swr: Fix compilation warnings
jzielins [Mon, 6 Jul 2020 15:38:02 +0000 (17:38 +0200)]
gallium/swr: Fix compilation warnings

In some places in SWR cod objects are initialized using
memset/memcpy. This is usually done to enable
allocating those objects in aligned memory.
It generates compilation warnings though,
which are worked around by casting the pointers to void*
before calling memset/memcpy.

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

4 years agofreedreno/a6xx: Force gl_Layer to 0 when necessary
Connor Abbott [Fri, 3 Jul 2020 10:04:03 +0000 (12:04 +0200)]
freedreno/a6xx: Force gl_Layer to 0 when necessary

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

4 years agotu: Force gl_Layer to 0 when necessary
Connor Abbott [Fri, 3 Jul 2020 10:03:00 +0000 (12:03 +0200)]
tu: Force gl_Layer to 0 when necessary

In particular this will help us implement input attachments correctly
with layered rendering.

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

4 years agoir3: Add layer_zero variant bit
Connor Abbott [Fri, 3 Jul 2020 10:01:17 +0000 (12:01 +0200)]
ir3: Add layer_zero variant bit

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

4 years agopan/decode: Make mapped memory read-only while decoding
Icecream95 [Mon, 22 Jun 2020 10:49:53 +0000 (22:49 +1200)]
pan/decode: Make mapped memory read-only while decoding

This will help catch any bugs where descriptors are accidentally
modified.

v2: Use a dynarray of ro memory mappings rather than iterating through
    the mmap hash table.

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

4 years agopanfrost: Expose MSAA 4x
Alyssa Rosenzweig [Tue, 30 Jun 2020 19:19:47 +0000 (15:19 -0400)]
panfrost: Expose MSAA 4x

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

4 years agopanfrost: Save sample_mask before blitting
Alyssa Rosenzweig [Fri, 3 Jul 2020 18:16:20 +0000 (14:16 -0400)]
panfrost: Save sample_mask before blitting

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

4 years agopanfrost: Enable MSAA if we render to such a surface
Alyssa Rosenzweig [Fri, 3 Jul 2020 16:04:53 +0000 (12:04 -0400)]
panfrost: Enable MSAA if we render to such a surface

We hit this case for clears of MSAA surfaces without draws.

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

4 years agopanfrost: Set depth/stencil_layer_stride accordingly
Alyssa Rosenzweig [Fri, 3 Jul 2020 16:04:36 +0000 (12:04 -0400)]
panfrost: Set depth/stencil_layer_stride accordingly

Same logic as colour layer stride, I think.

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

4 years agopanfrost: Identify depth/stencil layer strides
Alyssa Rosenzweig [Fri, 3 Jul 2020 15:27:48 +0000 (11:27 -0400)]
panfrost: Identify depth/stencil layer strides

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

4 years agopanfrost: Implement alpha-to-coverage
Alyssa Rosenzweig [Thu, 2 Jul 2020 15:17:37 +0000 (11:17 -0400)]
panfrost: Implement alpha-to-coverage

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

4 years agopanfrost: Pass sample_mask to the hardware
Alyssa Rosenzweig [Thu, 2 Jul 2020 14:07:08 +0000 (10:07 -0400)]
panfrost: Pass sample_mask to the hardware

Gallium computes it for us.

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

4 years agopanfrost: Identify coverage_mask
Alyssa Rosenzweig [Thu, 2 Jul 2020 14:06:33 +0000 (10:06 -0400)]
panfrost: Identify coverage_mask

The driver specifies the mask directly.

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

4 years agopanfrost: Don't advertise MSAA 2x
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:53:38 +0000 (16:53 -0400)]
panfrost: Don't advertise MSAA 2x

Let the frontend promote to MSAA 4x if the app requests it. We don't
support MSAA 2x.

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

4 years agopanfrost: Set layer_stride for multisampled rendering
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:49:52 +0000 (16:49 -0400)]
panfrost: Set layer_stride for multisampled rendering

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

4 years agopanfrost: Include pointer for each sample
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:43:47 +0000 (16:43 -0400)]
panfrost: Include pointer for each sample

Treating it like an array/3D texture.

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

4 years agopanfrost: Index texture by sample
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:43:32 +0000 (16:43 -0400)]
panfrost: Index texture by sample

This will allow MSAA to route through.

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

4 years agopanfrost: Allocate space for multisampling
Alyssa Rosenzweig [Tue, 30 Jun 2020 20:29:16 +0000 (16:29 -0400)]
panfrost: Allocate space for multisampling

As an effective depth. Ugly but matches the blob.

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