platform/upstream/mesa.git
22 months agomesa: clean up hairy code in state.c: update_program
Marek Olšák [Fri, 25 Nov 2022 18:08:48 +0000 (13:08 -0500)]
mesa: clean up hairy code in state.c: update_program

No change in behavior.

Replace:

if (shader)
   bind(shader);
else
   bind(NULL);

With:

bind(shader);

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

22 months agozink: fix rebase-mistake
Erik Faye-Lund [Wed, 7 Dec 2022 08:27:28 +0000 (09:27 +0100)]
zink: fix rebase-mistake

This should not have re-introduced this lowering, effectively reverting
dcf3ae72abf78e8959c5b5a94ef332c0b7396ab2.

Fixes: 16971cd667b ("zink: add driver-workaround for missing gl_point_size")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20195>

22 months agointel/fs: clamp per vertex input accesses to patchControlPoints
Lionel Landwerlin [Thu, 25 Mar 2021 12:53:32 +0000 (14:53 +0200)]
intel/fs: clamp per vertex input accesses to patchControlPoints

In a tesselation control shader where an input array is accessed using
the index gl_InvocationID, we can end up accessing elements beyond the
number of input vertices specified in the shader key.

This happens because of the lowering in nir_lower_indirect_derefs().
This lowering will affect compact variables which happens in this
case :

  in gl_PerVertex {
      vec4  gl_Position;
      float gl_ClipDistance[1];
  } gl_in[gl_MaxPatchVertices];

The lowered code produced by NIR is somewhat ineffecient (implements a
binary seach) :

  if (gl_InvocationID < 16) {
     if (gl_InvocationID < 8) {
        if (gl_InvocationID < 4) {
          vec4 vals = load_at_offset(0);
          value = bcsel(vals, gl_InvocationID);
        } else {
          vec4 vals = load_at_offset(4);
          value = bcsel(vals, gl_InvocationID - 4);
        }
     } else {
        if (gl_InvocationID < 12) {
          vec4 vals = load_at_offset(8);
          value = bcsel(vals, gl_InvocationID - 8);
        } else {
          vec4 vals = load_at_offset(12);
          value = bcsel(vals, gl_InvocationID - 12);
        }
     }
  } else {
     if (gl_InvocationID < 24) {
        ...
     } else {
        ...
     }
  }

By default the gl_MaxPatchVertices must be set at 32 items and that's
what the lowering code will use to divide the access into chunks of 4.
But when running with 3 input vertices, this means we'll pull one more
item than what was delivered in the shader payload.

This triggers issues further down the register scheduling where the
g5UD (register for the 4th item) is overwritten by a previous SEND,
leading the URB read to use an invalid handle.

This pass clamps any access load_per_vertex_input intrinsic vertex
indice to (input_vertices - 1).

Fixes issues with tests like :
dEQP-VK.clipping.user_defined.clip_distance.vert_tess.*

Also fixes a hang with zink/anv on :
KHR-GL46.draw_elements_base_vertex_tests.AEP_shader_stages

v2: Don't replace source register

v3: Implement in NIR

v4: Clamp per vertex array sizes in NIR (Jason)

v5: Move the clamping on the intel compiler

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

22 months agonir: Use nir_component_mask_t for nir_alu_dst::write_mask
Jason Ekstrand [Wed, 7 Dec 2022 00:26:25 +0000 (18:26 -0600)]
nir: Use nir_component_mask_t for nir_alu_dst::write_mask

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20193>

22 months agoglx: fix xshm check to init xshm_opcode.
Dave Airlie [Tue, 6 Dec 2022 19:11:47 +0000 (05:11 +1000)]
glx: fix xshm check to init xshm_opcode.

Found and proposed by Ray Strode (halfline)

Fixes: 68e89401140d ("glx/drisw: use xcb instead of X to query connection")
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20188>

22 months agozink: don't use defunct custom-flag
Erik Faye-Lund [Tue, 6 Dec 2022 15:16:08 +0000 (16:16 +0100)]
zink: don't use defunct custom-flag

We're no longer respecting this flag, so there's no need in setting it.

Fixes: 00dc0036bb6 ("zink: flatten out buffer creation usage flags codepath")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20183>

22 months agonir: Add missing includes
Konstantin Seurer [Wed, 2 Feb 2022 15:09:32 +0000 (16:09 +0100)]
nir: Add missing includes

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14831>

22 months agovenus: check against the Vulkan type rather than type index.
Dawn Han [Wed, 30 Nov 2022 19:02:40 +0000 (19:02 +0000)]
venus: check against the Vulkan type rather than type index.

Signed-off-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20064>

22 months agovenus: fix deqp tests failed on iub descriptor type
Dawn Han [Tue, 29 Nov 2022 23:31:34 +0000 (23:31 +0000)]
venus: fix deqp tests failed on iub descriptor type

Fixes: abae9d4831b ("Add the iub binding count tracking")

Signed-off-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20064>

22 months agoradv: fix guardband if the polygon mode is points or lines
Samuel Pitoiset [Wed, 30 Nov 2022 07:05:36 +0000 (08:05 +0100)]
radv: fix guardband if the polygon mode is points or lines

If points or lines are drawn using the polygon mode, the guardband
should be adjusted for large points/lines.

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

22 months agotu: Destroy disk_cache during tu_physical_device_finish
Mark Collins [Tue, 6 Dec 2022 09:09:25 +0000 (09:09 +0000)]
tu: Destroy disk_cache during tu_physical_device_finish

While running VK-CTS with valgrind, the application hit the max
thread count of 500. After further investigation, this was due to
multiple instances being created with the disk cache spinning up
worker threads which wouldn't be cleaned as disk_cache_destroy
wasn't being called.

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

22 months agomesa: Add missing dep on generated marshal header in the tests build.
Emma Anholt [Mon, 5 Dec 2022 20:52:51 +0000 (12:52 -0800)]
mesa: Add missing dep on generated marshal header in the tests build.

We lost the race in a recent MR of mine.

Fixes: 381e0b43d617 ("mesa: Add test to prevent windows.h to be included in shared headers")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20170>

22 months agoir3: Disallow `noperspective` texture preloads
Mark Collins [Fri, 18 Nov 2022 07:48:14 +0000 (07:48 +0000)]
ir3: Disallow `noperspective` texture preloads

The `coord_offset` pass is responsible for upgrading any eligible
texture loads into prefetches, but a texture prefetch's capabilities
are limited and cannot handle any interpolation modes aside from
`smooth`.

An exception is carved out for `flat` interpolation modes, but this
doesn't exclude upgrading `noperspective` texture loads and results
in perspective-corrected samples being provided that can severely
break applications depending on this behaviour.

Fixes incorrect lighting projection on Super Mario Odyssey on
Skyline Emulator.

Fixes incorrect dirt texture mapping on Portal 2 trace on Turnip and
Zink on Turnip.

Fixes incorrect lighter shadowing on Half Life 2 trace on Turnip.

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

22 months agoir3: Propagate `coord_offset` result from `alu` src insts
Mark Collins [Mon, 28 Nov 2022 08:35:32 +0000 (08:35 +0000)]
ir3: Propagate `coord_offset` result from `alu` src insts

`coord_offset` is called on the source of `alu` instructions and
it returns -1 for failures, this not explicitly checked for and
as a result the fetch can incorrectly be upgraded to a prefetch
when it isn't appropriate to do so.

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

22 months agoturnip: Initialize *memory on 0-sized alloc early exit.
Emma Anholt [Mon, 5 Dec 2022 22:52:07 +0000 (14:52 -0800)]
turnip: Initialize *memory on 0-sized alloc early exit.

Otherwise, making a CS using the memory will use the uninitialized .map
value (when checking the size of the CS in in begin's tu_cs_is_empty()
check), causing valgrind noise in
dEQP-VK.binding_model.descriptorset_random.sets4.dynindexed.ubolimitlow.sbolimitlow.sampledimghigh.lowimgsingletex.iublimitlow.nouab.vert.noia.0
(thanks to vi_info->vertexBindingDescriptionCount==0).

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

22 months agointel/compiler/mesh: align payload size to the size of vec4
Marcin Ślusarz [Mon, 5 Dec 2022 11:27:38 +0000 (12:27 +0100)]
intel/compiler/mesh: align payload size to the size of vec4

This reduces the number of instructions in task shaders when payload
size is not aligned to vec4 and payload_in_shared WA is enabled,
because nir_lower_task_shader will not need to handle the unaligned
size case.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20080>

22 months agonir/lower_task_shader: fix task payload corruption when shared memory workaround...
Marcin Ślusarz [Wed, 30 Nov 2022 12:47:19 +0000 (13:47 +0100)]
nir/lower_task_shader: fix task payload corruption when shared memory workaround is enabled

We were not taking into account that when all invocations within workgroup
are active, we'll copy more data than needed, corrupting task payload
of other workgroups.

Fixes: 8aff8d3dd42 ("nir: Add common task shader lowering to make the backend's job easier.")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20080>

22 months agoaco: apply NUW to additions for scratch access
Rhys Perry [Thu, 1 Dec 2022 18:04:49 +0000 (18:04 +0000)]
aco: apply NUW to additions for scratch access

fossil-db (navi21):
Totals from 52 (0.04% of 135636) affected shaders:
Instrs: 79036 -> 78567 (-0.59%)
CodeSize: 431188 -> 427984 (-0.74%)
Latency: 1318142 -> 1313821 (-0.33%)
InvThroughput: 293842 -> 292836 (-0.34%)
VClause: 2555 -> 2361 (-7.59%); split: -8.06%, +0.47%
Copies: 8746 -> 8767 (+0.24%); split: -0.11%, +0.35%

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

22 months agoaco: more carefully apply constant offsets into scratch accesses
Rhys Perry [Thu, 1 Dec 2022 15:05:49 +0000 (15:05 +0000)]
aco: more carefully apply constant offsets into scratch accesses

Death stranding does scratch_arr[80-idx]. This doesn't seem to work if we
try to combine the subtraction into the access.

fossil-db (navi21):
Totals from 52 (0.04% of 135636) affected shaders:
Instrs: 78560 -> 79036 (+0.61%)
CodeSize: 427940 -> 431188 (+0.76%)
Latency: 1313809 -> 1318142 (+0.33%)
InvThroughput: 292833 -> 293842 (+0.34%)
VClause: 2361 -> 2555 (+8.22%); split: -0.51%, +8.73%
Copies: 8767 -> 8746 (-0.24%); split: -0.35%, +0.11%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 0e783d687a3 ("aco: use scratch_* for scratch load/store on GFX9+")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7735
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20117>

22 months agoradv/rt: set additions for scratch access as NUW
Rhys Perry [Thu, 1 Dec 2022 20:26:52 +0000 (20:26 +0000)]
radv/rt: set additions for scratch access as NUW

No fossil-db changes.

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

22 months agonir/range_analysis: unsigned upper bound analysis for b2i
Rhys Perry [Thu, 1 Dec 2022 20:22:16 +0000 (20:22 +0000)]
nir/range_analysis: unsigned upper bound analysis for b2i

fossil-db (navi21):
Totals from 93 (0.07% of 135636) affected shaders:
Instrs: 133949 -> 133899 (-0.04%); split: -0.05%, +0.01%
CodeSize: 708124 -> 707528 (-0.08%); split: -0.09%, +0.01%
Latency: 2451564 -> 2450158 (-0.06%); split: -0.06%, +0.00%
InvThroughput: 398282 -> 397345 (-0.24%)
SClause: 4441 -> 4437 (-0.09%); split: -0.18%, +0.09%
Copies: 7578 -> 7546 (-0.42%); split: -0.55%, +0.13%

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

22 months agoci/freedreno: temporarily disable godot-trive on zink+freedreno
David Heidelberg [Tue, 6 Dec 2022 12:25:43 +0000 (13:25 +0100)]
ci/freedreno: temporarily disable godot-trive on zink+freedreno

Test if this trace impact surrounding traces causing rendering changes.

Ref: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7732

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20179>

22 months agoac/llvm: set invariant.load on image loads with ACCESS_CAN_REORDER
Marek Olšák [Sun, 4 Dec 2022 11:32:19 +0000 (06:32 -0500)]
ac/llvm: set invariant.load on image loads with ACCESS_CAN_REORDER

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

22 months agoac/llvm: inline ac_get_load_intr_attribs
Marek Olšák [Sun, 4 Dec 2022 11:25:55 +0000 (06:25 -0500)]
ac/llvm: inline ac_get_load_intr_attribs

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

22 months agoac/llvm: rename attribute enums
Marek Olšák [Sun, 4 Dec 2022 11:19:56 +0000 (06:19 -0500)]
ac/llvm: rename attribute enums

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

22 months agoac/llvm: use invariant.load metadata on load intrinsics instead of readnone
Marek Olšák [Sun, 4 Dec 2022 11:14:10 +0000 (06:14 -0500)]
ac/llvm: use invariant.load metadata on load intrinsics instead of readnone

readnone is illegal now and we should be using invariant.load since LLVM 15.
(suggested by Nicolai)

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

22 months agoac/llvm: don't set "readnone" on non-memory intrinsics
Marek Olšák [Sun, 4 Dec 2022 11:00:15 +0000 (06:00 -0500)]
ac/llvm: don't set "readnone" on non-memory intrinsics

It's illegal and LLVM always knows which intrinsics don't read memory.
This started failing IR validation with LLVM 16.

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

22 months agoac/llvm: don't set "convergent" on intrinsics where it's automatic
Marek Olšák [Sun, 4 Dec 2022 10:22:48 +0000 (05:22 -0500)]
ac/llvm: don't set "convergent" on intrinsics where it's automatic

LLVM adds the flag automatically.

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

22 months agoac/llvm: simplify how function attributes are set
Marek Olšák [Sun, 4 Dec 2022 11:07:32 +0000 (06:07 -0500)]
ac/llvm: simplify how function attributes are set

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

22 months agoac/llvm: simplify how call attributes are set
Marek Olšák [Sun, 4 Dec 2022 09:23:00 +0000 (04:23 -0500)]
ac/llvm: simplify how call attributes are set

set them directly in ac_build_intrinsic, the only place that sets them

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

22 months agoac/llvm: remove illegal function attributes READONLY and WRITEONLY
Marek Olšák [Sun, 4 Dec 2022 09:30:16 +0000 (04:30 -0500)]
ac/llvm: remove illegal function attributes READONLY and WRITEONLY

They are only legal on parameters.

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

22 months agogallivm: remove illegal and unused function attributes
Marek Olšák [Sun, 4 Dec 2022 09:13:30 +0000 (04:13 -0500)]
gallivm: remove illegal and unused function attributes

READONLY is illegal on calls. Others were unused.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20146>

22 months agogallivm: remove unused LP_FUNC_ATTR_LEGACY
Marek Olšák [Sun, 4 Dec 2022 06:37:46 +0000 (01:37 -0500)]
gallivm: remove unused LP_FUNC_ATTR_LEGACY

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20146>

22 months agogallivm: remove unused LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY
Marek Olšák [Sun, 4 Dec 2022 06:36:44 +0000 (01:36 -0500)]
gallivm: remove unused LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY

LLVM 16 removed it anyway.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20146>

22 months agoac/llvm: remove unused AC_FUNC_ATTR_LEGACY
Marek Olšák [Sun, 4 Dec 2022 06:35:33 +0000 (01:35 -0500)]
ac/llvm: remove unused AC_FUNC_ATTR_LEGACY

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

22 months agoac/llvm: remove AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY because LLVM 16 removed it
Marek Olšák [Sun, 4 Dec 2022 06:33:33 +0000 (01:33 -0500)]
ac/llvm: remove AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY because LLVM 16 removed it

We didn't use it reasonably anyway.

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

22 months agozink: add driver-workaround for missing gl_point_size
Igor Torrente [Tue, 29 Nov 2022 13:50:56 +0000 (10:50 -0300)]
zink: add driver-workaround for missing gl_point_size

Add code to support gl_point lowering.

In this commit the target of this lowering will be only the
imagination proprietary driver.

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

22 months agozink: rename `zink_set_line_stipple_keys`
Igor Torrente [Tue, 29 Nov 2022 14:40:50 +0000 (11:40 -0300)]
zink: rename `zink_set_line_stipple_keys`

This function will be used by another primitive emulation and
a more generic name will be needed.

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

22 months agozink: add gl_point lowering pass
Igor Torrente [Thu, 1 Dec 2022 12:41:48 +0000 (09:41 -0300)]
zink: add gl_point lowering pass

This lowering pass is intended for hardwares/drivers that can't honor
the gl_PointSize when GL_PROGRAM_POINT_SIZE is enabled.

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

23 months agollvmpipe: Faithfully honour pipe_rasterizer_state::rasterizer_discard flag.
Jose Fonseca [Mon, 5 Dec 2022 10:29:28 +0000 (10:29 +0000)]
llvmpipe: Faithfully honour pipe_rasterizer_state::rasterizer_discard flag.

D3D10 established that rasterization should be discarded when a null PS was
bound, and depth/stencil state was disabled, and llvmpipe followed those
semantics.  Nowadays all APIs have explicit rasterization discard flag,
and so does Gallium, so it's better for llvmpipe to faithfully follow
that flag, and trust the state tracker to follow the right semantics.

Second guessing pipe_rasterizer_state::rasterizer_discard actually
causes problems, specially when no depth-stencil surface is bound, as
D3D10 mandates rasterization should still happen, yet among all the
translation layers it often happens depth-stencil enablement is
optimized away when no depth-stencil is bound, which in turn was causing
llvmpipe to disable rasterization when it shouldn't.

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

23 months agonir: Recognize empty shaders in nir_tgsi_scan_shader().
Jose Fonseca [Mon, 5 Dec 2022 10:28:15 +0000 (10:28 +0000)]
nir: Recognize empty shaders in nir_tgsi_scan_shader().

When a null PS is bound, the
pipe_query_data_pipeline_statistics::ps_invocations counter should not
be incremented.

However llvmpipe can't cope with a null PS bound, requiring the state
tracker to bind an empty pixel shader instead.  llvmpipe infers empty
TGSI pixel shaders by looking tgsi_shader_info::num_instructions, as an
empty shader should have a single END instruction, but this logic wasn't
working for NIR shaders.

I mulled over the possibility of making llvmpipe handle null pixel
shaders.  Spreading null checks everywhere would be invasive and error
prone, but it would be quite simple if llvmpipe simply created a dummy
PS internally, to be used as a replacement whenever a null PS was bound.
That said, I'm not sure if other gallium drivers can cope with a null PS
neither, and if nought, might as well keep using an empty PS in lavapipe
state tracker.  An any rate, this change makes sense on its own.

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

23 months agozink: do not lower gs-intrinscs, take two
Erik Faye-Lund [Tue, 6 Dec 2022 07:52:44 +0000 (08:52 +0100)]
zink: do not lower gs-intrinscs, take two

Whoops, I missed a spot!

Fixes: ad26d29adcc ("zink: do not lower gs-intrinsics")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20177>

23 months agoradv: use LATE_Z for depth/stencil attachments used in feedback loops
Samuel Pitoiset [Mon, 14 Nov 2022 14:33:48 +0000 (15:33 +0100)]
radv: use LATE_Z for depth/stencil attachments used in feedback loops

To make sure shader invocations read the correct values.

Fixes dEQP-VK.rasterization.rasterization_order_attachment_access.*.samples_*.multi_draw_barriers

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

23 months agoradv: apply register changes for SQTT on GFX11
Samuel Pitoiset [Thu, 1 Dec 2022 07:51:43 +0000 (08:51 +0100)]
radv: apply register changes for SQTT on GFX11

Based on the register db, most of them moved.

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

23 months agozink: do not lower gs-intrinsics
Erik Faye-Lund [Mon, 5 Dec 2022 14:25:55 +0000 (15:25 +0100)]
zink: do not lower gs-intrinsics

We don't use the counters for anything useful, so let's drop this
lowering pass.

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

23 months agonir: fix nir_link_varying_precision
Chia-I Wu [Thu, 1 Dec 2022 19:17:04 +0000 (11:17 -0800)]
nir: fix nir_link_varying_precision

link_varyings ignores precisions and can assign the same location to
variables with different precisions.  nir_link_varying_precision should
check location_frac as well.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20113>

23 months agoturnip: fix dynamic logicop state
Chia-I Wu [Fri, 2 Dec 2022 02:34:23 +0000 (18:34 -0800)]
turnip: fix dynamic logicop state

When a pipeline has dynamic logicop state or blend state, we defer lrz
write decision to tu6_calculate_lrz_state.  As such,
tu6_calculate_lrz_state should look at both states when either of them
is dynamic.

Fixes dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.21 on
angle, which uses dynamic logicop state and static blend state with
blending enabled.

Fixes: c8c7154c2ec ("tu: Implement extendedDynamicState3ColorBlendEnable")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20136>

23 months agoanv: Don't ambiguate for undefined layouts on TGL+
Nanley Chery [Wed, 30 Nov 2022 23:02:14 +0000 (15:02 -0800)]
anv: Don't ambiguate for undefined layouts on TGL+

For Tiger Lake and onward, we generally don't need to ambiguate the CCS
before accessing it. This is safe for two reasons:

- Tiger Lake and onward treat all CCS values as legal.
- We enable compression on all writable image layouts. The CCS will
  receive all writes and will therefore always be valid.

When dealing with modifiers, we continue to allow ambiguates in some
instances.

Before this patch, I found ~19.5k ambiguates in Wolfenstein:
Youngblood's Riverside benchmark (note that this includes manually
entering the benchmark and exiting the app). With this patch, the number
of ambiguates goes down to zero.

Improves performance of Fallout 4 at 1080p/High settings on Arc A380 by
around 22%.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20118>

23 months agoanv: Move aux vars up in transition_color_buffer
Nanley Chery [Wed, 30 Nov 2022 23:57:16 +0000 (15:57 -0800)]
anv: Move aux vars up in transition_color_buffer

I'd like to reuse one of them for an assert.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20118>

23 months agointel/dev: Add a has_illegal_ccs_values flag
Nanley Chery [Wed, 30 Nov 2022 22:47:47 +0000 (14:47 -0800)]
intel/dev: Add a has_illegal_ccs_values flag

Whether or not CCS can be used without initialization depends on the
platform:

- On gfx7-8, each CCS element is 1-bit and encodes "fast-cleared" or
  "pass-through". So, those platforms have no illegal values.

- On gfx9-11, each CCS element is 2-bits and some bit combinations
  are invalid.

- On gfx12+, each CCS element is 4-bits but they have no truly illegal
  values. Unused encodings are interpreted as "pass-through".

Refer to the "MCS/CCS Buffers for Render Target(s)" sections of the
PRMs for more info.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20118>

23 months agoanv: Use specific flush reasons for CCS operations
Nanley Chery [Wed, 30 Nov 2022 21:50:57 +0000 (13:50 -0800)]
anv: Use specific flush reasons for CCS operations

When INTEL_DEBUG=pc is set and a CCS operation is being performed, the
driver reports that flushes are happing before and after the operation.
It also reports that the operation is a fast clear, but that's not
always the case. We could be resolving for example.

Reporting the specific operation can help avoid confusion.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20118>

23 months agointel: add missing restriction on fragment simd dispatch
Lionel Landwerlin [Mon, 5 Dec 2022 18:27:59 +0000 (20:27 +0200)]
intel: add missing restriction on fragment simd dispatch

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7755
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Tested-by: Mark Janes <markjanes@swizzler.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20169>

23 months agointel: factor out dispatch PS enabling logic
Lionel Landwerlin [Mon, 5 Dec 2022 17:26:40 +0000 (19:26 +0200)]
intel: factor out dispatch PS enabling logic

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Tested-by: Mark Janes <markjanes@swizzler.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20169>

23 months agoci/i915: Update xfails.
Emma Anholt [Mon, 5 Dec 2022 20:20:06 +0000 (12:20 -0800)]
ci/i915: Update xfails.

Some things have drifted since we were last green.

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

23 months agoi915: Fix probing regression.
Emma Anholt [Mon, 5 Dec 2022 19:18:55 +0000 (11:18 -0800)]
i915: Fix probing regression.

The device id was incorrectly getting passed as a pointer-to-pointer, and
also assert's expression doesn't get called on release builds.

Fixes: dfd20f002f38 ("intel: Add and use intel_gem_get_param()")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20166>

23 months agoegl+glx: Always support no_error contexts.
Emma Anholt [Tue, 29 Nov 2022 20:39:00 +0000 (12:39 -0800)]
egl+glx: Always support no_error contexts.

Since we know we're loading this Mesa build, we know that no_error is
always supported (the renderer query always returned true).

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agoegl: Collapse a bunch of renderer queries into pipe cap queries.
Emma Anholt [Tue, 29 Nov 2022 20:32:29 +0000 (12:32 -0800)]
egl: Collapse a bunch of renderer queries into pipe cap queries.

Now that we can access the pipe screen through the dri_screen, we can skip
some indirection.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agoegl: Pull the API mask directly out of the dri_screen.
Emma Anholt [Tue, 29 Nov 2022 20:15:12 +0000 (12:15 -0800)]
egl: Pull the API mask directly out of the dri_screen.

Now that we know the driver on the other side is the same version of Mesa
as our build, we can just access the screen instead of having accessor
functions.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agodri: Add createContext hook to __DRI_MESA.
Emma Anholt [Tue, 29 Nov 2022 20:04:21 +0000 (12:04 -0800)]
dri: Add createContext hook to __DRI_MESA.

Again, reduces switching on driver type in the loader.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agogallium/dri: Move the backendVtable InitScreen func into __DRI_MESA.
Emma Anholt [Tue, 29 Nov 2022 19:34:34 +0000 (11:34 -0800)]
gallium/dri: Move the backendVtable InitScreen func into __DRI_MESA.

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

23 months agodri: Add createNewScreen into the __DRI_MESA extension.
Emma Anholt [Tue, 29 Nov 2022 18:39:52 +0000 (10:39 -0800)]
dri: Add createNewScreen into the __DRI_MESA extension.

Now the loaders don't have to switch on dri2/dri3/swrast.

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

23 months agogallium/dri: Clarify some "extensions" lists in driCreateNewScreen2.
Emma Anholt [Tue, 29 Nov 2022 18:48:25 +0000 (10:48 -0800)]
gallium/dri: Clarify some "extensions" lists in driCreateNewScreen2.

I was having a hard time keeping track of them all.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agodri: Introduce internal Mesa DRI driver loader extension.
Emma Anholt [Mon, 28 Nov 2022 20:50:59 +0000 (12:50 -0800)]
dri: Introduce internal Mesa DRI driver loader extension.

All DRI loaders in Mesa (EGL, GLX, gbm) now require this ext and that the
driver come from a matching build.  This will let us use Mesa-internal
types and enums across the loader-driver bounary inside of Mesa.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
LOL-YESed-by: Kristian Høgsberg <krh@bitplanet.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agogbm: Refactor screen creation a bit.
Emma Anholt [Tue, 29 Nov 2022 19:16:49 +0000 (11:16 -0800)]
gbm: Refactor screen creation a bit.

A lot of the screen creation path was duplicated between swrast and dri2.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agogbm: Drop redundant extension error checks.
Emma Anholt [Tue, 29 Nov 2022 19:09:05 +0000 (11:09 -0800)]
gbm: Drop redundant extension error checks.

loader_bind_extensions error handling has already made sure these are
present.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agogallium/dri: Use loader_bind_extensions().
Emma Anholt [Tue, 29 Nov 2022 06:25:52 +0000 (22:25 -0800)]
gallium/dri: Use loader_bind_extensions().

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agoegl: Switch to using loader_bind_extensions().
Emma Anholt [Tue, 29 Nov 2022 01:08:04 +0000 (17:08 -0800)]
egl: Switch to using loader_bind_extensions().

Slightly different than our dri2_bind_extensions(), but same idea.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agoglx: Use loader_bind_extensions().
Emma Anholt [Tue, 29 Nov 2022 00:44:28 +0000 (16:44 -0800)]
glx: Use loader_bind_extensions().

This adds more consistent logging on failure and gives us a spot for
version checks.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agoloader: Simplify the extension matching logic.
Emma Anholt [Tue, 29 Nov 2022 00:28:21 +0000 (16:28 -0800)]
loader: Simplify the extension matching logic.

Also, add debug logging for missing optional extensions.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agogbm: Promote dri_bind_extensions() to the loader util library.
Emma Anholt [Tue, 29 Nov 2022 00:21:05 +0000 (16:21 -0800)]
gbm: Promote dri_bind_extensions() to the loader util library.

It's better than EGL's copy of it by having optional ext support in the
match structs, and GLX wishes it had either of the two.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>

23 months agoradv: Add missing radeon_check_space() in radv_cmd_buffer_after_draw()
Konstantin Seurer [Sun, 4 Dec 2022 12:47:17 +0000 (13:47 +0100)]
radv: Add missing radeon_check_space() in radv_cmd_buffer_after_draw()

Also adds a missing assert that cdw <= cdw_max.

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

23 months agoradv: Use wave32 for ray queries inside compute shaders
Konstantin Seurer [Sat, 3 Dec 2022 15:48:03 +0000 (16:48 +0100)]
radv: Use wave32 for ray queries inside compute shaders

Results in a 6% performance improvement with Quake II RTX.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20143>

23 months agofrontends/va: return proper error for unsupported profile
Boyuan Zhang [Fri, 2 Dec 2022 12:45:13 +0000 (07:45 -0500)]
frontends/va: return proper error for unsupported profile

Return VA_STATUS_ERROR_UNSUPPORTED_PROFILE if given profile is not
supported for both decode and encode.

Return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT if given profile is
supported (for at lease one of decode or encode), but current given
entrypoint is not supported.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20082>

23 months agoaco: fix missing uses of MRT output flags
Samuel Pitoiset [Mon, 5 Dec 2022 10:34:40 +0000 (11:34 +0100)]
aco: fix missing uses of MRT output flags

Fixes regressions on GFX6 and the RAGE2 workaround.

Fixes: a297ac10a4e ("radv,aco: stop lowering FS outputs in NIR")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20154>

23 months agopvr: Add empty PDS program
Matt Coster [Fri, 4 Nov 2022 17:25:33 +0000 (17:25 +0000)]
pvr: Add empty PDS program

This is a trivial program to accomplish allocation of local/common
store shared registers, used when no actual program is available or
required.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20130>

23 months agopvr: Add pvr_pds_compute_shader_program_init()
Matt Coster [Fri, 4 Nov 2022 17:24:01 +0000 (17:24 +0000)]
pvr: Add pvr_pds_compute_shader_program_init()

Some fields are to be initialized to a specific non-zero value if
unused; this inline function takes care of that.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20130>

23 months agopvr: Use util_dynarray_append_dynarray()
Matt Coster [Thu, 1 Dec 2022 16:59:51 +0000 (16:59 +0000)]
pvr: Use util_dynarray_append_dynarray()

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18904>

23 months agoradv: do not set ZPASS_INCREMENT_DISABLE on GFX11
Samuel Pitoiset [Wed, 30 Nov 2022 17:28:49 +0000 (18:28 +0100)]
radv: do not set ZPASS_INCREMENT_DISABLE on GFX11

This field no longer exists.

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

23 months agoradv: fix SPI_SHADER_Z_FORMAT for alpha-to-coverage via MRTZ on GFX11
Samuel Pitoiset [Fri, 2 Dec 2022 07:29:35 +0000 (08:29 +0100)]
radv: fix SPI_SHADER_Z_FORMAT for alpha-to-coverage via MRTZ on GFX11

It should select a 32-bit format with alpha.

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

23 months agoradv,aco: stop lowering FS outputs in NIR
Samuel Pitoiset [Fri, 2 Dec 2022 08:24:17 +0000 (09:24 +0100)]
radv,aco: stop lowering FS outputs in NIR

This was a bad idea because:
- it diverges too much with the fragment shader epilog
- it doesn't allow to implement alpha-to-coverage via MRTZ correctly
- it was supposed to be used by LLVM but this never happened

Reverting this back allows us to fix alpha-to-coverage via MRTZ
on GFX11 easily, including for fragment shader epilogs.

fossils-db (NAVI21):
Totals from 20411 (15.13% of 134913) affected shaders:
VGPRs: 972056 -> 971400 (-0.07%); split: -0.08%, +0.01%
CodeSize: 92284804 -> 92295392 (+0.01%); split: -0.05%, +0.06%
MaxWaves: 465010 -> 465166 (+0.03%); split: +0.03%, -0.00%
Instrs: 17034162 -> 17034963 (+0.00%); split: -0.00%, +0.01%
Latency: 252013190 -> 251971764 (-0.02%); split: -0.03%, +0.02%
InvThroughput: 45859625 -> 45842556 (-0.04%); split: -0.04%, +0.01%
VClause: 324627 -> 324629 (+0.00%); split: -0.03%, +0.03%
SClause: 672918 -> 672826 (-0.01%); split: -0.05%, +0.04%
Copies: 1172126 -> 1158152 (-1.19%); split: -1.20%, +0.01%
Branches: 420602 -> 420604 (+0.00%); split: -0.00%, +0.00%
PreSGPRs: 1025441 -> 1025481 (+0.00%)
PreVGPRs: 861787 -> 860650 (-0.13%); split: -0.17%, +0.03%

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

23 months agoaco: fix indexing MRT0 alpha channel for alpha-to-coverage via MRTZ on GFX11
Samuel Pitoiset [Fri, 2 Dec 2022 08:32:47 +0000 (09:32 +0100)]
aco: fix indexing MRT0 alpha channel for alpha-to-coverage via MRTZ on GFX11

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

23 months agoaco: always use 32-bit for exporting alpha-to-coverage via MRTZ on GFX11
Samuel Pitoiset [Fri, 2 Dec 2022 08:20:58 +0000 (09:20 +0100)]
aco: always use 32-bit for exporting alpha-to-coverage via MRTZ on GFX11

16-bit isn't possible. Note that this is currently style broken for
compressed formats because the w channel is never written to.

Ported from RadeonSI ('radeonsi/gfx11: fix alpha-to-coverage with
stencil or samplemask export')

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

23 months agoradv: fix emitting invalid color attachments
Samuel Pitoiset [Fri, 2 Dec 2022 10:39:52 +0000 (11:39 +0100)]
radv: fix emitting invalid color attachments

Note sure how this happened.

Fixes: 97dc28b1776 ("radv: fix configuring COLOR_INVALID on GFX11")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20127>

23 months agor600/sfn: Silence warning for unused parameters in override
Gert Wollny [Fri, 2 Dec 2022 14:34:56 +0000 (15:34 +0100)]
r600/sfn: Silence warning for unused parameters in override

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

23 months agor600/sfn: Allow more copy-propagation into TEX src
Gert Wollny [Wed, 30 Nov 2022 19:22:17 +0000 (20:22 +0100)]
r600/sfn: Allow more copy-propagation into TEX src

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

23 months agor600/sfn: use only as many components as needed for tex backend coord
Gert Wollny [Wed, 30 Nov 2022 17:54:00 +0000 (18:54 +0100)]
r600/sfn: use only as many components as needed for tex backend coord

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

23 months agor600/sfn: drop useless const specifier in return value
Gert Wollny [Wed, 30 Nov 2022 16:46:25 +0000 (17:46 +0100)]
r600/sfn: drop useless const specifier in return value

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

23 months agor600/sfn: simplify if clauses with empty then branch
Gert Wollny [Wed, 30 Nov 2022 16:06:25 +0000 (17:06 +0100)]
r600/sfn: simplify if clauses with empty then branch

nir_opt_if doesn't catch all the possible cases of empty then branches,
so resolve this on the fly when creating the backend IR.

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

23 months agor600/sfn: legalize image acccess on Cayman
Gert Wollny [Wed, 30 Nov 2022 14:25:35 +0000 (15:25 +0100)]
r600/sfn: legalize image acccess on Cayman

If we access non-existing images Cayman hardware may lock up
and trigger a reset that is not always successful. Therefore,
make sure the images access is legal.

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

23 months agor600/sfn: use three channels only for unary trans opts if possible
Gert Wollny [Tue, 29 Nov 2022 12:36:37 +0000 (13:36 +0100)]
r600/sfn: use three channels only for unary trans opts if possible

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

23 months agor600/sfn: lower-to-scalar in optimization loop
Gert Wollny [Tue, 29 Nov 2022 09:22:10 +0000 (10:22 +0100)]
r600/sfn: lower-to-scalar in optimization loop

This makes sure that no vector ops are left over

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

23 months agor600/sfn: Fix scheduling with limited channel availability
Gert Wollny [Mon, 28 Nov 2022 18:02:41 +0000 (19:02 +0100)]
r600/sfn: Fix scheduling with limited channel availability

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

23 months agor600/sfn: Don't copy propagate using non-allocated dest channel
Gert Wollny [Mon, 28 Nov 2022 18:01:23 +0000 (19:01 +0100)]
r600/sfn: Don't copy propagate using non-allocated dest channel

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

23 months agor300: improve conversion to native swizzles
Pavel Ondračka [Thu, 24 Nov 2022 19:53:18 +0000 (20:53 +0100)]
r300: improve conversion to native swizzles

Don't add extra movs to construct the swizzles, but just split the
instruction into separate channels, if possible. Idea by Filip Gawin.

shader-db for RV370:
total instructions in shared programs: 84632 -> 83565 (-1.26%)
instructions in affected programs: 12613 -> 11546 (-8.46%)
helped: 295
HURT: 8

total temps in shared programs: 12437 -> 12237 (-1.61%)
temps in affected programs: 1807 -> 1607 (-11.07%)
helped: 153
HURT: 20

LOST:   1
GAINED: 19

The HURT instructions and the single lost shaders are some fluctuations
from pair scheduling. The number of instructions before pair scheduling
is always lower or equivalent.

Partial fix for: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6339

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Tested-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20009>

23 months agor300: doublecheck for free alpha source when coventing to alpha
Pavel Ondračka [Fri, 25 Nov 2022 09:02:32 +0000 (10:02 +0100)]
r300: doublecheck for free alpha source when coventing to alpha

For any instruction that can be reasonably converted to alpha we check
all of its readers to see if the conversion is possible (including check
for at least one free alpha source) at the beginning of pair scheduling.
However, if the reader instruction has multiples sources that could be
converted to alpha and multiple indeed are, than we could run of of the
alpha sources eventually. So recheck just before converting that there
are still some unused sources left.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Tested-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20009>

23 months agoradeonsi: fix a regression causing GPU hang with GLCTS using streamout
Marek Olšák [Sun, 4 Dec 2022 07:47:45 +0000 (02:47 -0500)]
radeonsi: fix a regression causing GPU hang with GLCTS using streamout

Move the streamout code into the streamout-only branch. The code must be
guarded by si_shader_uses_streamout(). Using xfb_stride is not enough.

Fixes: 003cbddfee3 - radeonsi: use native shader info when init streamout args

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20147>

23 months agodzn: Don't crash when libd3d12.so can't be found
Jan Alexander Steffens (heftig) [Sun, 4 Dec 2022 00:21:45 +0000 (00:21 +0000)]
dzn: Don't crash when libd3d12.so can't be found

`dzn_instance_create` will call `dzn_instance_destroy` when the d3d12
library fails to load. Just like the issue in `d3d12_screen`, this will
lead to a crash because `d3d12_mod` is NULL.

To fix this, only close the library after if it was actually opened.

Cc: mesa-stable
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20145>

23 months agod3d12: Don't crash when libd3d12.so can't be found
Jan Alexander Steffens (heftig) [Sun, 4 Dec 2022 00:17:57 +0000 (00:17 +0000)]
d3d12: Don't crash when libd3d12.so can't be found

`d3d12_destroy_screen` is called by `d3d12_create_dxcore_screen` after
`d3d12_init_screen_base` fails and attempts to call `util_dl_close` on
a NULL pointer, leading to an abort.

To fix this, only close the library after if it was actually opened.

Cc: mesa-stable
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20145>

23 months agoradeonsi: fix ngg lds base load intrinsic llvm implementation
Qiang Yu [Sat, 3 Dec 2022 14:19:37 +0000 (22:19 +0800)]
radeonsi: fix ngg lds base load intrinsic llvm implementation

Otherwise we get llvm assertion.

Fixes: 7e1b804992d ("radeonsi: implement two lds base load intrinsics")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20142>

23 months agoanv: Defer flushing PIPE_CONTROL bits forbidden in CCS while in GPGPU mode
Sviatoslav Peleshko [Wed, 30 Nov 2022 05:05:51 +0000 (07:05 +0200)]
anv: Defer flushing PIPE_CONTROL bits forbidden in CCS while in GPGPU mode

Fixes: 313aeee8 ("anv: Use pending pipe control mechanism in flush_pipeline_select()
")

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7816
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/20124>