Commit Graph

32 Commits

Author SHA1 Message Date
Danylo Piliaiev 7b0fcd8932 turnip: Disable LRZ fast-clear for gen1 and gen2
LRZ fast-clear works on all gens, however blob disables it on
gen1 and gen2. We also elect to disable fast-clear on these gens
because for close to none gains it adds complexity and seem to work
a bit differently from gen3+. Which creates at least one edge case:
if first draw which uses LRZ fast-clear doesn't lock LRZ direction
the fast-clear value is undefined.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6829

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17599>
2022-07-20 02:58:44 +00:00
Danylo Piliaiev 4b5f0d98fd tu: Overhaul LRZ, implement on-GPU dir tracking and LRZ fast-clear
On-GPU LRZ direction tracking allows LRZ to support secondary cmdbufs,
reusing LRZ between renderpasses, and in future to support LRZ when
VK_KHR_dynamic_rendering is used.

With on-gpu tracking we have to be careful keeping LRZ state in sync
with underlying depth image, which means we should invalidate LRZ
when underlying image is changed or the view of image is different
from previous renderpass.

All of this resulted in LRZ logic being thinly spread through the code,
making it hard to understand. So most of it was moved to tu_lrz.c.

For more details on past and new LRZ features see comment at the
top of tu_lrz.c.

Note about blob:
- Blob is much more happy to do LRZ_FLUSH, it flushes at the start
  of the renderpass, after binning, and at the end of the renderpass.
- Blob seem not to care about changes in depth image done via
  vkCmdCopyImage.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6347

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16251>
2022-06-28 17:23:16 +00:00
Emma Anholt 086faecbba turnip: Document some fields about resolves.
I noticed the unk12 pattern, and cwabbott and danylo had figured out some
more details.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17126>
2022-06-21 19:40:58 +00:00
Danylo Piliaiev d77bfc117c tu,ir3: Implement VK_KHR_shader_integer_dot_product
- gen4 - has dp4acc and dp2acc, dp4acc is used to implement
  4x8 dot product.
- gen3 - has dp2acc, in OpenCL blob uses dp2acc for dot product
  on both get3 and gen4.
- gen2 - unknown, lower everything.
- gen1 - no dp2acc, lower everything. OpenCL blob doesn't advertise
  cl_qcom_dot_product8 but still generates code for it.
  The assembly is more verbose and uses yet to be documented
  mad32.u16 instruction.

Passes:
 dEQP-VK.spirv_assembly.instruction.compute.opsdotkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opudotkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opsudotkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opsdotaccsatkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opudotaccsatkhr.*
 dEQP-VK.spirv_assembly.instruction.compute.opsudotaccsatkhr.*

Only packed 4x8 unsigned and mixed versions are accelerated.
However in theory we should be able to do better for signed version
than current NIR lowering.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13986>
2022-01-10 13:21:24 +02:00
Danylo Piliaiev ded51fd39e ir3: Use getfiberid for SubgroupInvocationID on gen4
Since it requires (ss) categorize it as is_sfu() and not is_mem().

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13817>
2021-12-07 20:45:53 +00:00
Danylo Piliaiev e63ffc2f04 freedreno,tu: Limit the amount of instructions preloaded into icache
Inferring from blob's cmdstream the size of shader instruction
cache for:
- a630 is 64
- a650 is 128
- a660 is 128

On a650 and a660 gpu could hang if we exceed the limit. Though
it is not reproducible with computerator or a single amber
test. Also while blob limits the size to 128 - Turnip still
hangs with it but does not hang with the limit of 127.

On a630 there seem to be no hang when limit is exceeded.

Fixes the hang of compute shader in Alien Isolation on a650/a660.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14044>
2021-12-07 13:48:35 +00:00
Connor Abbott b1fe85e38c freedreno, turnip: Set TPL1_DBG_ECO_CNTL better
Match the blob better here. Note that the value of 0x1000000 for a650
comes from the Vulkan blob, and it's required to fix cubic filtering
even though the GLES driver doesn't set it (and doesn't support cubic
filtering).

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5261
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12929>
2021-09-21 09:08:20 +00:00
Rob Clark 68d4d09b56 freedreno: Add info->a6xx.has_shading_rate
@flto noticed these registers seem to be related to GL_QCOM_shading_rate

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12856>
2021-09-20 19:13:25 +00:00
Rob Clark 74d1052537 freedreno/a6xx: Fix a6xx gen4 compute shaders
I believe the addition of these new regs is related to the changes made
for LPAC ring, so let's key off of that.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12497>
2021-08-25 15:24:19 +00:00
Connor Abbott 47996b951e tu: Add a650-specific CCU flush workaround
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12475>
2021-08-20 18:03:26 +00:00
Danylo Piliaiev bb4db22ff4 turnip: apply workaround for depth bounds test without depth test
On some GPUs when:
- depth bounds test is enabled
- depth test is disabled
- depth attachment uses UBWC in sysmem mode
GPU hangs. As a workaround we should enable z test. That's what blob
is doing for a630. And since we enable z test we should make it always pass.

Blob doesn't emit this workaround on a650 and a660. Untested on a640.

Fixes:
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_static.depth_bounds_test_disable
 dEQP-VK.pipeline.extended_dynamic_state.two_draws_dynamic.depth_bounds_test_disable
 dEQP-VK.dynamic_state.ds_state.depth_bounds_1

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12407>
2021-08-19 10:25:58 +00:00
Connor Abbott 2b134a8c0c freedreno/a6xx: Add new register fields
Also use them in drivers and delete some comments that are now
irrelevant.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12340>
2021-08-13 08:58:56 +00:00
Rob Clark 4e28dfe58e freedreno: Device matching based on chip_id
Add support for device matching based on chip_id instead of gpu_id, to
handle newer GPUs

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12159>
2021-08-06 18:51:50 +00:00
Rob Clark 7806843866 freedreno/all: Introduce fd_dev_id
Move away from using gpu_id as the primary means to identify which
adreno we are running on, as future GPUs (starting with 7c3) stop
providing a gpu_id as a new naming scheme is introduced.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12159>
2021-08-06 18:51:50 +00:00
Rob Clark 7a11cc42e7 freedreno: Move generated device table to .h
We only need it in a single .c file, so we can make the device table
static.  Also rename the struct for device table entries, as I want
to re-use the name 'fd_dev_id'

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12159>
2021-08-06 18:51:50 +00:00
Rob Clark 7c7722304b freedreno+turnip: Get device name from device-info table
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark a4559c9550 freedreno+turnip: Add has_8bpp_ubwc
Newer a6xx devices seem to drop 8b/pixel UBWC support.

The turnip part was adapted from Jonathans patch on !10892

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark e552784e68 freedreno+turnip: Add has_cp_reg_write
Newer a6xx devices drop this packet from the sqe firmware, and use
direct (pkt4) register writes instead for the few cases that previously
used CP_REG_WRITE.

The turnip part was adapted from Jonathans patch on !10892

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark f74d0bf05e turnip: Get has_sample_locations from fd_dev_info
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark 3f1c4a86bb turnip: Get has_tex_filter_cubic from fd_dev_info
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark 64af60cfb3 turnip: Get indirect_draw_wfm_quirk from fd_dev_info
At some point we might want to change this to minimum fw version, but
for now it can be a bool.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark 06000f42ed turnip: Get storage_16bit from fd_dev_info
Removing more gpu_id checks that will become bogus as we add more a6xx.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark f4cfb5a61e freedreno/ir3: Get reg_size_vec4 from fd_dev_info
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark 4335f47f41 freedreno/ir3: Get tess_use_shared from fd_dev_info
A step towards getting rid of checks for gpu_id sprinkled around.
Checking major generation is ok, but checking for == or >= a specific
gpu_id is going to start getting messy as we add more a6xx.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark 78c8a8af80 freedreno: Generate device-info tables at build time
This way we can make the tables const.  At the same time, for a6xx, this
introduces a "sub-generation template" to reduce the copy/paste for
parameters which are keyed to the sub-generation.  It also explicitly
lists every supported GPU, to get rid of duplicate lists of supported
gpus between the device-info and drivers.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark 0eda0188aa freedreno: Rename *_dev_info
Everywhere else symbols/types/etc are shortend to "fd_*", so lets do the
same here for consistency.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Jonathan Marek 1a6dd7f9b1 freedreno/common: unhardcode CCU color cache offset
Replace it with a calculation which works for all current GPUs.

Duplicated the calculation in both drivers because freedreno_dev_info isn't
meant for derived parameters (and drivers might want to just calculate on
the fly instead).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
2021-07-14 01:58:00 +00:00
Rob Clark ccd68b672a freedreno/common: Re-indent
clang-format -fallback-style=none --style=file -i src/freedreno/common/*.[ch]

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10293>
2021-04-17 15:38:56 +00:00
Rob Clark 5871f4177c freedreno: Make headers C++ happy
We'll need a few of these for the C++ based gfx-pps performance counter
collector datasource.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9758>
2021-03-22 20:46:17 +00:00
Eric Anholt 1c4613f5d4 turnip: Move the limited_z24s8 flag to the shared device info.
I want to do the same logic in freedreno, so use the same flag.  On
suggestion by robclark, rename it to what it specifically means.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8319>
2021-01-06 22:54:14 +00:00
Connor Abbott b525934f26 freedreno: Add per-device parameters for private memory
We have to allocate backing storage big enough to hold all the private
memory for all threads that can possibly be in flight, which means that
we have to start filling in some more model-specific information as the
sizes will be different for models with different core counts/ALU
counts.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7386>
2020-11-19 17:55:03 +01:00
Connor Abbott 4a0bdf47e4 freedreno: Introduce common device info struct
This will collect all the various alignments, sizes, and magic values
and set them appropriately, replacing the various pieces scattered
throughout the drivers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7385>
2020-11-02 18:07:05 +00:00