platform/upstream/mesa.git
10 months agonir: Remove nir_ssa_for_src
Alyssa Rosenzweig [Fri, 15 Sep 2023 15:11:04 +0000 (11:11 -0400)]
nir: Remove nir_ssa_for_src

It is now unused and has no real use cases now that nir_register is gone.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25247>

10 months agotreewide: Remove remaining nir_ssa_for_src
Alyssa Rosenzweig [Fri, 15 Sep 2023 15:05:15 +0000 (11:05 -0400)]
treewide: Remove remaining nir_ssa_for_src

Coccinelle missed these, a few manual changes here.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25247>

10 months agotreewide: Drop nir_ssa_for_src users
Alyssa Rosenzweig [Fri, 15 Sep 2023 14:57:20 +0000 (10:57 -0400)]
treewide: Drop nir_ssa_for_src users

Via Coccinelle patch:

    @@
    expression b, s, n;
    @@

    -nir_ssa_for_src(b, *s, n)
    +s->ssa

    @@
    expression b, s, n;
    @@

    -nir_ssa_for_src(b, s, n)
    +s.ssa

Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25247>

10 months agoagx: Enable sinking ALU
Alyssa Rosenzweig [Sat, 2 Sep 2023 13:26:41 +0000 (09:26 -0400)]
agx: Enable sinking ALU

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/opt_sink: Also consider load_preamble as const
Alyssa Rosenzweig [Sun, 27 Aug 2023 21:38:02 +0000 (17:38 -0400)]
nir/opt_sink: Also consider load_preamble as const

Acts like constants, schedule them like constants. This lets us move lowered
frag coord code down. Results on dolphin ubers:

   total instructions in shared programs: 195144 -> 196633 (0.76%)
   instructions in affected programs: 175737 -> 177226 (0.85%)
   helped: 28
   HURT: 27
   Instructions are HURT.

   total bytes in shared programs: 1379980 -> 1388308 (0.60%)
   bytes in affected programs: 1244250 -> 1252578 (0.67%)
   helped: 28
   HURT: 27
   Bytes are HURT.

   total halfregs in shared programs: 13591 -> 13557 (-0.25%)
   halfregs in affected programs: 2176 -> 2142 (-1.56%)
   helped: 12
   HURT: 2
   Inconclusive result (%-change mean confidence interval includes 0).

   total threads in shared programs: 233728 -> 234112 (0.16%)
   threads in affected programs: 3264 -> 3648 (11.76%)
   helped: 6
   HURT: 0
   Threads are helped.

Results on Android shader-db:

   total instructions in shared programs: 1775324 -> 1775912 (0.03%)
   instructions in affected programs: 155305 -> 155893 (0.38%)
   helped: 353
   HURT: 548
   Instructions are HURT.

   total bytes in shared programs: 11676650 -> 11678454 (0.02%)
   bytes in affected programs: 1058924 -> 1060728 (0.17%)
   helped: 370
   HURT: 547
   Inconclusive result (value mean confidence interval includes 0).

   total halfregs in shared programs: 484143 -> 471212 (-2.67%)
   halfregs in affected programs: 98833 -> 85902 (-13.08%)
   helped: 2478
   HURT: 674
   Halfregs are helped.

Instr count changes due to losing the RA lottery.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/opt_sink: Move ALU with constant sources
Alyssa Rosenzweig [Sun, 20 Aug 2023 16:19:55 +0000 (12:19 -0400)]
nir/opt_sink: Move ALU with constant sources

In general, sinking ALU instructions can negatively impact register pressure,
since it extends the live ranges of the sources, although it does shrink the live range
of the destination.

However, constants do not usually contribute to register pressure. This is not a
totally true assumption, but it's pretty good in practice, since...

* constants can be rematerialized (backend-dependent)
* constants can often be inlined (ISA-dependent)
* constants can sometimes be promoted to free uniform registers (ISA-dependent)
* constants can live in scalar registers although the ALU destination might need
  a vector register (and vector registers are assumed to be much more expensive
  than scalar registers, again ISA-dependent)

So, assume that constants have zero effect on register pressure. Now consider an
ALU instruction where all but one source is a constant. Then there are two
cases:

1. The ALU instruction is moved past when its source was otherwise killed. Then
   there is no effect on register pressure, since the source live range is
   extended exactly as much as the destination live range shrinks.

2. The ALU instruction is moved down but its source is still alive where it's
   moved to. Then register pressure is improved, since the source live range is
   unchanged while the destination live range shrinks.

So, as a heuristic, we always move ALU instructions where n-1 sources are
constant. As an inevitable special case, this also (necessarily) moves unary ALU
ops, which should be beneficial by the same justification. This is not 100%
perfect but it is well-motivated. Results on AGX are decent:

   total instructions in shared programs: 1796101 -> 1795652 (-0.02%)
   instructions in affected programs: 326822 -> 326373 (-0.14%)
   helped: 800
   HURT: 371
   Inconclusive result (%-change mean confidence interval includes 0).

   total bytes in shared programs: 11805004 -> 11801424 (-0.03%)
   bytes in affected programs: 2610630 -> 2607050 (-0.14%)
   helped: 912
   HURT: 462
   Inconclusive result (%-change mean confidence interval includes 0).

   total halfregs in shared programs: 525818 -> 515399 (-1.98%)
   halfregs in affected programs: 118197 -> 107778 (-8.81%)
   helped: 2095
   HURT: 804
   Halfregs are helped.

   total threads in shared programs: 18916608 -> 18917056 (<.01%)
   threads in affected programs: 4800 -> 5248 (9.33%)
   helped: 7
   HURT: 0
   Threads are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/opt_sink: Do not move derivatives
Alyssa Rosenzweig [Thu, 24 Aug 2023 11:14:28 +0000 (07:14 -0400)]
nir/opt_sink: Do not move derivatives

At the moment, this does nothing. It will prevent problems from the next patch,
however.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/opt_sink: Sink frag coord instructions
Alyssa Rosenzweig [Sun, 20 Aug 2023 16:55:02 +0000 (12:55 -0400)]
nir/opt_sink: Sink frag coord instructions

load_input-like. ubershaders:

   instructions in affected programs: 72392 -> 72522 (0.18%)
   helped: 8
   HURT: 18
   Inconclusive result (value mean confidence interval includes 0).

   total bytes in shared programs: 1468550 -> 1469170 (0.04%)
   bytes in affected programs: 560486 -> 561106 (0.11%)
   helped: 10
   HURT: 17
   Inconclusive result (value mean confidence interval includes 0).

   total halfregs in shared programs: 13946 -> 13898 (-0.34%)
   halfregs in affected programs: 3642 -> 3594 (-1.32%)
   helped: 21
   HURT: 0
   Halfregs are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/opt_sink: Sink load_local_pixel_agx
Alyssa Rosenzweig [Sun, 20 Aug 2023 16:51:02 +0000 (12:51 -0400)]
nir/opt_sink: Sink load_local_pixel_agx

This is the AGX version of load_output, which shaders can use for framebuffer
fetch. It is beneficial to sink framebuffer fetch as late as possible, both to
reduce register pressure but also to reduce serialization of overlapping
fragments.

Results on a collection of ubershaders:

   total bytes in shared programs: 1468928 -> 1468550 (-0.03%)
   bytes in affected programs: 495300 -> 494922 (-0.08%)
   helped: 24
   HURT: 0
   Bytes are helped.

   total halfregs in shared programs: 14162 -> 13946 (-1.53%)
   halfregs in affected programs: 5148 -> 4932 (-4.20%)
   helped: 27
   HURT: 0
   Halfregs are helped.

   total threads in shared programs: 216896 -> 217664 (0.35%)
   threads in affected programs: 6912 -> 7680 (11.11%)
   helped: 12
   HURT: 0
   Threads are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/opt_sink: Sink load_constant_agx
Alyssa Rosenzweig [Sat, 19 Aug 2023 23:49:09 +0000 (19:49 -0400)]
nir/opt_sink: Sink load_constant_agx

By the time this runs, we will have already lowered load_ubo and load_vbo to
load_constant_agx so we need to handle the backend version.

This is very important for reducing register pressure in monolithic VS+GS
shaders on AGX. Since no other backend has _agx intrinsics, there's no need for
an option to gate this.

The additional instruction count is from more frequent wait instructions due to
fewer instructions grouped together. This should be mitigated in the future with
an ACO-style latency-reducing scheduler in the backend, after register pressure
is reduced by opt_sink.

total instructions in shared programs: 1793385 -> 1796101 (0.15%)
instructions in affected programs: 199816 -> 202532 (1.36%)
helped: 3
HURT: 941
Instructions are HURT.

total bytes in shared programs: 11799628 -> 11805004 (0.05%)
bytes in affected programs: 1345656 -> 1351032 (0.40%)
helped: 34
HURT: 919
Bytes are HURT.

total halfregs in shared programs: 533151 -> 525818 (-1.38%)
halfregs in affected programs: 40335 -> 33002 (-18.18%)
helped: 613
HURT: 42
Halfregs are helped.

total threads in shared programs: 18910464 -> 18916608 (0.03%)
threads in affected programs: 6144 -> 12288 (100.00%)
helped: 12
HURT: 0
Threads are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/gather_info: Use nir_op_is_derivative
Alyssa Rosenzweig [Thu, 24 Aug 2023 11:10:03 +0000 (07:10 -0400)]
nir/gather_info: Use nir_op_is_derivative

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/opt_gcm: Use nir_op_is_derivative more
Alyssa Rosenzweig [Thu, 24 Aug 2023 11:08:34 +0000 (07:08 -0400)]
nir/opt_gcm: Use nir_op_is_derivative more

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir/opt_preamble: Use nir_op_is_derivative
Alyssa Rosenzweig [Thu, 24 Aug 2023 11:06:44 +0000 (07:06 -0400)]
nir/opt_preamble: Use nir_op_is_derivative

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir: Hoist nir_op_is_derivative
Alyssa Rosenzweig [Thu, 24 Aug 2023 11:05:53 +0000 (07:05 -0400)]
nir: Hoist nir_op_is_derivative

Redefine in terms of the algebraic property. This correctly handles the
Mali-specific derivatives.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agonir: Add NIR_OP_IS_DERIVATIVE property
Alyssa Rosenzweig [Thu, 24 Aug 2023 11:04:20 +0000 (07:04 -0400)]
nir: Add NIR_OP_IS_DERIVATIVE property

Like IS_SELECTION.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>

10 months agoradv: disable mesh dispatch XYZ_DIM when possible
Rhys Perry [Tue, 12 Sep 2023 14:02:08 +0000 (15:02 +0100)]
radv: disable mesh dispatch XYZ_DIM when possible

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25222>

10 months agoaco: remove unused p_logical_end check when optimizing branching sequence
Rhys Perry [Fri, 15 Sep 2023 11:06:48 +0000 (12:06 +0100)]
aco: remove unused p_logical_end check when optimizing branching sequence

I don't see why a p_logical_end is expected or required. It might not be
present in some situations, which causes an assertion failure:
 s2: %19646:s[0-1] = p_reload %19701:v[8], 11
 s2: %0:exec,  s1: %8817:scc = s_andn2_b64 %19646:s[0-1], %0:exec
 s2: %8818:s[20-21] = p_cbranch_z %0:exec BB1116, BB1114

No fossil-db changes (gfx1100).

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

10 months agoaco: check logical_phi_info at p_logical_end when eliminating exec writes
Rhys Perry [Fri, 15 Sep 2023 11:05:34 +0000 (12:05 +0100)]
aco: check logical_phi_info at p_logical_end when eliminating exec writes

This is when the copies actually happen, not at the branch.

fossil-db (gfx1100):
Totals from 1 (0.00% of 79332) affected shaders:
Instrs: 424 -> 423 (-0.24%)
CodeSize: 2172 -> 2168 (-0.18%)
Latency: 2899 -> 2896 (-0.10%)
Copies: 24 -> 23 (-4.17%)

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

10 months agomeson: Update libarchive to v3.7.2-2
Mark Collins [Mon, 18 Sep 2023 07:31:39 +0000 (07:31 +0000)]
meson: Update libarchive to v3.7.2-2

The wrapdb build script used by v3.7.1-2 would lead to compilation
errors when using glibc which gated id_t's definition behind the
_GNU_SOURCE define which wasn't specified while scanning for types,
this was fixed upstream in wrapdb in v3.7.2-2.

Signed-off-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25269>

10 months agoaco/optimizer_postRA: check overwritten_subdword in is_overwritten_since()
Rhys Perry [Thu, 14 Sep 2023 13:22:29 +0000 (14:22 +0100)]
aco/optimizer_postRA: check overwritten_subdword in is_overwritten_since()

Fixes crash for
dEQP-VK.mesh_shader.ext.in_out.with_f16.permutation_0.mesh_only and
similar tests on GFX11.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Fixes: 3d29779a25a9 ("aco/optimizer_postRA: Distinguish overwritten untrackable and subdword.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25223>

10 months agofreedreno/replay: Fix implicit-function-declaration error
Vinson Lee [Sun, 17 Sep 2023 03:53:52 +0000 (20:53 -0700)]
freedreno/replay: Fix implicit-function-declaration error

../src/freedreno/decode/replay.c: In function ‘safe_ioctl’:
../src/freedreno/decode/replay.c:608:13: error: implicit declaration of function ‘ioctl’ [-Werror=implicit-function-declaration]
  608 |       ret = ioctl(fd, request, arg);
      |             ^~~~~

Fixes: e3bbd1688b8 ("freedreno/replay: Add limited support for KGSL")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25264>

10 months agost/mesa: check renderbuffer before using it
Pierre-Eric Pelloux-Prayer [Wed, 13 Sep 2023 14:28:12 +0000 (16:28 +0200)]
st/mesa: check renderbuffer before using it

rb being NULL is only checked for in the caller if no-error isn't
used.

cc: mesa-stable

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

10 months agodevice_select: add shortcut for MESA_VK_DEVICE_SELECT_FORCE_DEFAULT_DEVICE
Pierre-Eric Pelloux-Prayer [Thu, 17 Aug 2023 10:41:42 +0000 (12:41 +0200)]
device_select: add shortcut for MESA_VK_DEVICE_SELECT_FORCE_DEFAULT_DEVICE

MESA_VK_DEVICE_SELECT_FORCE_DEFAULT_DEVICE=1 is useful but it's tedious
to type. This commit extends slightly DRI_PRIME/MESA_VK_DEVICE_SELECT
syntax support: if "!" is appended at the end then only the selected GPU
will be made visible to the application.

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

10 months agodocs: update DRI_PRIME documentation
Pierre-Eric Pelloux-Prayer [Thu, 12 Jan 2023 13:07:08 +0000 (14:07 +0100)]
docs: update DRI_PRIME documentation

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

10 months agodevice_select_layer: support DRI_PRIME=n
Pierre-Eric Pelloux-Prayer [Thu, 12 Jan 2023 12:58:16 +0000 (13:58 +0100)]
device_select_layer: support DRI_PRIME=n

For feature-parity with OpenGL.
See commit "loader: extend DRI_PRIME to support =N".

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

10 months agoloader: add DRI_PRIME_DEBUG env var
Pierre-Eric Pelloux-Prayer [Thu, 12 Jan 2023 12:37:53 +0000 (13:37 +0100)]
loader: add DRI_PRIME_DEBUG env var

This makes debugging non-working DRI_PRIME selection much easier.

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

10 months agoloader: extend DRI_PRIME to support =N
Pierre-Eric Pelloux-Prayer [Thu, 12 Jan 2023 12:34:39 +0000 (13:34 +0100)]
loader: extend DRI_PRIME to support =N

DRI_PRIME=1 isn't useful on machines with more than 2 GPUs.

This commit adds support to DRI_PRIME=N syntax meaning: select
the Nth GPU (not counting the default GPU).

So on a 3 GPUs system where drmGetDevices2 returns the following:

   /dev/dri/renderD130 [default]
   /dev/dri/renderD129
   /dev/dri/renderD128

DRI_PRIME=1 would select D129 (as is already the case without this
commit), DRI_PRIME=2 would select D128.

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

10 months agoloader: refactor DRI_PRIME handling code
Pierre-Eric Pelloux-Prayer [Thu, 12 Jan 2023 12:30:05 +0000 (13:30 +0100)]
loader: refactor DRI_PRIME handling code

DRI_PRIME has 3 different meanings and this refactoring
separate the handling of them.
No functional changes.

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

10 months agoglx: drop the 'libGL' log prefix
Pierre-Eric Pelloux-Prayer [Fri, 18 Aug 2023 10:46:41 +0000 (12:46 +0200)]
glx: drop the 'libGL' log prefix

Suggested by @ajax in !24750.

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

10 months agoac/spm: enable support for multi-instance counters
Samuel Pitoiset [Thu, 14 Sep 2023 16:28:31 +0000 (18:28 +0200)]
ac/spm: enable support for multi-instance counters

This is what RGP expects and this will give us more fine grained
results given that all shader engines/shader arrays etc would be
sampled.

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

10 months agoac/spm: move the counter instance to ac_spm_counter_create_info
Samuel Pitoiset [Thu, 14 Sep 2023 12:23:01 +0000 (14:23 +0200)]
ac/spm: move the counter instance to ac_spm_counter_create_info

This will allow us to configure multi-instance counters.

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

10 months agoac,radv,radeonsi: prepare support for multi-instance SPM generic counters
Samuel Pitoiset [Thu, 14 Sep 2023 15:39:00 +0000 (17:39 +0200)]
ac,radv,radeonsi: prepare support for multi-instance SPM generic counters

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

10 months agoac,radv,radeonsi: prepare support for multi-instance SPM SQ counters
Samuel Pitoiset [Thu, 14 Sep 2023 14:02:14 +0000 (16:02 +0200)]
ac,radv,radeonsi: prepare support for multi-instance SPM SQ counters

Each SQG modules can configure up to 16 counters.

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

10 months agoac/spm: fix number of instances of GL2C
Samuel Pitoiset [Thu, 14 Sep 2023 15:19:37 +0000 (17:19 +0200)]
ac/spm: fix number of instances of GL2C

It's a global block, so the number of instances is equal.

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

10 months agoradv,radeonsi: make sure to emit GRBM_GFX_INDEX before SQ select registers
Samuel Pitoiset [Thu, 14 Sep 2023 13:49:05 +0000 (15:49 +0200)]
radv,radeonsi: make sure to emit GRBM_GFX_INDEX before SQ select registers

This was missing, but not sure if it was required given that only the
first SE is currently sampled.

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

10 months agoac/spm: select correct segment type for per-SE blocks
Samuel Pitoiset [Thu, 14 Sep 2023 11:43:53 +0000 (13:43 +0200)]
ac/spm: select correct segment type for per-SE blocks

This currently does nothing because only the first instance is used,
but this will be needed for multi-instance.

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

10 months agoac/spm: use block flags to initialize instance mapping
Samuel Pitoiset [Thu, 14 Sep 2023 11:42:25 +0000 (13:42 +0200)]
ac/spm: use block flags to initialize instance mapping

This simplify this a bit, ideally we would also have a per-SA flag
for performance counters.

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

10 months agoradv: reserve more CS space in SQTT/SPM paths
Samuel Pitoiset [Thu, 14 Sep 2023 17:00:05 +0000 (19:00 +0200)]
radv: reserve more CS space in SQTT/SPM paths

This will prevent an assertion when SPM will emit more counters.

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

10 months agocompiler/types: Use a string table for builtin type names
Caio Oliveira [Tue, 12 Sep 2023 20:43:09 +0000 (13:43 -0700)]
compiler/types: Use a string table for builtin type names

This avoids the relocations for each of the builtin type names, allowing
all the builtin data to be loaded in read-only memory.

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

10 months agocompiler/types: Change glsl_type::name to be an uintptr_t
Caio Oliveira [Tue, 12 Sep 2023 19:12:33 +0000 (12:12 -0700)]
compiler/types: Change glsl_type::name to be an uintptr_t

This will allow us later to store builtin names in a different way.

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

10 months agocompiler/types: Use glsl_get_type_name() to access the type name
Caio Oliveira [Tue, 12 Sep 2023 19:11:18 +0000 (12:11 -0700)]
compiler/types: Use glsl_get_type_name() to access the type name

This will allow us later to store builtin names in a different way.

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

10 months agocompiler/types: Use Python to generate code for builtin types
Caio Oliveira [Tue, 12 Sep 2023 17:33:42 +0000 (10:33 -0700)]
compiler/types: Use Python to generate code for builtin types

Will be useful later to generate string tables for the builtin types.

Note we make some extra effort to ensure C++ client code doesn't need to change,
by keeping glsl_type::*_type pointers around.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com> (Python and Meson changes)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25191>

10 months agor600/sfn: get rid of the method to get the index mode
Gert Wollny [Fri, 15 Sep 2023 19:13:50 +0000 (21:13 +0200)]
r600/sfn: get rid of the method to get the index mode

Since we always split the index load we can query the value directly
without checking whether it was lowered.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25159>

10 months agor600/sfn: Sepeate resource and sampler in texture instructions
Gert Wollny [Fri, 15 Sep 2023 19:12:30 +0000 (21:12 +0200)]
r600/sfn: Sepeate resource and sampler in texture instructions

Fix the use of resource and sampler and keep separate index registers
for both so that indirect resource and sampler access can be done
independently.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25159>

10 months agor600/sfn: Add old address to update_indirect_addr
Gert Wollny [Fri, 15 Sep 2023 19:02:10 +0000 (21:02 +0200)]
r600/sfn: Add old address to update_indirect_addr

v2: use UNUSED instead of adding (void)var; (Vitaly Kuzmin)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25159>

10 months agor600/sfn: rename method resource_base to resource_id
Gert Wollny [Fri, 15 Sep 2023 18:45:58 +0000 (20:45 +0200)]
r600/sfn: rename method resource_base to resource_id

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25159>

10 months agor600/sfn: Make address split pass obligatory
Gert Wollny [Fri, 15 Sep 2023 18:41:56 +0000 (20:41 +0200)]
r600/sfn: Make address split pass obligatory

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25159>

10 months agor600: print texture resource index mode separately
Gert Wollny [Mon, 11 Sep 2023 14:25:58 +0000 (16:25 +0200)]
r600: print texture resource index mode separately

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25159>

10 months agointel/common: Add sse2_args for 32-bit build when -Dsse2=false was set
Jordan Justen [Fri, 15 Sep 2023 17:00:51 +0000 (10:00 -0700)]
intel/common: Add sse2_args for 32-bit build when -Dsse2=false was set

Fixes: 543a707b7b8 ("intel/common: Move intel_clflush.h to intel_mem.h/intel_mem.c")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9762
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25249>

10 months agovulkan/android: improve vkQueueSignalReleaseImageANDROID
Yiwei Zhang [Sun, 10 Sep 2023 00:10:44 +0000 (17:10 -0700)]
vulkan/android: improve vkQueueSignalReleaseImageANDROID

There're two issues with the current implementation:
1. Wait semaphores are implicitly required to be SYNC_FD exportable
2. As a queue command that can further record cmds against the wsi
   image, it currently doesn't account for pending cmds in the queue
   beyond the wait semaphores.

This change fixes both by doing a queue submission in the call with a
SYNC_FD external signal semaphore. However, due to Android wsi not
exposing swapchain to icd, we have to cache the signal semaphore in the
queue, otherwise would have to create/destroy in each present.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25185>

10 months agovulkan: remove a dup entry from vk_image_usage_to_ahb_usage
Yiwei Zhang [Sat, 26 Aug 2023 19:54:47 +0000 (12:54 -0700)]
vulkan: remove a dup entry from vk_image_usage_to_ahb_usage

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25185>

10 months agoAndroid.mk: Only link LLVM for radeonsi, not amd_vk
Samuel Holland [Tue, 20 Jun 2023 19:32:07 +0000 (12:32 -0700)]
Android.mk: Only link LLVM for radeonsi, not amd_vk

When building for Android, avoid the LLVM dependency if possible.

Cc: mesa-stable
Acked-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: Idda03f954b4b5326e23a848e541411b60fcef063
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24007>

10 months agoAndroid.mk: Explicitly enable/disable LLVM support
Samuel Holland [Tue, 20 Jun 2023 19:27:12 +0000 (12:27 -0700)]
Android.mk: Explicitly enable/disable LLVM support

The AMD Vulkan driver uses LLVM by default, but it is possible to build
the driver without the LLVM dependency. In this case, we must explicitly
disable LLVM support, or else meson will die after failing to find LLVM.

The Android build system already knows when to link libLLVM, so forward
that information to meson.

Cc: mesa-stable
Acked-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: I7489d3811625b390aaaf2e84e666b4a8d98328b0
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24007>

10 months agoAndroid.mk: Allow building only Vulkan drivers
Samuel Holland [Tue, 20 Jun 2023 19:24:33 +0000 (12:24 -0700)]
Android.mk: Allow building only Vulkan drivers

Android bundles ANGLE for implementing OpenGL ES and EGL on top of
Vulkan. When using ANGLE, mesa is only needed for its Vulkan drivers.

Cc: mesa-stable
Acked-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: I034a0af52f9216bc5f1322f584bc591c90222327
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24007>

10 months agomeson: use a single dependency call for lua
Dylan Baker [Fri, 15 Sep 2023 17:24:43 +0000 (10:24 -0700)]
meson: use a single dependency call for lua

This is a newer Meson construct that allows passing multiple names for
the same dependency to one call. One advantage of this is that if the
first call (lua54) fails, it won't immediately fall back to a subproject
and will try the others before falling back.

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

10 months agoci/zink: drop redundant `MESA_LOADER_DRIVER_OVERRIDE: zink`
Eric Engestrom [Fri, 15 Sep 2023 16:02:35 +0000 (17:02 +0100)]
ci/zink: drop redundant `MESA_LOADER_DRIVER_OVERRIDE: zink`

This job extends `.zink-anv-test` and `.zink-trace-test`, both of which
extend `.zink-test` which already sets this var.

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

10 months agomesa: some cleanups for texparam extension checks
Tapani Pälli [Wed, 13 Sep 2023 06:30:58 +0000 (09:30 +0300)]
mesa: some cleanups for texparam extension checks

Patch removes some redudant _mesa_is_desktop_gl checks, these
extensions are available only in desktop context.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25202>

10 months agoRevert "ci: disable lima LAVA lab for maintance"
Erico Nunes [Fri, 15 Sep 2023 09:50:46 +0000 (11:50 +0200)]
Revert "ci: disable lima LAVA lab for maintance"

This reverts commit 079604e41efe001ab560fa68850f54475589f801.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25242>

10 months agoci/farm-rules: re-add "run every container and build job when a farm gets re-enabled"
Eric Engestrom [Fri, 15 Sep 2023 11:09:43 +0000 (12:09 +0100)]
ci/farm-rules: re-add "run every container and build job when a farm gets re-enabled"

Turns out I was right the first time, I was just missing that this
should only be done in MRs, which @daniels added in 16527f6ffd0129f2f6e1.

Without this, a "farm re-enable" pipeline will run all the jobs for that
farm, but will have none of the container & build jobs to support these
tests.

This reverts commit 1c3097225a4af294720e111eab3f58d590b85c8c.

Fixes: 1c3097225a4af294720e ("ci: don't run everything just because a farm gets re-enabled")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25243>

10 months agoci/farm-rules: rename .disable-farm-mr-rules to make it clear it's only about MRs
Eric Engestrom [Fri, 15 Sep 2023 11:03:54 +0000 (12:03 +0100)]
ci/farm-rules: rename .disable-farm-mr-rules to make it clear it's only about MRs

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

10 months agofreedreno/decode: Fix printing chip-id
Rob Clark [Thu, 14 Sep 2023 21:46:26 +0000 (14:46 -0700)]
freedreno/decode: Fix printing chip-id

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

10 months agofreedreno/layout: Handle 565/etc MSAA special case
Rob Clark [Thu, 14 Sep 2023 19:40:23 +0000 (12:40 -0700)]
freedreno/layout: Handle 565/etc MSAA special case

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

10 months agofreedreno: Fix crash with debug msgs enabled
Rob Clark [Thu, 14 Sep 2023 19:34:19 +0000 (12:34 -0700)]
freedreno: Fix crash with debug msgs enabled

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

10 months agozink: use null attachments for null attachments with dynamic render
Mike Blumenkrantz [Wed, 13 Sep 2023 10:55:22 +0000 (06:55 -0400)]
zink: use null attachments for null attachments with dynamic render

using dummy surfaces here is dumb

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

10 months agozink: propagate rp_tc_info_updated across unordered blits
Mike Blumenkrantz [Mon, 11 Sep 2023 15:30:35 +0000 (11:30 -0400)]
zink: propagate rp_tc_info_updated across unordered blits

this otherwise breaks rp optimizing

Fixes: 3a9f7d70383 ("zink: implement unordered u_blitter calls")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25121>

10 months agozink: use much bigger dummy surfaces
Mike Blumenkrantz [Fri, 8 Sep 2023 14:13:19 +0000 (10:13 -0400)]
zink: use much bigger dummy surfaces

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

10 months agotu: handle unused color attachments without crashing
Mike Blumenkrantz [Fri, 15 Sep 2023 13:29:49 +0000 (09:29 -0400)]
tu: handle unused color attachments without crashing

if the format is not set then this attachment must be ignored

Fixes: 97da0a77341 ("tu: Rewrite to use common Vulkan dynamic state")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25121>

10 months agolavapipe: EXT_load_store_op_none
Mike Blumenkrantz [Wed, 13 Sep 2023 17:18:56 +0000 (13:18 -0400)]
lavapipe: EXT_load_store_op_none

free real estate

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25213>

10 months agotu: Actually emit patchpoint for viewports with FDM
Connor Abbott [Thu, 14 Sep 2023 14:18:57 +0000 (16:18 +0200)]
tu: Actually emit patchpoint for viewports with FDM

At some point I intended to track whether the pipeline had FDM enabled
and set a dirty flag, but I realized that wasn't necessary. However I
forgot to remove the useless tu_cmd_state::pipeline_has_fdm and the
viewport/scissor emission code was still using it. Fix that.

Fixes: 97da0a77341 ("tu: Rewrite to use common Vulkan dynamic state")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25225>

10 months agotu: Fix assert in FDM state emission
Connor Abbott [Thu, 14 Sep 2023 14:24:22 +0000 (16:24 +0200)]
tu: Fix assert in FDM state emission

Making the sub_cs not writeable switches the BO we're emitting to, which
causes an assert failure in tu_cs_end_sub_stream() because it looks like
we have a mismatched start/end. Just make it not writeable later.

Fixes: 97da0a77341 ("tu: Rewrite to use common Vulkan dynamic state")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25225>

10 months agotu: Fix tu6_emit_*_fdm size call
Connor Abbott [Thu, 14 Sep 2023 14:23:16 +0000 (16:23 +0200)]
tu: Fix tu6_emit_*_fdm size call

cs is not initialized until the line after this.

Fixes: 95104707f18 ("tu: Basic a7xx support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25225>

10 months agotu: Fix per-view viewport state propagation
Connor Abbott [Wed, 6 Sep 2023 16:57:01 +0000 (18:57 +0200)]
tu: Fix per-view viewport state propagation

We no longer use viewport::per_view_viewport, it's part of the program
state instead, but we forgot to delete it and rewrite all users.

Fixes: 97da0a77341 ("tu: Rewrite to use common Vulkan dynamic state")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25225>

10 months agoci: document which image tags need to be bumped when updating {alpine,debian,fedora...
Eric Engestrom [Fri, 4 Aug 2023 17:30:53 +0000 (18:30 +0100)]
ci: document which image tags need to be bumped when updating {alpine,debian,fedora}/x86_64

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

10 months agoci: document which image tags need to be bumped when updating piglit
Eric Engestrom [Thu, 7 Sep 2023 12:51:36 +0000 (13:51 +0100)]
ci: document which image tags need to be bumped when updating piglit

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

10 months agoci: Fix pre-merge pipelines with no code changes
Daniel Stone [Thu, 14 Sep 2023 10:47:40 +0000 (11:47 +0100)]
ci: Fix pre-merge pipelines with no code changes

Make sure we don't end up with manual container jobs in MR pipelines,
because they'll never start. This cleans up the container and build
rules so always 'do the right thing' on MRs (container+build if
required, nothing if not) and user branches (all manual).

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

10 months agointel/fs: Check if the whole ubo load range is in the push const range
Sviatoslav Peleshko [Thu, 7 Sep 2023 10:15:41 +0000 (13:15 +0300)]
intel/fs: Check if the whole ubo load range is in the push const range

Before this, we were checking only the beginning of the ubo range, so
partially overlapping loads were trying to load undefined data.

Fixes: b2da1238 ("i965: Use pushed UBO data in the scalar backend.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9748
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25111>

10 months agopanvk: Add Android ICD loader entry point
Roman Stratiienko [Tue, 12 Sep 2023 21:27:34 +0000 (00:27 +0300)]
panvk: Add Android ICD loader entry point

Enables offscreen rendering on Android.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25194>

10 months agolavapipe: clamp cache uuid size
Mike Blumenkrantz [Thu, 14 Sep 2023 20:29:10 +0000 (16:29 -0400)]
lavapipe: clamp cache uuid size

cc: mesa-stable

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

10 months agozink: flag db maps as unsynchronized
Mike Blumenkrantz [Thu, 14 Sep 2023 15:42:35 +0000 (11:42 -0400)]
zink: flag db maps as unsynchronized

these otherwise can be created using the wrong slab

Fixes: 98c411a2a19 ("zink: add PERSISTENT for db buffer maps")

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

10 months agoaux/tc: don't use pipe_buffer_create_with_data() for rp-optimized subdata
Mike Blumenkrantz [Thu, 14 Sep 2023 15:41:42 +0000 (11:41 -0400)]
aux/tc: don't use pipe_buffer_create_with_data() for rp-optimized subdata

this function doesn't use the correct tc map flags, which causes
drivers to (potentially) use the wrong slab for transfer allocation
and then crash

Fixes: 51ad269198e ("aux/tc: handle stride mismatch during rp-optimized subdata")

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25227>

10 months agoaux/tc: fix rp info handling around tc_sync calls
Mike Blumenkrantz [Thu, 14 Sep 2023 15:40:29 +0000 (11:40 -0400)]
aux/tc: fix rp info handling around tc_sync calls

if a set_framebuffer_state call has occurred but no draws have been
triggered, the rp info must be preserved for the driver to (eventually)
use after the sync

Fixes: 07017aa137b ("util/tc: implement renderpass tracking")

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25227>

10 months agocompiler/types: Fix array name dimension flipping for unsized arrays
Caio Oliveira [Fri, 26 May 2023 18:23:19 +0000 (11:23 -0700)]
compiler/types: Fix array name dimension flipping for unsized arrays

Rewrite the code to use linear_asprintf and always flip the
dimensions in place if the element type is an array.  The new
code will now (correctly) flip even in the case of unsized arrays.

The flipping is done by swapping the ranges [a, b) and [b, c), as
shown below, with element type int[...] and an array of length 4.

```
           +--------------- a: first bracket in the name
           |    +---------- b: end of the element name
           |    |  +------- c: end of the array name
           |    |  |
        int[...][4]$

will be transformed into

        int[4][...]$
```

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

10 months agoglsl: Annotate _mesa_glsl_error() with PRINTFLIKE
Caio Oliveira [Wed, 13 Sep 2023 07:41:43 +0000 (00:41 -0700)]
glsl: Annotate _mesa_glsl_error() with PRINTFLIKE

And fix all the errors it found.

Note that for the unsized array error, we will print the
toplevel type -- so that the fact that an inner array is
unsized can be seen.

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25200>

10 months agofreedreno: Build drm subdir before perfcntrs, which uses it.
Emma Anholt [Thu, 14 Sep 2023 17:11:20 +0000 (10:11 -0700)]
freedreno: Build drm subdir before perfcntrs, which uses it.

Fixes: f8ac56895509 ("freedreno: Only add drm/computerator when system_has_kms_drm")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25229>

10 months agoci: add locked flag to bindgen-cli on x86_64_build.sh
Helen Koike [Thu, 14 Sep 2023 13:40:08 +0000 (10:40 -0300)]
ci: add locked flag to bindgen-cli on x86_64_build.sh

since the dependencies were not locked, they got updated and generating
a new container is throwing errors like the following:

error: failed to compile `bindgen-cli v0.62.0`, intermediate artifacts can be found at `/tmp/cargo-installcP54m7`
Caused by:
  package `memchr v2.6.3` cannot be built because it requires rustc 1.61 or newer, while the currently active rustc version is 1.60.0

rust packages have Cargo.lock file from when they were released, so add
--locked flag to use it.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25226>

10 months agointel/fs: Merge copy prop dataflow loops
Ian Romanick [Thu, 14 Sep 2023 00:52:29 +0000 (17:52 -0700)]
intel/fs: Merge copy prop dataflow loops

This is kept as a separate commit because the change looks like a lot
more than it it. The order of the two loops is swapped, then the two
loops are merged.

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

10 months agointel/fs: Use rb_tree for copy prop dataflow
Ian Romanick [Wed, 30 Aug 2023 20:20:35 +0000 (13:20 -0700)]
intel/fs: Use rb_tree for copy prop dataflow

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

10 months agointel/fs: Use rb_tree to store ACP entries by destination
Ian Romanick [Mon, 28 Aug 2023 22:46:53 +0000 (15:46 -0700)]
intel/fs: Use rb_tree to store ACP entries by destination

Using a single data structure seems better. There's no appreciable
performance change. On batman_arkham_city_goty.foz, the difference
reported was 0.48%±0.36% (n=20). Several commits in the MR, including
some that should have no effect at all, reported similar changes. I
attribute this primarily changing of loop alignments and similar.

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

10 months agointel/fs: Use rb_tree to store ACP entries by source
Ian Romanick [Sat, 19 Aug 2023 02:11:58 +0000 (19:11 -0700)]
intel/fs: Use rb_tree to store ACP entries by source

On batman_arkham_city_goty.foz, this improves fossil-db time by
-3.83%±0.24% (n=20). This fossil takes the longest time of any in my
database.

v2: Add some comments for cmp_entry_src_entry_src and
cmp_entry_src_nr. Suggested by Ken.

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

10 months agointel/fs: Encapsulate per-block ACP in a structure
Ian Romanick [Sat, 19 Aug 2023 00:37:02 +0000 (17:37 -0700)]
intel/fs: Encapsulate per-block ACP in a structure

This simplifies some later changes.

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

10 months agointel/fs: Make opt_copy_propagation_local file private
Ian Romanick [Sat, 19 Aug 2023 00:31:12 +0000 (17:31 -0700)]
intel/fs: Make opt_copy_propagation_local file private

This annoyed me durning development of this MR. Every time I changed the
parameters to this internal function, I had to modify a public header
file... and trigger a much large rebuild.

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

10 months agointel/fs: Simplify check in can_propagate_from
Ian Romanick [Fri, 18 Aug 2023 23:12:47 +0000 (16:12 -0700)]
intel/fs: Simplify check in can_propagate_from

The larger predicate here already requires that inst->opcode must be
BRW_OPCODE_MOV, so it can't BRW_OPCODE_SEL. With that removed, the
other simplifications are pretty straight forward.

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

10 months agointel/fs: Don't loop in try_constant_propagate
Ian Romanick [Wed, 15 Mar 2023 19:01:35 +0000 (12:01 -0700)]
intel/fs: Don't loop in try_constant_propagate

The caller already loops over the sources. This means that the caller
must loop over the sources in reverse because constant propagation
prefers to propagate into the last sources first.

The shader-db and fossil-db changes (below) are all due to SEL
instructions. Changing the order sources are visited changes whether a
SEL with two immediate sources is

    (+f0.0) sel     g12    IMM_A    IMM_B

or

    (-f0.0) sel     g12    IMM_B    IMM_A

The ordering of the sources affects the order the constant combining
encounters the values, and the determines which value is "combined"
and which value remains an immediate.

This affects the results by luck. If there are two instructions:

    (+f0.0) sel     g12    IMM_A    IMM_B
    (+f0.0) sel     g13    IMM_A    IMM_C

Picking IMM_A is advantageous over picking IMM_B and IMM_C. Since the
selection algorithm in constant combining is greedy, this case
requires the algorithm see the values in just the right order for the
right thing to happen.

v2: Rebase on many, many changes. Move instruction source fixup
reordering out or try_constant_propagate.

v3: Rebase on !7698.

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

10 months agointel/fs: Move src.file checks out of try_constant_propagate and try_copy_propagate
Ian Romanick [Wed, 15 Mar 2023 00:13:37 +0000 (17:13 -0700)]
intel/fs: Move src.file checks out of try_constant_propagate and try_copy_propagate

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

10 months agointel/fs: Make try_constant_propagate and try_copy_propagate file private
Ian Romanick [Wed, 15 Mar 2023 16:27:36 +0000 (09:27 -0700)]
intel/fs: Make try_constant_propagate and try_copy_propagate file private

This annoyed me durning development of this MR. Every time I changed the
parameters to this internal function, I had to modify a public header
file... and trigger a much large rebuild.

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

10 months agointel/fs: Don't try to copy propagate into a source again after progress is made
Ian Romanick [Fri, 18 Aug 2023 16:34:35 +0000 (09:34 -0700)]
intel/fs: Don't try to copy propagate into a source again after progress is made

If the linked list structure used depended on the list head to know when
to terminate, this would be a pretty serious bug. If try_constant_propage
or try_copy_propagate make progress, inst->src[i].nr will change. This
results in the foreach_in_list using a different list header on later
iterations of the loop.

This causes two shaders in shader-db and 9 shaders in fossil-db to
change. Looking at the code changes, these are cases where there was a
copy of a copy that gets propagated. The part that confuses me is the
VGRF numbers involved should **not** hash to the same bucket, so it
should be impossible to find the original source from the intermediate
VGRF.

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

10 months agointel/fs: Don't continue fixed point iteration just because liveout changes
Ian Romanick [Sat, 1 Apr 2023 01:13:57 +0000 (18:13 -0700)]
intel/fs: Don't continue fixed point iteration just because liveout changes

Unless the change in liveout also causes livein to change, updates to
liveout cannot have any global effect. Changes to livein already flag
additional interation.

I had additional changes in this area that didn't pan out. While working
on those change, I was a little confused about this bit of code. It's
unnecessary, so it's better to delete it.

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

10 months agoutil/rb-tree: Inline rb_tree_init
Ian Romanick [Wed, 30 Aug 2023 21:01:00 +0000 (14:01 -0700)]
util/rb-tree: Inline rb_tree_init

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

10 months agoutil/rb-tree: Work around C++'s dislike of offsetof
Ian Romanick [Sat, 19 Aug 2023 01:57:25 +0000 (18:57 -0700)]
util/rb-tree: Work around C++'s dislike of offsetof

This is the same technique used in src/compiler/glsl/list.h.

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

10 months agoglsl/list: Clean up an inappropriate comment
Ian Romanick [Sat, 19 Aug 2023 01:58:53 +0000 (18:58 -0700)]
glsl/list: Clean up an inappropriate comment

:facepalm:

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