Commit Graph

139760 Commits

Author SHA1 Message Date
Jose Fonseca 250605c57d draw: Allocate extra padding for extra shader outputs.
This prevents read buffer overflows in dup_vertex(), when draw stages
allocate extra shader outputs after the vertex buffers are allocated.

The original issue can be exercised with upcoming
piglit/tests/general/vertex-fallbacks.c test.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Cc: 21.0 21.1 <mesa-stable@lists.freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10836>
2021-05-19 06:31:31 +00:00
Mike Blumenkrantz 0df249f542 util/primconvert: add C++ guards to header
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10868>
2021-05-19 00:05:56 +00:00
Alyssa Rosenzweig de40016d8b panfrost: Express viewport in terms of the batch
Easier to say the state dependencies.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig c2d571934d panfrost: Simplify panfrost_bind_sampler_states
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig a9a3f55519 panfrost: Mark job_index > 10000 as unlikely
By definition this is happening <= 0.02% of the time.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 24eccad4a7 panfrost: Remove silly assertion
We don't assert the rest of the Gallium contract here either.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 35dfaaf1c3 panfrost: Pass batch to panfrost_get_index_buffer_bounded
Calling batch_for_fbo outside of Gallium entrypoints is an antipattern.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 7561cd5825 panfrost: Deduplicate some code from indirect/direct draws
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 4b3ac29bb9 panfrost: Move batch_set_requirements to the CSO
Much of the per-draw work can be precomputed.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig bfd76ab501 panfrost: Pack draw-time RSD all-at-once
Manually inline the functions, delete the duplicates, and use GenXML the
way it's meant to be used. Template structs should **never** cross
function boundaries.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 8f2b2bcff4 panfrost: Hoist part of shader_reads_tilebuffer
The other part is |'d together. Do the happy path at compile time, and
reserve the draw time fixup for a v5 silicon issue.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 876de2831f panfrost: Pull erratum workaround into own function
This _does_ need to be draw-time, but it doesn't need to be in the
monster routine.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 672079e592 panfrost: Distribute masks for FPK selection
We can calculate these at much lower frequencies and just & together at
draw time.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 974709c51c panfrost: Partially determine FPK state
This might be disabled at draw-time, but we can merge part of the state
check to compile-time.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 0dd3d32141 panfrost: Hoist allow_forward_pixel_to_be_killed
Only a function of the shader code.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 997c1c84f3 panfrost: Streamline the !fs_required case
Takes some complexity out of the per-draw path.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 00e3705f60 panfrost: Move early-z decision earlier
These were already grouped nicely, just never got used. I also added
coverage writes to the list of reasons not to use early-z for
completeness. At the moment this doesn't do anything since this is a
Midgard flag and we haven't hooked up coverage writes on Midgard.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig c05e04d530 panfrost: Fill out the rasterizer CSO
The RSD state is all over the place but let's try to collect what we
can.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 88b9e5e471 panfrost: Correct the type of sample_mask
Let's not encode impossible masks.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig aee43b8cb0 panfrost: Preset evaluate_per_sample
Even though this isn't totally known at compile-time, at least one case
is, so let's handle that one ahead-of-time.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 04f2cb8ec5 panfrost: Move depth/stencil/alpha to CSO create
Now that we can merge RSD state, there's no reason to pack this at
draw-time. This is fun!

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig ca690579b8 panfrost: Prepack partial RSD at compile time
Even for fragment shaders! Just need to merge the partial descriptors.

Fixes: c21c6d134b ("panfrost: Use the pan_shader_prepare_rsd() helper")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 398e65693b panfrost: Add draw-time merge helper
The famous GenXML "OR" trick. Will be *essential* to packing RSDs.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 5a8e1dfaf3 panfrost: Precompute bifrost_blend_type_from_nir
Needed in the draw call hot path. Do it at compile time.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 87256d335b panfrost: Split Bifrost BLEND emit by word
This allows the GenXML packs to be effectively inlined and folded,
skipping over the Midgard pieces.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 9ad1403747 panfrost: Remove unused dither flag
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig bb0b3fde10 panfrost: Streamline fixed-function get_blend path
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 2984d3bf1f panfrost: Pass batch to panfrost_get_blend
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig b98c40ce36 panfrost: Simplify blend_final
Now that we've moved everything but the blend shader up to the CSO, we
can just return a blend shader pointer (or zero to indicate the absence
thereof), and remove a source of name conflicts.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 6ca84265e4 panfrost: Distribute out constant colour code
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig b82ac27ec3 panfrost: Pack blend equations at CSO create time
These are large. Get them out of the per-draw path.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig aa85a64821 panfrost: Garbage collect Gallium blend includes
Got moved to common blend handling.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig ffeeda3414 panfrost: Translate fixed-function blend at CSO create
Fixes: 93824b6451 ("panfrost: Move the blend logic out of the gallium driver")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 3943adbd91 panfrost: Move blend properties to CSO create
Fixes: 93824b6451 ("panfrost: Move the blend logic out of the gallium driver")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig d7590efd25 panfrost: Fix pan_blend_to_fixed_function_equation prototype
Doesn't need the whole state, just the equation itself.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Fixes: 93824b6451 ("panfrost: Move the blend logic out of the gallium driver")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig b2affb6cc5 panfrost: Fix blend fixed-function prototype
Needs to be broken up into different functions for disjoint state.
Simpler prototypes and allows matching to CSOs.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 5d3e2b5e9e panfrost: Fix blend constant fetch prototype
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Fixes: 93824b6451 ("panfrost: Move the blend logic out of the gallium driver")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig c35194b945 panfrost: Fix is_opaque prototype
Fixes: 93824b6451 ("panfrost: Move the blend logic out of the gallium driver")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig a0592066b0 panfrost: Fix the reads_dest prototype
Takes too much state, only pass what we need.

Fixes: 93824b6451 ("panfrost: Move the blend logic out of the gallium driver")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Alyssa Rosenzweig 1d62ec348a panfrost: Fix blending for unbacked MRT
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
2021-05-18 22:51:56 +00:00
Bas Nieuwenhuizen c7904b5b9b aco: Implement bvh64_intersect_ray_amd intrinsic.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10818>
2021-05-18 23:02:25 +02:00
Bas Nieuwenhuizen 2d6a6469b8 nir: Add bvh64_intersect_ray_amd intrinsic.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10818>
2021-05-18 23:01:47 +02:00
Gert Wollny 5be00fe88a r600: Enable NIR debug flags also for Cayman
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>
2021-05-18 22:16:08 +02:00
Gert Wollny ed595c1785 r600/sfn: legalize image access on Cayman
This,  seems to avoid hardware resets with the
  ARB_shader_image_load_store-invalid
piglit.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>
2021-05-18 22:16:07 +02:00
Gert Wollny 27f5157777 r600/sfn: Add lowering pass to legalize image access
Make sure only existing images are accessed and that the accessed
coordinates are within the image.
The generated code is quite exponsive, because it encapsulates each
access to an image with two if statements, one to check whether the
image index actually exists (this will get optimized away if the
image selection is direct), and one if statement to check whether
the coordinates are in range. For that reason it will only be enabled
for Cayman were invalid access seems to raise more issues.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>
2021-05-18 22:16:07 +02:00
Gert Wollny ffc5be25ca r600/sfn: Fix cube query layer number for indirect access
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>
2021-05-18 22:16:07 +02:00
Gert Wollny 6a15c7d9ad r600/sfn: read number of images from shader info
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>
2021-05-18 22:16:07 +02:00
Gert Wollny efdb888b29 r600/sfn: Fix Geometry shader for Cayman
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>
2021-05-18 22:16:07 +02:00
Gert Wollny 80efb6369a r600/sfn: Fix Cayman SSBO write with more than one value
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>
2021-05-18 22:16:07 +02:00
Gert Wollny 3b1f82c777 r600/sfn: Fix ssbo/image atomic swap for Cayman
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10608>
2021-05-18 22:16:07 +02:00