Commit Graph

154351 Commits

Author SHA1 Message Date
Corentin Noël 583a4210e5 virgl/ci: Update virglrenderer
Update virglrenderer to the latest version on time.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16627>
2022-05-23 06:16:07 +00:00
Alyssa Rosenzweig d12b97122e docs/asahi: Add initial driver docs
Emma asked for some docs on how to use wrap for when wrap gets landed.
This should do :-)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 18:22:41 -04:00
Alyssa Rosenzweig 1b7304f44b asahi: Add wrap library
Add a library that wraps the key IOKit entrypoints used in the macOS
UABI for AGX. Our wrapped routines print information about the kernel
calls made and dump work submitted to the GPU using agxdecode. This code
has two major use cases:

1. Debugging Mesa, particularly around the undocumented macOS
   user-kernel interface. Logs from Mesa may compared to Metal to check
   that the UABI is being used correcrly.

2. Reverse-engineering the hardware, using this as glue to get at the
   "interesting" GPU memory.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:58:07 -04:00
Alyssa Rosenzweig d814711155 asahi: Guard against encoder overflows
We don't seem to hit this yet, but it's possible so add an assert to
rule it out for failing tests.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 1d0d27aac7 asahi: Allocate a larger segment list
This ought to be dynamically allocated but because this is macOS kernel
UABI only gunk, let's just hack around it...

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig ac09dcd358 asahi: Handle RECT textures as 2D
Rectangle textures are just 2D textures with unnormalized coordinates,
but we already handle unnormalized coordinates in the sampler state. So
we just need to alias RECT and 2D.

Fixes GALLIUM_HUD.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 689be69681 asahi: Fix pipeline decoding
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 8a1ee708a4 asahi: Improve render target dumping
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 6eb62c5f50 asahi: Sync some more unknown fields
I don't understand these structs well. Good news, though-- Asahi Lina
confirmed this is all software-defined crap in the macOS UABI.
Unfortunately, they seem to correspond to physical registers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig d8227f09d0 asahi: Drop some unknowns
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 03a3a7843e asahi: Identify suballocated size
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 14d966734f asahi: Identify suballocation mechanism
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig ca9b1d48fe asahi: Decode resource allocation requests
We already know much of this structure, let's pretty print to simplify
our traces.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 0c120cf141 asahi: Decode resource allocation responses
We already know much of this structure, let's pretty print to simplify
our traces.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig a5e774ef9e asahi: Align segment list unknowns with Metal
No observable change.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 8da2fdc889 asahi: Compute segment list length
Quiesces agxdecode error introduced in previous commit.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 1e42e4a390 asahi: Validate segment list length
This is easy now!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 343f4f886f asahi: Split unknown field in segment list header
Seen as 0x8000.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig 6b12292754 asahi: Add segment list pretty printer
Validate all the new expectations and print all the fields. This should
make differences between the drivers obvious, I hope.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:11:08 -04:00
Alyssa Rosenzweig db32b4a064 asahi: Sync some names with Project Zero
This should clarify a few things I didn't get independently
investigating the interface. Of coruse, I got other pieces... the sum of
the parts is better :-)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:10:57 -04:00
Alyssa Rosenzweig 6e59474ced asahi: Identify partial render pipeline
Needed if a partial render is incurred from overflowing the parameter
buffer (too much geometry).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig 65500b19df asahi: Implement polygon offset
This is pretty simple now that the hardware is understood. The hardware
interfaces parallels that of scissors, so the scissor path is reused
with minor modifications to accommodate the new functionality.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig 666f307d41 asahi: Add a depth bias structure
This is simple and corresponds directly to the Metal inputs. However,
the alignment is a bit tricky, so let's add formal XML for it.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig cb760a00c2 asahi: Identify depth bias enable bit
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig 7a0c220401 asahi: Identify "set depth bias index" field
Grouped together with the "set scissor index" field, which is natural.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig ff84c07b21 asahi: Identify depth bias array
"Inspired" by PowerVR code, by comparison.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig a39fb009d2 asahi: Note unknown field
...used internally with visibility tests, together with a weird
vertex/compute-like shader used to zero the visibility buffer.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig baa54da7d6 asahi: Relax Draw "command" check
Other values in the lower byte seen with multiple draws and
visibility testing.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig d8541d52d2 asahi: Add XML used for visibility tests
Aka occlusion queries. There is an annoying limitation in the hardware
(reflected in Metal) that only a single buffer may be bound per render
pass, with the per-draw settings merely specifying an offset.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig 46a7c10349 asahi: Dump "unknown 4a" structure
A few fields are known at least, let's decode them correctly instead of
falling back to a hex dump.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:04 -04:00
Alyssa Rosenzweig a5e6a5e585 asahi: Identify more depth pipeline fields
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-22 17:09:00 -04:00
Alyssa Rosenzweig 6aadd72bd4 asahi: Account for every byte of the cmdbuf
This adds the remaining XML. I don't know how much of this is correct,
but it nominally accounts for every byte. So there shouldn't be more
surprises in the command buffer after this.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:33 -04:00
Alyssa Rosenzweig c61e660323 asahi: Handle 3rd deflake address
Context switching is so broken. Just trying to get closer. Adding some
XML here to see if we're missing something else obvious.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:33 -04:00
Alyssa Rosenzweig 3be0314e5a asahi: Flush on partial clears
Not the fastest thing, but should be conformant. (Panfrost to this day
has this effective behaviour...)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:33 -04:00
Alyssa Rosenzweig 95a18d1c1c asahi: Pass depth/stencil clear values to firmware
These need to be format-packed, but as we only support Z32F_S8 right
now, that's trivial.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:32 -04:00
Alyssa Rosenzweig 43f6c08a3b asahi: Handle uncompressed Z32F depth buffers
This uses a subset of the depth/stencil infrastructure we built out to
support writing back tiled, uncompressed Z32F depth buffers to memory.
Texturing from this format is already supported.

This gets glmark2 -bshadow working.

v2: Fix partial renders

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:32 -04:00
Alyssa Rosenzweig c955dd726e asahi: Don't store to unbound render targets
Otherwise we have a state leak with depth-only attachments, as in
glmark2 -bshadow.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:32 -04:00
Alyssa Rosenzweig a0fc622be5 asahi: Validate depth/stencil formats
Don't go advertising formats we don't actually support.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:32 -04:00
Alyssa Rosenzweig e6c809d767 asahi: Use z24_in_z32f lowering
Thanks Dave!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:32 -04:00
Alyssa Rosenzweig 0ea174f38c asahi: Run lower_blend for all fragment shaders
Unify the paths so that colour masks are respected even when regular
blending is off (or when logic ops are used!) Fixes

dEQP-GLES2.functional.color_clear.masked_rgb

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
2022-05-21 22:01:32 -04:00
Mike Blumenkrantz aa32b96c51 turnip: fix assert for max xfb outputs
this is a counter, not an index, so use <=

cc: mesa-stable

Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16620>
2022-05-21 16:48:54 +00:00
Chia-I Wu 2a8e6a4d1a turnip: disable UBWC for SNORM formats
In copy_format, we treat snorm as unorm to avoid clamping.  But snorm
and unorm are UBWC incompatible for special values such as all 0's or
all 1's.  Disable UBWC for snorm.

For reference, I dumped the first byte of an UBWC blocks and it was

  color      UNORM  SNORM
  all black  0x01   0x31
  all white  0x0d   0x11

@flto clarified that bit 4 is unset for fast clear encoded blocks.  It
looks like fast clear is not used for SNORM.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6480
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16534>
2022-05-21 15:27:42 +00:00
Jeffrey Knockel d7dc27645e egl: dereference XCB drawable pointers
eglCreatePlatformWindowSurface[EXT] and
eglCreatePlatformPixmapSurface[EXT] should be passed (xcb_window_t *)
and (xcb_pixmap_t *), so we must dereference these types before using
them as drawables.  We already do something similar with X11 drawable
pointers.

Signed-off-by: Jeffrey Knockel <jeff@jeffreyknockel.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16269>
2022-05-21 14:42:06 +00:00
Karol Herbst cd8c083ab5 clc: disable opaque pointers until they are supported
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16479>
2022-05-21 12:26:37 +00:00
Karol Herbst b6ed3c6ea2 clc: fix compiler features_macro CTS Test
Even with that alone we can't pass the test, as LLVM enables some
extensions based on the SPIR target we choose.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16479>
2022-05-21 12:26:37 +00:00
Karol Herbst bcc2df4890 clc: speed up compilation by not relying on opencl-c.h
This depends on LLVM change: https://reviews.llvm.org/D125401

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16479>
2022-05-21 12:26:37 +00:00
Karol Herbst e5a052f75f clc: drop parsingComplete check
This relies too much on the properties of the SPIRV-LLVM-Translator and is
required to load SPIR-Vs found in the OpenCL CTS.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16479>
2022-05-21 12:26:37 +00:00
Karol Herbst c0cf7f578a clc: parse localSize and localSizeHint
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16479>
2022-05-21 12:26:37 +00:00
Chia-I Wu e8eb6d13a5 turnip: fix tu6_pack_border_color for z24
The value should be at the bottom 24 bits, not at the top.

dEQP-VK.pipeline.sampler.* still passes.  This fixes most of
dEQP-GLES31.functional.texture_border_clamp.formats.*depth* on angle.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16570>
2022-05-21 00:54:28 +00:00
Icecream95 2f2ddfa0ac panfrost: Move patched_s out of the pan_blitter_views struct
The struct is returned from a function, so in debug builds the address
may change after returning, and pointers to patched_s will be broken.

Pass the pointer to the patched stencil view as a parameter to
pan_preload_get_views to avoid this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16343>
2022-05-20 23:17:07 +00:00