platform/upstream/mesa.git
2 years agoclover: Fixes use of designated initializers requires in c++ that doesn't support...
Yonggang Luo [Mon, 19 Sep 2022 18:44:30 +0000 (02:44 +0800)]
clover: Fixes use of designated initializers requires in c++ that doesn't support by MSVC

../src/gallium/frontends/clover/nir/invocation.cpp(400): error C7555: use of designated initializers requires at least '/std:c++20'

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18683>

2 years agov3dv: optimize ldunif load into unifa write
Iago Toral Quiroga [Fri, 16 Sep 2022 09:44:25 +0000 (11:44 +0200)]
v3dv: optimize ldunif load into unifa write

If we emit a ldunif to load the ubo/ssbo base address and
then we are immediately moving it to the unifa register we
can have the ldunif write directly to unifa and avoid the mov
in between, which won't be done by copy propagation because that
only works with temp registers.

Also, since we can't read from unifa we must be careful to disallow
reuse of the ldunif result for a future ldunif of the same base address.
We do that by only reusing ldunif results from temp registers.

total instructions in shared programs: 12468943 -> 12455139 (-0.11%)
instructions in affected programs: 1661233 -> 1647429 (-0.83%)
helped: 8307
HURT: 3994

total uniforms in shared programs: 3704532 -> 3704522 (<.01%)
uniforms in affected programs: 339 -> 329 (-2.95%)
helped: 7
HURT: 0

total max-temps in shared programs: 2148158 -> 2148290 (<.01%)
max-temps in affected programs: 9320 -> 9452 (1.42%)
helped: 175
HURT: 295

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

total fills in shared programs: 3059 -> 3057 (-0.07%)
fills in affected programs: 27 -> 25 (-7.41%)
helped: 1
HURT: 0

total sfu-stalls in shared programs: 21167 -> 21056 (-0.52%)
sfu-stalls in affected programs: 497 -> 386 (-22.33%)
helped: 209
HURT: 127

total inst-and-stalls in shared programs: 12490110 -> 12476195 (-0.11%)
inst-and-stalls in affected programs: 1662875 -> 1648960 (-0.84%)
helped: 8312
HURT: 3987

total nops in shared programs: 316563 -> 313553 (-0.95%)
nops in affected programs: 24269 -> 21259 (-12.40%)
helped: 2158
HURT: 1006

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18667>

2 years agobroadcom/compiler: check signal writes to magic regs when updating scoreboard
Iago Toral Quiroga [Fri, 16 Sep 2022 09:42:50 +0000 (11:42 +0200)]
broadcom/compiler: check signal writes to magic regs when updating scoreboard

We have only been checking magic writes from ADD and MUL ports, but signals
can potentially write to magic registers too.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18667>

2 years agobroadcom/compiler: detect unifa write from signal
Iago Toral Quiroga [Mon, 19 Sep 2022 06:54:04 +0000 (08:54 +0200)]
broadcom/compiler: detect unifa write from signal

It is possible for some signals to write to unifa directly. We will
enable this from ldunif shortly so we should check for it here.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18667>

2 years agoradv: Use count_tes_user_sgprs return value.
Vinson Lee [Sun, 18 Sep 2022 22:39:37 +0000 (15:39 -0700)]
radv: Use count_tes_user_sgprs return value.

Fix defect reported by Coverity Scan.

Useless call (USELESS_CALL)
side_effect_free: Calling count_tes_user_sgprs(key) is only useful for
its return value, which is ignored.

Fixes: 8253ec3855a ("radv: add shader arguments for dynamic patch control points")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18659>

2 years agoradeonsi: print out remove_streamout shader key
Qiang Yu [Fri, 29 Jul 2022 03:23:22 +0000 (11:23 +0800)]
radeonsi: print out remove_streamout shader key

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17456>

2 years agoradeonsi: implement nir_intrinsic_load_streamout_buffer_amd
Qiang Yu [Thu, 30 Jun 2022 09:50:47 +0000 (17:50 +0800)]
radeonsi: implement nir_intrinsic_load_streamout_buffer_amd

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17456>

2 years agoradeonsi: implement nir_intrinsic_load_num_vertices_per_primitive_amd
Qiang Yu [Thu, 30 Jun 2022 09:28:46 +0000 (17:28 +0800)]
radeonsi: implement nir_intrinsic_load_num_vertices_per_primitive_amd

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17456>

2 years agoradeonsi: set VS_OUT_MISC_SIDE_BUS_ENA=1 for clip distance exports on gfx10.3
Marek Olšák [Mon, 12 Sep 2022 16:48:28 +0000 (12:48 -0400)]
radeonsi: set VS_OUT_MISC_SIDE_BUS_ENA=1 for clip distance exports on gfx10.3

This should improve performance of clip distances.

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

2 years agoanv: remove vk_sample_locations_state from emit_multisample
Tapani Pälli [Mon, 19 Sep 2022 12:52:38 +0000 (15:52 +0300)]
anv: remove vk_sample_locations_state from emit_multisample

State for sample locations is not used within this function.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18669>

2 years agofrontends/va: enable sao in hevc encoding
Ruijing Dong [Fri, 16 Sep 2022 00:57:52 +0000 (20:57 -0400)]
frontends/va: enable sao in hevc encoding

enable sao feature from config attribute. by default
from vcn2, hevc encoding enables sao.

Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18626>

2 years agofreedreno/a6xx: Simplify fd6_build_user_consts()
Rob Clark [Sun, 18 Sep 2022 18:42:11 +0000 (11:42 -0700)]
freedreno/a6xx: Simplify fd6_build_user_consts()

Get rid of the table indirects.  Cuts in half the time spent in this fxn
in drawoverhead test 31 ("many uniforms / 1 changemany uniforms / 1
change")

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

2 years agofreedreno/a6xx: Move user const upload to bind
Rob Clark [Sun, 18 Sep 2022 18:34:33 +0000 (11:34 -0700)]
freedreno/a6xx: Move user const upload to bind

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

2 years agofreedreno: Drop unused arg
Rob Clark [Sun, 18 Sep 2022 18:17:17 +0000 (11:17 -0700)]
freedreno: Drop unused arg

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

2 years agofreedreno/a6xx: Pre-calculate user const state size
Rob Clark [Sun, 18 Sep 2022 17:28:36 +0000 (10:28 -0700)]
freedreno/a6xx: Pre-calculate user const state size

We can do this when we construct the program state object, rather than
at draw time.

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

2 years agofreedreno/a6xx: Skip IBO state when unused
Rob Clark [Sun, 18 Sep 2022 17:07:34 +0000 (10:07 -0700)]
freedreno/a6xx: Skip IBO state when unused

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

2 years agofreedreno/drm: Simplify emit_reloc_common
Rob Clark [Sat, 17 Sep 2022 20:05:18 +0000 (13:05 -0700)]
freedreno/drm: Simplify emit_reloc_common

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

2 years agofreedreno/a6xx: Drop "hardpin" support
Rob Clark [Thu, 4 Aug 2022 22:58:15 +0000 (15:58 -0700)]
freedreno/a6xx: Drop "hardpin" support

The upstream kernel supported everything needed to stop doing
kernel-side relocs before the first things with a6xx were fully
supported in upstream kernel.  Take advantage to drop some extra
overhead in OUT_RELOC() and equiv in the pack macros.

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

2 years agofreedreno/drm: Add fd_ringbuffer_attach_bo()
Rob Clark [Thu, 4 Aug 2022 22:41:53 +0000 (15:41 -0700)]
freedreno/drm: Add fd_ringbuffer_attach_bo()

Which does only the bo bookkeeping and skips all the extra legacy reloc
related overhead.

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

2 years agofreedreno/drm: Inline fd_bo_get_iova()
Rob Clark [Thu, 4 Aug 2022 22:29:33 +0000 (15:29 -0700)]
freedreno/drm: Inline fd_bo_get_iova()

The struct body was originally hidden to avoid it being part of the ABI
between libdrm_freedreno and mesa.  But that is no longer a problem.

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

2 years agofreedreno/ir3: GC unused macro
Rob Clark [Fri, 5 Aug 2022 16:40:31 +0000 (09:40 -0700)]
freedreno/ir3: GC unused macro

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

2 years agofreedreno: Update github wiki links
Rob Clark [Sat, 17 Sep 2022 17:45:38 +0000 (10:45 -0700)]
freedreno: Update github wiki links

The github wiki isn't really maintained anymore.  Update references to
point to the gitlab wiki instead.

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

2 years agoradv: Add scratch stack to reduce LDS stack in RT traversal.
Bas Nieuwenhuizen [Sun, 11 Sep 2022 21:31:58 +0000 (23:31 +0200)]
radv: Add scratch stack to reduce LDS stack in RT traversal.

The current stack size is a significant limiter for occupancy, and
hence we need smaller stacks in LDS.

Rhys earlier had a patch that just put the N entries closest to the
root in LDS and the rest in scratch. However, this is not ideal for
performance as most of the activity is happening away from the root,
near the leaves. Of course we can't just switch it around, as the
leaf activity likely isn't happening all the way at the end of the
stack.

So what we do is make the LDS stack kinda a ringbuffer by always
accessing it using the stack index modulo the buffer size (always
a power of two so we can efficiently mask). If we then do not have
free space in this buffer we evict the entries closest to the root
to scratch and if we hit the "bottom" of the LDS space we load from
scratch.

Some rough perf numbers for indication with Q2RTX:

| evicting | LDS entries | perf |
|----------|-------------|------|
|       no |          76 |  55% |
|       no |          32 | 100% |
|       no |          24 | 105% |
|      yes |          32 |  95% |
|      yes |          16 | 100% |
|      yes |           8 |  90% |
|      yes |           4 |  75% |

(For the case with 4 entries we need to do some extra accounting as
 a full batch may not be available to evict)

So an obvious choice is to use a stack of 16 entries.

One might wonder if Q2RTX perf is mainly good due to BVHs with very
little geometry and hence low depth, so I also did some profiling
with control. This is done with RGP instruction timing, so this is
instructions executed not weighted for enabled masks, i.e. divergence
effects included.

| game    | LDS entries | scratch action | fraction of iterations |
|---------|-------------|----------------|------------------------|
| Control |           8 |          store |                  10.3% |
| Control |           8 |          load  |                  34.8% |
| Control |          16 |          store |                  0.58% |
| Control |          16 |          load  |                  2.62% |
| Q2RTX   |          16 |          store |                  1.00% |
| Q2RTX   |          16 |          load  |                  3.07% |

So Q2RTX doesn't seem like an unreasonably good case for this
algorithm.

On the implementation side, we can always place the scratch stack at
address 0 by just reserving the scratch space, and in the case of fixed
callstack size moving that up. In the dynamic case the dynamic stack
base already takes any reserved scratch space into account.

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

2 years agoradv: fix dynamic RT stack size with VGPR spilling
Rhys Perry [Mon, 14 Feb 2022 19:23:15 +0000 (19:23 +0000)]
radv: fix dynamic RT stack size with VGPR spilling

VGPR spilling might cause VGPRs to be spilled at scratch offset 0, so we
can't use that.

fossil-db (Sienna Cichlid, Q2RTX and Control):
Totals from 4 (0.26% of 1524) affected shaders:
Instrs: 8734 -> 8737 (+0.03%)
CodeSize: 48492 -> 48504 (+0.02%)
Latency: 384375 -> 384369 (-0.00%)
InvThroughput: 256250 -> 256246 (-0.00%)
Copies: 1312 -> 1313 (+0.08%)
Branches: 256 -> 258 (+0.78%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18541>

2 years agodocs: add new llvmpipe/lavapipe atomic float extensions
Dave Airlie [Mon, 19 Sep 2022 20:57:20 +0000 (06:57 +1000)]
docs: add new llvmpipe/lavapipe atomic float extensions

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

2 years agolavapipe: export VK_KHR_shader_atomic_float
Dave Airlie [Fri, 16 Sep 2022 15:03:13 +0000 (01:03 +1000)]
lavapipe: export VK_KHR_shader_atomic_float

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

2 years agollvmpipe: export GL_NV_shader_atomic_float
Dave Airlie [Fri, 16 Sep 2022 15:02:50 +0000 (01:02 +1000)]
llvmpipe: export GL_NV_shader_atomic_float

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

2 years agogallivm: add atomic 32-bit float support
Dave Airlie [Fri, 16 Sep 2022 09:58:59 +0000 (19:58 +1000)]
gallivm: add atomic 32-bit float support

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

2 years agozink: disable GPL when sample shading is in use
Mike Blumenkrantz [Mon, 19 Sep 2022 14:31:36 +0000 (10:31 -0400)]
zink: disable GPL when sample shading is in use

this seems impossible to handle as near as I can tell

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

2 years agoradv: Use nested ifs for pushing child nodes in traversal loop.
Bas Nieuwenhuizen [Sun, 11 Sep 2022 15:59:15 +0000 (17:59 +0200)]
radv: Use nested ifs for pushing child nodes in traversal loop.

Avoids a bunch of overhead costs if the previous child was empty
already.

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

2 years agoradv: Use constant for ray traversal exit condition.
Bas Nieuwenhuizen [Sun, 11 Sep 2022 14:48:58 +0000 (16:48 +0200)]
radv: Use constant for ray traversal exit condition.

Make the stack base ssa def dead in the loop, can save a register.

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

2 years agoRevert "radv/rt: use derefs for the traversal stack"
Bas Nieuwenhuizen [Sun, 11 Sep 2022 14:18:14 +0000 (16:18 +0200)]
Revert "radv/rt: use derefs for the traversal stack"

This reverts commit 3750663c72b01d8668c13eed44f40863af588ba4.

Doing things with derefs adds extra instructions for multiplying the
index with the element size, e.g.

BBF0_13:
   s_waitcnt vmcnt(0)
   v_mov_b32_e32 v27, v55
   s_mov_b32 s23, exec_lo
   v_cmpx_ne_i32_e32 -1, v27
   s_cbranch_execz _L14
BBF0_14:
   v_lshlrev_b32_e32 v48, 2, v46  <--
   ds_write_b32 v48, v27
   v_add_nc_u32_e32 v46, 32, v46
_L14:
   s_mov_b32 exec_lo, s23
   v_mov_b32_e32 v27, v54
   s_mov_b32 s23, exec_lo
   v_cmpx_ne_i32_e32 -1, v27
   s_cbranch_execz _L15
BBF0_15:
   v_lshlrev_b32_e32 v48, 2, v46 <--
   ds_write_b32 v48, v27
   v_add_nc_u32_e32 v46, 32, v46

On Q2RTC indirect lighting this saves about 2.3 VALU instructions
per loop iteration, which is ~4% of VALU instructions (we're at
58 per iteration now according to RGP).

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

2 years agoradv: Store top of stack in a register.
Bas Nieuwenhuizen [Sat, 10 Sep 2022 01:23:15 +0000 (03:23 +0200)]
radv: Store top of stack in a register.

Saves a bunch of processing and a lot of LDS traffic.

Improves perf of the indirect lighting RT pass in Q2RTX by ~3%. This
is mostly due to the -5% VALU instructions and -25% LDS instructions.

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

2 years agoradv: Don't flatten bottom AS exit if statement.
Bas Nieuwenhuizen [Sat, 10 Sep 2022 00:34:35 +0000 (02:34 +0200)]
radv: Don't flatten bottom AS exit if statement.

The flattening by ACO is more efficient than the nir condmask.

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

2 years agofix: frontends/va: unused variable ‘max_pipe_hevc_slices’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:42:44 +0000 (18:42 +0200)]
fix: frontends/va: unused variable ‘max_pipe_hevc_slices’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: zink: unused variable ‘intr’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:37:05 +0000 (18:37 +0200)]
fix: zink: unused variable ‘intr’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: iris: unused variable ‘devinfo’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:35:44 +0000 (18:35 +0200)]
fix: iris: unused variable ‘devinfo’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sfn: unused variable ‘spi_sid’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:33:10 +0000 (18:33 +0200)]
fix: r600/sfn: unused variable ‘spi_sid’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sfn: variable ‘fail’ set but not used [-Wunused-but-set-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:13:58 +0000 (18:13 +0200)]
fix: r600/sfn: variable ‘fail’ set but not used [-Wunused-but-set-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sfn: unused variable ‘{splitpos,param}’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:12:37 +0000 (18:12 +0200)]
fix: r600/sfn: unused variable ‘{splitpos,param}’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sfn: unused variable ‘splitpos’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:10:13 +0000 (18:10 +0200)]
fix: r600/sfn: unused variable ‘splitpos’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sb: warning: unused variable ‘{b,nl}’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 16:08:43 +0000 (18:08 +0200)]
fix: r600/sb: warning: unused variable ‘{b,nl}’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sfn: variable ‘opinfo’ set but not used [-Wunused-but-set-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:50:21 +0000 (13:50 +0200)]
fix: r600/sfn: variable ‘opinfo’ set but not used [-Wunused-but-set-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sb: unused variable ‘r’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:48:13 +0000 (13:48 +0200)]
fix: r600/sb: unused variable ‘r’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sb: unused variable ‘fop’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:46:07 +0000 (13:46 +0200)]
fix: r600/sb: unused variable ‘fop’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: r600/sb: unused variable ‘repdep2’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:43:53 +0000 (13:43 +0200)]
fix: r600/sb: unused variable ‘repdep2’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: gallivm: variable ‘type_kind’ set but not used [-Wunused-but-set-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:39:19 +0000 (13:39 +0200)]
fix: gallivm: variable ‘type_kind’ set but not used [-Wunused-but-set-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: mesa/st: unused variable ‘src’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:37:36 +0000 (13:37 +0200)]
fix: mesa/st: unused variable ‘src’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: mesa/st: variable ‘texobj’ set but not used [-Wunused-but-set-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:35:59 +0000 (13:35 +0200)]
fix: mesa/st: variable ‘texobj’ set but not used [-Wunused-but-set-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: mesa: unused variable ‘ret’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:33:34 +0000 (13:33 +0200)]
fix: mesa: unused variable ‘ret’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: ac/llvm: unused variable ‘offset’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:31:35 +0000 (13:31 +0200)]
fix: ac/llvm: unused variable ‘offset’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: nir: unused variable ‘else_block’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:28:43 +0000 (13:28 +0200)]
fix: nir: unused variable ‘else_block’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agofix: util/format: unused variable ‘desc’ [-Wunused-variable]
Kai Wasserbäch [Sat, 17 Sep 2022 11:25:53 +0000 (13:25 +0200)]
fix: util/format: unused variable ‘desc’ [-Wunused-variable]

Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>

2 years agost/drawpixels: use normalized coords in samplers with lowered rects
Mike Blumenkrantz [Thu, 15 Sep 2022 13:31:09 +0000 (09:31 -0400)]
st/drawpixels: use normalized coords in samplers with lowered rects

cc: mesa-stable

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

2 years agost/bitmap: use normalized coords in samplers with lowered rects
Mike Blumenkrantz [Thu, 15 Sep 2022 13:31:09 +0000 (09:31 -0400)]
st/bitmap: use normalized coords in samplers with lowered rects

cc: mesa-stable

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

2 years agozink: fix atomic ssbo fadd offsets
Mike Blumenkrantz [Mon, 19 Sep 2022 19:54:37 +0000 (15:54 -0400)]
zink: fix atomic ssbo fadd offsets

Fixes: 99a4a9c6ff0 ("zink: fix atomic ssbo indexing with non-32bit values")

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

2 years agozink: defer acquire semaphore destruction
Mike Blumenkrantz [Mon, 29 Aug 2022 15:40:50 +0000 (11:40 -0400)]
zink: defer acquire semaphore destruction

these have noticeable overhead, so handle them in the submit thread

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

2 years agozink: fix/relax resolve geometry check
Mike Blumenkrantz [Mon, 29 Aug 2022 15:17:43 +0000 (11:17 -0400)]
zink: fix/relax resolve geometry check

there's no requirement in the spec that the geometry for resolves must match,
only that the geometry must be positive (i.e., no flipped extents)

this avoids major perf issues for scaled resolves

cc: mesa-stable

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

2 years agoradeonsi/vcn: Add ability to encode with ltr
Kuixi Ren [Tue, 23 Aug 2022 20:22:40 +0000 (20:22 +0000)]
radeonsi/vcn: Add ability to encode with ltr

reads flags field from CurrPic struct in pps for VA_PICTURE_H264_LONG_TERM_REFERENCE. If found, Curr_pic.frame_idx wil be used for the long term reference index
In get_picture_storage, check if current frame is ltr, and whether its ref frame is ltr.
In radeon_enc_slice_header, adds the ref_pic_list_modification_flag_l0 and long_term_reference_flag for ltr

v2: fix code formatting issues

Reviewed-by: Ruijing Dong ruijing.dong@amd.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18219>

2 years agopan/bi: Implement unpack_64_2x32
Alyssa Rosenzweig [Fri, 24 Jun 2022 20:32:20 +0000 (16:32 -0400)]
pan/bi: Implement unpack_64_2x32

This duplicates the lowering from nir_lower_packing. However, nir_lower_packing
also lowers a pile of other instructions that we do implement natively, and this
is easier than adding a bunch of knobs to nir_lower_packing to get just what we
need.

Fixes test-printf address_space_4.

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

2 years agopan/bi: Stub out scoped_barrier
Alyssa Rosenzweig [Mon, 19 Sep 2022 02:26:39 +0000 (22:26 -0400)]
pan/bi: Stub out scoped_barrier

Implement like other workgroup barriers. No subgroup barriers yet, but that
doesn't seem needed yet.

Fixes test_basic.async_copy_global_to_local and a pile of other OpenCL tests.

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

2 years agopan/bi: Fix 1D array indexing on Valhall
Alyssa Rosenzweig [Fri, 24 Jun 2022 21:26:49 +0000 (17:26 -0400)]
pan/bi: Fix 1D array indexing on Valhall

Array index always goes in the fourth 16-bit component on Valhall. I'm unsure
whether that should also apply to Bifrost. f256ec2a881 ("pan/bi: Fix 1DArray
image coordinate retrieval") says that it should be in the third component on
Bifrost, but I can't remember why that would be the case.

Fixes OpenCL test image_streams.write.1darray on Valhall.

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

2 years agopan/bi: Use .auto for image stores
Alyssa Rosenzweig [Fri, 24 Jun 2022 21:12:43 +0000 (17:12 -0400)]
pan/bi: Use .auto for image stores

Works around LLVM/SPIR-V stupidity. In effect this means we always use typeless
image stores, which is good enough for both CL and GL.

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

2 years agopan/bi: Call nir_lower_64bit_phis
Alyssa Rosenzweig [Sun, 18 Sep 2022 20:22:08 +0000 (16:22 -0400)]
pan/bi: Call nir_lower_64bit_phis

Fixes test_basic.local_kernel_scope

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

2 years agopan/bi: Scalarize phis before the opt loop
Alyssa Rosenzweig [Thu, 7 Jul 2022 20:22:29 +0000 (16:22 -0400)]
pan/bi: Scalarize phis before the opt loop

Scalarizing phis results in vector constructions (nir_op_vec) of the same size
as the phi, so a wide phi (>128-bit) will result in a wide vector op that the
backend can't handle. These wide vector ops can always be copypropped away, but
that relies on running NIR copy/prop after scalarizing phis, which was not
always happening before. By scalarizing phis before the opt loop instead of
after, we guarantee that copyprop and DCE run to completion and we get
appropriately lowered code in the backend.

Fixes parts of integer_ops.integer_divideAssign with longs.

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

2 years agopan/bi: Lower fisnormal
Alyssa Rosenzweig [Wed, 6 Jul 2022 20:46:55 +0000 (16:46 -0400)]
pan/bi: Lower fisnormal

Fixes test_bruteforce.isnormal. We don't implement fisnormal in the backend, but
actually lower_bool_to_bitsize was failing earlier since there's no fisnormal32
to lower to either.

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

2 years agopan/bi: Lower <32-bit bit_count
Alyssa Rosenzweig [Wed, 6 Jul 2022 20:28:09 +0000 (16:28 -0400)]
pan/bi: Lower <32-bit bit_count

While we have a POPCOUNT.i32 instruction, we do not have v2i16/v4i8 variants.
The code generated by lower_to_bitsize doesn't seem any better than what we
could do ourselves, so let's use that.

While we're at it, give bitfield_reverse the same treatment as we have only
BITREV.i32. I don't think we can get <32-bit bitfield_reverse in either GL or
CL, but that seems likely to change in the future. (It looks to be valid SPIR-V,
at least.)

Fixes integer_ops.popcount.

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

2 years agopan/bi: Handle swizzles in unpack_64_2x32_split_{x,y}
Alyssa Rosenzweig [Fri, 24 Jun 2022 20:30:24 +0000 (16:30 -0400)]
pan/bi: Handle swizzles in unpack_64_2x32_split_{x,y}

No known fixes but this would still be wrong for OpenCL.

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

2 years agopan/bi: Allow selecting from an 8-bit vec8
Alyssa Rosenzweig [Fri, 24 Jun 2022 18:53:48 +0000 (14:53 -0400)]
pan/bi: Allow selecting from an 8-bit vec8

The word offset is already handled by the above code, there's no need to
restrict the further restrict the swizzle. This pattern can come up with OpenCL.

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

2 years agopan/bi: Remove bogus assert for pack_32_2x16
Alyssa Rosenzweig [Fri, 24 Jun 2022 15:53:16 +0000 (11:53 -0400)]
pan/bi: Remove bogus assert for pack_32_2x16

The following IR is valid NIR:

   vec1 16 ssa_0 = ...
   vec1 32 ssa_1 = pack_32_2x16 ssa_0.xx

In this case, pack_32_2x16 takes in a two component vector, but the source
itself ssa_0 has only a single component. This is fine due to the shuffle, but
will fail the assert. Remove the assert and all is well.

Fixes test_relational.shuffle_copy.

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

2 years agopan/bi: Lower f2i8, f2u8
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:34:17 +0000 (09:34 -0400)]
pan/bi: Lower f2i8, f2u8

These need a simple two-instruction lowering regardless of the size of float
involved. Fixes integer_ops.integer_divideAssign

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

2 years agopan/bi: Lower 8-bit min/max to bcsel+comparison
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:30:04 +0000 (09:30 -0400)]
pan/bi: Lower 8-bit min/max to bcsel+comparison

We don't have an 8-bit CSEL, so this is the best we can do. It's easier to write
the lowering as an algebraic rule since we don't need to do anything clever.
Fixes integer_ops.integer_clamp.

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

2 years agopan/va: Add 8-bit integer max assembler case
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:19:08 +0000 (09:19 -0400)]
pan/va: Add 8-bit integer max assembler case

This needs to be lowered to a two instruction sequence because there is no
CSEL.v4s8.

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

2 years agopan/bi: Add HADD.v4s8.rhadd packing test cases
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:11:33 +0000 (09:11 -0400)]
pan/bi: Add HADD.v4s8.rhadd packing test cases

To confirm the XML is right.

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

2 years agopan/va: Pack .rhadd bit
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:16:58 +0000 (09:16 -0400)]
pan/va: Pack .rhadd bit

Fixes integer_ops.integer_rhadd.

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

2 years agopan/bi: Handle uhadd, urhadd opcodes
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:09:06 +0000 (09:09 -0400)]
pan/bi: Handle uhadd, urhadd opcodes

Fixes integer_ops.integer_hadd.

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

2 years agopan/va: Fix v4s8 form of R2 opcodes
Alyssa Rosenzweig [Thu, 23 Jun 2022 22:33:37 +0000 (18:33 -0400)]
pan/va: Fix v4s8 form of R2 opcodes

The XML had a typo which was copypasted (incorrectly) into various instructions.
Fixes a pile of integer_ops subtests.

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

2 years agopan/va: Pack IADD.sat bit
Alyssa Rosenzweig [Thu, 23 Jun 2022 22:21:59 +0000 (18:21 -0400)]
pan/va: Pack IADD.sat bit

Fixes 32-bit portion of integer_ops integer_add_sat.

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

2 years agopan/bi: Strip negate when lowering swizzles
Alyssa Rosenzweig [Fri, 24 Jun 2022 15:44:25 +0000 (11:44 -0400)]
pan/bi: Strip negate when lowering swizzles

When we lower swizzles, we move source modifiers (except for the swizzle) after
the swizzle operation. In particular, we change the order of composition for
negates and abs. However, copying the source will copy the modifiers unless we
specifically strip the extra modifiers. That's harmless in practice on Bifrost,
which doesn't check for extraneous modifiers, but is incorrect IR and trips an
assertion in the Valhall packing code.

Fixes test_relations.relational_bitselect.

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

2 years agopan/bi: Lower swizzles for 8-bit shifts
Alyssa Rosenzweig [Fri, 24 Jun 2022 13:07:42 +0000 (09:07 -0400)]
pan/bi: Lower swizzles for 8-bit shifts

Fixes integers_ops.integer_ctz

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

2 years agopan/bi: Test some 8-bit swizzle lowering
Alyssa Rosenzweig [Wed, 22 Jun 2022 20:52:45 +0000 (16:52 -0400)]
pan/bi: Test some 8-bit swizzle lowering

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

2 years agopan/bi: Lower some 8-bit swizzles
Alyssa Rosenzweig [Wed, 22 Jun 2022 20:52:58 +0000 (16:52 -0400)]
pan/bi: Lower some 8-bit swizzles

Fixes the 8-bit portion of OpenCL's integer_ops.integer_clz test case.

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

2 years agopan/bi: Unit test swizzle lowering
Alyssa Rosenzweig [Wed, 22 Jun 2022 20:36:11 +0000 (16:36 -0400)]
pan/bi: Unit test swizzle lowering

We're about to extend this pass to support 8-bit swizzles. That will be a
nontrivial change, so let's get some testing for what's already in the pass.

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

2 years agopan/va: Fix missing swizzle on CLZ.v2u16
Alyssa Rosenzweig [Wed, 22 Jun 2022 20:57:43 +0000 (16:57 -0400)]
pan/va: Fix missing swizzle on CLZ.v2u16

Fixes 16-bit portion of integer_clz.

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

2 years agopanfrost: Assume launch_grid parameters always change
Alyssa Rosenzweig [Mon, 19 Sep 2022 01:05:01 +0000 (21:05 -0400)]
panfrost: Assume launch_grid parameters always change

This is only a theoretical bug fix because, for now, we always reemit
everything. But this aligns launch_grid with draw_vbo and makes the intention
explicit, both seem like good things to me.

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

2 years agopanfrost: Honour flush-to-zero controls on Valhall
Alyssa Rosenzweig [Mon, 19 Sep 2022 02:08:42 +0000 (22:08 -0400)]
panfrost: Honour flush-to-zero controls on Valhall

Fixes math_bruteforce.atan2 and contractions tests.

For OpenCL, we want to flush fp32 and preserve fp16, applying to both inputs and
outputs so F16_TO_F32 acts as preserve, which implements CL spec text:

> Denormalized numbers for the half data type which may be generated when
converting a float to a half using vstore_half and converting a half to a float
using vload_half cannot be flushed to zero

Note that our libclc builds flush denorms and rusticl does not advertise denorms
so we're expected to flush to zero. rusticl correctly sets the desired float
controls, we just have to match to the hardware requirements.

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

2 years agopanfrost: Advertise PIPE_CAP_INT64
Alyssa Rosenzweig [Thu, 7 Jul 2022 17:48:11 +0000 (13:48 -0400)]
panfrost: Advertise PIPE_CAP_INT64

nir_lower_int64 should be able to chew through everything anyway. Fixes
compilers.feature_macro (with LLVM 15).

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

2 years agopanfrost: Bump PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS
Alyssa Rosenzweig [Mon, 27 Jun 2022 15:38:59 +0000 (11:38 -0400)]
panfrost: Bump PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS

Bump to 2048, the minimum maximum for image support in the full profile of
OpenCL. The relevant hardware limit is 65536 so we have plenty of clearance.

Fixes api.get_image1d_array_info.

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

2 years agopanfrost: Upload default sampler for txf
Alyssa Rosenzweig [Tue, 13 Sep 2022 16:04:32 +0000 (12:04 -0400)]
panfrost: Upload default sampler for txf

In NIR, txf does not take a sampler. However, in the hardware it does take a
sampler. If there is no sampler bound and we use txf, the hardware will read
back all-0's due to bounds checking. As a workaround, bind a trivial sampler and
use that.

As-is this workaround is Valhall specific, making use of an extra resource
table. I'm punting on generalizing back to Bifrost until I can discuss the issue
in more depth with Jason and Karol and figure out the right fix.

Fixes api.image_properties_query.

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

2 years agopanfrost: Allow compiling MESA_SHADER_KERNEL
Alyssa Rosenzweig [Wed, 22 Jun 2022 14:32:12 +0000 (10:32 -0400)]
panfrost: Allow compiling MESA_SHADER_KERNEL

Required for Rusticl.

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

2 years agopanfrost: Default pipe->clear_texture impl
Alyssa Rosenzweig [Tue, 21 Jun 2022 20:55:44 +0000 (16:55 -0400)]
panfrost: Default pipe->clear_texture impl

For rusticl.

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

2 years agonir/load_libclc: Don't add generic variants that already exist
Jason Ekstrand [Thu, 7 Apr 2022 21:45:22 +0000 (16:45 -0500)]
nir/load_libclc: Don't add generic variants that already exist

At some point in the future, adding generic variants to libclc will
hopefully no longer be needed.  At that point, we don't want the NIR
code adding duplicates.  Check if the generic version already exists
and, if it does, don't re-add it.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18675>

2 years agonir: Add a helper for finding a function by name
Jason Ekstrand [Thu, 7 Apr 2022 21:44:08 +0000 (16:44 -0500)]
nir: Add a helper for finding a function by name

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18675>

2 years agospirv: Don't use libclc for wait_group_events
Jason Ekstrand [Thu, 7 Apr 2022 22:04:04 +0000 (17:04 -0500)]
spirv: Don't use libclc for wait_group_events

v2: Drop old code (Karol)

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18675>

2 years agoegl/dri2: Fix missing return with dri2_egl_error_unlock.
Vinson Lee [Sun, 18 Sep 2022 18:02:04 +0000 (11:02 -0700)]
egl/dri2: Fix missing return with dri2_egl_error_unlock.

Fix defect reported by Coverity Scan.

Double unlock (LOCK)
double_unlock: dri2_egl_error_unlock unlocks dri2_dpy->lock while it is unlocked.

Fixes: f1efe037dfd ("egl/dri2: Add display lock")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18655>

2 years agoagx: Convert and clamp array indices in NIR
Alyssa Rosenzweig [Sun, 18 Sep 2022 15:38:12 +0000 (11:38 -0400)]
agx: Convert and clamp array indices in NIR

..Rather than at backend IR translation time. This is considerably
simpler because we can use the txs lowering instead of special casing
array sizes. Unfortunately it generates worse code, but that gap should
close once nir_opt_preamble is wired in.

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

2 years agopanfrost: Adapt emit_shared_memory for indirect dispatch
Alyssa Rosenzweig [Sun, 18 Sep 2022 23:54:44 +0000 (19:54 -0400)]
panfrost: Adapt emit_shared_memory for indirect dispatch

Indirect dispatch does not actually require any dynamic memory allocation, even
with shared memory. We just need to set wls_instances to some (mostly arbitrary)
value, statically allocate memory based on that, and let the hardware throttle
workgroups to fit if needed.

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

2 years agorusticl: Build Panfrost
Alyssa Rosenzweig [Tue, 21 Jun 2022 20:52:01 +0000 (16:52 -0400)]
rusticl: Build Panfrost

We want OpenCL, too!

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18663>

2 years agomeson,amd: Remove Windows libelf wrap
James Park [Thu, 8 Sep 2022 16:15:00 +0000 (09:15 -0700)]
meson,amd: Remove Windows libelf wrap

Functionality isn't worth the maintenance cost.

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

2 years agodriconf/Intel: Add lower_depth_range_rate option workaround for Homerun Clash misrend...
Illia Polishchuk [Tue, 13 Sep 2022 09:22:33 +0000 (12:22 +0300)]
driconf/Intel: Add lower_depth_range_rate option workaround for Homerun Clash misrendering issue

Intel has different Z interpolation float point rounding
than other mesa gpus
For example gl_Position.z = 0.0 will be interpolated to
gl_FragCoord.z = 0.5 for all gpus

gl_FragCoord = -0.00000001 will be interpolated to
gl_FragCoord.z = 0.4999999702 for Intel
and rounded to gl_FragCoord.z = 0.5 for other gpus

Games with LEQUAL depth func will fail depth test on Intel
and will pass it on other gpus in such case

This workaround lowers translated depth range
and several gl_FragCoord.z coords with extra small difference
will be translated to the same UINT16\UINT24\UINT32
value of an integer depth buffer

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7199

Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18412>