platform/upstream/mesa.git
3 years agoiris: Remove context from iris_create_uncompiled_shader
Kenneth Graunke [Tue, 9 Feb 2021 02:26:57 +0000 (18:26 -0800)]
iris: Remove context from iris_create_uncompiled_shader

Nothing uses the context here, just the screen.

Fixes: 84a38ec1336 ("iris: Enable PIPE_CAP_SHAREABLE_SHADERS.")
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8922>

3 years agoiris: Remove context from iris_compile_vs and friends
Kenneth Graunke [Tue, 9 Feb 2021 02:25:01 +0000 (18:25 -0800)]
iris: Remove context from iris_compile_vs and friends

Instead, we pass the screen, an uploader, and a debug callback.

Fixes: 84a38ec1336 ("iris: Enable PIPE_CAP_SHAREABLE_SHADERS.")
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8922>

3 years agoiris: Remove context from iris_upload_shader()
Kenneth Graunke [Tue, 9 Feb 2021 02:01:31 +0000 (18:01 -0800)]
iris: Remove context from iris_upload_shader()

Shaders are now shared across contexts, so we'd like to avoid requiring
access to a full context.  Instead, we pass the screen and an uploader
to use.

Fixes: 84a38ec1336 ("iris: Enable PIPE_CAP_SHAREABLE_SHADERS.")
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8922>

3 years agoiris: Remove context from iris_debug_recompile
Kenneth Graunke [Tue, 9 Feb 2021 01:50:41 +0000 (17:50 -0800)]
iris: Remove context from iris_debug_recompile

This doesn't and shouldn't use the context.  It just wants a debug
callback to print things on.

Fixes: 84a38ec1336 ("iris: Enable PIPE_CAP_SHAREABLE_SHADERS.")
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8922>

3 years agoiris: Fill out scratch base address dynamically
Kenneth Graunke [Wed, 3 Feb 2021 09:41:42 +0000 (01:41 -0800)]
iris: Fill out scratch base address dynamically

Now that shaders are shared between contexts, we can't pre-bake the
shader scratch address into the derived 3DSTATE_XS packets.  Scratch
buffers are and must be per-context, as multiple contexts could be
executing shaders using scratch at the same time.

So instead, we leave that field blank when pre-filling those packets
up-front, and merge in the actual address when emitting them.  It's
a little more overhead, but only in the case where scratch is used.

Fixes: 84a38ec1336 ("iris: Enable PIPE_CAP_SHAREABLE_SHADERS.")
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8922>

3 years agozink: lower flrp64 and ffma64 when in softfp64 mode
Mike Blumenkrantz [Thu, 11 Feb 2021 15:33:25 +0000 (10:33 -0500)]
zink: lower flrp64 and ffma64 when in softfp64 mode

fixes a bunch of crashes

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8986>

3 years agozink: add spirv interfaces for bo and image/sampler/push variables
Mike Blumenkrantz [Fri, 11 Dec 2020 23:56:26 +0000 (18:56 -0500)]
zink: add spirv interfaces for bo and image/sampler/push variables

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8985>

3 years agoanv: Add ANV_QUEUE_OVERRIDE env-var to override advertised queues
Jordan Justen [Mon, 25 Jan 2021 20:33:19 +0000 (12:33 -0800)]
anv: Add ANV_QUEUE_OVERRIDE env-var to override advertised queues

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8771>

3 years agoanv: Add fake graphics-only and compute-only queue families
Jason Ekstrand [Tue, 26 Jan 2021 16:38:47 +0000 (10:38 -0600)]
anv: Add fake graphics-only and compute-only queue families

Rework:
 * Jordan: Add graphics-only queue
 * Jordan: Bump ANV_MAX_QUEUE_FAMILIES and add related asserts
 * Jordan: Fix queueCount on compute-only family

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8771>

3 years agoci: enable max texture size tests for zink
Erik Faye-Lund [Wed, 10 Feb 2021 17:22:03 +0000 (18:22 +0100)]
ci: enable max texture size tests for zink

I cargo-culted these from the llvmpipe tests, but they seem to pass and
not take much time or memory at all, so let's try enabling them. If this
works fine, we might want to try the same for llvmpipe as well...

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8979>

3 years agovulkan: Fix windows api conflict
Michel Zou [Thu, 11 Feb 2021 08:11:42 +0000 (09:11 +0100)]
vulkan: Fix windows api conflict

It must be undefined in the header too

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

3 years agopan/bi: Push UBOs on Bifrost
Alyssa Rosenzweig [Tue, 9 Feb 2021 23:23:06 +0000 (18:23 -0500)]
pan/bi: Push UBOs on Bifrost

Based on the Midgard pass. Results look better since Midgard already had
a basic UBO pushing pass to begin with. Particularly nice to see the
dramatic reduction in spilling.

total instructions in shared programs: 169141 -> 161215 (-4.69%)
instructions in affected programs: 164102 -> 156176 (-4.83%)
helped: 1269
HURT: 90
helped stats (abs) min: 1 max: 61 x̄: 6.50 x̃: 4
helped stats (rel) min: 0.15% max: 17.58% x̄: 6.31% x̃: 5.88%
HURT stats (abs)   min: 1 max: 170 x̄: 3.58 x̃: 1
HURT stats (rel)   min: 0.08% max: 133.33% x̄: 16.65% x̃: 5.26%
95% mean confidence interval for instructions value: -6.28 -5.38
95% mean confidence interval for instructions %-change: -5.39% -4.18%
Instructions are helped.

total nops in shared programs: 121049 -> 120997 (-0.04%)
nops in affected programs: 110024 -> 109972 (-0.05%)
helped: 501
HURT: 758
helped stats (abs) min: 1 max: 45 x̄: 5.54 x̃: 2
helped stats (rel) min: 0.25% max: 47.06% x̄: 6.81% x̃: 4.55%
HURT stats (abs)   min: 1 max: 102 x̄: 3.59 x̃: 3
HURT stats (rel)   min: 0.32% max: 50.00% x̄: 7.13% x̃: 6.06%
95% mean confidence interval for nops value: -0.45 0.37
95% mean confidence interval for nops %-change: 1.07% 2.09%
Inconclusive result (value mean confidence interval includes 0).

total clauses in shared programs: 40388 -> 31610 (-21.73%)
clauses in affected programs: 38825 -> 30047 (-22.61%)
helped: 1367
HURT: 2
helped stats (abs) min: 1 max: 58 x̄: 6.43 x̃: 5
helped stats (rel) min: 1.34% max: 55.56% x̄: 24.97% x̃: 25.00%
HURT stats (abs)   min: 2 max: 12 x̄: 7.00 x̃: 7
HURT stats (rel)   min: 5.08% max: 6.67% x̄: 5.88% x̃: 5.88%
95% mean confidence interval for clauses value: -6.74 -6.08
95% mean confidence interval for clauses %-change: -25.50% -24.35%
Clauses are helped.

total quadwords in shared programs: 144937 -> 130686 (-9.83%)
quadwords in affected programs: 140419 -> 126168 (-10.15%)
helped: 1369
HURT: 13
helped stats (abs) min: 1 max: 112 x̄: 10.50 x̃: 7
helped stats (rel) min: 0.23% max: 31.82% x̄: 11.36% x̃: 10.78%
HURT stats (abs)   min: 1 max: 106 x̄: 10.00 x̃: 1
HURT stats (rel)   min: 5.88% max: 10.24% x̄: 9.26% x̃: 10.00%
95% mean confidence interval for quadwords value: -10.96 -9.66
95% mean confidence interval for quadwords %-change: -11.52% -10.82%
Quadwords are helped.

total spills in shared programs: 1106 -> 705 (-36.26%)
spills in affected programs: 1058 -> 657 (-37.90%)
helped: 41
HURT: 0

total fills in shared programs: 2241 -> 1645 (-26.60%)
fills in affected programs: 2219 -> 1623 (-26.86%)
helped: 43
HURT: 2

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Add SSA-based scalar copy propagation
Alyssa Rosenzweig [Wed, 10 Feb 2021 16:47:24 +0000 (11:47 -0500)]
pan/bi: Add SSA-based scalar copy propagation

This is a very simple (and slow...) copyprop pass. It's good enough to
get rid of redundant moves from FAU, but it doesn't help for vector
combines.

total instructions in shared programs: 175219 -> 169141 (-3.47%)
instructions in affected programs: 91439 -> 85361 (-6.65%)
helped: 599
HURT: 0
helped stats (abs) min: 1 max: 112 x̄: 10.15 x̃: 6
helped stats (rel) min: 0.30% max: 33.33% x̄: 8.61% x̃: 8.04%
95% mean confidence interval for instructions value: -11.06 -9.24
95% mean confidence interval for instructions %-change: -9.07% -8.16%
Instructions are helped.

total nops in shared programs: 120011 -> 121049 (0.86%)
nops in affected programs: 47355 -> 48393 (2.19%)
helped: 110
HURT: 309
helped stats (abs) min: 1 max: 6 x̄: 2.07 x̃: 2
helped stats (rel) min: 0.44% max: 16.67% x̄: 3.59% x̃: 3.16%
HURT stats (abs)   min: 1 max: 56 x̄: 4.10 x̃: 2
HURT stats (rel)   min: 0.32% max: 80.85% x̄: 6.85% x̃: 3.12%
95% mean confidence interval for nops value: 1.86 3.09
95% mean confidence interval for nops %-change: 3.08% 5.14%
Nops are HURT.

total clauses in shared programs: 40576 -> 40388 (-0.46%)
clauses in affected programs: 3074 -> 2886 (-6.12%)
helped: 106
HURT: 0
helped stats (abs) min: 1 max: 4 x̄: 1.77 x̃: 2
helped stats (rel) min: 0.42% max: 22.22% x̄: 7.17% x̃: 6.90%
95% mean confidence interval for clauses value: -1.91 -1.63
95% mean confidence interval for clauses %-change: -7.80% -6.53%
Clauses are helped.

total quadwords in shared programs: 146590 -> 144937 (-1.13%)
quadwords in affected programs: 59475 -> 57822 (-2.78%)
helped: 493
HURT: 1
helped stats (abs) min: 1 max: 28 x̄: 3.35 x̃: 2
helped stats (rel) min: 0.28% max: 15.38% x̄: 4.08% x̃: 3.85%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 2.38% max: 2.38% x̄: 2.38% x̃: 2.38%
95% mean confidence interval for quadwords value: -3.61 -3.08
95% mean confidence interval for quadwords %-change: -4.33% -3.81%
Quadwords are helped.

total spills in shared programs: 1106 -> 1106 (0.00%)
spills in affected programs: 0 -> 0
helped: 0
HURT: 0

total fills in shared programs: 2241 -> 2241 (0.00%)
fills in affected programs: 0 -> 0
helped: 0
HURT: 0

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Simplify derivative lowering
Alyssa Rosenzweig [Wed, 10 Feb 2021 16:44:37 +0000 (11:44 -0500)]
pan/bi: Simplify derivative lowering

Now that we lower FAU correctly, we don't need to write the extra move
explicitly, it will be lowered in later.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Rework FAU lowering
Alyssa Rosenzweig [Wed, 10 Feb 2021 16:43:18 +0000 (11:43 -0500)]
pan/bi: Rework FAU lowering

Move and reshape bi_lower_fau to bi_schedule.c. This generalizes the
pass for FAU reads, allowing copyprop to work with FAU without problems.

The pass must run immediately before scheduling. Its post-conditions are
directly specified as the scheduler's pre-conditions. It momentarily
will depend on internal scheduler predicates. It is, for all intents and
purposes, part of the scheduler. Keep it all together.

Finally, adjust the 0 handling to avoid a move at the expense of
constrained scheduling of something like `FADD.v2f16.clamp_0_1 u0, #0`

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Handle modifiers in rewrite_fau_to_pass
Alyssa Rosenzweig [Wed, 10 Feb 2021 17:38:09 +0000 (12:38 -0500)]
pan/bi: Handle modifiers in rewrite_fau_to_pass

Will prevent failures when we start using FAU together with modifiers in
a few commits.

Fixes: fc7770b1dda ("pan/bi: Add trivial rewrite helpers")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Generalize bi_update_fau with fast zero
Alyssa Rosenzweig [Wed, 10 Feb 2021 17:39:09 +0000 (12:39 -0500)]
pan/bi: Generalize bi_update_fau with fast zero

Ensure we don't fall over if we have an instruction like

   FADD.f32 u0, #0

In this case, the tuple's FAU requirement implies the instruction can be
scheduler without lowering to the FMA slot but not the ADD slot.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Print FAU uniforms in IR
Alyssa Rosenzweig [Tue, 9 Feb 2021 23:34:08 +0000 (18:34 -0500)]
pan/bi: Print FAU uniforms in IR

Uses "u3, u3[1]" syntax which is close enough to the assembly syntax
"u3.w0, u3.w1".

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Add bi_is_ssa helper
Alyssa Rosenzweig [Wed, 10 Feb 2021 16:47:03 +0000 (11:47 -0500)]
pan/bi: Add bi_is_ssa helper

Convenient for SSA-based opt passes.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Add bi_replace_index helper
Alyssa Rosenzweig [Wed, 10 Feb 2021 16:46:01 +0000 (11:46 -0500)]
pan/bi: Add bi_replace_index helper

I keep open-coding this, incorrectly... Since bi_index contains both
"position" and "modifier" data, it's common to want to swap the position
while preserving modifiers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/bi: Fix multithreaded shader-db
Alyssa Rosenzweig [Thu, 11 Feb 2021 00:40:38 +0000 (19:40 -0500)]
pan/bi: Fix multithreaded shader-db

Clobbered names.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/mdg: Push uniforms based on UBO analysis
Alyssa Rosenzweig [Sun, 7 Feb 2021 16:09:06 +0000 (11:09 -0500)]
pan/mdg: Push uniforms based on UBO analysis

Skips over "holes" in UBO ranges and allows pushing things other than
UBO #0 (GL uniforms) and sysvals. shader-db results relative to
beginning of series (so includes the hurt from lowering UBO to
uniforms):

total instructions in shared programs: 96611 -> 95018 (-1.65%)
instructions in affected programs: 22356 -> 20763 (-7.13%)
helped: 204
HURT: 13
helped stats (abs) min: 1 max: 27 x̄: 8.18 x̃: 7
helped stats (rel) min: 0.42% max: 26.09% x̄: 8.60% x̃: 8.07%
HURT stats (abs)   min: 1 max: 33 x̄: 5.77 x̃: 2
HURT stats (rel)   min: 0.47% max: 15.64% x̄: 3.56% x̃: 1.72%
95% mean confidence interval for instructions value: -8.29 -6.39
95% mean confidence interval for instructions %-change: -8.74% -7.00%
Instructions are helped.

total bundles in shared programs: 44886 -> 44790 (-0.21%)
bundles in affected programs: 9640 -> 9544 (-1.00%)
helped: 131
HURT: 70
helped stats (abs) min: 1 max: 11 x̄: 4.34 x̃: 4
helped stats (rel) min: 1.04% max: 42.31% x̄: 10.39% x̃: 9.84%
HURT stats (abs)   min: 1 max: 16 x̄: 6.76 x̃: 6
HURT stats (rel)   min: 2.22% max: 37.50% x̄: 13.78% x̃: 10.00%
95% mean confidence interval for bundles value: -1.37 0.42
95% mean confidence interval for bundles %-change: -3.99% 0.04%
Inconclusive result (value mean confidence interval includes 0).

total quadwords in shared programs: 76320 -> 75140 (-1.55%)
quadwords in affected programs: 16691 -> 15511 (-7.07%)
helped: 206
HURT: 5
helped stats (abs) min: 1 max: 18 x̄: 5.91 x̃: 6
helped stats (rel) min: 0.36% max: 27.78% x̄: 7.93% x̃: 8.33%
HURT stats (abs)   min: 1 max: 19 x̄: 7.40 x̃: 1
HURT stats (rel)   min: 0.55% max: 15.79% x̄: 7.39% x̃: 3.57%
95% mean confidence interval for quadwords value: -6.19 -5.00
95% mean confidence interval for quadwords %-change: -8.32% -6.82%
Quadwords are helped.

total registers in shared programs: 6958 -> 6827 (-1.88%)
registers in affected programs: 1083 -> 952 (-12.10%)
helped: 112
HURT: 16
helped stats (abs) min: 1 max: 3 x̄: 1.32 x̃: 1
helped stats (rel) min: 6.25% max: 50.00% x̄: 17.13% x̃: 12.50%
HURT stats (abs)   min: 1 max: 2 x̄: 1.06 x̃: 1
HURT stats (rel)   min: 9.09% max: 20.00% x̄: 11.97% x̃: 11.81%
95% mean confidence interval for registers value: -1.19 -0.86
95% mean confidence interval for registers %-change: -15.78% -11.21%
Registers are helped.

total threads in shared programs: 5109 -> 5153 (0.86%)
threads in affected programs: 62 -> 106 (70.97%)
helped: 42
HURT: 6
helped stats (abs) min: 1 max: 2 x̄: 1.19 x̃: 1
helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 50.00% max: 50.00% x̄: 50.00% x̃: 50.00%
95% mean confidence interval for threads value: 0.68 1.16
95% mean confidence interval for threads %-change: 66.69% 95.81%
Threads are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/mdg: Update UBO promotion comment
Alyssa Rosenzweig [Sat, 6 Feb 2021 14:00:13 +0000 (09:00 -0500)]
pan/mdg: Update UBO promotion comment

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopanfrost: Don't store uniform_count on Midgard
Alyssa Rosenzweig [Wed, 10 Feb 2021 00:09:43 +0000 (19:09 -0500)]
panfrost: Don't store uniform_count on Midgard

We weren't reading it anywhere outside this function, no need to keep
the extra copy of the data around. Avoids a footgun since this field
isn't even used on Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopanfrost: Set FAU count based on program->push
Alyssa Rosenzweig [Wed, 10 Feb 2021 00:08:54 +0000 (19:08 -0500)]
panfrost: Set FAU count based on program->push

There's no "cutoff" to worry about on Bifrost, just do the simple thing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopanfrost: Push uniforms required by the program
Alyssa Rosenzweig [Sun, 7 Feb 2021 15:09:21 +0000 (10:09 -0500)]
panfrost: Push uniforms required by the program

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopanfrost: Add UBO push data structure
Alyssa Rosenzweig [Sun, 7 Feb 2021 16:08:33 +0000 (11:08 -0500)]
panfrost: Add UBO push data structure

Will be used to generalize RMU on Midgard and also to support Bifrost's
FAU (which is essentially the same thing).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopanfrost: Don't truncate uniform_count
Alyssa Rosenzweig [Sun, 7 Feb 2021 16:05:28 +0000 (11:05 -0500)]
panfrost: Don't truncate uniform_count

Will fix INSTR_INVALID_OPERAND faults when we push other UBOs.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopanfrost: Move sysvals to dedicated UBO
Alyssa Rosenzweig [Fri, 29 Jan 2021 23:06:02 +0000 (18:06 -0500)]
panfrost: Move sysvals to dedicated UBO

This makes UBO 0 less special, allowing us to generalize uniform
optimization. Note this disables RMU on Midgard as we're about to
rewrite the RMU mechanism.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopanfrost: Respect buffer_offset when mapping to CPU
Alyssa Rosenzweig [Tue, 9 Feb 2021 14:46:12 +0000 (09:46 -0500)]
panfrost: Respect buffer_offset when mapping to CPU

Previously not seen since mesa/st seems to leave this zero for uniforms.
Still wrong, though.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopanfrost: Fix race condition in UBO mapping to CPU
Alyssa Rosenzweig [Mon, 8 Feb 2021 22:49:17 +0000 (17:49 -0500)]
panfrost: Fix race condition in UBO mapping to CPU

In theory, a compute shader (or transform feedback) could write to an
SSBO, rebind as a UBO, and then read as a UBO later in the same frame.
We would need to flush in this case so we don't push stale data to the
later shader. This seems sufficiently obscure, but if this is a
performance issue in a real workload, we could emit a small compute
shader to do the copies without flushing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/mdg: Set lower_uniforms_to_ubo
Alyssa Rosenzweig [Sun, 7 Feb 2021 21:15:07 +0000 (16:15 -0500)]
pan/mdg: Set lower_uniforms_to_ubo

Removes our custom load_uniform implementation and unifies the command
stream side with Bifrost, preparing for additional optimizations.
shader-db results are a wash. It's worth noting some of the increase in
bundles is due to peephole select which is notoriously awkward for
shader-db stats.

total instructions in shared programs: 96611 -> 95613 (-1.03%)
instructions in affected programs: 17562 -> 16564 (-5.68%)
helped: 137
HURT: 13
helped stats (abs) min: 2 max: 27 x̄: 7.83 x̃: 7
helped stats (rel) min: 0.61% max: 20.00% x̄: 7.19% x̃: 5.75%
HURT stats (abs)   min: 1 max: 33 x̄: 5.77 x̃: 2
HURT stats (rel)   min: 0.47% max: 15.64% x̄: 3.56% x̃: 1.72%
95% mean confidence interval for instructions value: -7.78 -5.53
95% mean confidence interval for instructions %-change: -7.13% -5.38%
Instructions are helped.

total bundles in shared programs: 44886 -> 45230 (0.77%)
bundles in affected programs: 6649 -> 6993 (5.17%)
helped: 54
HURT: 68
helped stats (abs) min: 1 max: 6 x̄: 2.35 x̃: 2
helped stats (rel) min: 1.04% max: 6.82% x̄: 4.37% x̃: 4.80%
HURT stats (abs)   min: 1 max: 16 x̄: 6.93 x̃: 6
HURT stats (rel)   min: 2.22% max: 37.50% x̄: 14.03% x̃: 10.00%
95% mean confidence interval for bundles value: 1.78 3.85
95% mean confidence interval for bundles %-change: 3.73% 8.04%
Bundles are HURT.

total quadwords in shared programs: 76320 -> 75533 (-1.03%)
quadwords in affected programs: 12404 -> 11617 (-6.34%)
helped: 133
HURT: 3
helped stats (abs) min: 1 max: 18 x̄: 6.18 x̃: 6
helped stats (rel) min: 0.36% max: 18.18% x̄: 7.34% x̃: 7.45%
HURT stats (abs)   min: 1 max: 19 x̄: 11.67 x̃: 15
HURT stats (rel)   min: 0.55% max: 15.79% x̄: 9.94% x̃: 13.48%
95% mean confidence interval for quadwords value: -6.41 -5.16
95% mean confidence interval for quadwords %-change: -7.58% -6.34%
Quadwords are helped.

total registers in shared programs: 6958 -> 6928 (-0.43%)
registers in affected programs: 524 -> 494 (-5.73%)
helped: 42
HURT: 15
helped stats (abs) min: 1 max: 2 x̄: 1.10 x̃: 1
helped stats (rel) min: 6.25% max: 25.00% x̄: 12.71% x̃: 12.50%
HURT stats (abs)   min: 1 max: 2 x̄: 1.07 x̃: 1
HURT stats (rel)   min: 9.09% max: 20.00% x̄: 11.44% x̃: 11.11%
95% mean confidence interval for registers value: -0.79 -0.26
95% mean confidence interval for registers %-change: -9.35% -3.36%
Registers are helped.

total threads in shared programs: 5109 -> 5107 (-0.04%)
threads in affected programs: 16 -> 14 (-12.50%)
helped: 2
HURT: 6
helped stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2
helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 50.00% max: 50.00% x̄: 50.00% x̃: 50.00%
95% mean confidence interval for threads value: -1.41 0.91
95% mean confidence interval for threads %-change: -70.55% 45.55%
Inconclusive result (value mean confidence interval includes 0).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
WIP - do peephole ourselves

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/mdg: Optimize UBO offset calculations
Alyssa Rosenzweig [Sun, 7 Feb 2021 18:40:03 +0000 (13:40 -0500)]
pan/mdg: Optimize UBO offset calculations

LD_UNIFORM supports constant shifts and biases, just like LD, so take
advantage of that. Will avoid a regression in code quality from lowering
uniforms to UBOs.

No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/mdg: Add MIDGARD_MESA_DEBUG=inorder option
Alyssa Rosenzweig [Tue, 9 Feb 2021 14:48:48 +0000 (09:48 -0500)]
pan/mdg: Add MIDGARD_MESA_DEBUG=inorder option

Helpful to disable the scheduler when debugging, so the assembly can be
compared against the NIR directly when lost in a big dEQP test.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agopan/mdg: Fix multithreaded shader-db
Alyssa Rosenzweig [Thu, 11 Feb 2021 00:40:47 +0000 (19:40 -0500)]
pan/mdg: Fix multithreaded shader-db

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>

3 years agoanv: discard all timeline wait/signal value=0
Lionel Landwerlin [Thu, 11 Feb 2021 15:38:11 +0000 (17:38 +0200)]
anv: discard all timeline wait/signal value=0

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 34f32a6d664807 ("anv: implement VK_KHR_timeline_semaphore")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4277
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8987>

3 years agofeatures: mark off GL 4.5 for zink
Mike Blumenkrantz [Thu, 11 Feb 2021 16:22:09 +0000 (11:22 -0500)]
features: mark off GL 4.5 for zink

also update relnotes

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: GLSL 450
Mike Blumenkrantz [Tue, 18 Aug 2020 21:14:54 +0000 (17:14 -0400)]
zink: GLSL 450

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: enable PIPE_CAP_TEXTURE_BARRIER
Mike Blumenkrantz [Tue, 18 Aug 2020 21:13:42 +0000 (17:13 -0400)]
zink: enable PIPE_CAP_TEXTURE_BARRIER

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: enable PIPE_CAP_TGSI_TXQS
Mike Blumenkrantz [Tue, 18 Aug 2020 21:01:07 +0000 (17:01 -0400)]
zink: enable PIPE_CAP_TGSI_TXQS

aka ARB_shader_texture_image_samples

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: enable PIPE_CAP_CLIP_HALFZ
Mike Blumenkrantz [Tue, 18 Aug 2020 19:08:15 +0000 (15:08 -0400)]
zink: enable PIPE_CAP_CLIP_HALFZ

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: enable PIPE_CAP_CONDITIONAL_RENDER_INVERTED
Mike Blumenkrantz [Tue, 18 Aug 2020 15:41:16 +0000 (11:41 -0400)]
zink: enable PIPE_CAP_CONDITIONAL_RENDER_INVERTED

this was already handled

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: GLSL 440
Mike Blumenkrantz [Tue, 18 Aug 2020 15:36:20 +0000 (11:36 -0400)]
zink: GLSL 440

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: enable PIPE_CAP_QUERY_BUFFER_OBJECT
Mike Blumenkrantz [Mon, 17 Aug 2020 19:09:31 +0000 (15:09 -0400)]
zink: enable PIPE_CAP_QUERY_BUFFER_OBJECT

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: enable PIPE_CAP_TGSI_ARRAY_COMPONENTS
Mike Blumenkrantz [Fri, 14 Aug 2020 21:39:49 +0000 (17:39 -0400)]
zink: enable PIPE_CAP_TGSI_ARRAY_COMPONENTS

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>

3 years agozink: add a get_query_result_resource hook
Mike Blumenkrantz [Mon, 17 Aug 2020 19:08:47 +0000 (15:08 -0400)]
zink: add a get_query_result_resource hook

this is messy due to how we have to accumulate all the query results
in some cases

future patches will break things up into utility functions for reuse

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8944>

3 years agozink: add PIPE_BIND_QUERY_BUFFER to the all-purpose resource creation path
Mike Blumenkrantz [Mon, 17 Aug 2020 19:08:03 +0000 (15:08 -0400)]
zink: add PIPE_BIND_QUERY_BUFFER to the all-purpose resource creation path

this can be used pretty much anywhere, so it needs all the bits

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8944>

3 years agoci: Ensure that jobs inherting the ci-deqp jobs artifact meson logs
Rohan Garg [Tue, 9 Feb 2021 16:43:35 +0000 (17:43 +0100)]
ci: Ensure that jobs inherting the ci-deqp jobs artifact meson logs

Since gitlab-ci cannot merge artifact lists, and the last entry a job
extends from overwrites the artifact list, we should ensure that we
artifact meson logs via the .ci-deqp-artifacts job.

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8937>

3 years agozink: fix xfb buffer refcounting
Mike Blumenkrantz [Fri, 18 Sep 2020 16:13:39 +0000 (12:13 -0400)]
zink: fix xfb buffer refcounting

we need to always ref the counter buffer to the current batch, not
just when using it for resumign xfb

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8984>

3 years agotgsi_to_nir: Fix uniform ranges.
Timur Kristóf [Mon, 8 Feb 2021 16:58:15 +0000 (17:58 +0100)]
tgsi_to_nir: Fix uniform ranges.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Fixes: f3b33a5a35e605101d45213bddf52f2f800a52bb
Closes: #4127
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8920>

3 years agozink: enable excluded test
Erik Faye-Lund [Wed, 10 Feb 2021 17:55:31 +0000 (18:55 +0100)]
zink: enable excluded test

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8977>

3 years agozink: correctly handle 64 valid timestamp bits
Erik Faye-Lund [Wed, 10 Feb 2021 17:50:32 +0000 (18:50 +0100)]
zink: correctly handle 64 valid timestamp bits

We can't shift up 1ull by more than 63 without triggering undefined
behavior here. But in that case, doing nothing is perfectly fine.

While we're at it, remove some needless parens.

This fixes the spec@ext_timer_query@time-elapsed piglit test on top of
Lavapipe.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8977>

3 years agoradv: use a more relaxed alignment for upload buffer allocations
Rhys Perry [Tue, 2 Feb 2021 15:28:37 +0000 (15:28 +0000)]
radv: use a more relaxed alignment for upload buffer allocations

256 bytes was higher than necessary.

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

3 years agoac/rgp: append the number of seconds to the generated RGP file
Samuel Pitoiset [Wed, 10 Feb 2021 14:26:35 +0000 (15:26 +0100)]
ac/rgp: append the number of seconds to the generated RGP file

To not overwrite the previous ones.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8960>

3 years agoradv: add support for resizing the SQTT buffer automatically
Samuel Pitoiset [Wed, 10 Feb 2021 13:18:11 +0000 (14:18 +0100)]
radv: add support for resizing the SQTT buffer automatically

The buffer is resized when too small, the 150% limit is arbitrary and
works in most cases.

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

3 years agoradv: adjust an error message related to the SQTT buffer size
Samuel Pitoiset [Wed, 10 Feb 2021 13:29:14 +0000 (14:29 +0100)]
radv: adjust an error message related to the SQTT buffer size

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

3 years agoradv: do not overallocate the SQTT buffer
Samuel Pitoiset [Wed, 10 Feb 2021 13:27:24 +0000 (14:27 +0100)]
radv: do not overallocate the SQTT buffer

The total size is computed for all available SEs which is not always 4.

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

3 years agoci: document arm oddity in build-rules
Erik Faye-Lund [Wed, 10 Feb 2021 18:19:35 +0000 (19:19 +0100)]
ci: document arm oddity in build-rules

There's an oddity in the .lava-test:amd64 build rules; we depend on and
use the ARM images instead of the AMD64 images. The reason for this is
kind of silly; we need the Docker image to match the architecture of the
runner, which happens to be ARM.

So this isn't at all about the target architecture, but more of a Docker
detail.

Hopefully documenting this will prevent others from spending time being
puzzled about this in the future.

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

3 years agoci: Restrict meson-gallium job to gstreamer runners
Michel Dänzer [Wed, 10 Feb 2021 17:27:41 +0000 (18:27 +0100)]
ci: Restrict meson-gallium job to gstreamer runners

The i965_asm tests are randomly timing out. I've been able to find such
timeouts only on packet runners. This change should have either of these
results:

* The timeouts actually don't happen on gstreamer runners. There will
  be no more spurious pipeline failures due to them for the time being,
  and we'll know the timeouts are due to some kind of packet runner
  specific issue.

* The timeouts happen on gstreamer runners as well. We'll know they're
  not caused by a packet runner specific issue.

Win-win.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8966>

3 years agollvmpipe: enable GL spir-v support
Dave Airlie [Mon, 6 Jul 2020 04:55:48 +0000 (14:55 +1000)]
llvmpipe: enable GL spir-v support

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8972>

3 years agoglsl: fix leak in gl_nir_link_uniform_blocks
Dave Airlie [Thu, 11 Feb 2021 03:42:09 +0000 (13:42 +1000)]
glsl: fix leak in gl_nir_link_uniform_blocks

asan on llvmpipe with piglit tests/spec/arb_gl_spirv/execution/ssbo/array-indirect.shader_test
reported.

=================================================================
==3288325==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f5b2d6513cf in __interceptor_malloc (/lib64/libasan.so.6+0xab3cf)
    #1 0x7f5b2a1ae810 in ralloc_size ../src/util/ralloc.c:133
    #2 0x7f5b2a1ae7e1 in ralloc_context ../src/util/ralloc.c:120
    #3 0x7f5b2b210177 in gl_nir_link_uniform_blocks ../src/compiler/glsl/gl_nir_link_uniform_blocks.c:585
    #4 0x7f5b2af7f52d in gl_nir_link_spirv ../src/compiler/glsl/gl_nir_linker.c:614
    #5 0x7f5b2a3b76fa in st_link_nir ../src/mesa/state_tracker/st_glsl_to_nir.cpp:765
    #6 0x7f5b2a3ace7b in st_link_shader ../src/mesa/state_tracker/st_glsl_to_ir.cpp:65
    #7 0x7f5b2a471165 in _mesa_glsl_link_shader ../src/mesa/program/ir_to_mesa.cpp:3122
    #8 0x7f5b2a97a6d8 in link_program ../src/mesa/main/shaderapi.c:1311
    #9 0x7f5b2a97a6d8 in link_program_error ../src/mesa/main/shaderapi.c:1419
    #10 0x7f5b2a97df45 in _mesa_LinkProgram ../src/mesa/main/shaderapi.c:1911
    #11 0x7f5b299b59e5 in stub_glLinkProgram /mnt/devel/gl/piglit/tests/util/piglit-dispatch-gen.c:33956
    #12 0x40a71a in link_and_use_shaders /mnt/devel/gl/piglit/tests/shaders/shader_runner.c:1604
    #13 0x415722 in init_test /mnt/devel/gl/piglit/tests/shaders/shader_runner.c:5225
    #14 0x4164ce in piglit_init /mnt/devel/gl/piglit/tests/shaders/shader_runner.c:5597
    #15 0x7f5b29a214e9 in run_test /mnt/devel/gl/piglit/tests/util/piglit-framework-gl/piglit_winsys_framework.c:73
    #16 0x7f5b29a103fe in piglit_gl_test_run /mnt/devel/gl/piglit/tests/util/piglit-framework-gl.c:229
    #17 0x407847 in main /mnt/devel/gl/piglit/tests/shaders/shader_runner.c:72
    #18 0x7f5b2928f1e1 in __libc_start_main (/lib64/libc.so.6+0x281e1)

SUMMARY: AddressSanitizer: 48 byte(s) leaked in 1 allocation(s).

Fixes: 57239192 ("nir/linker: add gl_nir_link_uniform_blocks.c")
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8974>

3 years agozink: handle nir_intrinsic_load_helper_invocation
Mike Blumenkrantz [Thu, 20 Aug 2020 20:16:04 +0000 (16:16 -0400)]
zink: handle nir_intrinsic_load_helper_invocation

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

3 years agolavapipe: reset shader constant buffers after execution
Dave Airlie [Mon, 8 Feb 2021 07:31:36 +0000 (17:31 +1000)]
lavapipe: reset shader constant buffers after execution

Otherwise this leads to a use-after-free
dEQP-VK.synchronization.op.single_queue.fence.write_fill_buffer_read_ssbo_vertex.buffer_16384
when run after any test using a ubo in the fragment shader.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8912>

3 years agollvmpipe: fix use after free with fs variant cleanup
Dave Airlie [Mon, 8 Feb 2021 06:52:57 +0000 (16:52 +1000)]
llvmpipe: fix use after free with fs variant cleanup

item->base will be freed for the NULL reference write
so just use a temporary to avoid it.

This was found with asan and lavapipe:
dEQP-VK.api.copy_and_blit.core.blit_image*

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8912>

3 years agollvmpipe: add a mutex around debug resource tracking
Dave Airlie [Mon, 8 Feb 2021 06:10:26 +0000 (16:10 +1000)]
llvmpipe: add a mutex around debug resource tracking

The debug resource tracking triggers an asan warning, add a mutex
around it to avoid multi-thread failures with vulkan CTS test:

dEQP-VK.api.object_management.multithreaded_per_thread_device.buffer_uniform_small

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8912>

3 years agoglx: Fix GLX_SGI_video_sync for the no-current-drawable case
Adam Jackson [Mon, 16 Nov 2020 18:24:23 +0000 (13:24 -0500)]
glx: Fix GLX_SGI_video_sync for the no-current-drawable case

Starting with GL 3.0 it's legal to have no drawable bound to the current
context. GLX_SGI_video_sync doesn't take a drawable for an argument so
it implicitly operates on... something. NVIDIA's driver throws
GLX_BAD_CONTEXT for GetVideoSync, but WaitVideoSync seems to actually
wait for the next MSC on the context's screen. We could work around this
by internally creating/destroying a GLXWindow for the root window, but
for Xwayland there's not necessarily a good answer it can return.

Just throw GLX_BAD_CONTEXT for both.

Fixes: mesa/mesa#1207
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8334>

3 years agoosmesa: Pacify MSVC in the test code
Adam Jackson [Wed, 27 Jan 2021 19:23:17 +0000 (14:23 -0500)]
osmesa: Pacify MSVC in the test code

Not smart enough to think this is const, eh.

Fixes: mesa/mesa#4119
Fixes: c5c1aa7c75c05927017325829cb3f354654d0b73 ("gallium/osmesa: Fix flushing and Y-flipping of the depth buffer.")
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8936>

3 years agoiris: Call iris_sample_with_depth_aux earlier
Nanley Chery [Wed, 11 Nov 2020 16:04:53 +0000 (08:04 -0800)]
iris: Call iris_sample_with_depth_aux earlier

Instead of calling iris_sample_with_depth_aux right before a sample
operation, call it at resource creation time. Unifies the code which
ensures that it's okay to sample with HiZ.

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

3 years agoiris: Drop iris_resource::aux::has_hiz
Nanley Chery [Mon, 14 Dec 2020 19:36:29 +0000 (11:36 -0800)]
iris: Drop iris_resource::aux::has_hiz

Instead of storing a bitfield of which resource levels will be accessed
with HiZ, compute this information on-demand. Makes the iris_resource
struct more generic.

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

3 years agoiris: Don't avoid aux state getter/setter with HiZ
Nanley Chery [Wed, 16 Dec 2020 01:08:17 +0000 (17:08 -0800)]
iris: Don't avoid aux state getter/setter with HiZ

Before this commit, various functions avoided calling
iris_resource_get_aux_state and iris_resource_set_aux_state for depth
buffers which lacked full HiZ support at certain levels. This was
because:

 1. Some callers of prepare/finish neglected to use ISL_AUX_USAGE_NONE
    for the levels which lacked full HiZ support.
 2. The assertions within the getter and setter were too strict.

Now that both of these issues have been resolved, there's no obvious
reason to try to avoid these function calls. Delete the code for
avoiding them.

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

3 years agoiris: Loosen aux state getter/setter assert on HiZ
Nanley Chery [Wed, 16 Dec 2020 00:38:52 +0000 (16:38 -0800)]
iris: Loosen aux state getter/setter assert on HiZ

The aux state getter and setter currently assert
iris_resource_level_has_hiz() for depth surfaces.

This assertion is too strict however. In some cases where the assert
would fail, we can still correctly describe the aux state with the ISL
enums (using ISL_AUX_STATE_AUX_INVALID, for example).

When HiZ is enabled on a resource but disabled for a given level, allow
the getter to be called and allow the setter to set aux states that lack
compression. Enables code simplifications later on.

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

3 years agoiris: Fix aux usage of depth buffer prepare/finish
Nanley Chery [Wed, 16 Dec 2020 22:57:14 +0000 (14:57 -0800)]
iris: Fix aux usage of depth buffer prepare/finish

Prepare/finish a framebuffer's depth buffer with the aux usage that's
appropriate for the given miplevel instead of wrongly assuming that
compression is always enabled. Enables code simplifications later on.

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

3 years agoiris: Keep aux_usage in iris_blorp_surf_for_resource
Nanley Chery [Mon, 14 Dec 2020 19:10:02 +0000 (11:10 -0800)]
iris: Keep aux_usage in iris_blorp_surf_for_resource

Avoid the surprising behavior of overriding the aux usage for depth
resources.

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

3 years agoiris: Fix the depth aspect aux usage in iris_blit
Nanley Chery [Thu, 17 Dec 2020 22:41:19 +0000 (14:41 -0800)]
iris: Fix the depth aspect aux usage in iris_blit

Set dst_aux_usage to ISL_AUX_USAGE_NONE for the depth buffer blit if the
level doesn't fully support HiZ. Enables removing the code that masked
this issue later on.

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

3 years agoiris: Drop batch param from iris_resource_prepare_render
Nanley Chery [Thu, 17 Dec 2020 23:05:51 +0000 (15:05 -0800)]
iris: Drop batch param from iris_resource_prepare_render

Drop an unused parameter.

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

3 years agoiris: Delete redundant assertion in iris_hiz_exec
Nanley Chery [Tue, 15 Dec 2020 05:29:00 +0000 (21:29 -0800)]
iris: Delete redundant assertion in iris_hiz_exec

There's an iris_resource_level_has_hiz assert at the top of the
function. Also, aux surfaces are allocated in the same BO as main
surfaces.

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

3 years agoiris: Drop a stale comment about HiZ sampling
Nanley Chery [Thu, 19 Nov 2020 22:36:03 +0000 (14:36 -0800)]
iris: Drop a stale comment about HiZ sampling

With commit 7339660e80331ed773fc6dbb8295384d4ef6954e, this comment is no
longer needed.

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

3 years agoiris: Drop an XXX comment about sampling HiZ arrays
Nanley Chery [Fri, 13 Nov 2020 00:59:12 +0000 (16:59 -0800)]
iris: Drop an XXX comment about sampling HiZ arrays

Contrary to the comment, i965 doesn't disable sampling with HiZ on 2D
arrays.

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

3 years agoi965,iris: Delete misleading HiZ sampling comments
Nanley Chery [Fri, 13 Nov 2020 14:50:55 +0000 (06:50 -0800)]
i965,iris: Delete misleading HiZ sampling comments

One comment seems to suggest that MCS (which is needed for compressed
multisampling) can be used to sample from a multisampled depth buffer.
This is not the case. Multisampled depth buffers are sampled without an
auxiliary surface.

Another comment seems to suggest that some depth buffers don't have
corresponding levels in their HiZ buffers. Each main slice *should* have
a corresponding aux slice, but not all of these slices have equal
support for HiZ ops (e.g. ambiguates aren't really supported on
non-8x4-aligned slices).

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

3 years agoblorp: Assert 8x4 alignment for a HiZ op on Gen8-9
Nanley Chery [Mon, 14 Dec 2020 23:03:26 +0000 (15:03 -0800)]
blorp: Assert 8x4 alignment for a HiZ op on Gen8-9

On BDW and SKL, assert that render target dimensions are 8x4-aligned
when performing HiZ ambiguates on LOD1+. Testing indicates that the
assertion should hold in order to achieve consistent/correct ambiguate
operations on gen9.

v2. Account for the relaxed restrictions on ICL+. (Ken)

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

3 years agozink: Factor out instance setup a bit more
Adam Jackson [Wed, 16 Dec 2020 22:44:50 +0000 (17:44 -0500)]
zink: Factor out instance setup a bit more

The VkInstance is really display state not screen state, as is the
loader version. Factor this out a bit further so that
zink_create_instance fills in a zink_instance_info. The latter struct
still lives in the zink_screen for now but that'll move soon.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8968>

3 years agozink: use better mapping for PIPE_FORMAT_X24S8_UINT
Mike Blumenkrantz [Wed, 10 Feb 2021 14:47:57 +0000 (09:47 -0500)]
zink: use better mapping for PIPE_FORMAT_X24S8_UINT

this needs to be unconditionally supported in some way, and it also
needs to use a more compatible fallback format if the base format is unavailable

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8959>

3 years agolavapipe: report correct value for minMemoryMapAlignment
Erik Faye-Lund [Wed, 10 Feb 2021 17:07:39 +0000 (18:07 +0100)]
lavapipe: report correct value for minMemoryMapAlignment

The vulkan spec says the following about vkMapMemory:

"ppData is a pointer to a void * variable in which is returned a
 host-accessible pointer to the beginning of the mapped range. This
 pointer minus offset must be aligned to at least
 VkPhysicalDeviceLimits::minMemoryMapAlignment."

So let's report the same value as the gallium-driver reports, otherwise
we'll fail to adhere to the alignment requirement.

This fixes a few Piglit failures for Zink.

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

3 years agozink: Fix win32 build
Michel Zou [Wed, 10 Feb 2021 13:27:52 +0000 (14:27 +0100)]
zink: Fix win32 build

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8957>

3 years agopan/bi: Fix 2-write pseudo op scheduling
Alyssa Rosenzweig [Wed, 10 Feb 2021 00:46:40 +0000 (19:46 -0500)]
pan/bi: Fix 2-write pseudo op scheduling

These cannot schedule to the last tuple, there needs to be other work in
the last clause, or a tuple of NOP's failing that. Can occur depending
on scheduling of CUBEFACE instructions, and will apply to computational
atomics in the near future.

Fixes: 77933d16d8c ("pan/bi: Switch to new scheduler")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8962>

3 years agopan/bi: Fix 'last tuple' for terminal-NOP clauses
Alyssa Rosenzweig [Wed, 10 Feb 2021 00:45:03 +0000 (19:45 -0500)]
pan/bi: Fix 'last tuple' for terminal-NOP clauses

This incorrectly assumed the last tuple was nontrivial, an invariant
that holds by accident on the current scheduler but will break
momentarily. Fix this, and document the invariants.

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

3 years agovulkan: Fix windows api conflict
Michel Zou [Wed, 10 Feb 2021 13:25:38 +0000 (14:25 +0100)]
vulkan: Fix windows api conflict

Closes #4247

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

3 years agoci: run piglit on zink with lavapipe
Erik Faye-Lund [Wed, 2 Dec 2020 20:28:19 +0000 (21:28 +0100)]
ci: run piglit on zink with lavapipe

Now that we can run on top of Lavapipe, we can finally start testing
Piglit on top of Zink in CI, yay!

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8879>

3 years agoci: make sure all lava-builders have libvulkan
Erik Faye-Lund [Tue, 9 Feb 2021 17:28:17 +0000 (18:28 +0100)]
ci: make sure all lava-builders have libvulkan

In the next commit, we'll start building Zink in the meson-testing step,
and because mega-drivers end up stuffing all dependencies in the same
shared-object, we end up requiring libvulkan for other drivers as well.

So let's no longer track separately who needs vulkan and who doesn't,
and just always install it.

Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8879>

3 years agogallium/u_upload_mgr: lower risk of hitting an assert
Pierre-Eric Pelloux-Prayer [Fri, 5 Feb 2021 14:31:19 +0000 (15:31 +0100)]
gallium/u_upload_mgr: lower risk of hitting an assert

The assert(size < INT32_MAX / 2) can be triggered by large uploads.

Since we know that the caller of u_upload_alloc_buffer will consume
min_size bytes, we can init buffer_private_refcount to a much smaller
value.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Fixes: ccf9ef36285 ("gallium/u_upload_mgr: eliminate all atomics for the upload buffer")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4235
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8880>

3 years agozink: handle null xfb buffers
Mike Blumenkrantz [Fri, 14 Aug 2020 21:38:44 +0000 (17:38 -0400)]
zink: handle null xfb buffers

ARB_enhanced_layouts allows specifying explicit locations for xfb buffers,
which means we get arrays of buffers with gaps in the middle sometimes and
have to throw in a null handle

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8943>

3 years agozink: create dummy xfb buffer
Mike Blumenkrantz [Fri, 9 Oct 2020 15:13:57 +0000 (11:13 -0400)]
zink: create dummy xfb buffer

xfb spec disallows binding a null buffer, so we need something to throw in

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8943>

3 years agozink: rename zink_context::dummy_buffer -> dummy_vertex_buffer
Mike Blumenkrantz [Fri, 9 Oct 2020 15:11:43 +0000 (11:11 -0400)]
zink: rename zink_context::dummy_buffer -> dummy_vertex_buffer

this is a bit more specific

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8943>

3 years agoanv: print out perf permission warning only once
Lionel Landwerlin [Wed, 10 Feb 2021 10:25:49 +0000 (12:25 +0200)]
anv: print out perf permission warning only once

This warning is bothering a number of people and rightfully so.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8955>

3 years agozink: enable PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT
Mike Blumenkrantz [Thu, 13 Aug 2020 14:55:13 +0000 (10:55 -0400)]
zink: enable PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8942>

3 years agozink: flush all resources with persistent maps on work batch before draw/compute
Mike Blumenkrantz [Thu, 13 Aug 2020 14:54:25 +0000 (10:54 -0400)]
zink: flush all resources with persistent maps on work batch before draw/compute

these require explicit memory sync on our part

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8942>

3 years agozink: slightly refactor batch resource referencing in update_descriptors()
Mike Blumenkrantz [Mon, 21 Sep 2020 13:16:33 +0000 (09:16 -0400)]
zink: slightly refactor batch resource referencing in update_descriptors()

this is easier to debug

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8942>

3 years agozink: track persistent, non-coherent, writable transfer map count for resources
Mike Blumenkrantz [Thu, 13 Aug 2020 14:53:25 +0000 (10:53 -0400)]
zink: track persistent, non-coherent, writable transfer map count for resources

these require explicit memory flushes before being submitted to a batch

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8942>

3 years agozink: set HOST_COHERENT bit for coherent resource creation
Mike Blumenkrantz [Thu, 13 Aug 2020 14:24:46 +0000 (10:24 -0400)]
zink: set HOST_COHERENT bit for coherent resource creation

this allows memory to be mapped during draws without requiring a flush

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8942>

3 years agozink: use = and not |= for VkMemoryPropertyFlags during resource creation
Mike Blumenkrantz [Thu, 13 Aug 2020 14:23:24 +0000 (10:23 -0400)]
zink: use = and not |= for VkMemoryPropertyFlags during resource creation

the previous value of this isn't used, so be explicit here

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8942>