Commit Graph

30 Commits

Author SHA1 Message Date
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 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
Alyssa Rosenzweig 0228ccf857 panfrost: Leverage Bifrost's 2*src blend factor
Bifrost adds a value for the C factor equaling 2*src. This does not
correspond directly to API blend modes so it is not too useful in
general. However, it's required for src*dest + dest*src blending to be
done in hardware instead of a blend shader. GFXbench uses that blend
mode, so it must be important ;-)

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12152>
2021-08-11 18:15:52 +00:00
Alyssa Rosenzweig 95187c03f1 panfrost: Simplify blend_factor_constant_mask
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12152>
2021-08-11 18:15:52 +00:00
Alyssa Rosenzweig 01a1b253b4 panfrost: Fix is_opaque when blend_enable=false
Needed to pass the "replace" unit test.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12152>
2021-08-11 18:15:52 +00:00
Alyssa Rosenzweig b7af56f2ad panfrost: Add blend helper packing the equation
This is more convenient for the Gallium driver and easier to test.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12152>
2021-08-11 18:15:52 +00:00
Alyssa Rosenzweig 7eb2559198 panfrost: Use _PU for non-dithered formats
This is required to disable dithering on a per-draw basis when OPAQUE
output is used (bypassing the blender which normally uses the
round_to_framebuffer_precision flag to do the same).

This functionally reverts:

   ebc07f4b2f ("panfrost: Remove padded unorm blendable formats")
   fae90a7940 ("panfrost: Always pick dithered tb formats")

while adding the functionality to make them useful.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12152>
2021-08-11 18:15:52 +00:00
Alyssa Rosenzweig 8db1c0e509 panfrost: Pin an architecture for blending
Need to pick something but it's all the same, even on Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11785>
2021-07-12 23:12:29 +00:00
Boris Brezillon 6d2ed635c3 panfrost: Constify the constants pointers passed to pan_blend functions
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/11139>
2021-06-22 14:07:33 +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 e0419c29cc panfrost: Use common blend lowering
Contains a number of bugfixes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10601>
2021-05-07 17:25:21 +00:00
Alyssa Rosenzweig b7a757b2f7 panfrost: Fix typo handling blend types
This was right in my head.

Fixes: 93a176b6cf ("panfrost: Key blend shaders to the input types")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9239>
2021-05-06 23:26:21 +00:00
Alyssa Rosenzweig 1378c67bcf panfrost/blend: Inline blend constants
If we're going to key them in NIR, we might as well get the benefit of
constant folding them too.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10652>
2021-05-06 16:40:50 +00:00
Alyssa Rosenzweig 93a176b6cf panfrost: Key blend shaders to the input types
On Bifrost, fragment shaders might output either FP16 or FP32. The blend
shader will access the output as-is within the register, so depending on
the precision of the blend shader's logic, it may need to insert a
f2f16 or f2f32 conversion. This requires expanding the blend shader key.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig 9df1d1306e pan/blend: Emit explicit conversions for all types
Needed so we can mix and match.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig 6a4482df98 panfrost/blend: Prepare for lower_fragcolor
FRAG_RESULT_COLOR means something a bit different.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig 120dd92e86 panfrost/blend: Distribute to_c_factor
Easier to understand, I think.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig 613722e046 panfrost/blend: Workaround a v7 implementation-detail
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig 392bf00019 panfrost/blend: Fix outdated comments
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig 86b0eddf2b pan/lower_blend: Rename is_bifrost->scalar
Don't leak ISA details.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig fae90a7940 panfrost: Always pick dithered tb formats
Matches current logic and simplifies the code considerably.

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/10188>
2021-04-21 13:20:40 +00:00
Alyssa Rosenzweig 884f9c7926 panfrost: Drop blendable format accessor
Needless indirection.

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/10188>
2021-04-21 13:20:40 +00:00
Alyssa Rosenzweig 0f2140df8e panfrost: Simplify format_to_bifrost_blend prototype
Avoids a util_format_description call in a hot path, and drops some
indirection everywhere.

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/10188>
2021-04-21 13:20:40 +00:00
Michel Dänzer 2928c21eb7 Convert most remaining free-form fall-through comments to FALLTHROUGH
One exception is src/amd/addrlib/, for which -Wimplicit-fallthrough is
explicitly disabled.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10220>
2021-04-15 16:01:22 +00:00
Boris Brezillon bbff09b952 panfrost: Move the blend shader cache at the device level
So we can re-use it in the Vulkan driver.

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/9831>
2021-03-29 06:53:50 +00:00
Boris Brezillon 93824b6451 panfrost: Move the blend logic out of the gallium driver
Most of it is API-independent, so let's move it out of the gallium
driver so it can be shared with the Vulkan driver.

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/8963>
2021-02-15 11:23:46 +00:00