mesa.git
4 years agofreedreno: Count blits in GL_TIME_ELAPSED and perf counter queries.
Eric Anholt [Fri, 27 Mar 2020 17:54:19 +0000 (10:54 -0700)]
freedreno: Count blits in GL_TIME_ELAPSED and perf counter queries.

Fixes 0 gpu time reported for glBlitFramebuffer in apitrace replay --pgpu.

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

4 years agofreedreno: Associate the acc query bo with the batch.
Eric Anholt [Fri, 27 Mar 2020 18:31:24 +0000 (11:31 -0700)]
freedreno: Associate the acc query bo with the batch.

Otherwise, a result query with wait won't trigger flushing the batch, and
we can end up with zeroed results.

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

4 years agofreedreno: Fix acc query handling in the presence of batch reordering.
Eric Anholt [Fri, 27 Mar 2020 22:55:14 +0000 (15:55 -0700)]
freedreno: Fix acc query handling in the presence of batch reordering.

When we switch batches and start a new draw, we need to cap the queries in
the previous batch and start queries again in the new one.

FD_STAGE_NULL got renamed to 0 so that it would naturally return
!is_active and end the queries at the end of the batch.

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

4 years agofreedreno: Remove the "active" member of queries.
Eric Anholt [Fri, 27 Mar 2020 23:48:05 +0000 (16:48 -0700)]
freedreno: Remove the "active" member of queries.

The state tracker only gets to begin/query/destroy when !active and end
when active, so we have no need to try to track this ourselves.

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

4 years agofreedreno: Remove always-true return from per-gen begin_query.
Eric Anholt [Fri, 27 Mar 2020 23:46:22 +0000 (16:46 -0700)]
freedreno: Remove always-true return from per-gen begin_query.

You should do failure-prone allocation in create_query, not begin, anyway.

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

4 years agoutil/u_queue: fix race in total_jobs_size access
Rhys Perry [Thu, 26 Mar 2020 15:50:31 +0000 (15:50 +0000)]
util/u_queue: fix race in total_jobs_size access

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
CC: <mesa-stable@lists.freedesktop.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335>

4 years agoglsl: fix race in instance getters
Rhys Perry [Thu, 26 Mar 2020 15:49:05 +0000 (15:49 +0000)]
glsl: fix race in instance getters

Insertions can modify entry->data. Seems to fix random Fossilize crashes.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
CC: <mesa-stable@lists.freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335>

4 years agonir: Set UBO alignments in lower_uniforms_to_ubo
Jason Ekstrand [Fri, 27 Mar 2020 04:56:57 +0000 (23:56 -0500)]
nir: Set UBO alignments in lower_uniforms_to_ubo

Fixes: fb64954d9dd "nir: Validate that memory load/store ops work on..."
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4378>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4378>

4 years agoaco: look at p_{extract,split}_vector's definitions in pred_by_exec_mask()
Rhys Perry [Thu, 26 Mar 2020 13:22:13 +0000 (13:22 +0000)]
aco: look at p_{extract,split}_vector's definitions in pred_by_exec_mask()

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

4 years agoCI: Re-enable Windows VS2019 builds
Daniel Stone [Mon, 30 Mar 2020 14:58:51 +0000 (15:58 +0100)]
CI: Re-enable Windows VS2019 builds

The failures are fixed, but I didn't notice this had been silently
disabled in !4272.

Re-enable the VS2019 build.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4374>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4374>

4 years agonir: Validate that memory load/store ops work on whole bytes
Jason Ekstrand [Fri, 27 Mar 2020 18:08:21 +0000 (13:08 -0500)]
nir: Validate that memory load/store ops work on whole bytes

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

4 years agoanv: Set alignments on descriptor and constant loads
Jason Ekstrand [Thu, 26 Mar 2020 20:46:56 +0000 (15:46 -0500)]
anv: Set alignments on descriptor and constant loads

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

4 years agonir: Insert b2b1s around booleans in nir_lower_to
Jason Ekstrand [Fri, 27 Mar 2020 05:30:25 +0000 (00:30 -0500)]
nir: Insert b2b1s around booleans in nir_lower_to

By inserting a b2b1 around the load_ubo, load_input, etc. intrinsics
generated by nir_lower_io, we can ensure that the intrinsic has the
correct destination bit size.  Not having the right size can mess up
passes which try to optimize access.  In particular, it was causing
brw_nir_analyze_ubo_ranges to ignore load_ubo of booleans which meant
that booleans uniforms weren't getting pushed as push constants.  I
don't think this is an actual functional bug anywhere hence no CC to
stable but it may improve perf somewhere.

Shader-db results on ICL with iris:

    total instructions in shared programs: 16076707 -> 16075246 (<.01%)
    instructions in affected programs: 129034 -> 127573 (-1.13%)
    helped: 487
    HURT: 0
    helped stats (abs) min: 3 max: 3 x̄: 3.00 x̃: 3
    helped stats (rel) min: 0.45% max: 3.00% x̄: 1.33% x̃: 1.36%
    95% mean confidence interval for instructions value: -3.00 -3.00
    95% mean confidence interval for instructions %-change: -1.37% -1.29%
    Instructions are helped.

    total cycles in shared programs: 338015639 -> 337983311 (<.01%)
    cycles in affected programs: 971986 -> 939658 (-3.33%)
    helped: 362
    HURT: 110
    helped stats (abs) min: 1 max: 1664 x̄: 97.37 x̃: 43
    helped stats (rel) min: 0.03% max: 36.22% x̄: 5.58% x̃: 2.60%
    HURT stats (abs)   min: 1 max: 554 x̄: 26.55 x̃: 18
    HURT stats (rel)   min: 0.03% max: 10.99% x̄: 1.04% x̃: 0.96%
    95% mean confidence interval for cycles value: -79.97 -57.01
    95% mean confidence interval for cycles %-change: -4.60% -3.47%
    Cycles are helped.

    total sends in shared programs: 815037 -> 814550 (-0.06%)
    sends in affected programs: 5701 -> 5214 (-8.54%)
    helped: 487
    HURT: 0

    LOST:   2
    GAINED: 0

The two lost programs were SIMD16 shaders in CS:GO.  However, CS:GO was
also one of the most helped programs where it shaves sends off of 134
programs.  This seems to reduce GPU core clocks by about 4% on the first
1000 frames of the PTS benchmark.

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

4 years agonir: Use b2b opcodes for shared and constant memory
Jason Ekstrand [Fri, 27 Mar 2020 05:29:14 +0000 (00:29 -0500)]
nir: Use b2b opcodes for shared and constant memory

No shader-db changes on ICL with iris

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4338>

4 years agoaco: Implement b2b32 and b2b1
Jason Ekstrand [Fri, 27 Mar 2020 16:49:14 +0000 (11:49 -0500)]
aco: Implement b2b32 and b2b1

The implementations here just clone i2b32 and i2b1.  This means that
b2b32 doesn't technically generate true NIR 0/-1 booleans but it should
be fine as it's only ever generated for shared variable writes which
will always be consumed by something which will then run it through an
i2b again.

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

4 years agonir: Add b2b opcodes
Jason Ekstrand [Fri, 27 Mar 2020 05:18:43 +0000 (00:18 -0500)]
nir: Add b2b opcodes

These exist to convert between different types of boolean values.  In
particular, we want to use these for uniform and shared memory
operations where we need to convert to a reasonably sized boolean but we
don't care what its format is so we don't want to make the back-end
insert an actual i2b/b2i.  In the case of uniforms, Mesa can tweak the
format of the uniform boolean to whatever the driver wants.  In the case
of shared, every value in a shared variable comes from the shader so
it's already in the right boolean format.

The new boolean conversion opcodes get replaced with mov in
lower_bool_to_int/float32 so the back-end will hopefully never see them.
However, while we're in the middle of optimizing our NIR, they let us
have sensible load_uniform/ubo intrinsics and also have the bit size
conversion.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4338>

4 years agointel/nir: Run copy-prop and DCE after lower_bool_to_int32
Jason Ekstrand [Fri, 27 Mar 2020 16:05:27 +0000 (11:05 -0500)]
intel/nir: Run copy-prop and DCE after lower_bool_to_int32

No shader-db impact on ICL with iris.

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

4 years agoetnaviv: compiled_framebuffer_state: get rid of SE_SCISSOR_*
Christian Gmeiner [Sun, 22 Mar 2020 21:42:35 +0000 (22:42 +0100)]
etnaviv: compiled_framebuffer_state: get rid of SE_SCISSOR_*

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4278>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4278>

4 years agoetnaviv: s/scissor_s/scissor
Christian Gmeiner [Sun, 22 Mar 2020 10:16:58 +0000 (11:16 +0100)]
etnaviv: s/scissor_s/scissor

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4278>

4 years agoetnaviv: get rid of struct compiled_scissor_state
Christian Gmeiner [Sun, 22 Mar 2020 10:13:12 +0000 (11:13 +0100)]
etnaviv: get rid of struct compiled_scissor_state

We can reuse pipe_scissor_state.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4278>

4 years agoetnaviv: do the left shift by 16 at emit time
Christian Gmeiner [Sun, 22 Mar 2020 10:07:16 +0000 (11:07 +0100)]
etnaviv: do the left shift by 16 at emit time

Also round up the max bounds.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4278>

4 years agoetnaviv: rework clippling calculation to be a derived state
Christian Gmeiner [Sat, 21 Mar 2020 10:24:48 +0000 (11:24 +0100)]
etnaviv: rework clippling calculation to be a derived state

This moves the whole clipping calculation out of the emit function.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4278>

4 years agoetnaviv: get rid of SE_CLIP_*
Christian Gmeiner [Sat, 21 Mar 2020 10:16:37 +0000 (11:16 +0100)]
etnaviv: get rid of SE_CLIP_*

The only difference between e.g. SE_SCISSOR_RIGHT and SE_CLIP_RIGHT
is the used margin value. With that information we can remove
SE_CLIP_* and apply the different margins during emit time.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4278>

4 years agogitlab-ci: Prune all SCons jobs except scons-win64, and allows failures.
Jose Fonseca [Sat, 28 Mar 2020 10:36:28 +0000 (10:36 +0000)]
gitlab-ci: Prune all SCons jobs except scons-win64, and allows failures.

Based on the discussion in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4352

Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4363>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4363>

4 years agonir/algebraic: add fexp2(fmul(flog2(a), 0.5) -> fsqrt(a) optimization
Samuel Pitoiset [Fri, 27 Mar 2020 15:40:38 +0000 (16:40 +0100)]
nir/algebraic: add fexp2(fmul(flog2(a), 0.5) -> fsqrt(a) optimization

Helps some Wolfenstein II and Wolfenstein Youngblood shaders.

pipeline-db (VEGA10/ACO):
Totals from affected shaders:
SGPRS: 17904 -> 17904 (0.00 %)
VGPRS: 14492 -> 14492 (0.00 %)
Spilled SGPRs: 20 -> 20 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Code Size: 1753152 -> 1749708 (-0.20 %) bytes
Max Waves: 2581 -> 2581 (0.00 %)

pipeline-db (VEGA10/LLVM):
Totals from affected shaders:
SGPRS: 26656 -> 26656 (0.00 %)
VGPRS: 23780 -> 23780 (0.00 %)
Spilled SGPRs: 2112 -> 2112 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Code Size: 2552712 -> 2549236 (-0.14 %) bytes
Max Waves: 3359 -> 3359 (0.00 %)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4353>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4353>

4 years agoscons: Prune out unnecessary targets.
Jose Fonseca [Fri, 27 Mar 2020 15:07:32 +0000 (15:07 +0000)]
scons: Prune out unnecessary targets.

This prunes out all targets except libgl-gdi, libgl-xlib, and svga, as
suggested by Marek Olšák.

libgl-xlib will be remove once I have had time to confirm no automated
tests we have rely upon it.

There are also a bunch of Makefile.sources which become orphaned as
result, that are not taken care of in this change.

v2: Prune remainders of swr support.

Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4348>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4348>

4 years agoaco: Don't store LS VS outputs to LDS when TCS doesn't need them.
Timur Kristóf [Thu, 26 Mar 2020 18:36:05 +0000 (19:36 +0100)]
aco: Don't store LS VS outputs to LDS when TCS doesn't need them.

Totals:
Code Size: 254764624 -> 254745104 (-0.01 %) bytes

Totals from affected shaders:
VGPRS: 12132 -> 12112 (-0.16 %)
Code Size: 573364 -> 553844 (-3.40 %) bytes

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

4 years agoaco: When LS and HS invocations are the same, pass LS outputs in temps.
Timur Kristóf [Thu, 26 Mar 2020 16:45:55 +0000 (17:45 +0100)]
aco: When LS and HS invocations are the same, pass LS outputs in temps.

We know that in this case, the LS and HS invocations are working
on the exact same vertex, so it's safe to skip the LDS.

Totals:
VGPRS: 3960744 -> 3961844 (0.03 %)
Code Size: 254824300 -> 254764624 (-0.02 %) bytes
Max Waves: 1053748 -> 1053574 (-0.02 %)

Totals from affected shaders:
VGPRS: 26152 -> 27252 (4.21 %)
Code Size: 1496600 -> 1436924 (-3.99 %) bytes
Max Waves: 4860 -> 4686 (-3.58 %)

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/4165>

4 years agoaco: Extract store_output_to_temps into a separate function.
Timur Kristóf [Thu, 26 Mar 2020 16:30:16 +0000 (17:30 +0100)]
aco: Extract store_output_to_temps into a separate function.

Will be used by LS output stores.

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/4165>

4 years agoaco: Fix workgroup size calculation.
Timur Kristóf [Thu, 12 Mar 2020 15:28:48 +0000 (16:28 +0100)]
aco: Fix workgroup size calculation.

Clear the workgroup size for all supported shader stages.
Also, unify the workgroup size calculation accross various places.

As a result, insert_waitcnt can use the proper workgroup size
which means that some waits can be dropped from tessellation
shaders. Also, in cases where the previous calculation was wrong,
we now insert s_barrier instructions.

Totals from affected shaders (GFX10):
Code Size: 340116 -> 338484 (-0.48 %) bytes

Fixes: a8d15ab6daf0a07476e9dfabe513c0f1e0f3bf82
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4165>

4 years agoaco: Extract setup_tcs_info to a separate function.
Timur Kristóf [Thu, 26 Mar 2020 16:17:38 +0000 (17:17 +0100)]
aco: Extract setup_tcs_info to a separate function.

Will be required by the workgroup size calculation.

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/4165>

4 years agoaco: Zero-fill undefined elements in create_vec_from_array.
Timur Kristóf [Thu, 26 Mar 2020 11:19:32 +0000 (12:19 +0100)]
aco: Zero-fill undefined elements in create_vec_from_array.

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/4165>

4 years agoaco: Change isel inputs/outputs to a flat array.
Timur Kristóf [Tue, 24 Mar 2020 14:46:55 +0000 (15:46 +0100)]
aco: Change isel inputs/outputs to a flat array.

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/4165>

4 years agoaco: Treat outputs of the previous stage as inputs of the next stage.
Timur Kristóf [Tue, 17 Mar 2020 12:43:08 +0000 (13:43 +0100)]
aco: Treat outputs of the previous stage as inputs of the next stage.

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/4165>

4 years agonir: Collect if shader uses cross-invocation or indirect I/O.
Timur Kristóf [Fri, 13 Mar 2020 09:14:37 +0000 (10:14 +0100)]
nir: Collect if shader uses cross-invocation or indirect I/O.

The following new fields are added to tess shader info:

* `tcs_cross_invocation_inputs_read`
* `tcs_cross_invocation_outputs_read`

These are I/O masks that are a subset of inputs_read and outputs_read
and they contain which per-vertex inputs and outputs are read
cross-invocation.

Additionall, the following new fields are added to shader_info:

* `inputs_read_indirectly`
* `outputs_accessed_indirectly`
* `patch_inputs_read_indirectly`
* `patch_outputs_accessed_indirectly`

These new fields can be used for optimizing TCS in a back-end compiler.
If you can be sure that the TCS doesn't use cross-invocation inputs
or outputs, you can choose a different strategy for storing VS and TCS
outputs. However, such optimizations might need to be disabled when
the inputs/outputs are accessed indirectly due to backend limitations,
so this information is also collected.

Example: RADV currently has to store all VS and TCS outputs in LDS, but
for shaders when only inputs and/or outputs belonging to the current
invocation ID are used, it could skip storing these in LDS entirely.

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/4165>

4 years agoaco: Use more optimal sequence at the beginning of merged shaders.
Timur Kristóf [Fri, 13 Mar 2020 11:39:23 +0000 (12:39 +0100)]
aco: Use more optimal sequence at the beginning of merged shaders.

It can be further optimized in the future, but
the new sequence already has a few advantages:

* Uses fewer instructions
* Uses even fewer instructions in wave32 mode
* Doesn't use the VALU at all

Totals from affected shaders (GFX10):
VGPRS: 43504 -> 43496 (-0.02 %)
Code Size: 2436000 -> 2423688 (-0.51 %) bytes
Max Waves: 8704 -> 8705 (0.01 %)

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4165>

4 years agoaco: Skip 2nd read of merged wave info when TCS in/out vertices are equal.
Timur Kristóf [Thu, 12 Mar 2020 18:54:16 +0000 (19:54 +0100)]
aco: Skip 2nd read of merged wave info when TCS in/out vertices are equal.

When TCS has an equal number of input and output, it means that the
number of VS and TCS invocations (LS and HS) are the same; and that
the HS invocations operate on the same vertices as the LS.

When this is the case, this commit removes the else-if between
the merged VS and TCS halves, making it possible to schedule
and optimize the code accross the two halves.

Totals:
SGPRS: 5577367 -> 5581735 (0.08 %)
VGPRS: 3958592 -> 3960752 (0.05 %)
Code Size: 254867144 -> 254838244 (-0.01 %) bytes
Max Waves: 1053887 -> 1053747 (-0.01 %)

Totals from affected shaders:
SGPRS: 29032 -> 33400 (15.05 %)
VGPRS: 35664 -> 37824 (6.06 %)
Code Size: 1979028 -> 1950128 (-1.46 %) bytes
Max Waves: 7310 -> 7170 (-1.92 %)

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/4165>

4 years agoaco: Allow combining LDS loads when loading tess factors.
Timur Kristóf [Thu, 12 Mar 2020 15:55:19 +0000 (16:55 +0100)]
aco: Allow combining LDS loads when loading tess factors.

Previously the tess factors were loaded individually, but now they can
be loaded using a single LDS load instruction.

Note that the inner and outer tess factors are not yet combined.

Totals (GFX10):
Code Size: 254896008 -> 254879212 (-0.01 %) bytes

Totals from affected shaders (GFX10):
Code Size: 2028352 -> 2011556 (-0.83 %) bytes

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/4165>

4 years agoaco: Allow combining TCS output VMEM stores.
Timur Kristóf [Thu, 12 Mar 2020 15:30:58 +0000 (16:30 +0100)]
aco: Allow combining TCS output VMEM stores.

Some copypasta may have stuck in the code.
This was left on false by mistake.

Totals (GFX10):
Code Size: 254939248 -> 254896008 (-0.02 %) bytes

Totals from affected shaders (GFX10):
VGPRS: 16196 -> 16212 (0.10 %)
Code Size: 1126332 -> 1083092 (-3.84 %) bytes
Max Waves: 2336 -> 2334 (-0.09 %)

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/4165>

4 years agoaco: Fix handling of tess factors.
Timur Kristóf [Thu, 26 Mar 2020 17:36:07 +0000 (18:36 +0100)]
aco: Fix handling of tess factors.

There is no need to check whether they are written using indirect
indices, because all tess factors should be written to VMEM only
at the end of the shader.

No pipeline db changes.

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/4165>

4 years agoaco: Extract tcs_driver_location_matches_api_mask to separate function.
Timur Kristóf [Thu, 26 Mar 2020 17:14:43 +0000 (18:14 +0100)]
aco: Extract tcs_driver_location_matches_api_mask to separate function.

Also clear up should_write_tcs_output_to_lds a little bit.

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/4165>

4 years agoaco: Create null exports in instruction selection instead of assembler.
Timur Kristóf [Thu, 12 Mar 2020 16:20:16 +0000 (17:20 +0100)]
aco: Create null exports in instruction selection instead of assembler.

This allows the passes after isel to assume that the exports are
always correct, and also allows to schedule these null exports later.
Additionally, it ensures that the correct exec mask is used for
these exports.

Totals from affected shaders (GFX10):
SGPRS: 84224 -> 84344 (0.14 %)
VGPRS: 23088 -> 23076 (-0.05 %)
Code Size: 882892 -> 894368 (1.30 %) bytes

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/4165>

4 years agonir: Fix breakage of foreach_list_typed_safe assumptions in loop unrolling
Danylo Piliaiev [Fri, 13 Mar 2020 14:06:07 +0000 (16:06 +0200)]
nir: Fix breakage of foreach_list_typed_safe assumptions in loop unrolling

foreach_list_typed_safe works with assumption that even if current node
becomes invalid, the next will be still valid.

However process_loops broke this assumption, because during iteration
when immediate child is unrolled - not only current node could be removed
but also the one after it.

This doesn't cause issues now but it will cause issues when undefined
behaviour in foreach* macros is fixed.

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4189>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4189>

4 years agoradeon: switch to 3-spaces style
Pierre-Eric Pelloux-Prayer [Fri, 27 Mar 2020 19:42:29 +0000 (20:42 +0100)]
radeon: switch to 3-spaces style

For clang-format config see the previous commit.

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

4 years agoradeonsi: switch to 3-spaces style
Pierre-Eric Pelloux-Prayer [Fri, 27 Mar 2020 18:32:38 +0000 (19:32 +0100)]
radeonsi: switch to 3-spaces style

Generated automatically using clang-format and the following config:

AlignAfterOpenBracket: true
AlignConsecutiveMacros: true
AllowAllArgumentsOnNextLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlwaysBreakAfterReturnType: None
BasedOnStyle: LLVM
BraceWrapping:
  AfterControlStatement: false
  AfterEnum: true
  AfterFunction: true
  AfterStruct: false
  BeforeElse: false
  SplitEmptyFunction: true
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Custom
ColumnLimit: 100
ContinuationIndentWidth: 3
Cpp11BracedListStyle: false
Cpp11BracedListStyle: true
ForEachMacros:
  - LIST_FOR_EACH_ENTRY
  - LIST_FOR_EACH_ENTRY_SAFE
  - util_dynarray_foreach
  - nir_foreach_variable
  - nir_foreach_variable_safe
  - nir_foreach_register
  - nir_foreach_register_safe
  - nir_foreach_use
  - nir_foreach_use_safe
  - nir_foreach_if_use
  - nir_foreach_if_use_safe
  - nir_foreach_def
  - nir_foreach_def_safe
  - nir_foreach_phi_src
  - nir_foreach_phi_src_safe
  - nir_foreach_parallel_copy_entry
  - nir_foreach_instr
  - nir_foreach_instr_reverse
  - nir_foreach_instr_safe
  - nir_foreach_instr_reverse_safe
  - nir_foreach_function
  - nir_foreach_block
  - nir_foreach_block_safe
  - nir_foreach_block_reverse
  - nir_foreach_block_reverse_safe
  - nir_foreach_block_in_cf_node
IncludeBlocks: Regroup
IncludeCategories:
  - Regex:           '<[[:alnum:].]+>'
    Priority:        2
  - Regex:           '.*'
    Priority:        1
IndentWidth: 3
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyExcessCharacter: 100
SpaceAfterCStyleCast: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: false
SpacesInContainerLiterals: false

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

4 years agoradeon: fix includes
Pierre-Eric Pelloux-Prayer [Fri, 27 Mar 2020 19:33:13 +0000 (20:33 +0100)]
radeon: fix includes

And add required forward declarations.

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

4 years agoddebug: add missing forward declaration
Pierre-Eric Pelloux-Prayer [Fri, 27 Mar 2020 19:34:09 +0000 (20:34 +0100)]
ddebug: add missing forward declaration

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

4 years agomeson: Add VS 4624 warning exclusion to remove piles of LLVM warnings
Daniel Stone [Tue, 28 Jan 2020 12:47:20 +0000 (12:47 +0000)]
meson: Add VS 4624 warning exclusion to remove piles of LLVM warnings

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4343>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4343>

4 years agomeson: disable some more warnings on msvc
Erik Faye-Lund [Tue, 14 Jan 2020 10:56:13 +0000 (11:56 +0100)]
meson: disable some more warnings on msvc

These warnings triggers for me, and they are harmless as-is. Let's
disable them to avoid hiding actually scary warnings.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4343>

4 years agoCI: Avoid htz4 runner for VS2019
Daniel Stone [Mon, 30 Mar 2020 09:16:18 +0000 (10:16 +0100)]
CI: Avoid htz4 runner for VS2019

The htz4 runner needs to be updated in order for our support binaries
like Chocolatey to work. Temporarily restrict jobs to the EC2 runner
until this has happened.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4371>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4371>

4 years agointel: drop unused include directories
Eric Engestrom [Fri, 27 Mar 2020 23:28:33 +0000 (00:28 +0100)]
intel: drop unused include directories

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>

4 years agovulkan: drop unused include directories
Eric Engestrom [Tue, 5 Mar 2019 16:55:02 +0000 (16:55 +0000)]
vulkan: drop unused include directories

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>

4 years agomeson: inline `inc_common`
Eric Engestrom [Tue, 5 Mar 2019 16:21:47 +0000 (16:21 +0000)]
meson: inline `inc_common`

Let's make it clear what includes are being added everywhere, so that
they can be cleaned up.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>

4 years agomeson: use existing variables in inc_common
Eric Engestrom [Tue, 5 Mar 2019 10:40:51 +0000 (10:40 +0000)]
meson: use existing variables in inc_common

Stepping stone to make review of the next commits easier.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>

4 years agomesa: Change _mesa_exec_malloc argument type.
Vinson Lee [Sat, 28 Mar 2020 02:56:10 +0000 (19:56 -0700)]
mesa: Change _mesa_exec_malloc argument type.

Fix build error.

In file included from ../src/mesa/x86/rtasm/x86sse.c:7:0:
../src/mesa/main/execmem.h:31:19: error: unknown type name ‘GLuint’; did you mean ‘uint’?
 _mesa_exec_malloc(GLuint size);
                   ^~~~~~
                   uint

Suggested-by: Marek Olšák <marek.olsak@amd.com>
Fixes: e5339fe4a47c ("Move compiler.h and imports.h/c from src/mesa/main into src/util")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4361>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4361>

4 years agogitlab-ci: Update to current templates
Michel Dänzer [Mon, 23 Mar 2020 17:16:07 +0000 (18:16 +0100)]
gitlab-ci: Update to current templates

The .fdo.container-ifnot-exists template has been replaced by
.fdo.container-build.

We need to include "debian/" in FDO_REPO_SUFFIX for now, we can drop it
for individual images when their tags are bumped if we want.

Miscellaneous other goodies this gets us:
* The templates now add some labels to images which may be useful for
  garbage collecting unused tags in the future.
* The templates now copy the current tag from the main project
  registry to the forked project's if it already exists in the latter
  but points to a different image hash. This will avoid false failures
  (or passes) due to using the wrong image.

Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4286>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4286>

4 years agoRevert "gitlab-ci: Disable jobs for Collabora's LAVA lab"
Tomeu Vizoso [Fri, 27 Mar 2020 14:31:45 +0000 (15:31 +0100)]
Revert "gitlab-ci: Disable jobs for Collabora's LAVA lab"

Lab is online again.

This reverts commit 1351ee03352b12690233a73e160f92da2edecf16.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4347>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4347>

4 years agoradeonsi/gfx10: fix descriptors and compute registers for compute-based culling
Marek Olšák [Fri, 20 Mar 2020 21:34:15 +0000 (17:34 -0400)]
radeonsi/gfx10: fix descriptors and compute registers for compute-based culling

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi/gfx10: fix the wave size for compute-based culling
Marek Olšák [Fri, 20 Mar 2020 21:35:56 +0000 (17:35 -0400)]
radeonsi/gfx10: fix the wave size for compute-based culling

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi/gfx10: user correct ACQUIRE_MEM packet for compute-based culling
Marek Olšák [Fri, 20 Mar 2020 21:34:59 +0000 (17:34 -0400)]
radeonsi/gfx10: user correct ACQUIRE_MEM packet for compute-based culling

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi/gfx10: fix ds.ordered.add intrinsic for compute-based culling
Marek Olšák [Fri, 20 Mar 2020 21:30:33 +0000 (17:30 -0400)]
radeonsi/gfx10: fix ds.ordered.add intrinsic for compute-based culling

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi/gfx10: don't use NGG culling if compute-based culling is used
Marek Olšák [Fri, 20 Mar 2020 21:45:17 +0000 (17:45 -0400)]
radeonsi/gfx10: don't use NGG culling if compute-based culling is used

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi: add num_vbos_in_user_sgprs into the shader cache key
Marek Olšák [Sat, 21 Mar 2020 01:12:38 +0000 (21:12 -0400)]
radeonsi: add num_vbos_in_user_sgprs into the shader cache key

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi: always create wait_mem_scratch for compute-based culling
Marek Olšák [Fri, 20 Mar 2020 22:20:52 +0000 (18:20 -0400)]
radeonsi: always create wait_mem_scratch for compute-based culling

used by the primitive restart emulation

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi: set amdgpu-gds-size for mode == 2 of compute-based culling
Marek Olšák [Fri, 20 Mar 2020 22:02:20 +0000 (18:02 -0400)]
radeonsi: set amdgpu-gds-size for mode == 2 of compute-based culling

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi: fix incorrect ordered_wave_id initilization for compute-based culling
Marek Olšák [Fri, 20 Mar 2020 21:32:11 +0000 (17:32 -0400)]
radeonsi: fix incorrect ordered_wave_id initilization for compute-based culling

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agoradeonsi: remove obsolete TODO comment related to compute-based culling
Marek Olšák [Fri, 20 Mar 2020 21:30:10 +0000 (17:30 -0400)]
radeonsi: remove obsolete TODO comment related to compute-based culling

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4269>

4 years agolima: Implement lima_texture_subdata
Vasily Khoruzhick [Mon, 23 Mar 2020 06:12:06 +0000 (23:12 -0700)]
lima: Implement lima_texture_subdata

We can avoid intermediate copy if we implement it ourselves.
Improves x11perf -shmput500 from 199.0/s to 283.0/s

Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4281>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4281>

4 years agogitlab-ci: disable vs2019 build
Rob Clark [Fri, 27 Mar 2020 23:34:27 +0000 (16:34 -0700)]
gitlab-ci: disable vs2019 build

Seems to be broken atm and blocking merging anything.

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

4 years agofreedreno/ir3/ra: re-work a6xx merged register file conflicts
Rob Clark [Thu, 26 Mar 2020 17:45:54 +0000 (10:45 -0700)]
freedreno/ir3/ra: re-work a6xx merged register file conflicts

In particular setup the full/half conflicts first.  This avoids spurious
conflicts that where causing RA to place vecN half-regs poorly.

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

4 years agofreedreno/ir3/ra: split building regs/classes and conflicts
Rob Clark [Thu, 26 Mar 2020 17:25:04 +0000 (10:25 -0700)]
freedreno/ir3/ra: split building regs/classes and conflicts

Split out the construction of registers and classes (which is the same
on all gens) from setting up conflicts.  Prep to re-work how we setup
conflicts on a6xx+ which merged half/full register file.

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

4 years agofreedreno/ir3/ra: pick higher numbered scalars in first pass
Rob Clark [Mon, 23 Mar 2020 17:25:38 +0000 (10:25 -0700)]
freedreno/ir3/ra: pick higher numbered scalars in first pass

Since we are re-assigning the scalars anyways in the second pass, assign
them to the highest free reg in the first pass (rather than lowest) to
allow packing vecN regs as low as possible.

Note this required some changes specifically for tex instructions with a
single component writemask that is not necessarily .x, as previously
these would get assigned in the first RA pass, and since they are still
scalar, we'd end up w/ some r47.* and other similarly way-to-high
assignments after the 2nd pass.

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

4 years agofreedreno/ir3/ra: compute register target from liveranges
Rob Clark [Fri, 20 Mar 2020 16:14:36 +0000 (09:14 -0700)]
freedreno/ir3/ra: compute register target from liveranges

Using the output of the first pass isn't ideal, as it can bake in the
losses from fragmentation which the scalar pass is intended to fill in.
This gets worse when we start using "vectorish" instructions, due to
higher use of vecN values.

Instead, we can just use the outputs of the liveness analysis to get a
more accurate # of maximum live values at any point.

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

4 years agofreedreno/ir3/ra: fix array liveranges
Rob Clark [Sun, 22 Mar 2020 19:37:12 +0000 (12:37 -0700)]
freedreno/ir3/ra: fix array liveranges

Fixes: 1b658533e11 ("freedreno/ir3: extend liverange of arrays")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4272>

4 years agofreedreno/ir3/ra: add def/use iterators
Rob Clark [Sat, 21 Mar 2020 21:44:44 +0000 (14:44 -0700)]
freedreno/ir3/ra: add def/use iterators

Decouple the messy logic of figuring out vreg names defined/used by an
instruction from the logic of what to do about it by introducing
iterators.  There is still *some* array vs ssa special casing in
ra_block_compute_live_ranges(), but less than before.  And this will
avoid introducing a second copy of the def/use logic in a following
patch which uses the liveranges to calculate the maximum # of live
values (which is the optimal target for max physical register window
to round-robin within).

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

4 years agofreedreno/ir3/ra: drop extending output live-ranges
Rob Clark [Sat, 21 Mar 2020 20:29:37 +0000 (13:29 -0700)]
freedreno/ir3/ra: drop extending output live-ranges

This is no longer needed as we create meta:collect instructions in the
end block, which achieves the same result.

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

4 years agofreedreno/ir3/ra: add helper to map name to array
Rob Clark [Sat, 21 Mar 2020 18:25:36 +0000 (11:25 -0700)]
freedreno/ir3/ra: add helper to map name to array

For vreg names that refer to arrays rather than SSA values, this is the
counterpart to name_to_instr().

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

4 years agofreedreno/ir3/ra: fix target register calculation
Rob Clark [Sat, 21 Mar 2020 18:07:35 +0000 (11:07 -0700)]
freedreno/ir3/ra: fix target register calculation

Account for the # of regs an instruction writes, and fix an off-by-one.

(We are about to replace this with calculating the register target using
the live-ranges, but in debugging that it was useful to assert() if it
chose a higher target.)

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

4 years agofreedreno/ir3/ra: add helper to map name to instruction
Rob Clark [Thu, 19 Mar 2020 23:29:57 +0000 (16:29 -0700)]
freedreno/ir3/ra: add helper to map name to instruction

Extract out a helper from the select_reg callback.  And include all the
instructions in the hashtable, not just SFU.  This will be useful in the
following commits.

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

4 years agofreedreno/ir3/ra: split-up
Rob Clark [Sat, 21 Mar 2020 17:33:48 +0000 (10:33 -0700)]
freedreno/ir3/ra: split-up

Split out regset and shared header, since the RA pass is already getting
large-ish.

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

4 years agofreedreno/ir3/ra: add debug option for RA debug msgs
Rob Clark [Mon, 23 Mar 2020 15:58:07 +0000 (08:58 -0700)]
freedreno/ir3/ra: add debug option for RA debug msgs

Similar to the debug switch for sched debug msgs

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

4 years agofreedreno/ir3: convert debug bitfield to BITFIELD_BIT()
Rob Clark [Fri, 6 Mar 2020 16:46:43 +0000 (08:46 -0800)]
freedreno/ir3: convert debug bitfield to BITFIELD_BIT()

(Little more verbose than the kernel's BIT())

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

4 years agofreedreno/ir3: reformat disasm output
Rob Clark [Fri, 6 Mar 2020 16:43:35 +0000 (08:43 -0800)]
freedreno/ir3: reformat disasm output

In particular, make sure we see all the shader-db stats.  The format
(order) is the sameish, except split across multiple lines to make it
easier to read.

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

4 years agofreedreno/ir3: fix bogus register footprint with tess/gs
Rob Clark [Sat, 21 Mar 2020 20:13:34 +0000 (13:13 -0700)]
freedreno/ir3: fix bogus register footprint with tess/gs

When we have a tess or gs stage, VS outputs aren't normal varyings, so
regid is r63.x.. we shouldn't extend our registerfootprint to 64!

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

4 years agofreedreno/ir3: remove unused helper
Rob Clark [Thu, 12 Mar 2020 21:16:38 +0000 (14:16 -0700)]
freedreno/ir3: remove unused helper

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

4 years agofreedreno/ir3: add bary_ij as src for meta:tex_prefetch
Rob Clark [Fri, 20 Mar 2020 18:50:46 +0000 (11:50 -0700)]
freedreno/ir3: add bary_ij as src for meta:tex_prefetch

This way RA doesn't have to special case it in use/def accounting..

This gets rid of an extra level of split/collect, which shouldn't be
needed.  And interferes with scheduler trying to put tex-prefetches
after inputs but before other instructions.  (Otherwise it would have
to figure out which split/collects need to go before the tex-prefetch)

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

4 years agofreedreno/ir3: small cleanup and comments
Rob Clark [Sat, 21 Mar 2020 18:06:59 +0000 (11:06 -0700)]
freedreno/ir3: small cleanup and comments

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

4 years agofreedreno/a6xx: register update
Rob Clark [Sat, 21 Mar 2020 16:49:27 +0000 (09:49 -0700)]
freedreno/a6xx: register update

No functional change, and this register isn't used in userspace.  Just
syncing from envytools tree to eliminate the delta.

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

4 years agoCI: Disable Panfrost Mali-T820 jobs
Daniel Stone [Fri, 27 Mar 2020 21:20:11 +0000 (21:20 +0000)]
CI: Disable Panfrost Mali-T820 jobs

The BayLibre T820 runners appear to be unhealthy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4359>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4359>

4 years agoutil: remove duplicated MALLOC_STRUCT and CALLOC_STRUCT
Marek Olšák [Thu, 26 Mar 2020 03:47:36 +0000 (23:47 -0400)]
util: remove duplicated MALLOC_STRUCT and CALLOC_STRUCT

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>

4 years agoutil: don't include p_defines.h and u_pointer.h from gallium
Marek Olšák [Thu, 26 Mar 2020 03:44:59 +0000 (23:44 -0400)]
util: don't include p_defines.h and u_pointer.h from gallium

It's a mess, but this is what I arrived at.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>

4 years agoradv: stop including files from mesa/main
Marek Olšák [Thu, 26 Mar 2020 01:30:55 +0000 (21:30 -0400)]
radv: stop including files from mesa/main

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>

4 years agoutil: stop including files from mesa/main
Marek Olšák [Thu, 26 Mar 2020 01:26:24 +0000 (21:26 -0400)]
util: stop including files from mesa/main

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>

4 years agomesa: don't use <> for including internal headers
Marek Olšák [Thu, 26 Mar 2020 01:13:48 +0000 (21:13 -0400)]
mesa: don't use <> for including internal headers

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>

4 years agoMove compiler.h and imports.h/c from src/mesa/main into src/util
Marek Olšák [Thu, 26 Mar 2020 01:11:44 +0000 (21:11 -0400)]
Move compiler.h and imports.h/c from src/mesa/main into src/util

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>

4 years agowgl: use gldrv.h instead of stw_icd.h
Jesse Natalie [Tue, 17 Mar 2020 17:53:33 +0000 (10:53 -0700)]
wgl: use gldrv.h instead of stw_icd.h

Now that we have the official header, let's use that instead of
stw_icd.h.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4305>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4305>

4 years agowgl: add official gldrv.h header-file
Jesse Natalie [Tue, 17 Mar 2020 17:53:33 +0000 (10:53 -0700)]
wgl: add official gldrv.h header-file

This is the official, Microsoft-provided gldrv.h that describes the
driver-interface for OpenGL drivers on Windows.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4305>

4 years agonv50, nvc0: fix must_check warning of util_dynarray_resize_bytes
Karol Herbst [Fri, 20 Sep 2019 18:27:20 +0000 (20:27 +0200)]
nv50, nvc0: fix must_check warning of util_dynarray_resize_bytes

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4330>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4330>

4 years agonv50: remove unused variable
Erik Faye-Lund [Thu, 26 Mar 2020 10:50:10 +0000 (11:50 +0100)]
nv50: remove unused variable

This isn't used anymore, so let's get rid of it to silence a warning.

Fixes: c574cda3c6a ("util: Make helper functions for pack/unpacking pixel rows.")
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4330>

4 years agointel/perf: store the probed i915-perf version
Lionel Landwerlin [Mon, 2 Mar 2020 12:00:55 +0000 (14:00 +0200)]
intel/perf: store the probed i915-perf version

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4344>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4344>