Commit Graph

238 Commits

Author SHA1 Message Date
Connor Abbott cf0cfd572e freedreno/a6xx: VPC_SO_NCOMP is actually VPC_SO_BUFFER_STRIDE
This answers the question in a comment in turnip, and fixes some GL46
tests and piglit tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17494>
2022-07-12 17:57:07 +00:00
Emma Anholt 240a98297d freedreno: Rename the "SIZE" regs for interpolateAtOffset to "CENTERRHW"
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17322>
2022-07-11 16:56:05 +00:00
Danylo Piliaiev 465e7c303b tu,freedreno: Refactored START/STOP events for pipeline stats
For a5xx+ renamed:
- RST_PIX_CNT -> START_FRAGMENT_CTRS
- RST_VTX_CNT -> STOP_FRAGMENT_CTRS
- TILE_FLUSH  -> START_COMPUTE_CTRS
- STAT_EVENT  -> STOP_COMPUTE_CTRS
I'm not sure about a5xx itself but I'll take a chance of it being
similar to a6xx in this regard.

Knowing this emit_begin_stat_query/emit_end_stat_query can now emit
only events that are needed for the pool's flags.

Also primitive generated query clearly doesn't need fragment and
compute counters.

Passes tests:
 dEQP-VK.query_pool.statistics_query.*
 dEQP-VK.transform_feedback.primitives_generated_query.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17163>
2022-07-08 11:14:18 +03:00
Rob Clark 9e1bf8e7ac freedreno/registers: Small cleanup
Whitespace fix plus move a couple regs that ended split apart from the
rest of the VFD regs.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17317>
2022-07-03 23:20:46 +00:00
Jonathan Marek b41620f9ed freedreno/registers: add missing varset="chip" for new enum values
Fixes: de8c769d11 ("freedreno/registers: add a7xx registers for drm/msm kernel driver")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6788
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17351>
2022-07-03 18:01:17 +00:00
Jonathan Marek de8c769d11 freedreno/registers: add a7xx registers for drm/msm kernel driver
Most of this is taken directly from the downstream kernel driver.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15602>
2022-07-01 15:11:28 +00:00
Hyunjun Ko 6cb41c5188 freedreno,ir3: rename Z_CLAMP_ENABLE to Z_CLIP_DISABLE
UNK5 of GRAS_CL_CNTL is still unclear though.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17248>
2022-06-30 01:08:17 +00:00
Connor Abbott 2a928ae325 freedreno/a6xx: Document border color/swizzle interaction
Make it clear that the swap happens before border color replacment but
the swizzle happens after.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17177>
2022-06-29 03:00:56 +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
Danylo Piliaiev 70f1d70ddd freedreno: document GRAS_UNKNOWN_810A
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
Connor Abbott 1cd91fdec3 freedreno: Document a650-specific CP_REG_WRITE flag
v2: Danylo: clarified previously unknown GRAS_LRZ_CNTL field.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16251>
2022-06-28 17:23:16 +00:00
Danylo Piliaiev 5592c366cf freedreno: Document rest of GRAS_LRZ_CNTL, clarify UNK_25 event
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 4e3c51cbd8 freedreno/a5xx: Set the buffer bit appropriately in XS_CTRL_REG0.
This seems to be how the bit gets used, from grepping my blob traces.
Hopefully this helps stabilize some stuff.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17004>
2022-06-22 20:07:36 +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 48540caec9 tu: Disable sample counting for 3d blits during occlusion query
Per Vulkan spec only "Draw" commands should be counted towards
occlusion query.

Apparently RB_SAMPLE_COUNT_CONTROL::UNK0 bool controls whether
sample counting is enabled, so we could use it to disable
sample counting for 3d blits which are sometimes used for
clear/copy/blit/gmem-store/resolve operations.

Fixes GL CTS tests running through Zink:
 dEQP-GLES3.functional.occlusion_query.depth_clear
 dEQP-GLES3.functional.occlusion_query.depth_clear_stencil_clear
 dEQP-GLES3.functional.occlusion_query.scissor_depth_clear_stencil_clear
 dEQP-GLES3.functional.occlusion_query.scissor_stencil_clear
 dEQP-GLES3.functional.occlusion_query.stencil_clear

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

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17138>
2022-06-21 13:13:36 +00:00
Danylo Piliaiev 5d377f435b freedreno/a6xx: Add EARLYPREAMBLE flag to all a6xx_sp_xs_ctrl_reg0
Each shader stage has its own "early preamble" flag.

Early preamble is likely an optimization to hide some of latency
when loading UBOs into consts in the preamble.

Early preamble has the following limitations:
- Only shared, a1, and consts regs could be used
  (accessing other regs would result in GPU fault);
- No cat5/cat6, only stc/ldc variants are working;
- Values writen to shared regs are not accessible by the rest
  of the shader;
- Instructions before shps are also considered to be a part of
  early preamble.

Note, for all shaders from d3d11 games blob produced preambles
compatible with early preamble mode.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15901>
2022-05-18 11:17:47 +00:00
Danylo Piliaiev db69218cbe tu: Implement VK_EXT_image_view_min_lod
Relevant tests:
 dEQP-VK.texture.mipmap.*.image_view_min_lod.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16292>
2022-05-09 07:53:41 +00:00
Danylo Piliaiev d5debf0d8a freedreno/a6xx: Add UNK fields to CP_REG_TEST and CP_COND_REG_EXEC
Their meaning is unknown, however they DO change the behavior.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15974>
2022-04-29 09:29:55 +00:00
Connor Abbott 32af90d96f freedreno/a6xx: Fix SP_DS_CTRL_REG0 definition
Bit 20 isn't actually MERGEDREGS, the mode for the entire geometry
pipeline is controlled by SP_VS_CTRL_REG0::MERGEDREGS and it appears to
be something preamble-related instead since writing any register in the
preamble hangs if it's set. This fixes those hangs on freedreno and
turnip since we no longer set it.

Fixes: fccc35c2de ("ir3: Add preamble optimization pass")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15801>
2022-04-08 04:40:17 +00:00
Vinod Koul 28ae397be1 freedreno/registers: update dsi registers to support dsc
Display Stream compression (DSC) compresses the display stream in
host which is later decoded by panel. This requires addition of 3 new
DSI registers to support DSC over DSI.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14967>
2022-04-01 21:56:40 +00:00
Ilia Mirkin e42a8a5b92 a4xx: add emission of compute state, and compute dispatch
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14794>
2022-03-05 03:21:05 -05:00
Rob Clark 7e63fa2bb1 freedreno/registers: Add a couple regs we need for kernel
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15221>
2022-03-03 02:19:47 +00:00
Connor Abbott 00be8c4619 freedreno: Replace A6XX_IBO with A6XX_TEX_CONST
Since these were reverse-engineered, it's become clear that IBO
descriptors are just a subset of texture descriptors, and bindless reads
of readonly images actually use isam on the IBO descriptor, further
confirming that the two are always compatible, even if not all of the
texture fields exist for IBOs. It's pointless to have a separate type
for IBOs, and just leads to things getting out-of-sync unnecessarily
which has already happened. Just remove it and use TEX_CONST insted.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15114>
2022-02-28 23:33:22 +00:00
Dmitry Baryshkov b4bef890ee freedreno/regs: remove 5nm DSI PHY regs
5nm PHY is a variation of 7nm PHY, they use the same register
definitions. To remove duplication, drop 5nm defs.

Cc: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15051>
2022-02-23 21:25:22 +00:00
Dmitry Baryshkov 22efeec399 freedreno/registers: add new register for 7nm DSI PHY v4.3 (sm8450)
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15052>
2022-02-23 17:28:17 +00:00
Connor Abbott bb41d47f2e freedreno/a6xx: Name texture descriptor bit
This appears to do the same thing as CLAMPENABLE on a3xx. That is, it
clamps the result to [0, 1] for unorm formats and [-1, 1] for snorm
formats *after* filtering. In particular it's now more easily observable
with cubic filtering, because cubic filtering can produce values outside
the original range. Presumably this only matters with linear filtering
due to rounding errors when computing the weighted average.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14613>
2022-01-21 20:55:46 +00:00
Marcin Ślusarz ed0edcc338 freedreno/rnn: normalize line endings in rules-ng.xsd
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11779>
2022-01-19 15:17:17 +00:00
Emma Anholt 5071d39cb2 freedreno/a5xx: Document the sRGB bit on RB_2D_SRC/DST info.
Noticed while looking through my set of traces for where the average bit
might be.  Same spot as on a6xx.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13867>
2021-11-19 17:24:11 +00:00
Emma Anholt 1ef6465665 freedreno/a5xx: Define a5xx_2d_surf_info like a6xx has.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13867>
2021-11-19 17:24:11 +00:00
Ilia Mirkin a95a9f0cc6 freedreno/a4xx: include guesses from a3xx for some of the constid's
The ones that are untested are left as comments. The ones that rename
values were tested manually.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13806>
2021-11-16 05:08:26 +00:00
Ilia Mirkin 45606b51cc freedreno/a4xx: indicate whether outputs are uint/sint
Unclear whether this fixes anything, but the blob does seem to set
these. (Discovered while trying to determine if value clamping was
missing for non-32-bit integer formats, which fail in some tests.)

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13806>
2021-11-16 05:08:26 +00:00
Ilia Mirkin 20e8e11d64 freedreno/a6xx: re-express buffer textures more logically
Same as a5xx, move one bit into the tex type, one as a separate named
BUFFER bit.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13805>
2021-11-16 04:44:23 +00:00
Ilia Mirkin 8c041f4bf3 freedreno/a5xx: re-express buffer textures more logically
Instead of treating it as 2 bits to enable, make BUFFER a type (and
extend the bitfield width), and then add a separate BUFFER bit
(ostensibly to perform the width/height concatenation but who knows).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13805>
2021-11-16 04:44:23 +00:00
Ilia Mirkin 6566eae933 freedreno/a4xx: add proper buffer texture support
Rather than faking it as a 1d texture, add the buffer texture type, and
allow a full range of sizes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13805>
2021-11-16 04:44:23 +00:00
Emma Anholt d1801d43f8 freedreno/a5xx: Use the defined names for 2D_BLIT_CNTL regs.
We have definitions for them above, no need to be UNKNOWN about it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13659>
2021-11-04 03:47:54 +00:00
Connor Abbott c135c2cdb7 freedreno/a6xx: Rename GRAS_2D_BLIT_INFO
It's not actually used for 2d blits, it's supposed to mirror
RB_MRT_BUF_INFO[0].COLOR_FORMAT and seems to be used only when rendering
to the special planar formats, although the blob name seems to suggest
it's connected to LRZ.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6792>
2021-10-22 11:25:30 +00:00
Hyunjun Ko 88afceacf0 freedreno/a5xx,a6xx: rename MSAA_ENABLE to LINE_MODE in GRAS_SU_CNTL
This bit seems like the control for line mode of rastrization.

That can be simply figured out by comparing
dEQP-VK.rasterization.primitives.no_stipple.bresenham_lines,
dEQP-VK.rasterization.primitives.no_stipple.rectangular_lines and
dEQP-VK.rasterization.primitives.no_stipple.lines.

For opengl, the value of bresenham lines mode, which is 0, is set
by default and the value of rectangular mode, which is 0x1, is set
when multi-sampled.

For vulkan, the bresenham lines are enabled when lineRasterizationMode is
VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT, which sets the bit to 0, while
the value is 1 when it's VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT,
that seems to be default.

If both multi-sampled and bresenham-lines are used when primitive type is
line, the bit is to be set as 0 and makes msaa disabled.

Note that this is only tested on a6xx, but I guess it's likely the same
for a5xx.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6020>
2021-10-13 12:18:01 +00:00
Emma Anholt 3f99916433 freedreno/a5xx+: Rename GRAS_CNTL/RB_RENDER_CONTROL0 IJ_LINEAR_* bits.
This is what they actually enable.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12949>
2021-09-21 17:11:42 +00:00
Connor Abbott 9ec0580095 freedreno/a6xx: Name TPL1_DBG_ECO_CNTL
This is a guess, but an informed guess, since every other block with a
known DBG_ECO_CNTL register has it at the very beginning immediately
followed by ADDR_MODE_CNTL.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12929>
2021-09-21 09:08:20 +00:00
Ilia Mirkin 269cbc8a4d a4xx: add some better documentation for compute registers
These were driven by seeing 0x1c (and other) values set by blob, as well
as comparing to equivalent a3xx documentation.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12784>
2021-09-10 01:20:22 +00:00
Jonathan Marek 27f2c9dc2e freedreno/registers: add a6xx media formats
Define hardware formats which correspond to media formats.

DPU/CAMSS/VENUS/CDSP can consume/produce buffers in these formats with UBWC

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12740>
2021-09-06 18:48:47 +00:00
Rob Clark 12a9adbb3b freedreno/a6xx: Register updates for a6xx gen4
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
Rob Clark 677dbb0e52 freedreno/a6xx: Register updates for a6xx gen3
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
Rob Clark 28c5384cf9 freedreno/a6xx: Set type for PC_HS_INPUT_SIZE
It is an unsigned integer.. display it as such.

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
Danylo Piliaiev 7faee1430a freedreno: rename Z_TEST_ENABLE->Z_READ_ENABLE, Z_ENABLE->Z_TEST_ENABLE
This makes their interaction with Z_BOUNDS_ENABLE more understandable.

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 d9c90eee8b freedreno: Decode a650+ CP_START_BIN/CP_END_BIN packets
The blob uses them for GMEM renderpasses.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12184>
2021-08-17 16:53:40 +00:00
Connor Abbott 351c6b8bfe freedreno/a6xx: Document GRAS_SC_CNTL::SINGLE_PRIM_MODE
Add a value discovered when investigating how the blob implements
GL_KHR_blend_equation_advanced.

Note that everything added here is a bit speculative, because it's
assuming the blob's implementation of GL_KHR_blend_equation_advanced is
sane. In particular a value of 0x3 seems to solve the UBWC problem as
well, so I'm not sure whether my description of the difference between
0x1 and 0x3 is correct. I'm also surprised that it uses the same value
for the coherent and non-coherent cases when forcing sysmem.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12360>
2021-08-16 08:57:10 +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
Dmitry Baryshkov f800b9182b freedreno/regs: add bit to control continuous clock with 7nm PHYs
7nm PHYs need another special bit set in DSI_LANE_CTRL to enable
continuous DSI clock. Document this bit.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11219>
2021-08-08 20:15:42 +00:00
Connor Abbott 2e2e6865b4 tu, freedreno/a6xx: Fix setting PC_XS_OUT_CNTL::PRIMITVE_ID
This is supposed to be set when that stage needs the PrimID sysval
preloaded, except for the VS which doesn't have this bit and instead
infers it from the HS or GS bit (depending on whether tess/GS is
enabled). Therefore for HS, GS, and DS we should set it whenever the
corresponding sysval is there. This includes adding a missing
PC_HS_OUT_CNTL, which I confirmed is set when the HS reads PrimID from
the VS. Note that the DS sysval is currently always enabled whenever
there's a GS, if we were to fix that then we should also change the
logic here.

This doesn't fix anything that I know of, but aligns us more with what
the blob does.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12166>
2021-08-05 16:35:41 +00:00