platform/upstream/mesa.git
17 months agointel/compiler: Fold constants after distributing source modifiers
Kenneth Graunke [Thu, 4 May 2023 07:55:42 +0000 (00:55 -0700)]
intel/compiler: Fold constants after distributing source modifiers

This can generate things like fneg! of load_const, which is silly.
Fold those away into an actual constant.  Only do so on the scalar
backend because there's a comment above that the vec4 backend doesn't
want any new constants this late, and I'm inclined to believe it.

fossil-db stats show a very minor improvement:

   Totals:
   Instrs: 203091223 -> 203091099 (-0.00%); split: -0.00%, +0.00%
   Cycles: 14410638075 -> 14410577067 (-0.00%); split: -0.00%, +0.00%

   Totals from 20 (0.00% of 665070) affected shaders:
   Instrs: 27067 -> 26943 (-0.46%); split: -0.47%, +0.01%
   Cycles: 2687958 -> 2626950 (-2.27%); split: -2.27%, +0.00%

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22881>

17 months agovenus: enable sparse binding properties
Juston Li [Thu, 27 Apr 2023 21:04:25 +0000 (14:04 -0700)]
venus: enable sparse binding properties

signed-off-by: Juston Li <justonli@google.com>

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

17 months agovenus: enable sparse binding features
Juston Li [Thu, 20 Apr 2023 19:48:10 +0000 (12:48 -0700)]
venus: enable sparse binding features

Enable sparse binding now that vkQueueBindSparse works with feedback.

If a device only has queue families with exclusive sparse binding
support then disable sparse binding.

Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22616>

17 months agovenus: add back sparse binding support
Juston Li [Thu, 20 Apr 2023 18:42:35 +0000 (11:42 -0700)]
venus: add back sparse binding support

Add back support for vkQueueBindSparse that works with fence and timeline
semaphore feedback.

For each vkQueueBindSparse batch, if it contains feedback then move the
signal operations to a subsequent vkQueueSubmit with feedback cmds.

This requires queue families that support vkQueueSubmit alongside sparse
binding support so any queue familes that exclusively support sparse
binding will be filtered out.

Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22616>

17 months agovenus: add helper function support for VkBindSparseInfo
Juston Li [Wed, 19 Apr 2023 19:03:26 +0000 (12:03 -0700)]
venus: add helper function support for VkBindSparseInfo

add getter/setters for VkBindSparseInfo so we can at least share
vn_queue_submission_prepare() to handle external semaphores and
check for fence/semaphore feedback

Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22616>

17 months agovenus: filter out queue familes with exclusive sparse binding support
Juston Li [Thu, 20 Apr 2023 21:36:53 +0000 (14:36 -0700)]
venus: filter out queue familes with exclusive sparse binding support

We require the queue to have additional support to be able to send
feedback commands.

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

17 months agoac/nir/cull: fix line position w culling
Qiang Yu [Fri, 5 May 2023 03:04:35 +0000 (11:04 +0800)]
ac/nir/cull: fix line position w culling

Fixes: db0e9d3caba ("ac/nir/ngg: support line culling")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8950
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/22867>

17 months agozink: fix uncached memory readback
Mike Blumenkrantz [Mon, 8 May 2023 19:06:55 +0000 (15:06 -0400)]
zink: fix uncached memory readback

the inner conditional here didn't include uncached readback, meaning
that many (most?) buffers allocated with uncached memory (i.e., BAR) were
being read back directly instead of using staging resources to be faster

at some point this inner conditional should be reevaluated to determine
whether it still does anything, but this is not that time

fixes, among other things, loading in DOOM2016 on some GPUs

Fixes: 52f27cda05b ("zink: allow direct memory mapping for any COHERENT+CACHED buffer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22907>

17 months agozink: block batching of unordered barriers if previous usage was write
Mike Blumenkrantz [Mon, 8 May 2023 23:19:04 +0000 (19:19 -0400)]
zink: block batching of unordered barriers if previous usage was write

in the case where a cmdbuf was submitted with write access and the subsequent
batch promotes an op to unordered, it's important for associated barriers
to happen-before those ops to guarantee synchronization

the fixes tag is wrong on this, but it's all in the same release

Fixes: bf0af0f8ede ("zink: move all barrier-related functions to c++")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22907>

17 months agozink: disable batched unordered barries with ZINK_DEBUG=noreorder
Mike Blumenkrantz [Mon, 8 May 2023 23:19:04 +0000 (19:19 -0400)]
zink: disable batched unordered barries with ZINK_DEBUG=noreorder

another improvement for debugging

Fixes: bf0af0f8ede ("zink: move all barrier-related functions to c++")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22907>

17 months agozink: flush INDIRECT_BUFFER mem barrier for compute
Mike Blumenkrantz [Mon, 8 May 2023 21:25:17 +0000 (17:25 -0400)]
zink: flush INDIRECT_BUFFER mem barrier for compute

this is usable in gfx and compute, so don't desync

Fixes: 3674839d110 ("zink: batch mem barrier hooks")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22907>

17 months agozink: unbind the ssbo slot being iterated, not the index of the buffer
Mike Blumenkrantz [Mon, 8 May 2023 20:31:58 +0000 (16:31 -0400)]
zink: unbind the ssbo slot being iterated, not the index of the buffer

this otherwise breaks ssbo binding

cc: mesa-stable

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

17 months agozink: use an intermediate variable for binding ssbo slots
Mike Blumenkrantz [Mon, 8 May 2023 20:31:18 +0000 (16:31 -0400)]
zink: use an intermediate variable for binding ssbo slots

this makes the bug more obvious

cc: mesa-stable

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

17 months agozink: delete unnecessary pipeline stage flags from inference
Mike Blumenkrantz [Mon, 8 May 2023 20:15:15 +0000 (16:15 -0400)]
zink: delete unnecessary pipeline stage flags from inference

I added these for completeness, but zink will never use them

cc: mesa-stable

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

17 months agozink: add PERSISTENT for db buffer maps
Mike Blumenkrantz [Mon, 8 May 2023 19:14:14 +0000 (15:14 -0400)]
zink: add PERSISTENT for db buffer maps

Fixes: 13c6ad0038a ("zink: use a single descriptor buffer for all non-bindless types")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22907>

17 months agozink: delete persistent map tracking
Mike Blumenkrantz [Mon, 8 May 2023 19:23:10 +0000 (15:23 -0400)]
zink: delete persistent map tracking

this was never needed and never did anything: zink only uses COHERENT
memory, which is always available on queue submission, so it was all
just pointless code

cc: mesa-stable

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

17 months agomicrosoft/compiler: Avoid integer divides by 0
Jesse Natalie [Mon, 1 May 2023 23:43:05 +0000 (16:43 -0700)]
microsoft/compiler: Avoid integer divides by 0

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

17 months agospirv2dxil: Lower large temps to scratch
Jesse Natalie [Mon, 1 May 2023 23:18:22 +0000 (16:18 -0700)]
spirv2dxil: Lower large temps to scratch

WARP has a temp register limit, and the control flow needed to convert
indirect to direct accesses on large temps ends up bloating shaders massively.
We can just go ahead and spill these large temps to scratch, which maps
to an alloca in DXIL.

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

17 months agodzn: Use A4B4G4R4 instead of B4G4R4A4 when available
Jesse Natalie [Thu, 20 Apr 2023 16:27:09 +0000 (09:27 -0700)]
dzn: Use A4B4G4R4 instead of B4G4R4A4 when available

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

17 months agozink: stringify unsupported prim restart log error
Mike Blumenkrantz [Fri, 28 Apr 2023 13:55:13 +0000 (09:55 -0400)]
zink: stringify unsupported prim restart log error

cc: mesa-stable

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

17 months agozink: allow vk 1.2 timelineSemaphore feature if extension isn't supported
Mike Blumenkrantz [Fri, 28 Apr 2023 13:50:28 +0000 (09:50 -0400)]
zink: allow vk 1.2 timelineSemaphore feature if extension isn't supported

this is a weird case but whatever

cc: mesa-stable

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

17 months agoci/windows: Pick up WARP 1.0.6 NuGet with lots of dzn fixes
Jesse Natalie [Mon, 8 May 2023 21:50:06 +0000 (14:50 -0700)]
ci/windows: Pick up WARP 1.0.6 NuGet with lots of dzn fixes

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

17 months agofrontend/nine: Add debug driconf var force_features_emulation
Axel Davy [Sat, 22 Apr 2023 13:09:46 +0000 (15:09 +0200)]
frontend/nine: Add debug driconf var force_features_emulation

This is useful to debug drivers to be able to
disable all specific d3d9 features and always trigger
the emulated path.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Fix shader cap test for POSITIONT
Axel Davy [Sat, 22 Apr 2023 13:08:19 +0000 (15:08 +0200)]
frontend/nine: Fix shader cap test for POSITIONT

This feature is almost never used in programmable
shaders so no issue was ever reported.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Implement backup support for clip planes
Axel Davy [Thu, 21 Jul 2022 20:50:10 +0000 (22:50 +0200)]
frontend/nine: Implement backup support for clip planes

Implement backup support for clip planes.
Driver support is still preferred, as the driver
can reuse the compilation of the core of the shader
to generate variants.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agotgsi_to_nir: handle PIPE_CAP_NIR_COMPACT_ARRAYS for clipdistance
Mike Blumenkrantz [Wed, 27 Jul 2022 16:29:15 +0000 (12:29 -0400)]
tgsi_to_nir: handle PIPE_CAP_NIR_COMPACT_ARRAYS for clipdistance

drivers that set this cap require clipdistance to be passed as an
array of floats, so convert the existing stores during finalize

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

17 months agodocs/gallium: Clarify PIPE_CAP_CLIP_PLANES
Axel Davy [Thu, 21 Jul 2022 20:01:47 +0000 (22:01 +0200)]
docs/gallium: Clarify PIPE_CAP_CLIP_PLANES

Drivers with PIPE_CAP_CLIP_PLANES set to 0,
such as zink, ignore clip_plane_enable.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: initialize force_color_in_centroid
Axel Davy [Sun, 23 Apr 2023 11:25:43 +0000 (13:25 +0200)]
frontend/nine: initialize force_color_in_centroid

The first version of the shader didn't have proper
force_color_in_centroid field set.

That won't make much a difference (centroid is very
similar to no centroid) but it is still better.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Get rid of INTERPOLATE_COLOR
Axel Davy [Fri, 29 Jul 2022 16:02:26 +0000 (18:02 +0200)]
frontend/nine: Get rid of INTERPOLATE_COLOR

Some drivers don't handle it, and those who do replace it anyway
depending on the rasterizer setting. Keep the rasterizer setting
but replace the interpolation flag accordingly.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Enforce legacy pow behaviour
Axel Davy [Thu, 28 Jul 2022 21:35:07 +0000 (23:35 +0200)]
frontend/nine: Enforce legacy pow behaviour

Gallium drivers used to implement the legacy behaviour.
It's not the case of all recent drivers, so implement
the legacy behaviour in nine.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Print warning incomplete position_t support
Axel Davy [Thu, 28 Jul 2022 19:59:06 +0000 (21:59 +0200)]
frontend/nine: Print warning incomplete position_t support

What would be missing for position_t to work in
vs programmable shaders when VS_WINDOW_SPACE_POSITION
is unavailable is to apply the inverse viewport transformation
similarly to what is done for ff vs.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Improve VS_WINDOW_SPACE_POSITION fallback
Axel Davy [Thu, 28 Jul 2022 19:31:25 +0000 (21:31 +0200)]
frontend/nine: Improve VS_WINDOW_SPACE_POSITION fallback

Previously we would implement position_t by
applying the inverse of the viewport, and
advertising clipping was going to occur with
the cap CLIPTLVERTS.

However when the cap is advertised, clipping
is supposed to be disabled via sw emulation
when D3DRS_CLIPPING is set to FALSE.

Since we don't support that either, instead take the
approach of disabling at least depth clipping, and
not advertising the cap.

Ideally, clipping should be totally disabled.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Implement backup support for pointsize
Axel Davy [Thu, 21 Jul 2022 16:45:25 +0000 (18:45 +0200)]
frontend/nine: Implement backup support for pointsize

Improve support for drivers that don't support the
pointsize states.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Implement alpha test backup support
Axel Davy [Thu, 21 Jul 2022 15:14:45 +0000 (17:14 +0200)]
frontend/nine: Implement alpha test backup support

Implement alpha test emulation for drivers without support.

Driver support is still a preferred option, as driver
can reuse the compilation of the main core of the shader
to generate shader variants.

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

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agofrontend/nine: Drop max_ps_const_f
Axel Davy [Wed, 20 Jul 2022 21:56:14 +0000 (23:56 +0200)]
frontend/nine: Drop max_ps_const_f

Replace max_ps_const_f with a constant.
In practice it already was always the
same value no matter the hw.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>

17 months agozink: don't init mutable for swapchain src during blit
Mike Blumenkrantz [Mon, 8 May 2023 17:55:45 +0000 (13:55 -0400)]
zink: don't init mutable for swapchain src during blit

fixes #8993

cc: 23.1 <mesa-stable>

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

17 months agozink: don't init mutable resource bit for swapchain images
Mike Blumenkrantz [Fri, 5 May 2023 16:06:05 +0000 (12:06 -0400)]
zink: don't init mutable resource bit for swapchain images

these are either already mutable (for srgb) or invalid usage

fixes #8970

cc: mesa-stable

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

17 months agointel: enable protected context creation along with engines
Lionel Landwerlin [Mon, 8 May 2023 06:15:02 +0000 (09:15 +0300)]
intel: enable protected context creation along with engines

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22898>

17 months agotu: Expose VK_EXT_fragment_density_map
Connor Abbott [Fri, 25 Nov 2022 13:12:58 +0000 (14:12 +0100)]
tu: Expose VK_EXT_fragment_density_map

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

17 months agotu: Don't allow importing/exporting subsampled images with modifiers
Connor Abbott [Tue, 13 Dec 2022 18:28:17 +0000 (19:28 +0100)]
tu: Don't allow importing/exporting subsampled images with modifiers

Right now subsampled images are the same as non-subsampled images, this
will change when we actually implement them which will be an ABI break.
Disallow importing/exporting them with modifiers until that's stabilized
to force users to match the driver UUID.

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

17 months agotu/autotune: Always prefer GMEM with fragment density maps
Connor Abbott [Fri, 25 Nov 2022 15:48:17 +0000 (16:48 +0100)]
tu/autotune: Always prefer GMEM with fragment density maps

If we encounter an app doing bad things where we want sysmem, we can fix
that later, but this seems like the right thing to do initially.

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

17 months agotu, ir3: Handle FDM shader builtins
Connor Abbott [Fri, 25 Nov 2022 13:11:12 +0000 (14:11 +0100)]
tu, ir3: Handle FDM shader builtins

Also, add the necessary transform to fixup gl_FragCoord.xy.

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

17 months agonir, ir3: Add option to use unscaled FragCoord for input attachments
Connor Abbott [Tue, 13 Dec 2022 17:09:28 +0000 (18:09 +0100)]
nir, ir3: Add option to use unscaled FragCoord for input attachments

When rendering a scaled tile, we need to use the original, hardware
FragCoord when accessing input attachments that are on-tile (i.e. were
rendered to in a previous subpass) because they are also scaled in the
same way that FragCoord is scaled. For input attachments that aren't
already on-tile, however, we need to use the fixed gl_FragCoord. Add a
new intrinsic and a bitfield of input attachments which should use it.

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

17 months agotu: Implement FDM scaled loads/stores
Connor Abbott [Mon, 21 Nov 2022 13:54:36 +0000 (14:54 +0100)]
tu: Implement FDM scaled loads/stores

In addition to scaling the rendering itself, we need to scale
loads/stores except when using subsampling, but subsampling isn't
implemented yet.

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

17 months agotu: Implement FDM viewport patching
Connor Abbott [Mon, 21 Nov 2022 13:52:44 +0000 (14:52 +0100)]
tu: Implement FDM viewport patching

We scale the actual rendering by patching the viewport state. This is
helped by a HW bit to make the viewport index equal to the view index,
so that we can have a different scaling per-view.

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

17 months agoir3: Record whether a shader writes gl_ViewportIndex
Connor Abbott [Mon, 21 Nov 2022 13:05:43 +0000 (14:05 +0100)]
ir3: Record whether a shader writes gl_ViewportIndex

This will be needed by turnip.

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

17 months agotu: Add core FDM patchpoint infrastructure
Connor Abbott [Mon, 21 Nov 2022 13:37:15 +0000 (14:37 +0100)]
tu: Add core FDM patchpoint infrastructure

FDM is implemented pretty much entirely inside the driver, by patching
various structures for each bin. This adds the core infrastructure to
sample the density map, compute the scaled bin sizes we will use, create
patchpoints, and apply them at the start of each bin before executing
the IB2.

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

17 months agotu/cs: Add support for CS patching
Connor Abbott [Fri, 25 Nov 2022 13:53:05 +0000 (14:53 +0100)]
tu/cs: Add support for CS patching

In order to patch the command stream on the gpu, we need two features:

1. The ability to use a read-write BO instead of a read-only one, when
   patching might be performed.
2. The ability to get the iova of the current position after reserving
   some number of dwords, even with externally-allocated command
   streams.

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

17 months agotu: Implement sampling the fragment density map
Connor Abbott [Mon, 21 Nov 2022 13:34:31 +0000 (14:34 +0100)]
tu: Implement sampling the fragment density map

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

17 months agotu: Parse fragment density map attachment info
Connor Abbott [Mon, 21 Nov 2022 13:09:17 +0000 (14:09 +0100)]
tu: Parse fragment density map attachment info

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

17 months agofreedreno/a6xx: Document per-view viewport in GRAS_SU_CNTL
Connor Abbott [Mon, 21 Nov 2022 11:21:10 +0000 (12:21 +0100)]
freedreno/a6xx: Document per-view viewport in GRAS_SU_CNTL

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

17 months agotu: Make dynamic viewport and scissor count more accurate
Connor Abbott [Fri, 18 Nov 2022 20:28:08 +0000 (21:28 +0100)]
tu: Make dynamic viewport and scissor count more accurate

Because we delay emitting them until we know the pipeline, we can track
the actual count instead of taking the max.

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

17 months agotu: Merge RB_DEPTH_CNTL and RB_STENCIL_CONTROL drawstates
Connor Abbott [Mon, 21 Nov 2022 17:36:19 +0000 (18:36 +0100)]
tu: Merge RB_DEPTH_CNTL and RB_STENCIL_CONTROL drawstates

We're again running out of draw states, and this matches what gallium
does.

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

17 months agotu: Precompute maximum views across all subpasses
Connor Abbott [Thu, 17 Nov 2022 12:24:30 +0000 (13:24 +0100)]
tu: Precompute maximum views across all subpasses

We'll need this to know how many viewports to create.

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

17 months agotu: Use dirty bit for scissor state
Connor Abbott [Thu, 17 Nov 2022 11:08:37 +0000 (12:08 +0100)]
tu: Use dirty bit for scissor state

This will make patching it on-demand easier.

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

17 months agotu: Add 3D GMEM load path
Connor Abbott [Mon, 14 Nov 2022 14:50:01 +0000 (15:50 +0100)]
tu: Add 3D GMEM load path

This is similar to old gens which couldn't support loading from GMEM
automatically. It will be needed for loads with a fragment density map,
because we need to scale the image when loading to GMEM.

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

17 months agofreedreno/fdl: Expose view offset
Connor Abbott [Wed, 16 Nov 2022 15:12:33 +0000 (16:12 +0100)]
freedreno/fdl: Expose view offset

Will be used by CPU sampling.

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

17 months agofreedreno/fdl: Don't pre-shift image view pitch
Connor Abbott [Wed, 16 Nov 2022 15:02:14 +0000 (16:02 +0100)]
freedreno/fdl: Don't pre-shift image view pitch

We'll need the unshifted pitch for doing CPU reads.

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

17 months agotu: Don't pre-shift depth and stencil pitch
Connor Abbott [Mon, 14 Nov 2022 14:45:54 +0000 (15:45 +0100)]
tu: Don't pre-shift depth and stencil pitch

Different uses in various registers and the texture descriptor have
different shifts, and we already had a few ugly workarounds to handle
this. Remove the foot-gun by specifying it in bytes and letting users
handle the shift themselves using the correct macro.

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

17 months agotu: Don't override depth for GMEM
Connor Abbott [Thu, 24 Nov 2022 16:19:09 +0000 (17:19 +0100)]
tu: Don't override depth for GMEM

Otherwise accesses to non-0 views of input attachments may be considered
out-of-bounds and return 0. This should've been removed when enabling
multiview for GMEM, not sure how it was missed.

Fixes: def56b531c8 ("tu: Support GMEM with layered rendering and multiview")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20304>

17 months agonouveau/nir: Set isSigned on all atomic_imax/imin
M Henning [Sat, 6 May 2023 18:30:20 +0000 (14:30 -0400)]
nouveau/nir: Set isSigned on all atomic_imax/imin

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22889>

17 months agoaux/draw: add guardband clipping for lines
Mike Blumenkrantz [Tue, 28 Jun 2022 14:49:14 +0000 (10:49 -0400)]
aux/draw: add guardband clipping for lines

to comply with ES2+ line clipping rules, guardband clipping should be
used so that the rasterizer will clip lines without using clip planes

fixes (llvmpipe):
dEQP-GLES*.functional.clipping.line.wide_line_clip_viewport_center
dEQP-GLES*.functional.clipping.line.wide_line_clip_viewport_corner

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

17 months agoaux/draw: check for lines when setting clipping-mode
Erik Faye-Lund [Wed, 3 May 2023 17:24:58 +0000 (19:24 +0200)]
aux/draw: check for lines when setting clipping-mode

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

17 months agoaux/draw: guard_band_points_xy -> guard_band_points_lines_xy
Mike Blumenkrantz [Tue, 28 Jun 2022 14:47:01 +0000 (10:47 -0400)]
aux/draw: guard_band_points_xy -> guard_band_points_lines_xy

just a rename, no functional changes

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

17 months agogallium: pipe_rasterizer_state::point_tri_clip -> point_line_tri_clip
Mike Blumenkrantz [Tue, 28 Jun 2022 14:45:52 +0000 (10:45 -0400)]
gallium: pipe_rasterizer_state::point_tri_clip -> point_line_tri_clip

this is just a rename, no functional changes

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

17 months agoci: uprev virglrenderer to drop venus release patches
Yiwei Zhang [Mon, 8 May 2023 03:08:43 +0000 (20:08 -0700)]
ci: uprev virglrenderer to drop venus release patches

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22896>

17 months agoradv: Fix vk_instance_init vk_error instance use-after-free
Vitaliy Triang3l Kuzmin [Sat, 6 May 2023 19:59:13 +0000 (22:59 +0300)]
radv: Fix vk_instance_init vk_error instance use-after-free

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Vitaliy Triang3l Kuzmin <triang3l@yandex.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22887>

17 months agolavapipe: Fix vk_instance_init vk_error instance use-after-free
Vitaliy Triang3l Kuzmin [Sat, 6 May 2023 19:57:46 +0000 (22:57 +0300)]
lavapipe: Fix vk_instance_init vk_error instance use-after-free

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Vitaliy Triang3l Kuzmin <triang3l@yandex.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22887>

17 months agor600/sfn: Fix iterator use
Gert Wollny [Mon, 8 May 2023 11:24:42 +0000 (13:24 +0200)]
r600/sfn: Fix iterator use

Reported by Coverity 1529462

Fixes:  e57643cf5488fc7ca2619f62997527b1f546cd38
    r600/sfn: Add handling for R600 indirect access alias

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

17 months agoradeonsi: do AMD_DEBUG=nodisplaydcc differently to also remove modifiers
Marek Olšák [Sat, 29 Apr 2023 08:52:31 +0000 (04:52 -0400)]
radeonsi: do AMD_DEBUG=nodisplaydcc differently to also remove modifiers

Only modifiers with DCC retiling are removed for now.

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

17 months agoradeon: add radeon_info parameter into radeon_winsys::surface_init
Marek Olšák [Sat, 29 Apr 2023 08:50:31 +0000 (04:50 -0400)]
radeon: add radeon_info parameter into radeon_winsys::surface_init

to allow radeonsi to change radeon_info. The next commit will rely on it.

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

17 months agoac/gpu_info: disable display DCC on Raphael and Mendocino to improve power usage
Marek Olšák [Sat, 29 Apr 2023 08:58:41 +0000 (04:58 -0400)]
ac/gpu_info: disable display DCC on Raphael and Mendocino to improve power usage

Below is the summary from the power validation.. "it looks like the only
workload where I see savings from DCC is PLT and it is only about 65mW
which is just run to run variation. For Idle I am seeing ~280mW increase
in power, ~200mW increase for power_VideoCall, and ~80mW increase for VP"

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

17 months agoac/surface: don't expose modifiers with DCC retiling if radeon_info forbids it
Marek Olšák [Sat, 29 Apr 2023 08:43:49 +0000 (04:43 -0400)]
ac/surface: don't expose modifiers with DCC retiling if radeon_info forbids it

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

17 months agoradv: remove ac_surf_info from radv_image
Samuel Pitoiset [Wed, 3 May 2023 07:18:54 +0000 (09:18 +0200)]
radv: remove ac_surf_info from radv_image

Introduce a helper to convert vk_image info to ac_surf_info instead.

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

17 months agoradv: use vk_image::extent instead of radv_image::info::{width,height,depth}
Samuel Pitoiset [Wed, 3 May 2023 06:36:54 +0000 (08:36 +0200)]
radv: use vk_image::extent instead of radv_image::info::{width,height,depth}

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

17 months agoradv: use vk_image::samples instead of radv_image::info::samples
Samuel Pitoiset [Wed, 3 May 2023 06:28:44 +0000 (08:28 +0200)]
radv: use vk_image::samples instead of radv_image::info::samples

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

17 months agoradv: use vk_image::samples instead of radv_image::info::storage_samples
Samuel Pitoiset [Wed, 3 May 2023 06:25:02 +0000 (08:25 +0200)]
radv: use vk_image::samples instead of radv_image::info::storage_samples

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

17 months agoradv: use vk_image::array_layers instead of radv_image::info::array_size
Samuel Pitoiset [Wed, 3 May 2023 06:21:04 +0000 (08:21 +0200)]
radv: use vk_image::array_layers instead of radv_image::info::array_size

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

17 months agoradv: use vk_image::mip_levels instead of radv_image::info::levels
Samuel Pitoiset [Wed, 3 May 2023 06:17:06 +0000 (08:17 +0200)]
radv: use vk_image::mip_levels instead of radv_image::info::levels

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

17 months agoradv: disable RB+ blend optimizations on GFX11 when a2c is enabled
Samuel Pitoiset [Thu, 4 May 2023 09:52:58 +0000 (11:52 +0200)]
radv: disable RB+ blend optimizations on GFX11 when a2c is enabled

Closes: #8222
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21313>

17 months agoCorrects log print to produce hexadecimal base output
Christopher Snowhill [Sat, 6 May 2023 04:45:45 +0000 (21:45 -0700)]
Corrects log print to produce hexadecimal base output

Matching the original %016lx, and the "0x" prefix which is still
in the format string.

Fixes: 53b77a8102cd ("anv: remove 48bit address space checks")

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22882>

17 months agointel/fs: reduce register usage for relocated constants
Lionel Landwerlin [Fri, 5 May 2023 10:12:25 +0000 (13:12 +0300)]
intel/fs: reduce register usage for relocated constants

Commit bb8e31b7ed ("anv: avoid hardcoding instruction VA constant in
shaders") had a slight negative impact on shaders (Red Dead Redemption
2 in particular). Dropping a few shaders from SIMD32 to SIMD16.

With this change, it brings back all the dropped SIMD32 shaders.

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

17 months agoasahi: Fix batch writer_syncobj cleanup
Asahi Lina [Wed, 3 May 2023 06:41:37 +0000 (15:41 +0900)]
asahi: Fix batch writer_syncobj cleanup

When an ACTIVE batch takes over the active writer role from a SUBMITTED
batch, the written BO has the syncobj from the latter even though the
writer is the former. This is correct and an intended state, but it
means that then we can't gate the syncobj cleanup in agx_batch_cleanup
on being the active writer, since the SUBMITTED batch won't be.

Fixes: asahi/mesa#18

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22891>

17 months agoasahi: Assert that freed BOs have no pending writers
Asahi Lina [Wed, 3 May 2023 06:40:33 +0000 (15:40 +0900)]
asahi: Assert that freed BOs have no pending writers

This is just a sanity check, I haven't actually hit this case but if we
ever do something is very broken (e.g. BO refcounting bug).

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22891>

17 months agoasahi: Fix depth load/store flags
Alyssa Rosenzweig [Wed, 26 Apr 2023 19:26:37 +0000 (15:26 -0400)]
asahi: Fix depth load/store flags

If depth_writemask is set, we need to write depth regardless of whether we run
the depth test, to write out the fixed-function fragment depth. This will matter
when we start honouring these flags.

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

17 months agoasahi: Clear batch->resolve on agx_batch_init
Asahi Lina [Wed, 3 May 2023 12:48:21 +0000 (21:48 +0900)]
asahi: Clear batch->resolve on agx_batch_init

This has been broken forever, but it was only noticed with the ZS
load/store optimizations in the subsequent commits.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22891>

17 months agoasahi: Implement transform feedback
Alyssa Rosenzweig [Mon, 20 Mar 2023 02:12:09 +0000 (22:12 -0400)]
asahi: Implement transform feedback

This code was originally based on the Panfrost implementation, but has been
improved in a number of ways.

1. Transform feedback programs are dispatched generically with Gallium calls,
   rather than emitting something hardware-specific. This is cleaner and
   portable to future GPUs.

2. Transform feedback with indexed draws is now fixed, by lowering to an index
   buffer pull.

3. Transform feedback with buffer overflows is now fixed, by correctly
   bounds checking in transform feedback programs.

4. Transform feedback with strips/fans/loops are fixed, by correctly
   tessellating to the underlying primitives as required by OpenGL.

5. Transform feedback with QUADS is fixed, by tessellating to triangles as
   required by OpenGL.

That said, the code is still not in its final form.

1. It still does not support indirect draws. This will require a substantial
   overhaul to do tracking on the GPU instead of the CPU. Currently we force
   unroll indirect draws (slow but kosher in GL, treif in Vulkan). This isn't
   hard to solve but I'm not going to duplicate the code until the algorithms
   are otherwise complete because it's a lot easier to hack on the CPU versions
   than the GPU versions.

2. It still does not support primitive restart. This has especially nasty
   interactions with transform feedback. Again we force unroll to non-primitive
   restart forms, again slow but kosher in GL but treif in Vulkan. This is a lot
   harder to deal with. I sketched out something really nasty in my notebook
   (hinging on efficient GPU prefix sums) but I'm not in a hurry to type this
   out.

3. There will be interactions with geometry and tessellation shaders and I don't
   think I can get the core code here future-proofed without actually bringing
   up the new shader stages.

As such, this is a hard fork of the panfrost code for now, I'm not trying to
share the code (although it *would* clear out almost all of panfrost's transform
feedback related piglit failures).

Passes dEQP-GLES3.functional.transform_feedback.* and most of the relevant
piglits.

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

17 months agoasahi: Bump MAX_PUSH_RANGES to the worst-case
Alyssa Rosenzweig [Thu, 27 Apr 2023 18:41:17 +0000 (14:41 -0400)]
asahi: Bump MAX_PUSH_RANGES to the worst-case

This shortcuts all headaches about how big this should be. It does increase
memory usage a bit if there are lots of shader variants compiled, but this
should be tolerable, and can be optimized later if so required. Thanks to the
previous commit, the disk cache size should be unaffected.

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

17 months agoasahi: Shrink disk cache size of push ranges
Alyssa Rosenzweig [Thu, 27 Apr 2023 19:24:32 +0000 (15:24 -0400)]
asahi: Shrink disk cache size of push ranges

Only store the push ranges we actually need, not all of them. This should save
some disk space, while insulating us to MAX_PUSH_RANGES changes.

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

17 months agoagx: Lower I/O to scalar later
Alyssa Rosenzweig [Thu, 22 Dec 2022 02:46:06 +0000 (21:46 -0500)]
agx: Lower I/O to scalar later

This lets us preserve vectorized stores for transform feedback shaders.

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

17 months agoagx: Validate that collect sources are the same size
Alyssa Rosenzweig [Sat, 15 Apr 2023 13:39:28 +0000 (09:39 -0400)]
agx: Validate that collect sources are the same size

RA asserts this, but by then if you've messed it up, the failure is inscrutable.
Let's check it in the validator for more pleasant debugging.

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

17 months agoagx: Rework z/s emit
Alyssa Rosenzweig [Sun, 23 Apr 2023 21:50:52 +0000 (17:50 -0400)]
agx: Rework z/s emit

We were being sloppy with the sizes before. It mostly worked out, but there were
some corner cases where we would end up with mixed sized collects and that won't
end well for us. Let's rework the logic to make all the sizes explicit in NIR --
32-bit for depth and 16-bit stencil -- and then do the needed promotions to make
it happen in the AGX IR side.

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

17 months agoagx: Ensure load_frag_coord has the right sizes
Alyssa Rosenzweig [Sun, 23 Apr 2023 21:38:40 +0000 (17:38 -0400)]
agx: Ensure load_frag_coord has the right sizes

In case .x isn't read, it'll be null which has the wrong size and will fail
the validation added later in this series. We fix this by padding with sized
undefs (something that exists of defined size but undefined value) rather than
nothingness (of undefined size).

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

17 months agoagx/lower_address: Match multiplies, not only shifts
Alyssa Rosenzweig [Thu, 27 Apr 2023 16:00:12 +0000 (12:00 -0400)]
agx/lower_address: Match multiplies, not only shifts

Sometimes a shader might index with a non-power-of-two stride. For example, if
it's indexing into an array of structures where the structure size is not a
power of two, we'll get a multiply with a constant as opposed to a shift. We
want to handle these cases, too. To do so, we generalize our pattern matching to
look for any kind of multiply (with our new helper), rather than hardcoding
logic for ishl. This eliminates right-shifts in a pile of compute shaders, which
makes me happy from a "I read lots of shader assembly when debugging"
perspective.

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

17 months agoagx/lower_address: Add helper to match multiplies
Alyssa Rosenzweig [Thu, 27 Apr 2023 15:59:17 +0000 (11:59 -0400)]
agx/lower_address: Add helper to match multiplies

Currently, we hardcode logic in the addressing chasing code to look for ishl
instructions that shift by constants. We can generalize this to looking for
integer multiplies by constants to optimize more addressing patterns. Add a
helper to do so.

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

17 months agoasahi: Bind staging resources as RENDER_TARGET
Alyssa Rosenzweig [Wed, 26 Apr 2023 14:20:45 +0000 (10:20 -0400)]
asahi: Bind staging resources as RENDER_TARGET

This doesn't matter in practice (at least with mesa/st), but it's more correct
technically.

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

17 months agoagx: Don't wait at the end of the shader
Alyssa Rosenzweig [Wed, 26 Apr 2023 03:20:25 +0000 (23:20 -0400)]
agx: Don't wait at the end of the shader

This is totally pointless. This saves some waits at the ends of compute kernels
(waiting for stores to complete before terminating the thread). I don't know
how much this would matter for performance, since the hardware may have to do
these waits internally, but it makes the generated code less silly which is
always nice.

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

17 months agoasahi: Copy resources if needed to shadow
Alyssa Rosenzweig [Sat, 11 Mar 2023 22:37:19 +0000 (17:37 -0500)]
asahi: Copy resources if needed to shadow

This lets us shadow textures updated in the middle of rendering in Quake3.
They're big memcpys, but as long as the texture memory is cached it's ok. We use
a heuristic to avoid too many memcpys from uncached memory, which would cause
slideshow performance in quake.

We need to be careful to avoid shadowing shared resources, though, that's
invalid and would break WSI pretty hard.

It would be better to blit on the GPU for large shadowing, but that's more
involved and left for future work.

Reduces stuttering in Quake3.

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

17 months agoasahi: Rename no colour output to tag write disable
Alyssa Rosenzweig [Fri, 14 Apr 2023 23:57:20 +0000 (19:57 -0400)]
asahi: Rename no colour output to tag write disable

Comparison with PowerVR's XML shows that this is the actual name... And it needs
to be set a bit more carefully than "no colour output" in order to get correct
behaviour for depth-only passes that use sample mask / discard. Fix the name
first, the extra conditions will come when they're needed for multisampling.

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

17 months agoagx: Fix packing for iadd with shift
Alyssa Rosenzweig [Tue, 25 Apr 2023 17:51:46 +0000 (13:51 -0400)]
agx: Fix packing for iadd with shift

Wrong bit pattern was packed, oops.

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