Commit Graph

172427 Commits

Author SHA1 Message Date
Juan A. Suarez Romero
7a21b59df9 v3d: handle samplerExternalOES
Add handling for GLSL_SAMPLER_DIM_EXTERNAL.

Fixes `spec@oes_egl_image_external_essl3@oes_egl_image_external_essl3`.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23469>
2023-06-07 09:20:32 +00:00
Yonggang Luo
b687fa4ccb vulkan: move nir_convert_ycbcr into vulkan runtime
This only used by vulkan drivers and depends on vulkan util, so do the move to decouple
nir from vulkan utils

Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23444>
2023-06-07 08:42:03 +00:00
Mike Blumenkrantz
476022cbe1 zink: also disable bg compile for compute with nobgc
forgot this one in the original MR

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22933>
2023-06-07 06:50:34 +00:00
Emma Anholt
b222b34e78 ci/etnaviv: Update some xfails common between the last 3 nightly runs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23446>
2023-06-07 06:34:35 +00:00
Emma Anholt
d93bdf2427 ci/crocus: Update trace hash for the neverball regression.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23446>
2023-06-07 06:34:35 +00:00
Mike Blumenkrantz
580a8a8b1e lavapipe: fix memory budget reporting
I put this on the wrong struct

Fixes: 1c42056ee1 ("lavapipe: EXT_memory_budget")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23395>
2023-06-07 05:59:49 +00:00
Dave Airlie
bfed41d322 lavapipe: don't remove queue family barriers.
This fixes the remaining barrier issues.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23453>
2023-06-07 04:21:09 +00:00
Dave Airlie
91e919f1bf llvmpipe: emit fences for barrier.
I tried emitting less here but I'm just gonna hit it with the big
seq_cst hammer.

Fixes:
dEQP-VK.memory_model.message_passing.*

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23453>
2023-06-07 04:21:09 +00:00
Yiwei Zhang
9fb0bbd7d4 docs: update venus VK_EXT_device_memory_report support
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>
2023-06-07 04:00:40 +00:00
Yiwei Zhang
1bc4e71695 venus: enable VK_EXT_device_memory_report
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>
2023-06-07 04:00:40 +00:00
Yiwei Zhang
0960ceb071 venus: emit device memory report for device memory events
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>
2023-06-07 04:00:40 +00:00
Yiwei Zhang
f70a08bc60 venus: handle device memory report requests
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>
2023-06-07 04:00:40 +00:00
Yiwei Zhang
26567183d8 venus: refactor vn_device_memory to track VkMemoryType
The VkMemoryType::heapIndex will be used by device memory report.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23411>
2023-06-07 04:00:40 +00:00
Rob Clark
7b38799724 freedreno/a6xx: Use idalloc for samp/view seqno's
Samplers and views can be re-created dynamically or long-lasting,
resulting in the possibility of a tex cache collision.  So instead
of a simple counter, use idalloc.

Fixes: a3c73987ab ("freedreno/a6xx: Move rsc seqno out of tex cache key")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9111
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23470>
2023-06-07 03:38:57 +00:00
Rob Clark
3f00f4ac30 freedreno/a6xx: Directly invalidate on samp view update
Instead of incrementing the seqno, just directly invalidate any existing
tex cache entries when we update a sampler view.

No reason not to just directly clear stale entries, and avoiding to re-
assign the seqno will simplify the next patch.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23470>
2023-06-07 03:38:57 +00:00
Rob Clark
ca9dc7be34 freedreno/batch: Add driver-thread assert
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23470>
2023-06-07 03:38:57 +00:00
Rob Clark
e527bd7986 freedreno: Add extra assert
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23470>
2023-06-07 03:38:56 +00:00
Alyssa Rosenzweig
537994bb32 asahi: Remove stale comments
Trivial.

It is now later and I have confirmed with Piglit.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Asahi Lina
d6ff4733a6 asahi: Do not leak meta shader NIR
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Asahi Lina
c6016486f4 asahi: Fix memory leak in agx_nir_lower_sysvals()
We need to free the dynarray.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Asahi Lina
bb27e3f69c asahi: Use os_dupfd_cloexec() instead of dup()
This fixes file descriptor leaks in konsole/etc.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
35d849025b asahi: Decompress with format reinterpretation
The internal layout used with compression partially depends on the pixel format.
Some limited reinterpretation is definitely allowed (linear vs sRGB views of the
same physical format are documented by Apple as allowed). Some reinterpretations
are definitely forbidden (R8G8B8A8 vs R32, I think). At some point we'll need to
work out the exact rule. I suspect the answer is that "you can reinterpret iff
the Channels field matches". Meaning that R8G8B8A8_UNORM and B8G8R8A8_SINT would
be compatible, but not R16G16_UNORM. But I haven't tested that.

Fixes all fails in:

   dEQP-GLES31.functional.image_load_store.*.format_reinterpret.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
d499bf10a3 asahi: Decompress writable images
We can't write to compressed images. Decompress on the fly if needed. mesa/st
doesn't bother to do this for us.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
531247cf31 asahi: Extract transition_resource helper
We'll reuse this logic for images. Extract it out and generalize it.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
389c0fdc7c asahi: Add ASAHI_MESA_DEBUG=nowc flag
Add a debug flag to disable write-combining as a performance hack. This may help
diagnose slowness with glReadPixels() heavy workloads like screen capture.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
3a0d1f83d5 agx: Stop bit-inexact conversion propagation
Despite being mathematically equivalent, the following code sequences are not
bit-identical under IEEE 754 rules due to differing internal precision:

   fadd16 r0l, r2, 0.0              z = f2f16 x
   fadd16 r1h, r0l, r0h             w = fadd z, y

versus

   fadd32 r1h, r2, r0h              f2f16(w) = fadd x, f2f32(y)

This is probably fine under GL's relaxed floating point precision rules, but
it's definitely not ok with the more strict OpenCL or Vulkan. It also is a
potential problem with GL invariance rules, if we get different results for the
same shader depending whether we did a monolithic compile or a fast link. The
place for doing inexact transformations is NIR, when we have the information
available to do so correctly. By the time we get to the backend, everything we
do needs to be bit-exact to preserve sanity.

Fixes dEQP-GLES2.functional.shaders.algorithm.rgb_to_hsl_vertex. We believe that
this is a CTS bug, but it's a useful one since it uncovered a serious driver bug
that would bite us in the much less friendly Vulkan (or god forbid OpenCL) CTS
later. It also seems like a magnet for GL app bugs, the fp16 support we do now
is uncovering bad enough bugs as it is.

shader-db results are pretty abysmal, though :|

total instructions in shared programs: 1537964 -> 1571328 (2.17%)
instructions in affected programs: 670231 -> 703595 (4.98%)

total bytes in shared programs: 10533984 -> 10732316 (1.88%)
bytes in affected programs: 4662414 -> 4860746 (4.25%)

total halfregs in shared programs: 483448 -> 474541 (-1.84%)
halfregs in affected programs: 58867 -> 49960 (-15.13%)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
be5004691c asahi: Advertise GL 3.1
We now have support for baseline MSAA, except for support for eMRT. But hey,
this gets us 99% of the way there, so it's worth flipping on at least in
agx/next.

We can also advertise dual-source blending again. It was reverted since Chromium
freaks out with dual-source blending on a GL 2.1 driver, but since we're
advertising GL 3.1 now, it's ok.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
8d019125a0 agx: Emit shader info late
So we can take into account program transformations for the final info. This
reports more accurate metadata.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
7b1d6204c8 asahi: Use nonempty tib for MSAA
Affects
dEQP-GLES31.functional.texture.multisample.samples_4.use_texture_depth_2d. This
needs tests, but whatever, 70% of the YouTube chat said to land the hack.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
HackHackHacked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Acked-by: YouTube Viewers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
f3919bead6 asahi: Lower MSAA
Use the shiny new passes to lower fragment shaders. Monolithic only right now.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
1dd513727d agx: Handle centroid and sample interpolation
Works great now that all the infrastructure is wired up.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
b7f130fbbc agx: Model interpolation for iter instructions
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
2548293e8b agx: Split iter and iterproj instructions
These are different (though related) instructions. I've split them in applegpu,
let's mirror that here. This simplifies the IR a bit.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
b9b71bcae6 asahi,agx: Call lower_discard_zs_emit in the driver
The driver needs to lower MSAA (because only it knows the sample count). MSAA
lowering depends on discards getting lowered (in order to get sample masks on the
discards for sample shading to work properly). Discard lowering depends on all
discards emitted. But the driver needs to lower clip planes which generates
discards. To break the circular dependency, we have the driver call the
discard lowering pass itself (in between lowering clip planes and lowering
MSAA). Technically, this is probably a layering violation but it's the least
gross solution I see.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
398851ca53 agx: Lower discard in NIR
We already lower discard in NIR when depth/stencil writes are used in the
shader. In this patch, we extend that lowering for when depth/stencil writes are
not used, in which case the discard is lowered to a sample_mask instruction.
This is a step towards multisampling, since the old lowering assumed
single-sample and there's no way to express a sample mask with a standard NIR
discard instructions so we need to lower in NIR anyway for sample shading (i.e.
if a discard_if diverges between samples in a pixel).

This changes the lowering for discard_if to be free of control flow (instead
executing a sample mask instruction unconditionally). This seems to be slightly
faster in SuperTuxKart and slightly slower in Dolphin, but I'm not too worried
right now.

To make this work, we do need some extra lowering to ensure we always execute a
sample_mask instruction, in case a discard_if is buried in other control flow
(as occurs with Dolphin's ubershaders). So that's added too. We need that for
MSAA anyway, so pardon the line count.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
989d6fd378 agx: Enable tag writes when sample mask written
Including indirectly via discard/demote.

Fixes graphical artefacts in Chromium when API sample masks are hooked up, which
will result in fragment programs that do not write colour/depth but do a lone
sample mask write. These need tag writes enabled (according to a trace from
Metal for a case constructed to test this scenario).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
f514d49ae2 agx: Handle sample_mask_agx
1:1 translation.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
73bbf43bc0 agx: Plumb in nir_intrinsic_load_sample_mask_in
We have a special register for this, although this will need some lowering for
glSampleMask.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
6fd16dd7c9 agx: Model both sources of sample_mask
We need to control both sources to implement multisampling properly. The
semantic is something like:

   foreach sample in the first mask {
      if correspond bit in second bit set {
         make sample live
      } else {
         make sample dead
      }
   }

But I'm reticent to document more formally until the details are really
understood and properly tested.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
954e2eee29 asahi: Plumb ppp_multisamplectl into shaders
This lets us implement gl_SamplePositions in a cheap way with some ALU in the
shader preamble.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
17a05884b4 asahi: Plumb API sample mask into shaders
So we can lower glSampleMask() appropriately.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
bffbe099df asahi: Set uses_sample_shading for background program
If we read gl_SampleID we need the lowering, even though we don't call into
gather_info to set the bit for us. So set the bit manually.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:49 +00:00
Alyssa Rosenzweig
0b95d81150 agx: Assert that sample shading is lowered
Lest someone mess this up later and then try to "implement" these intrinsics in
the backend.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:48 +00:00
Alyssa Rosenzweig
46a5a99d24 asahi: Add alpha-to-coverage (and alpha-to-one) lowering
This should probably be shared code but meh.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:48 +00:00
Alyssa Rosenzweig
51e868f3a2 asahi: Add passes to lower sample intrinsics
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:48 +00:00
Alyssa Rosenzweig
f28962e29a asahi: Add passes to lower MSAA
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:48 +00:00
Alyssa Rosenzweig
70b8babe3c agx: Use textures_used, not num_textures
The latter doesn't account for holes. Fixes regression in Neverball on Asahi.

Fixes: e607a89f ("mesa/main: ff-fragshader to nir")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:48 +00:00
Alyssa Rosenzweig
f1c2ea99e2 agx: Constant fold when optimizing int64
Otherwise we can get bcsel(false, ...) in the final optimized code, which isn't
great.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:48 +00:00
Alyssa Rosenzweig
9641fba9ba agx: Set support_16bit_alu
Allows some more optimizations.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
2023-06-07 03:21:48 +00:00
Gert Wollny
8068264469 r600/sfn: Switch to scoped barriers
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23272>
2023-06-07 02:37:22 +00:00