Commit Graph

795 Commits

Author SHA1 Message Date
Alyssa Rosenzweig d11351c616 panfrost: Control tiler memory usage
Ensure we don't hit OOM when rendering at 8192x8192 on Valhall by disabling
the smallest bin size of the hierarchy mask.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15795>
2022-04-07 15:11:04 +00:00
Alyssa Rosenzweig 586c3b9e35 panfrost: Handle stencil texturing on Valhall
Use a Bifrost compatible path. It's not clear this is optimal but it passes the
tests and is no worse than what we do on Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15795>
2022-04-07 15:11:04 +00:00
Alyssa Rosenzweig db20152c8a panfrost: Handle Valhall texturing
Surface descriptors have been replaced by plane descriptors, which facilitate
the intermediate layout of textures. This allows for more sophisticated handling
of texture compressions, of particular to interest to copy_image. However, it
requires a considerable amount of new logic to handle.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15795>
2022-04-07 15:11:04 +00:00
Roman Stratiienko 61f94fff0d panfrost: Don't crash on panfrost_bo_create() with size==0 invocation
1. Clamp bucket_index from both ends to avoid returning negative index.
2. Return NULL in case BO allocation/fetching failure to prevent invalid
   bo mapping.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6247
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15748>
2022-04-05 13:08:51 +03:00
Alyssa Rosenzweig 0c1fde956b panfrost: Add Valhall compressed formats
We need to map to the interchange format, since there is no longer a pixel
format for the memory layout. Use this new format table on v9.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15586>
2022-03-30 17:29:12 +00:00
Alyssa Rosenzweig 42b9295fa6 panfrost: Restrict Z/S formats for Valhall
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15586>
2022-03-30 17:29:12 +00:00
Alyssa Rosenzweig ac51142bab panfrost: Handle Valhall IDVS in job_uses_tiling
Valhall-style IDVS uses a distinct job type which has to be handled separately.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15586>
2022-03-30 17:29:12 +00:00
Alyssa Rosenzweig 508335c927 panfrost: Add Tiler Job to v9 XML
Legacy tiling job, semantics are the same as on Midgard. Useful for blits and
transform feedback.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15461>
2022-03-18 18:52:05 +00:00
Alyssa Rosenzweig e635dc9ea5 panfrost: Refactor XML to permit non-IDVS jobs
Tiler jobs look similar, but don't have the Allocations fields. Refactor to make
this possible to express.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15461>
2022-03-18 18:52:05 +00:00
Alyssa Rosenzweig 53f1fa9219 panfrost: Fix definition of DCD on v9
The position and varying shader environment descriptors are additional sections
of the job, rather than part of the (fragment only) DCD. This distinction
matters for non-IDVS jobs.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15461>
2022-03-18 18:52:05 +00:00
Alyssa Rosenzweig 02f519601a panfrost: Correct ASTC decode mode XML
The narrow/wide bit was backwards.

Fixes: bfba7533c7 ("panfrost: Add Valhall Plane Descriptor XML")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15461>
2022-03-18 18:52:05 +00:00
Alyssa Rosenzweig fd87135852 pan/decode: Unify tiler job handling
Instead of adding a third Valhall path, let's use GenXML to unify our paths.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15461>
2022-03-18 18:52:05 +00:00
Alyssa Rosenzweig a9ca751a8f pan/decode: Handle blend arrays on Valhall
Required for MRT.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15461>
2022-03-18 18:52:05 +00:00
Alyssa Rosenzweig 2604c65174 panfrost: Unify barrier+helper handling
These are unified in the hardware, so let's unify them in pan_shader_info.
Hoisting this logic to pan_shader.c avoids the need to duplicate this logic for
Midgard/Bifrost (RSD packing) and Valhall (SPD packing).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig 30d0c2e390 panfrost: Set texel_interleave on Valhall
Instead of specifying the tiling on the texture descriptor, Valhall specifies it
on the plane descriptor. There is a new flag on the texture descriptor
specifying only whether the planes are interleaved or not.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig 407bda4d8c panfrost: Adapt estimate_texture_payload_size to Valhall
The plane descriptor is larger than earlier surface descriptors, so we need to
be somewhat careful here. This removes a memory micro-optimization in the
interest of simplifying the code.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig 469a36d071 panfrost: Don't emit compression tags on Valhall
Unnecessary. To avoid even more #if/#endif soup, merge the v4, v5-v8, and v9
paths together -- by returning 0 as the compression tag on v4 or v9.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig 36a2b8d039 panfrost: Add PAN_MESA_DEBUG=dump option
To dump all graphics memory via the new pandecode_dump_mappings function(),
since for Valhall I have to do this often enough to warrant a dynamic flag.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig f3c971e0fe panfrost: Make Divisor E an integer on v9
For consistency with previous architecture's XML files. Logically this is an
1-bit unsigned integer, not a boolean.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig b19afaf307 panfrost: Clarify contains descriptor? bit
Influences cache prefetching. I don't see a good reason to put anything other
than descriptors inside shader resources, meaning always setting this bit is
appropriate (at least for GLES).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig 1df6b0d7e2 panfrost: Remove Invalidate Cache from Valhall job header
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig 217e038289 panfrost: Add Tile Render Order enum to fragment jobs
Not sure what this is needed for yet.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Alyssa Rosenzweig 52ccd21e6b panfrost: Extend SPD size
There is software-defined state at the end we don't need. Model in the XML for
correct behaviour.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15204>
2022-03-01 19:43:22 +00:00
Adrián Larumbe 6d0824abcc panfrost: fix segfault in pandecode
The structure wrapped around the rb tree node was being freed, but not the node
itself, which caused a segmentation fault when accessing its parent node.

Add rb tree node remove call to fix it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15188>
2022-02-28 12:40:32 +00:00
Alyssa Rosenzweig 6618697e0e panfrost: Pack message preloads from compiler
Include full message preload descriptors in the RSD on v7, and do the obvious
packing for fragment shader message preloads.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9438>
2022-02-24 12:51:04 -05:00
Alyssa Rosenzweig 2d0c4973dc panfrost: Remove Message Preload Descriptor from v6.xml
It is an anachronism, as this descriptor was added in v7 and, seemingly, removed
immediately after. Good work.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9438>
2022-02-24 12:50:58 -05:00
Alyssa Rosenzweig abb7f04674 panfrost: Inline pan_emit_sfbd_tiler
Easier to read, the common code was already common.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>
2022-02-23 12:56:30 +00:00
Alyssa Rosenzweig 910d4f8245 panfrost: Remove pan_emit_fbd thunking
Use a common interface.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>
2022-02-23 12:56:30 +00:00
Alyssa Rosenzweig 099d61c95d panfrost: Use txl instead of tex in the blitter
We always blit from a particular level, so it's a waste to compute the LOD.
This corresponds to a simple texture instruction with implement 0 LOD, which is
the optimal texturing path on Bifrost -- it maps to TEXS_2D but does not require
helper invocations.

Functional change on Bifrost: Blit shaders no longer set .computed_lod or
shader_contains_barrier.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>
2022-02-23 12:56:30 +00:00
Alyssa Rosenzweig 5b1a00c565 panfrost: Inline pan_blit_emit_dcd
Easier to follow the logic without having a million arguments passed around.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>
2022-02-23 12:56:30 +00:00
Alyssa Rosenzweig c9784c9512 panfrost: Decouple tiler job and DCD emit
We can share the "emit quad" logic, even though the DCDs differ.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>
2022-02-23 12:56:30 +00:00
Alyssa Rosenzweig 1eb3dbafdb panfrost: Set defaults for deprecated DCD fields
There are always set to true. Don't pollute the driver code with them, make
their existence a local detail to pre-Valhall XML and that's it.

Functional change: "four components per vertex" is now set on vertex job DCDs.
This should be a no-op.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>
2022-02-23 12:56:30 +00:00
Alyssa Rosenzweig bd3d7e33b6 panfrost: Use pan_shader_prepare_rsd in blitter
This reduces code duplication and will ease Valhall porting. Functional changes
on v7:

* Shader contains barrier is now set (perf loss, fixed later in series)
* Shader register allocation is now set (perf win)
* Point sprite inverted, no-op for blit shaders

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>
2022-02-23 12:56:30 +00:00
Alyssa Rosenzweig 294a357b33 panfrost,asahi,radv: Don't set internal=true manually
nir_builder_init_simple_shader does this automatically now.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14936>
2022-02-17 23:30:46 +00:00
Alyssa Rosenzweig 3697907231 panfrost: Fix Malloc Vertex definition
A few missing things and a few wrong things, nothing major.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15047>
2022-02-16 22:05:55 +00:00
Alyssa Rosenzweig 1ca2358d6b panfrost: Flesh out compute jobs
Valhall has a new twist on Mali's task splitting voodoo, plus compute offset
support.

On Bifrost + Vulkan, compute offsets needed lowering on Bifrost (gl_GlobalID).
Valhall saves a few instructions here.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15047>
2022-02-16 22:05:55 +00:00
Alyssa Rosenzweig 6d5ddf69e2 panfrost: Update Shader Environment descriptor
Disambiguate the name, add a missing field, shorten a field, remove a dated
comment.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15047>
2022-02-16 22:05:55 +00:00
Alyssa Rosenzweig cf95a1c308 panfrost: Add Valhall fields to tiler descriptor
Mostly to support layered rendering.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15047>
2022-02-16 22:05:55 +00:00
Alyssa Rosenzweig c011ea6c26 panfrost: Shuffle render target AFBC for Valhall
I'm not sure why this is different, although it adds support for new AFBC
modifiers.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15047>
2022-02-16 22:05:55 +00:00
Alyssa Rosenzweig 1ee09eaca8 panfrost: Add Valhall additions to the framebuffer
There are a few minor changes. Nothing fundamanetal.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15047>
2022-02-16 22:05:55 +00:00
Alyssa Rosenzweig 9dc30f99ae panfrost: Flesh out the Shader Program Descriptor
Only breaking change since Bifrost is that the shader contains barrier? flag is
now fragment-only, meaning it is just a spawn helper threads flag. This affects
compute shaders slightly.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15003>
2022-02-12 09:32:55 -05:00
Alyssa Rosenzweig 60b37424d9 panfrost: Simplify Valhall preload descriptor
Honestly, we could stand to do the same to Bifrost...

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15003>
2022-02-12 09:32:55 -05:00
Alyssa Rosenzweig 1e9a35648a panfrost: Clarify unknowns in z/stencil descriptor
Depth culling and clamping.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15003>
2022-02-12 09:32:55 -05:00
Alyssa Rosenzweig 733d5f061d panfrost: Add more fields to Attribute Descriptor
More XML

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15003>
2022-02-12 09:32:35 -05:00
Alyssa Rosenzweig b31f6a821d panfrost: Update primitive descriptor for Valhall
Contains stuff needed for layered rendering. Unfortunately, there's no more
provoking vertex per draw -- ugh! That's fine for Vulkan (just don't set
provokingVertexModePerPipeline), but requires inserting extra flushes on desktop
OpenGL.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15003>
2022-02-12 09:32:18 -05:00
Alyssa Rosenzweig 12446491c1 panfrost: Fix Depth Source enum
As I suspected... sigh.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14935>
2022-02-08 20:27:09 +00:00
Alyssa Rosenzweig 32e58c2dd4 panfrost: Remove unused layout enums
Folded into Valhall-specific plane descriptor enums.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14935>
2022-02-08 20:27:09 +00:00
Alyssa Rosenzweig d27d46a266 panfrost: Remove some indexed formats on Valhall
Block compressed formats like ETC2 are now indicated in the plane descriptor,
rather than the pixel format descriptor. Various other minor formats were
removed in Valhall; remove them from the XML so we don't accidentally try to use
them.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14935>
2022-02-08 20:27:09 +00:00
Alyssa Rosenzweig 8c51b54bd1 panfrost: Update supported job types
Remove a few that no longer exist, and rename IDVS helper to Malloc Vertex. The
distinction between Malloc Vertex jobs and regular Indexed Vertex jobs is that
the hardware allocates varying buffers dynamically for Malloc Vertex jobs.
Regular IDVS and even legacy tiler jobs are also supported where desired.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14935>
2022-02-08 20:27:09 +00:00
Alyssa Rosenzweig d70a48a706 panfrost: Flesh out tiler heap descriptor
Merged with the Buffer descriptor, hence why it shares a type nibble. However,
Bifrost uses a dedicated tiler heap descriptor, and I see no benefit to merging.
So pretending it's a dedicated descriptor on Valhall too allows us to reuse the
Bifrost code with no modifications.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14935>
2022-02-08 20:27:09 +00:00
Alyssa Rosenzweig 62173fa532 panfrost: Strip % in GenXML names
A new Valhall enum will represent percentages, so allow that.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14935>
2022-02-08 20:27:09 +00:00
Alyssa Rosenzweig e514f4c0b1 panfrost: Flesh out Buffer descriptor
Add fields required for structured buffers.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14935>
2022-02-08 20:27:09 +00:00
Alyssa Rosenzweig 1410d150e7 panfrost: Fix texel interleave flag on Valhall
Interleave mode specified per-plane on Valhall. The texture descriptor proper
merely has a flag specifying whether planes are somehow interleaved
(u-interleaved, AFBC, or block compressed formats) or whether they are all
linear (and uncompressed).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14851>
2022-02-03 15:43:27 +00:00
Alyssa Rosenzweig 3bf34a1494 panfrost: Add remaining ZS/CRC XML
Flesh out the ZS/CRC XML, adding fields required for AFBC. Valhall allows AFBC
compressing stencil buffers independent of depth buffers, which is a new feature
since Bifrost. That results in a shuffling of the descriptor.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14851>
2022-02-03 15:43:27 +00:00
Alyssa Rosenzweig bfba7533c7 panfrost: Add Valhall Plane Descriptor XML
This looks superficially like the Bifrost "Surface" descriptor, but it
additionally specifies the in-memory representation of blocks (clumps). If I
understand correctly, decompression is controlled by the plane descriptor,
rather than the texture descriptor level. This is a bit more flexible than
Bifrost.

Once the new fields here are wired up to Mesa, my
dEQP-GLES2.functional.texture.* failures should go away... I hope!

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14851>
2022-02-03 15:43:27 +00:00
Alyssa Rosenzweig c34381d8e8 panfrost: Fix alignments on Valhall
Otherwise we get DATA_INVALID_FAULT trying to run even trivial null jobs. For
each descriptor, set the correct alignment.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14851>
2022-02-03 15:43:27 +00:00
Alyssa Rosenzweig a98f0e280e panfrost: Remove blend shader return value on v9
Removed since there's a new ABI for blend shaders. Even if we always write 0,
it's better not to pack this at all, and to denoise the dumps.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14851>
2022-02-03 15:43:27 +00:00
Alyssa Rosenzweig 0b16bf370e panfrost: Add Mali-G51 support
Just to prove it can be done in one line now :-)

Thanks to Robin Murphy for breaking out the ol' FPGA.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14726>
2022-01-28 17:47:46 +00:00
Alyssa Rosenzweig 8c01a8a263 panfrost: Replace panfrost_model_name with model->name
One less place to update GPU IDs.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14726>
2022-01-28 17:47:46 +00:00
Alyssa Rosenzweig 6c0d433d19 panfrost: Centralize our model list
Replaces panfrost-quirks.h

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14726>
2022-01-28 17:47:46 +00:00
Alyssa Rosenzweig 2b699d0650 panfrost: Fix v9 "Stencil from shader" bit
Typo.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Fixes: 96acad5cd5 ("panfrost: Add XML for Valhall data structures")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14776>
2022-01-28 17:30:37 +00:00
Alyssa Rosenzweig 23d52b47f1 panfrost: Make primary_shader boolean
Fixes: 96acad5cd5 ("panfrost: Add XML for Valhall data structures")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14776>
2022-01-28 17:30:37 +00:00
Alyssa Rosenzweig 47a7e26954 panfrost: Remove HAS_SWIZZLES quirk
It's a function of the major arch.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14724>
2022-01-26 01:45:09 +00:00
Alyssa Rosenzweig c85df67f27 pan/decode: Fix missing newlines in error messages
Otherwise these error message lines end up truncated, which is a bit
annoying.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reported-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14575>
2022-01-24 16:20:49 +00:00
Alyssa Rosenzweig 77a1514a37 pan/decode: Disassemble Bifrost quietly
Although Bifrost clause packing and register assignment is tricky, the
relevant code is by now extensively tested, and there's no remaining
reverse-engineering here. So disassembling verbosely just adds tons of
noise to pandecode without increasing the useful information.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Suggested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:48:32 -05:00
Alyssa Rosenzweig 58accc995b pan/decode: Don't print Preload twice
It's already printed in the RSD itself, no need to print it out-of-band
a second time. Removes noise in the pandecode.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:46:12 -05:00
Alyssa Rosenzweig 330bb2c58b panfrost: Remove FBD pointer on Bifrost XML
It's a pointer to a thread storage descriptor, not a framebuffer
descriptor. Unlike Midgard, these don't have to alias. The FBD pointer
was unused anyway, so remove it to reduce noise in pandecode dumps.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:43:40 -05:00
Alyssa Rosenzweig ae9316f812 pan/decode: Decode Valhall surface descriptor
Instead of incorrectly falling down the Bifrost path.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:40:14 -05:00
Alyssa Rosenzweig c947a52df4 pan/decode: Add pandecode_dump_mappings
Add a helper to dump all mapped GPU memory. This is a blunt, seldom
useful instrument ... but when it /is/ useful it's your only option.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:40:13 -05:00
Alyssa Rosenzweig 861fa2baec pan/decode: Add hexdump helper
I think I originally wrote this for Asahi? Should probably be moved to
util/...

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:40:13 -05:00
Alyssa Rosenzweig 6752fcf179 pan/decode: Track mmaps with a red-black tree
Rather than emulating page tables, poorly, with a hash table, use a
red-black tree and store the intervals directly. This is deterministic
instead of probabilistic, attaining O(log n) performance for n mapped
intervals which is good enough. Unlike the hash table approach, this
allows us to iterate intervals easily.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:40:13 -05:00
Alyssa Rosenzweig a07473b79d pan/decode: Include addresses for jobs
Helpful for contextualizing fault pointers.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:40:13 -05:00
Alyssa Rosenzweig 4af20895c5 pan/decode: Remove hierarchy mask check
This has never been meaningful.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14543>
2022-01-15 11:40:13 -05:00
Carsten Haitzler b22294f6d5 panfrost: Add GPU G76 to the set of known ids
This is another working GPU so add the ID to the known set. Working on
real silicon and tested.

Signed-off-by: Carsten Haitzler <carsten.haitzler@foss.arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14517>
2022-01-13 14:59:48 +00:00
Alyssa Rosenzweig 311077c483 panfrost: Make pan_merge macro more robust
Consider the following innocuous-looking code:

   pan_merge(packed, vtx->attributes[i], ATTRIBUTE);

Under the current implementation, this code is completely broken. Why?
The current implemention is a macro which hardcodes the loop index i,
which shadows the i used to index attributes. Pull out a helper method
so we do the right thing without resulting to further preprocessor abuse
(__COUNTER__).

While making things more robust, assert the crucial pan_merge
invariant that the total size is a multiple of 4; if this fails, the
routine risks memory corruption.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14119>
2021-12-28 13:55:21 +00:00
Vinson Lee 9f8a204645 panfrost: Avoid double unlock.
Fix defect reported by Coverity Scan.

Double unlock (LOCK)
double_unlock: pthread_mutex_unlock unlocks dev->indirect_draw_shaders.lock while it is unlocked.

Fixes: 2e6d94c198 ("panfrost: Add helpers to support indirect draws")
Suggested-by: Alyssa Rosenzweig <alyssa@collabora.com>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14262>
2021-12-22 02:01:57 +00:00
Alyssa Rosenzweig 4d8d987f1a panfrost: Set secondary_* fields for IDVS
Easy now that we've split everything out nicely.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:41 +00:00
Alyssa Rosenzweig 29f63c6283 panfrost: Remove regalloc from v6.xml
These fields were not introduced until v7, fix that.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:41 +00:00
Alyssa Rosenzweig 83356c58f8 panfrost: Split out regalloc/preload helpers
The logic gets duplicated if IDVS is in use.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:41 +00:00
Alyssa Rosenzweig dc4fe86a01 panfrost: Treat IDVS jobs as tiler for scoreboarding
These need to be chained and need to provoke a fragment job when we're
done.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:41 +00:00
Alyssa Rosenzweig 8dc1936faa panfrost: Fix Secondary Shader field
Off-by-one on the start.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reported-by: Icecream95 <ixn@disroot.org>
Fixes: 73e80994d5 ("panfrost: Add secondary shader XML fields")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:40 +00:00
Alyssa Rosenzweig b27bbbe0c9 panfrost: Remove unused shader info bits
These were only used to infer preloading and can be deleted.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:40 +00:00
Alyssa Rosenzweig 7358edad42 panfrost: Set preload descriptor more accurately
Preload exactly what the shader needs, based on the compiler's mask of
uninitialized registers, rather than trying to sync pan_shader.h with
the behaviour of code gen. Would've saved me some debugging over the
years...

As a bonus this avoids preloading unnecessary registers, particularly in
compute shaders. In theory this should reduce power consumption.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:40 +00:00
Alyssa Rosenzweig e8566f7529 pan/indirect_draw: Support IDVS jobs
Handle as tiler jobs with an extra vertex DCD at the end.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:40 +00:00
Alyssa Rosenzweig 37ab248c77 pan/indirect_draw: Split out update_dcd
This is common between vertex/tiler jobs and needs to be duplicated for
IDVS jobs.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:40 +00:00
Alyssa Rosenzweig d696183d4d pan/indirect_draw: Don't upload garbage UBO
There should never be a CPU pointer in GPU memory, let's say that...

Fixes: 2e6d94c198 ("panfrost: Add helpers to support indirect draws")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
2021-12-20 18:21:40 +00:00
Alyssa Rosenzweig 9b068f186a panfrost: Add Valhall support to pandecode
Valhall v9 introduces a number of new data structures since Bifrost v7,
and removes a number of traditional data structures. Add decode routines
for the new Valhall data structures, and condition the old routines on
(PAN_ARCH <= 7) to remain buildable and warning-free.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14063>
2021-12-06 20:46:09 +00:00
Alyssa Rosenzweig 244f3704d4 panfrost: Zero initialize disassembler stats
Keep it simple for introducing new support.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14063>
2021-12-06 20:46:09 +00:00
Alyssa Rosenzweig 96acad5cd5 panfrost: Add XML for Valhall data structures
Fork the latest canonical XML (Bifrost v7) and adapt to the data
structures found in the earliest Valhall GPU I could get my hands on
(Valhall v9). This should minimize the churn needed for the port by
keeping the Valhall model close to the Bifrost we already supported.

It is not known what happened to v8. It appears to have been yeeted from
existence.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14063>
2021-12-06 20:46:09 +00:00
Alyssa Rosenzweig 6eb0770be8 panfrost: Add "hex" type to GenXML
Although known fields wouldn't be given the type "hex", it is useful as
the default type for unknown fields while reverse-engineering, and as
such is used in the Valhall XML.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14063>
2021-12-06 20:46:09 +00:00
Alyssa Rosenzweig ae4d46d457 panfrost: Only build GPU indirect kernels for v7
These kernels aren't tested (and are probably broken) elsewhere. Don't
waste cycles trying to compile for other architectures. This reduces the
amount of code that needs to be ported to a new architecture.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14064>
2021-12-06 13:54:25 +00:00
Alyssa Rosenzweig 8d2be391e3 panfrost: Add empty tile flags to GenXML
These flags control special CRC handling for empty tiles using the CRC
clear colour field added on Bifrost. Their use depends on CRC being
used. We missed these flags earlier; let's add them since they are used
by the Valhall DDK but are not new to Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13982>
2021-11-30 15:43:59 +00:00
Alyssa Rosenzweig e257344a82 nir/lower_pntc_ytransform: Support PointCoordIsSysval
Pattern match the point coord sysval and support lowering it as well.
This is required to handle flipped framebuffers on Bifrost. However,
what this pass normalizes to is the opposite of the hardware mode we
used on Bifrost before, so we need to swap modes at the same time to
prevent regressions.

Fixes Piglit glsl-fs-pointcoord and glsl-fs-pointcoord_gles2

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13073>
2021-11-12 12:34:14 +00:00
Alyssa Rosenzweig 169aa9f177 panfrost: Test alpha_zero_nop/one_store predicates
For each blend mode in our blending unit tests, add whether we can set
the alpha_zero_nop and alpha_one_store flags and check against the
predicates.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13508>
2021-10-26 19:01:47 +00:00
Alyssa Rosenzweig c6b2c1069b panfrost: Add alpha_zero_nop/one_store predicate
Some Mali GPUs can avoid storing to the tilebuffer if src alpha = 0, and
can replace blending with a store if src alpha = 1. This saves power in
the common case of alpha blending. Add predicates to check if these
optimizations are valid for a given blend equation.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13508>
2021-10-26 19:01:46 +00:00
Alyssa Rosenzweig 87b68e77cc panfrost: Rename depth bias fields
Make it clear that the distinction is the facingness of the primitives
the depth bias applies to.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13509>
2021-10-26 18:45:08 +00:00
Alyssa Rosenzweig c2d522b07f panfrost: Remove duplicated #if
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13208>
2021-10-23 02:21:13 +00:00
Alyssa Rosenzweig baaa88cf9e panfrost: Remove ancient TODO
This was implemented ages ago.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13208>
2021-10-23 02:21:13 +00:00
Alyssa Rosenzweig 93c9123c31 panfrost: Add internal afbc_formats
We need to know the internal (physical) formats used for AFBC of a given
logical format, in order to check format compatibility and determine if
we need to decompress AFBC for conformance.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13205>
2021-10-22 21:55:32 -04:00
Alyssa Rosenzweig 342ed4909f panfrost: Workaround ISSUE_TSIX_2033
According to mali_kbase, all Bifrost and Valhall GPUs are affected by
issue TSIX_2033. This hardware bug breaks the INTERSECT frame shader
mode when forcing clean_tile_writes. What does that mean?

The hardware considers a tile "clean" if it has been cleared but not
drawn to. Setting clean_tile_write forces the hardware to write back
such "clean" tiles to main memory.

Bifrost hardware supports frame shaders, which insert a rectangle into
every tile according to a configured rule. Frame shaders are used in
Panfrost to implement tile reloads (i.e. LOAD_OP_LOAD). Two modes are
relevant to the current discussion: ALWAYS, which always inserts a frame
shader, and INTERSECT, which tries to only insert where there is
geometry. Normally, we use INTERSECT for tile reloads as it is more
efficient than ALWAYS-- it allows us to skip reloads of tiles that are
discarded and never written back to memory.

From a software perspective, Panfrost's current logic is correct: if we
clear, we set clean_tile_writes, else we use an INTERSECT frame shader.
There is no software interaction between the two.

Unfortunately, there is a hardware interaction. The hardware forces
clean_tile_writes in certain circumstances when AFBC is used.
Ordinarily, this is a hardware implementation detail and invisible to
software. Unfortunately, this implicit clean tile write is enough to
trigger the hardware bug when using INTERSECT. As such, we need to
detect this case and use ALWAYS instead of INTERSECT for correct
results.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13205>
2021-10-22 21:55:32 -04:00
Alyssa Rosenzweig 3e168b97cc panfrost: Detect implementations support AFBC
AFBC is an optional feature on Bifrost. If it is missing, a bit will be
set in the poorly named AFBC_FEATURES register. Check this so we can act
appropriately.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13497>
2021-10-22 19:33:38 -04:00
Alyssa Rosenzweig d31ca63527 panfrost: Don't allow rendering/texturing 48-bit
Matches freedreno. Fixes crashes in Piglit arb_texture_view.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13394>
2021-10-16 23:49:13 +00:00
Alyssa Rosenzweig b88225378d panfrost: Introduce PAN_MAX_VARYINGS define
The number of varying records we need to reserve in the worst case is
greater than the number of source-level varyings we advertise
(gl_Position, gl_PointSize...)

We advertise MAX_VARYINGS source level varyings, which means anywhere we
manipulate varyings we need up to (MAX_VARYINGS + max non-source level
varyings) records. Add a PAN_MAX_VARYINGS define for this and use it
throughout.

Fixes a buffer overflow in Piglit glsl-max-varyings, which now passes
instead of crashes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>
2021-10-05 21:13:52 +00:00
Alyssa Rosenzweig 00b0529061 panfrost: Move special_varying to compiler definitions
The number of special varyings on midgard can influence how much space
we need to allocate for varyings in the compiler ABI. Move the enum so
we can get access it.

No functional change. This is cc stable purely so the following patches
can be backported.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>
2021-10-05 21:13:52 +00:00
Icecream95 689870e7c4 panfrost: Add ASTC 3D texture format entries
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12814>
2021-09-30 14:26:12 +00:00
Alyssa Rosenzweig e26ffda2b9 panfrost: Encode 3D ASTC dimensions
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12814>
2021-09-30 14:26:12 +00:00
Alyssa Rosenzweig a1c6a15012 panfrost: Use ASTC 2D enums
Rather than manipulating the bits to do the mapping, use a dead simple
switch() with the enum definition.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12814>
2021-09-30 14:26:12 +00:00
Alyssa Rosenzweig 3d28039b3e panfrost: Assert ASTC/AFBC are not used on v4
These are not introduced until v5. The required enums do not exist on
v4. Assert this is so.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12814>
2021-09-30 14:26:12 +00:00
Alyssa Rosenzweig f4f0e30701 panfrost: Add ASTC stretch factor enums
ASTC textures all use a common ASTC format, with the ASTC block
dimension configured with auxiliary bits at the bottom of the payload
pointer. Add the corresponding enum for ASTC 2D and 3D.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12814>
2021-09-30 14:26:12 +00:00
Boris Brezillon 8276a8eb55 panfrost: Move genxml related files to a subdir
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12208>
2021-09-30 10:30:19 +00:00
Boris Brezillon b76420be1f panfrost: Split command stream descriptor definitions per-gen
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12208>
2021-09-30 10:30:19 +00:00
Boris Brezillon 95b37fd21e panfrost: Add a common genxml file so we can share a few definitions
Start with the enums that were manually redefined in
pan_{texture,format}.h and the blend equation descriptors.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12208>
2021-09-30 10:30:19 +00:00
Boris Brezillon fbbe00c0b7 panfrost: Use an identity swizzle for RAW formats
When the render target format is raw, the swizzle is ignored. Let's
set it to identity to avoid misleading the pandecode reader into
thinking the swizzle is applied.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Suggested-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12793>
2021-09-28 18:59:46 +00:00
Boris Brezillon 7625cba2b7 pan/lower_fb: Re-order components when dealing with raw formats
The output swizzle defined in the render-target descriptor is ignored
when the format is RAW. In that case, we have to swap the components
when lowering FB stores/loads if we want to get the right color.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12793>
2021-09-28 18:59:46 +00:00
Boris Brezillon c49f221888 pan/blit: Fix 3D blittering
Fixes several problems in the pan_blit() logic:

1. We actually need the reciprocal of the depth scaling in z_scale (maybe
   we should rename this field z_scale_rcp to make it clear)

2. When Z end < Z start we should remove one to the cur_layer/layer_offset
   instead of doing it on the last_layer field, otherwise there's an
   off-by-one error

3. The Z src offset should be adjusted to account for scaling. If we don't
   do that we won't sample from the right layer when upscaling.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12961>
2021-09-27 07:45:41 +00:00
Boris Brezillon c7204ab7fc pan/blit: Let the caller offset the start/end coords passed to the blitter
Since we have no guarantee that start < end, we can't really tell to
which one the offset applies to. Let the caller take care of that.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12961>
2021-09-27 07:45:41 +00:00
Alyssa Rosenzweig f100551bee panfrost: Fix incorrect test condition
Oh, the irony. I linked to this file in a software design class as an
example of how unit testing works under the hood, since it's not using
any particular testing framework. In doing so I realized the test is
totally broken. It doesn't matter -- the tests passed before, pass now,
and the code being tested is correct. But let's still fix the
embarassing logic error for future Panfrost hackers.

Fixes: d42e53c77a ("panfrost: Unit test clear colour packing")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13006>
2021-09-24 11:46:29 +00:00
Boris Brezillon d47a8789f9 pan/decode: Fix DCD size in Pre frame decoding
DCD size on Bifrost is supposed to be 32 words wide, but this change
will only happen after the per-gen XML split. We have to manually append
the DRAW_PADDING for now.

Fixes: de13fdc251 ("panfrost: Prepare pandecode to per-gen XML")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12970>
2021-09-22 11:43:10 +00:00
Boris Brezillon ba2874563e pan/blit: Extend pan_preload_fb() to return emitted jobs
The vulkan driver needs to patch job headers when re-issuing batches.
Extend pan_preload_fb() so it can return the emitted tiler jobs.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12095>
2021-09-21 14:59:50 +02:00
Boris Brezillon 9f4dab0f2d pan/blit: Fix a NULL dereference in the preload path
The ZS view can be NULL if a stencil-only buffer is attached to the FB.

Fixes: 1de393fec5 ("panfrost: Fix ZS reloading on Bifrost v6")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12095>
2021-09-21 14:59:44 +02:00
Boris Brezillon 3c2d7cb0d6 panfrost: Fix collision in the indirect draw shader table
Min/max index search shaders are different for the !primitive_restart
and primitive_restart. We need to add entries for the primitive restart
cases otherwise we might retrieve a wrong shader from the cache.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12589>
2021-09-20 14:58:02 +00:00
Boris Brezillon 43760a7b2f panfrost: Fix indirect draws when vertex or instance count is 0
In that case we should just skip the vertex/tiler jobs as done in the
direct draw path.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12589>
2021-09-20 14:58:02 +00:00
Italo Nicola 7682a5de04 panfrost: fix null deref when no color buffer is attached
Do not dereference color buffer #0 in the SFBD code path if no color buffer is
attached, as with depth-only attachments. Fixes a crash running glmark2 -b
shadow on Mali T720.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Fixes: c746747cb8 ("panfrost: fix GL_EXT_multisampled_render_to_texture regression")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12927>
2021-09-20 14:42:39 +00:00
Boris Brezillon bdb37c862f panfrost: Prepare shader helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:18:56 +02:00
Boris Brezillon 0d57a76458 panfrost: Prepare texture helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:18:56 +02:00
Boris Brezillon a865a4a789 panfrost: Prepare pan_encoder.h to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:18:50 +02:00
Boris Brezillon f36fd4ac4c panfrost: Prepare scoreboard helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:12:33 +02:00
Boris Brezillon de13fdc251 panfrost: Prepare pandecode to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:11:30 +02:00
Boris Brezillon 502b942944 panfrost: Move panfrost_major_version() to gen_macros.h
So we can use this function in decode_common.c when transitioning to
per-gen XML. While at it rename the function pan_arch().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:10:10 +02:00
Boris Brezillon 5af3516f9e panfrost: Prepare pan_cs helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:10:00 +02:00
Boris Brezillon e145a5fdd4 panfrost: Prepare blend helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:09:19 +02:00
Boris Brezillon f68c9a575b panfrost: Prepare blitter helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12935>
2021-09-20 15:08:31 +02:00
Boris Brezillon 8805509fff panfrost: RGB332_UNORM is not a valid texture format on v6+
Cc: mesa-stable
Fixes: c6bdd976e6 ("panfrost: Split out v6/v7 format tables")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12508>
2021-09-20 11:21:29 +00:00
Boris Brezillon b1172540f3 panfrost: Drop the R and T flags on SCALED formats
Sampling from SCALED textures / rendering to SCALED FBOs is a bit tricky
(requires extra int <-> float conversions in a few places).
mesa/st only use SCALED formats as vertex formats, and those formats
are optional in Vulkan, so let's drop the RENDER/TEXTURE flags to keep
things simple.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Suggested-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12508>
2021-09-20 11:21:29 +00:00
Boris Brezillon bab84c62d5 panfrost: RGB10_A2_SNORM is not a valid texture format on v6+
Cc: mesa-stable
Fixes: c6bdd976e6 ("panfrost: Split out v6/v7 format tables")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12508>
2021-09-20 11:21:29 +00:00
Boris Brezillon 8651dfbeb4 panfrost: Fix the Z32_S8X24 and X32_S8X24 definitions
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12508>
2021-09-20 11:21:29 +00:00
Carsten Haitzler 6f56eb2429 panfrost: tidy up GPU naming to be in line with official names
Offical naming of Mali GPUs is like Mali-G52 or Mali-T860 wth a dash.
Also variants of the same GPU e.g. revision 1 are generally not part
of the name. This adds a dash instead of a space between Mali and the
model and also splits off the r1 revision with a space. This should
keep the naming in-line with offical names and with what the binary
DDK uses for naming.

Signed-off-by: Carsten Haitzler <carsten.haitzler@foss.arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12667>
2021-09-02 11:16:49 +00:00
Boris Brezillon 19e29960e9 panfrost: v7 does not support RGB32_UNORM textures
Cc: mesa-stable
Fixes: c6bdd976e6 ("panfrost: Split out v6/v7 format tables")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12588>
2021-08-27 08:21:14 +00:00
Boris Brezillon 587046ed25 panfrost: Make pan_blit() return the tiler job pointer
The Vulkan driver needs to patch job headers when re-issueing a command
buffer. Return the tiler job pointer to allow that.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12552>
2021-08-26 08:53:45 +00:00
Boris Brezillon e466e0ecd2 panfrost: Fix pan_blit_ctx_init() when start > end
This can happen when one wants to obtain a mirrored view. We need
to make sure the min <= max before emitting the viewport.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12552>
2021-08-26 08:53:45 +00:00
Boris Brezillon 1c953ba212 panfrost: Prepare indirect draw helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon 1447db0d51 panfrost: Prepare indirect dispatch helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon 56a4aa9332 panfrost: Move panfrost_modifier_to_layout() to pan_texture.c
This function is not used outside pan_texture.c.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon 0400c4ca1b pan/gen_pack: Add parens around packed1/2 vars in pan_merge()
This way we can pass *desc instead of (*desc).

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon fe1d33daaf panfrost: Add generic mappings for the gen-specific tiler descriptor macros
This way the transition to per-gen XML files gets simpler.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon 5f3910a343 panfrost: Get rid of the mali_xxx enum redefinitions
The gen_macros.h header should include the common header file when
PAN_ARCH is undefined, thus making those redefinitions useless.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon 13c13efcac panfrost: s/[idep_]midgard_pack/[idep_]pan_packers/
We will soon have per-gen pack headers. Let's rename the meson variables
to reflect that.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon 908dde360a panfrost: Stop including midgard_pack.h directly
Include gen_macros.h instead so we can smoothly transition to per-gen
XMLs.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon f96a30cea5 pan/gen_macros: Include midgard_pack.h from gen_macros.h
This way we will only have a single entry point, thus making the
transition to per-gen XML files easier.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00
Boris Brezillon f29b45f934 pan/gen_macros: Map {TEXTURE,SAMPLER} to the arch-specific descriptor
This will ease the transition to per-arch XML files. While at it, patch
pan_cmdstream.c to use this new macro and avoid an #if section.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
2021-08-26 10:35:17 +02:00